Skip to content

Commit d715230

Browse files
authored
PULL_SECRET env var in control-operator makefile (#863)
[control-operator] adding variable PULL_SECRET for the operator image deployment
1 parent b1589b6 commit d715230

4 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎control-operator/Makefile‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ OPERATOR_SDK_VERSION ?= unknown
5353
# Image URL to use all building/pushing image targets
5454
TASK_IMG ?= gitlab-registry.cern.ch/aliceo2group/dockerfiles/aliecs/task-manager:latest
5555
ENVIRONMENT_IMG ?= gitlab-registry.cern.ch/aliceo2group/dockerfiles/aliecs/environment-manager:latest
56+
# Name of the image pull secret (in operator-system namespace) used by deployed controllers
57+
PULL_SECRET ?= ghcr-pull
5658
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
5759
ENVTEST_K8S_VERSION = 1.27.1
5860

@@ -212,12 +214,12 @@ deploy: deploy-task deploy-environment ## Deploy both controllers to the K8s clu
212214
.PHONY: deploy-task
213215
deploy-task: manifests kustomize ## Deploy task controller to the K8s cluster specified in ~/.kube/config.
214216
cd config/task && $(KUSTOMIZE) edit set image task-manager=${TASK_IMG}
215-
$(KUSTOMIZE) build config/task | $(KUBECTL) apply -f - --server-side
217+
$(KUSTOMIZE) build config/task | sed 's/- name: pull-secret-placeholder$$/- name: $(PULL_SECRET)/' | $(KUBECTL) apply -f - --server-side
216218

217219
.PHONY: deploy-environment
218220
deploy-environment: manifests kustomize ## Deploy environment controller to the K8s cluster specified in ~/.kube/config.
219221
cd config/environment && $(KUSTOMIZE) edit set image environment-manager=${ENVIRONMENT_IMG}
220-
$(KUSTOMIZE) build config/environment | $(KUBECTL) apply -f - --server-side
222+
$(KUSTOMIZE) build config/environment | sed 's/- name: pull-secret-placeholder$$/- name: $(PULL_SECRET)/' | $(KUBECTL) apply -f - --server-side
221223

222224
.PHONY: undeploy
223225
undeploy: undeploy-task undeploy-environment ## Undeploy both controllers from the K8s cluster specified in ~/.kube/config.

‎control-operator/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ kubectl apply -f config/samples/
3737
make docker-build docker-push TASK_IMG=<some-registry>/task-manager:tag ENVIRONMENT_IMG=<some-registry>/environment-manager:tag
3838
```
3939

40-
1. Deploy the controllers to the cluster. Uses the same `TASK_IMG` and `ENVIRONMENT_IMG` defaults, override them if needed:
40+
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:
4141

4242
```sh
43-
make deploy TASK_IMG=<some-registry>/task-manager:tag ENVIRONMENT_IMG=<some-registry>/environment-manager:tag
43+
make deploy TASK_IMG=<some-registry>/task-manager:tag ENVIRONMENT_IMG=<some-registry>/environment-manager:tag PULL_SECRET=<secret-name>
4444
```
4545

4646
### Uninstall CRDs

‎control-operator/config/manager/environment-manager/environment-manager.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ spec:
2323
labels:
2424
control-plane: environment-manager
2525
spec:
26+
# placeholder, replaced with $(PULL_SECRET) by `make deploy-task` / `make deploy-environment`
2627
imagePullSecrets:
27-
- name: gitlab-registry-secret
28+
- name: pull-secret-placeholder
2829
securityContext:
2930
runAsNonRoot: true
3031
containers:

‎control-operator/config/manager/task-manager/task-manager.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ spec:
2323
control-plane: task-manager
2424
spec:
2525
hostNetwork: true
26+
# placeholder, replaced with $(PULL_SECRET) by `make deploy-task` / `make deploy-environment`
2627
imagePullSecrets:
27-
- name: gitlab-registry-secret
28+
- name: pull-secret-placeholder
2829
securityContext:
2930
runAsNonRoot: true
3031
containers:

0 commit comments

Comments
 (0)