Skip to content

Commit acfe5f3

Browse files
[Monorepo] Unify Install Script and YAML File
- Consolidated YAML for both projects into operator-controller.yaml. - Updated the install script to utilize the unified YAML file.
1 parent 9a0ccec commit acfe5f3

File tree

5 files changed

+42
-490
lines changed

5 files changed

+42
-490
lines changed

Makefile

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ IMAGE_REPO := quay.io/operator-framework/operator-controller
1414
endif
1515
export IMAGE_REPO
1616

17+
ifeq ($(origin CATALOG_IMAGE_REPO), undefined)
18+
CATALOG_IMAGE_REPO := quay.io/operator-framework/catalogd
19+
endif
20+
export CATALOG_IMAGE_REPO
21+
1722
ifeq ($(origin IMAGE_TAG), undefined)
1823
IMAGE_TAG := devel
1924
endif
@@ -23,7 +28,6 @@ IMG := $(IMAGE_REPO):$(IMAGE_TAG)
2328

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

2933
# Install default ClusterCatalogs
@@ -99,9 +103,14 @@ tidy: #HELP Update dependencies.
99103
# Force tidy to use the version already in go.mod
100104
$(Q)go mod tidy -go=$(GOLANG_VERSION)
101105

106+
102107
.PHONY: manifests
103-
manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
104-
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/base/crd/bases output:rbac:artifacts:config=config/base/rbac
108+
manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
109+
# To generate the manifests used and do not use catalogd directory
110+
$(CONTROLLER_GEN) rbac:roleName=manager-role paths=./internal/... output:rbac:artifacts:config=config/base/rbac
111+
$(CONTROLLER_GEN) crd paths=./api/... output:crd:artifacts:config=config/base/crd/bases
112+
# To generate the manifests for catalogd
113+
$(MAKE) -C catalogd generate
105114

106115
.PHONY: generate
107116
generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
@@ -229,14 +238,16 @@ e2e-coverage:
229238
COVERAGE_OUTPUT=./coverage/e2e.out ./hack/test/e2e-coverage.sh
230239

231240
.PHONY: kind-load
232-
kind-load: $(KIND) #EXHELP Loads the currently constructed image onto the cluster.
241+
kind-load: $(KIND) #EXHELP Loads the currently constructed images into the KIND cluster.
233242
$(CONTAINER_RUNTIME) save $(IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
243+
IMAGE_REPO=$(CATALOG_IMAGE_REPO) KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) $(MAKE) -C catalogd kind-load
234244

235245
.PHONY: kind-deploy
236-
kind-deploy: export MANIFEST="./operator-controller.yaml"
237-
kind-deploy: manifests $(KUSTOMIZE) #EXHELP Install controller and dependencies onto the kind cluster.
238-
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) > operator-controller.yaml
239-
envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s
246+
kind-deploy: export MANIFEST := ./operator-controller.yaml
247+
kind-deploy: manifests $(KUSTOMIZE)
248+
($(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) && echo "---" && $(KUSTOMIZE) build catalogd/config/overlays/cert-manager | sed "s/cert-git-version/cert-$(VERSION)/g") > $(MANIFEST)
249+
envsubst '$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s
250+
240251

241252
.PHONY: kind-cluster
242253
kind-cluster: $(KIND) #EXHELP Standup a kind cluster.
@@ -293,8 +304,9 @@ go-build-linux: $(BINARIES)
293304
run: docker-build kind-cluster kind-load kind-deploy #HELP Build the operator-controller then deploy it into a new kind cluster.
294305

295306
.PHONY: docker-build
296-
docker-build: build-linux #EXHELP Build docker image for operator-controller with GOOS=linux and local GOARCH.
307+
docker-build: build-linux #EXHELP Build docker image for operator-controller and catalog with GOOS=linux and local GOARCH.
297308
$(CONTAINER_RUNTIME) build -t $(IMG) -f Dockerfile ./bin/linux
309+
IMAGE_REPO=$(CATALOG_IMAGE_REPO) $(MAKE) -C catalogd build-container
298310

299311
#SECTION Release
300312
ifeq ($(origin ENABLE_RELEASE_PIPELINE), undefined)
@@ -312,10 +324,10 @@ release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By d
312324
$(GORELEASER) $(GORELEASER_ARGS)
313325

314326
.PHONY: quickstart
315-
quickstart: export MANIFEST := https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml
316-
quickstart: $(KUSTOMIZE) manifests #EXHELP Generate the installation release manifests and scripts.
317-
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | sed "s/:devel/:$(VERSION)/g" > operator-controller.yaml
318-
envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh
327+
quickstart: export MANIFEST := ./operator-controller.yaml
328+
quickstart: $(KUSTOMIZE) manifests #EXHELP Generate the unified installation release manifests and scripts.
329+
($(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) && echo "---" && $(KUSTOMIZE) build catalogd/config/overlays/cert-manager | sed "s/cert-git-version/cert-$(VERSION)/g") > $(MANIFEST)
330+
envsubst '$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh
319331

320332
##@ Docs
321333

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

0 commit comments

Comments
 (0)