diff --git a/Makefile b/Makefile index 310065429..85e82583e 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,6 @@ IMG := $(IMAGE_REPO):$(IMAGE_TAG) # Define dependency versions (use go.mod if we also use Go code from dependency) export CERT_MGR_VERSION := v1.15.3 -export CATALOGD_VERSION := $(shell go list -mod=mod -m -f "{{.Version}}" github.com/operator-framework/catalogd) export WAIT_TIMEOUT := 60s # Install default ClusterCatalogs @@ -235,12 +234,18 @@ e2e-coverage: .PHONY: kind-load kind-load: $(KIND) #EXHELP Loads the currently constructed image onto the cluster. $(CONTAINER_RUNTIME) save $(IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME) + #TODO: Change it when we unify the Makefile commands + $(CONTAINER_RUNTIME) save quay.io/operator-framework/catalogd:devel | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME) .PHONY: kind-deploy -kind-deploy: export MANIFEST="./operator-controller.yaml" -kind-deploy: manifests $(KUSTOMIZE) #EXHELP Install controller and dependencies onto the kind cluster. +kind-deploy: export MANIFEST := ./operator-controller.yaml +kind-deploy: manifests $(KUSTOMIZE) #EXHELP Install controller and dependencies, including catalogd, onto the kind cluster. $(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) > operator-controller.yaml - envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s + cd catalogd && $(KUSTOMIZE) build config/overlays/cert-manager > catalogd.yaml + envsubst '$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh + bash install.sh \ + --catalogd-manifest=./catalogd/catalogd.yaml \ + --default-catalogs-manifest=./catalogd/config/base/default/clustercatalogs/default-catalogs.yaml .PHONY: kind-cluster kind-cluster: $(KIND) #EXHELP Standup a kind cluster. @@ -299,6 +304,7 @@ run: docker-build kind-cluster kind-load kind-deploy #HELP Build the operator-co .PHONY: docker-build docker-build: build-linux #EXHELP Build docker image for operator-controller with GOOS=linux and local GOARCH. $(CONTAINER_RUNTIME) build -t $(IMG) -f Dockerfile ./bin/linux + cd catalogd && $(MAKE) build-container #SECTION Release ifeq ($(origin ENABLE_RELEASE_PIPELINE), undefined) @@ -316,10 +322,12 @@ release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By d $(GORELEASER) $(GORELEASER_ARGS) .PHONY: quickstart -quickstart: export MANIFEST := https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml +quickstart: export MANIFEST := ./operator-controller.yaml quickstart: $(KUSTOMIZE) manifests #EXHELP Generate the installation release manifests and scripts. $(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | sed "s/:devel/:$(VERSION)/g" > operator-controller.yaml - envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh + cd catalogd && $(KUSTOMIZE) build config/overlays/cert-manager > catalogd.yaml + envsubst '$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh + ##@ Docs diff --git a/scripts/install.tpl.sh b/scripts/install.tpl.sh index c3525dbcb..bedcc6a3e 100644 --- a/scripts/install.tpl.sh +++ b/scripts/install.tpl.sh @@ -9,19 +9,23 @@ if [[ -z "$operator_controller_manifest" ]]; then exit 1 fi -catalogd_version=$CATALOGD_VERSION +catalogd_manifest="./catalogd/catalogd.yaml" +default_catalogs_manifest="./catalogd/config/base/default/clustercatalogs/default-catalogs.yaml" cert_mgr_version=$CERT_MGR_VERSION install_default_catalogs=$INSTALL_DEFAULT_CATALOGS -if [[ -z "$catalogd_version" || -z "$cert_mgr_version" ]]; then - err="Error: Missing component version(s) for: " - if [[ -z "$catalogd_version" ]]; then - err+="catalogd " - fi - if [[ -z "$cert_mgr_version" ]]; then - err+="cert-manager " - fi - echo "$err" +if [[ ! -f "$catalogd_manifest" ]]; then + echo "Error: Missing required catalogd manifest file at $catalogd_manifest" + exit 1 +fi + +if [[ ! -f "$default_catalogs_manifest" ]]; then + echo "Error: Missing required default catalogs manifest file at $default_catalogs_manifest" + exit 1 +fi + +if [[ -z "$cert_mgr_version" ]]; then + echo "Error: Missing CERT_MGR_VERSION variable" exit 1 fi @@ -76,13 +80,13 @@ kubectl_wait "cert-manager" "deployment/cert-manager" "60s" kubectl_wait_for_query "mutatingwebhookconfigurations/cert-manager-webhook" '{.webhooks[0].clientConfig.caBundle}' 60 5 kubectl_wait_for_query "validatingwebhookconfigurations/cert-manager-webhook" '{.webhooks[0].clientConfig.caBundle}' 60 5 -kubectl apply -f "https://github.com/operator-framework/catalogd/releases/download/${catalogd_version}/catalogd.yaml" +kubectl apply -f "${catalogd_manifest}" # Wait for the rollout, and then wait for the deployment to be Available kubectl_wait_rollout "olmv1-system" "deployment/catalogd-controller-manager" "60s" kubectl_wait "olmv1-system" "deployment/catalogd-controller-manager" "60s" if [[ "${install_default_catalogs}" != "false" ]]; then - kubectl apply -f "https://github.com/operator-framework/catalogd/releases/download/${catalogd_version}/default-catalogs.yaml" + kubectl apply -f "${default_catalogs_manifest}" kubectl wait --for=condition=Serving "clustercatalog/operatorhubio" --timeout="60s" fi