Skip to content

Commit 1bd92a2

Browse files
Fix install script
1 parent 67f98c5 commit 1bd92a2

File tree

3 files changed

+47
-23
lines changed

3 files changed

+47
-23
lines changed

Makefile

Lines changed: 31 additions & 9 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
@@ -232,15 +231,19 @@ test-upgrade-e2e: kind-cluster run-latest-release image-registry pre-upgrade-set
232231
e2e-coverage:
233232
COVERAGE_OUTPUT=./coverage/e2e.out ./hack/test/e2e-coverage.sh
234233

235-
.PHONY: kind-load
236-
kind-load: $(KIND) #EXHELP Loads the currently constructed image onto the cluster.
234+
kind-load: $(KIND) build-catalogd #EXHELP Loads the currently constructed images into the KIND cluster.
237235
$(CONTAINER_RUNTIME) save $(IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
236+
$(CONTAINER_RUNTIME) save quay.io/operator-framework/catalogd:devel | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
238237

239238
.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.
239+
kind-deploy: export MANIFEST := ./operator-controller.yaml
240+
kind-deploy: manifests $(KUSTOMIZE) #EXHELP Install controller and dependencies, including catalogd, onto the kind cluster.
242241
$(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
242+
cd catalogd && $(KUSTOMIZE) build config/overlays/cert-manager > catalogd.yaml
243+
envsubst '$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh
244+
bash install.sh \
245+
--catalogd-manifest=./catalogd/catalogd.yaml \
246+
--default-catalogs-manifest=./catalogd/config/base/default/clustercatalogs/default-catalogs.yaml
244247

245248
.PHONY: kind-cluster
246249
kind-cluster: $(KIND) #EXHELP Standup a kind cluster.
@@ -297,9 +300,26 @@ go-build-linux: $(BINARIES)
297300
run: docker-build kind-cluster kind-load kind-deploy #HELP Build the operator-controller then deploy it into a new kind cluster.
298301

299302
.PHONY: docker-build
300-
docker-build: build-linux #EXHELP Build docker image for operator-controller with GOOS=linux and local GOARCH.
303+
docker-build: build-linux build-catalogd #EXHELP Build docker image for operator-controller with GOOS=linux and local GOARCH.
301304
$(CONTAINER_RUNTIME) build -t $(IMG) -f Dockerfile ./bin/linux
302305

306+
307+
ifeq ($(origin IMAGE_CATALOG_REPO), undefined)
308+
IMAGE_REPO := quay.io/operator-framework/catalogd
309+
endif
310+
export IMAGE_REPO
311+
312+
ifeq ($(origin IMAGE_CATALOG_TAG), undefined)
313+
IMAGE_TAG := devel
314+
endif
315+
export IMAGE_TAG
316+
317+
IMAGE_CATALOG := $(IMAGE_CATALOG_REPO):$(IMAGE_TAG)
318+
319+
.PHONY: build-catalogd
320+
build-catalogd: ## Build the catalogd project with specified IMAGE_TAG and IMAGE_REPO
321+
IMAGE=$(IMAGE_CATALOG) $(MAKE) -C catalogd build-container
322+
303323
#SECTION Release
304324
ifeq ($(origin ENABLE_RELEASE_PIPELINE), undefined)
305325
ENABLE_RELEASE_PIPELINE := false
@@ -316,10 +336,12 @@ release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By d
316336
$(GORELEASER) $(GORELEASER_ARGS)
317337

318338
.PHONY: quickstart
319-
quickstart: export MANIFEST := https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml
339+
quickstart: export MANIFEST := ./operator-controller.yaml
320340
quickstart: $(KUSTOMIZE) manifests #EXHELP Generate the installation release manifests and scripts.
321341
$(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
342+
cd catalogd && $(KUSTOMIZE) build config/overlays/cert-manager > catalogd.yaml
343+
envsubst '$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh
344+
323345

324346
##@ Docs
325347

catalogd/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
SHELL := /usr/bin/env bash -o pipefail
44
.SHELLFLAGS := -ec
55

6-
GOLANG_VERSION := $(shell sed -En 's/^go (.*)$$/\1/p' "go.mod")
7-
86
ifeq ($(origin IMAGE_REPO), undefined)
97
IMAGE_REPO := quay.io/operator-framework/catalogd
108
endif

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)