From 89944b2cc1edf5cb32f4f83b1dfc560ab575f1ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Tich=C3=A1k?= Date: Tue, 13 Oct 2026 14:38:32 +0200 Subject: [PATCH] [control-operator] adding variable PULL_SECRET for the operator image deployment --- control-operator/Makefile | 6 ++++-- control-operator/README.md | 4 ++-- .../manager/environment-manager/environment-manager.yaml | 3 ++- .../config/manager/task-manager/task-manager.yaml | 3 ++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/control-operator/Makefile b/control-operator/Makefile index 45ccb9502..ee2fb687f 100644 --- a/control-operator/Makefile +++ b/control-operator/Makefile @@ -53,6 +53,8 @@ OPERATOR_SDK_VERSION ?= unknown # Image URL to use all building/pushing image targets TASK_IMG ?= gitlab-registry.cern.ch/aliceo2group/dockerfiles/aliecs/task-manager:latest ENVIRONMENT_IMG ?= gitlab-registry.cern.ch/aliceo2group/dockerfiles/aliecs/environment-manager:latest +# Name of the image pull secret (in operator-system namespace) used by deployed controllers +PULL_SECRET ?= ghcr-pull # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.27.1 @@ -212,12 +214,12 @@ deploy: deploy-task deploy-environment ## Deploy both controllers to the K8s clu .PHONY: deploy-task deploy-task: manifests kustomize ## Deploy task controller to the K8s cluster specified in ~/.kube/config. cd config/task && $(KUSTOMIZE) edit set image task-manager=${TASK_IMG} - $(KUSTOMIZE) build config/task | $(KUBECTL) apply -f - --server-side + $(KUSTOMIZE) build config/task | sed 's/- name: pull-secret-placeholder$$/- name: $(PULL_SECRET)/' | $(KUBECTL) apply -f - --server-side .PHONY: deploy-environment deploy-environment: manifests kustomize ## Deploy environment controller to the K8s cluster specified in ~/.kube/config. cd config/environment && $(KUSTOMIZE) edit set image environment-manager=${ENVIRONMENT_IMG} - $(KUSTOMIZE) build config/environment | $(KUBECTL) apply -f - --server-side + $(KUSTOMIZE) build config/environment | sed 's/- name: pull-secret-placeholder$$/- name: $(PULL_SECRET)/' | $(KUBECTL) apply -f - --server-side .PHONY: undeploy undeploy: undeploy-task undeploy-environment ## Undeploy both controllers from the K8s cluster specified in ~/.kube/config. diff --git a/control-operator/README.md b/control-operator/README.md index 208ff6b67..91fc6b931 100644 --- a/control-operator/README.md +++ b/control-operator/README.md @@ -37,10 +37,10 @@ kubectl apply -f config/samples/ make docker-build docker-push TASK_IMG=/task-manager:tag ENVIRONMENT_IMG=/environment-manager:tag ``` -1. Deploy the controllers to the cluster. Uses the same `TASK_IMG` and `ENVIRONMENT_IMG` defaults, override them if needed: +1. Deploy the controllers to the cluster. Uses the same `TASK_IMG` and `ENVIRONMENT_IMG` defaults, override them if needed. Images are pulled using the secret named by `PULL_SECRET` (default `ghcr-pull`), which must exist in the `operator-system` namespace: ```sh -make deploy TASK_IMG=/task-manager:tag ENVIRONMENT_IMG=/environment-manager:tag +make deploy TASK_IMG=/task-manager:tag ENVIRONMENT_IMG=/environment-manager:tag PULL_SECRET= ``` ### Uninstall CRDs diff --git a/control-operator/config/manager/environment-manager/environment-manager.yaml b/control-operator/config/manager/environment-manager/environment-manager.yaml index 11b12925d..f4536ca02 100644 --- a/control-operator/config/manager/environment-manager/environment-manager.yaml +++ b/control-operator/config/manager/environment-manager/environment-manager.yaml @@ -23,8 +23,9 @@ spec: labels: control-plane: environment-manager spec: + # placeholder, replaced with $(PULL_SECRET) by `make deploy-task` / `make deploy-environment` imagePullSecrets: - - name: gitlab-registry-secret + - name: pull-secret-placeholder securityContext: runAsNonRoot: true containers: diff --git a/control-operator/config/manager/task-manager/task-manager.yaml b/control-operator/config/manager/task-manager/task-manager.yaml index 717c9a8d5..c7bcf8adb 100644 --- a/control-operator/config/manager/task-manager/task-manager.yaml +++ b/control-operator/config/manager/task-manager/task-manager.yaml @@ -23,8 +23,9 @@ spec: control-plane: task-manager spec: hostNetwork: true + # placeholder, replaced with $(PULL_SECRET) by `make deploy-task` / `make deploy-environment` imagePullSecrets: - - name: gitlab-registry-secret + - name: pull-secret-placeholder securityContext: runAsNonRoot: true containers: