Skip to content

Commit 88d9bbb

Browse files
Unify Install script and YAML file
Now, operator-controller.yaml contains YAML for both projects And the install script is prepared to use it.
1 parent f7ea0a3 commit 88d9bbb

File tree

5 files changed

+46
-490
lines changed

5 files changed

+46
-490
lines changed

Makefile

Lines changed: 29 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,18 @@ 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 \ # Generate RBAC from internal
111+
paths=./internal/... \
112+
output:rbac:artifacts:config=config/base/rbac
113+
$(CONTROLLER_GEN) crd \ # Generate CRDs from API
114+
paths=./api/... \
115+
output:crd:artifacts:config=config/base/crd/bases
116+
# To generate the manifests for catalogd
117+
$(MAKE) -C catalogd generate
105118

106119
.PHONY: generate
107120
generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
@@ -229,14 +242,16 @@ e2e-coverage:
229242
COVERAGE_OUTPUT=./coverage/e2e.out ./hack/test/e2e-coverage.sh
230243

231244
.PHONY: kind-load
232-
kind-load: $(KIND) #EXHELP Loads the currently constructed image onto the cluster.
245+
kind-load: $(KIND) #EXHELP Loads the currently constructed images into the KIND cluster.
233246
$(CONTAINER_RUNTIME) save $(IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
247+
IMAGE_REPO=$(CATALOG_IMAGE_REPO) KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) $(MAKE) -C catalogd kind-load
234248

235249
.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
250+
kind-deploy: export MANIFEST := ./operator-controller.yaml
251+
kind-deploy: manifests $(KUSTOMIZE)
252+
($(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) && echo "---" && $(KUSTOMIZE) build catalogd/config/overlays/cert-manager | sed "s/cert-git-version/cert-$(VERSION)/g") > $(MANIFEST)
253+
envsubst '$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s
254+
240255

241256
.PHONY: kind-cluster
242257
kind-cluster: $(KIND) #EXHELP Standup a kind cluster.
@@ -293,8 +308,9 @@ go-build-linux: $(BINARIES)
293308
run: docker-build kind-cluster kind-load kind-deploy #HELP Build the operator-controller then deploy it into a new kind cluster.
294309

295310
.PHONY: docker-build
296-
docker-build: build-linux #EXHELP Build docker image for operator-controller with GOOS=linux and local GOARCH.
311+
docker-build: build-linux #EXHELP Build docker image for operator-controller and catalog with GOOS=linux and local GOARCH.
297312
$(CONTAINER_RUNTIME) build -t $(IMG) -f Dockerfile ./bin/linux
313+
IMAGE_REPO=$(CATALOG_IMAGE_REPO) $(MAKE) -C catalogd build-container
298314

299315
#SECTION Release
300316
ifeq ($(origin ENABLE_RELEASE_PIPELINE), undefined)
@@ -312,10 +328,10 @@ release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By d
312328
$(GORELEASER) $(GORELEASER_ARGS)
313329

314330
.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
331+
quickstart: export MANIFEST := ./operator-controller.yaml
332+
quickstart: $(KUSTOMIZE) manifests #EXHELP Generate the unified installation release manifests and scripts.
333+
($(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) && echo "---" && $(KUSTOMIZE) build catalogd/config/overlays/cert-manager | sed "s/cert-git-version/cert-$(VERSION)/g") > $(MANIFEST)
334+
envsubst '$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh
319335

320336
##@ Docs
321337

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)