From 383733b36833fb3560a7160e421cf3172c4f6516 Mon Sep 17 00:00:00 2001 From: Rakshith R Date: Mon, 31 Jan 2022 16:27:28 +0530 Subject: [PATCH] deploy: fix setting rbac-proxy image in kustomize files ` cd config/manager && $(KUSTOMIZE) edit set image controller=${CONTROLLER_IMG} $(KUSTOMIZE_RBAC_PROXY)` The above command did not set rbax-proxy image since this image variable was part of config/default/kustomization.yaml. This commit fixes this issue and does some cleanup in the Makefile and config/default/kustomization.yaml(running the cmd moved /removed some default parameters). Signed-off-by: Rakshith R --- Makefile | 18 +++++++----------- config/default/kustomization.yaml | 15 +++++++++------ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index a6fd0f6f6..a5e135442 100644 --- a/Makefile +++ b/Makefile @@ -32,10 +32,7 @@ PACKAGE_NAME ?= csi-addons # the kube-rbac-proxy can easily be tested. Products that include CSI-Addons # may want to provide a different location of the container-image. # The default value is set in config/default/kustomization.yaml -#RBAC_PROXY_IMG ?= gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0 -ifneq ($(RBAC_PROXY_IMG),) -KUSTOMIZE_RBAC_PROXY := rbac-proxy=$(RBAC_PROXY_IMG) -endif +RBAC_PROXY_IMG ?= gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0 # The default version of the bundle (CSV) can be found in # config/manifests/bases/csi-addons.clusterserviceversion.yaml . When tagging a @@ -85,7 +82,8 @@ help: ## Display this help. .PHONY: manifests manifests: controller-gen kustomize ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="{./api/...,./cmd/...,./controllers/...,./sidecar/...}" output:crd:artifacts:config=config/crd/bases - cd config/manager && $(KUSTOMIZE) edit set image controller=${CONTROLLER_IMG} $(KUSTOMIZE_RBAC_PROXY) + cd config/default && $(KUSTOMIZE) edit set image rbac-proxy=${RBAC_PROXY_IMG} + cd config/manager && $(KUSTOMIZE) edit set image controller=${CONTROLLER_IMG} $(KUSTOMIZE) build config/default > deploy/controller/setup-controller.yaml # generate the .clusterserviceversion.yaml @@ -93,8 +91,7 @@ config/manifests/bases/$(PACKAGE_NAME).clusterserviceversion.yaml: config/manife sed 's/@PACKAGE_NAME@/$(PACKAGE_NAME)/g' < $^ > $@ .PHONY: bundle -bundle: config/manifests/bases/$(PACKAGE_NAME).clusterserviceversion.yaml kustomize operator-sdk - cd config/manager && $(KUSTOMIZE) edit set image controller=$(CONTROLLER_IMG) $(KUSTOMIZE_RBAC_PROXY) +bundle: config/manifests/bases/$(PACKAGE_NAME).clusterserviceversion.yaml manifests operator-sdk $(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle --manifests --metadata --package=$(PACKAGE_NAME) $(BUNDLE_VERSION) .PHONY: generate @@ -164,16 +161,15 @@ ifndef ignore-not-found endif .PHONY: install -install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config. +install: manifests ## Install CRDs into the K8s cluster specified in ~/.kube/config. $(KUSTOMIZE) build config/crd | kubectl apply -f - .PHONY: uninstall -uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. +uninstall: manifests ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. $(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f - .PHONY: deploy -deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. - cd config/manager && $(KUSTOMIZE) edit set image controller=${CONTROLLER_IMG} $(KUSTOMIZE_RBAC_PROXY) +deploy: manifests ## Deploy controller to the K8s cluster specified in ~/.kube/config. $(KUSTOMIZE) build config/default | kubectl apply -f - .PHONY: undeploy diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index 580b2ad7f..825083400 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -12,10 +12,7 @@ namePrefix: csi-addons- #commonLabels: # someName: someValue -bases: -- ../crd -- ../rbac -- ../manager +# bases: # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in # crd/kustomization.yaml #- ../webhook @@ -24,10 +21,10 @@ bases: # [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'. #- ../prometheus -patchesStrategicMerge: # Protect the /metrics endpoint by putting it behind auth. # If you want your controller-manager to expose the /metrics # endpoint w/o any authn/z, please comment the following line. +patchesStrategicMerge: - manager_auth_proxy_patch.yaml # Mount the controller config file for loading manager configurations @@ -44,7 +41,7 @@ patchesStrategicMerge: #- webhookcainjection_patch.yaml # the following config is for teaching kustomize how to do var substitution -vars: +# vars: # [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix. #- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR # objref: @@ -77,3 +74,9 @@ images: - name: rbac-proxy newName: gcr.io/kubebuilder/kube-rbac-proxy newTag: v0.8.0 +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ../crd +- ../rbac +- ../manager