Skip to content

Commit c8e795b

Browse files
wip:fix install script
1 parent 9d1fde9 commit c8e795b

File tree

2 files changed

+30
-18
lines changed

2 files changed

+30
-18
lines changed

Makefile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ IMG := $(IMAGE_REPO):$(IMAGE_TAG)
2323

2424
# Define dependency versions (use go.mod if we also use Go code from dependency)
2525
export CERT_MGR_VERSION := v1.15.3
26-
export CATALOGD_VERSION := $(shell go list -mod=mod -m -f "{{.Version}}" github.com/operator-framework/catalogd)
2726
export WAIT_TIMEOUT := 60s
2827

2928
# Install default ClusterCatalogs
@@ -235,12 +234,18 @@ e2e-coverage:
235234
.PHONY: kind-load
236235
kind-load: $(KIND) #EXHELP Loads the currently constructed image onto the cluster.
237236
$(CONTAINER_RUNTIME) save $(IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
237+
#TODO: Change it when we unify the Makefile commands
238+
$(CONTAINER_RUNTIME) save quay.io/operator-framework/catalogd:devel | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
238239

239240
.PHONY: kind-deploy
240-
kind-deploy: export MANIFEST="./operator-controller.yaml"
241-
kind-deploy: manifests $(KUSTOMIZE) #EXHELP Install controller and dependencies onto the kind cluster.
241+
kind-deploy: export MANIFEST := ./operator-controller.yaml
242+
kind-deploy: manifests $(KUSTOMIZE) #EXHELP Install controller and dependencies, including catalogd, onto the kind cluster.
242243
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) > operator-controller.yaml
243-
envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s
244+
cd catalogd && $(KUSTOMIZE) build config/overlays/cert-manager > catalogd.yaml
245+
envsubst '$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh
246+
bash install.sh \
247+
--catalogd-manifest=./catalogd/catalogd.yaml \
248+
--default-catalogs-manifest=./catalogd/config/base/default/clustercatalogs/default-catalogs.yaml
244249

245250
.PHONY: kind-cluster
246251
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
299304
.PHONY: docker-build
300305
docker-build: build-linux #EXHELP Build docker image for operator-controller with GOOS=linux and local GOARCH.
301306
$(CONTAINER_RUNTIME) build -t $(IMG) -f Dockerfile ./bin/linux
307+
cd catalogd && $(MAKE) build-container
302308

303309
#SECTION Release
304310
ifeq ($(origin ENABLE_RELEASE_PIPELINE), undefined)
@@ -316,10 +322,12 @@ release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By d
316322
$(GORELEASER) $(GORELEASER_ARGS)
317323

318324
.PHONY: quickstart
319-
quickstart: export MANIFEST := https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml
325+
quickstart: export MANIFEST := ./operator-controller.yaml
320326
quickstart: $(KUSTOMIZE) manifests #EXHELP Generate the installation release manifests and scripts.
321327
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | sed "s/:devel/:$(VERSION)/g" > operator-controller.yaml
322-
envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh
328+
cd catalogd && $(KUSTOMIZE) build config/overlays/cert-manager > catalogd.yaml
329+
envsubst '$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh
330+
323331

324332
##@ Docs
325333

scripts/install.tpl.sh

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,23 @@ if [[ -z "$operator_controller_manifest" ]]; then
99
exit 1
1010
fi
1111

12-
catalogd_version=$CATALOGD_VERSION
12+
catalogd_manifest="./catalogd/catalogd.yaml"
13+
default_catalogs_manifest="./catalogd/config/base/default/clustercatalogs/default-catalogs.yaml"
1314
cert_mgr_version=$CERT_MGR_VERSION
1415
install_default_catalogs=$INSTALL_DEFAULT_CATALOGS
1516

16-
if [[ -z "$catalogd_version" || -z "$cert_mgr_version" ]]; then
17-
err="Error: Missing component version(s) for: "
18-
if [[ -z "$catalogd_version" ]]; then
19-
err+="catalogd "
20-
fi
21-
if [[ -z "$cert_mgr_version" ]]; then
22-
err+="cert-manager "
23-
fi
24-
echo "$err"
17+
if [[ ! -f "$catalogd_manifest" ]]; then
18+
echo "Error: Missing required catalogd manifest file at $catalogd_manifest"
19+
exit 1
20+
fi
21+
22+
if [[ ! -f "$default_catalogs_manifest" ]]; then
23+
echo "Error: Missing required default catalogs manifest file at $default_catalogs_manifest"
24+
exit 1
25+
fi
26+
27+
if [[ -z "$cert_mgr_version" ]]; then
28+
echo "Error: Missing CERT_MGR_VERSION variable"
2529
exit 1
2630
fi
2731

@@ -76,13 +80,13 @@ kubectl_wait "cert-manager" "deployment/cert-manager" "60s"
7680
kubectl_wait_for_query "mutatingwebhookconfigurations/cert-manager-webhook" '{.webhooks[0].clientConfig.caBundle}' 60 5
7781
kubectl_wait_for_query "validatingwebhookconfigurations/cert-manager-webhook" '{.webhooks[0].clientConfig.caBundle}' 60 5
7882

79-
kubectl apply -f "https://github.com/operator-framework/catalogd/releases/download/${catalogd_version}/catalogd.yaml"
83+
kubectl apply -f "${catalogd_manifest}"
8084
# Wait for the rollout, and then wait for the deployment to be Available
8185
kubectl_wait_rollout "olmv1-system" "deployment/catalogd-controller-manager" "60s"
8286
kubectl_wait "olmv1-system" "deployment/catalogd-controller-manager" "60s"
8387

8488
if [[ "${install_default_catalogs}" != "false" ]]; then
85-
kubectl apply -f "https://github.com/operator-framework/catalogd/releases/download/${catalogd_version}/default-catalogs.yaml"
89+
kubectl apply -f "${default_catalogs_manifest}"
8690
kubectl wait --for=condition=Serving "clustercatalog/operatorhubio" --timeout="60s"
8791
fi
8892

0 commit comments

Comments
 (0)