Skip to content

Commit e27d45b

Browse files
authored
Make operator aware of registry certificates (#58)
1 parent 2f2329e commit e27d45b

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,36 @@ install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~
220220
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.
221221
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
222222

223+
.PHONY: patch-registry-cert
224+
patch-registry-cert: ## Patch deployment to mount local registry certificate (for Kind development)
225+
@if [ -f hack/registry-certs/registry.crt ]; then \
226+
echo "Creating ConfigMap with registry certificate..."; \
227+
$(KUBECTL) create configmap registry-ca-cert \
228+
--from-file=ca.crt=hack/registry-certs/registry.crt \
229+
--namespace=func-operator-system \
230+
--dry-run=client -o yaml | $(KUBECTL) apply -f -; \
231+
if ! $(KUBECTL) get deployment func-operator-controller-manager -n func-operator-system -o jsonpath='{.spec.template.spec.volumes[*].name}' | grep -q registry-ca-cert; then \
232+
echo "Patching deployment to mount local registry certificate..."; \
233+
$(KUBECTL) patch deployment func-operator-controller-manager -n func-operator-system --type=json -p='[{"op":"add","path":"/spec/template/spec/volumes/-","value":{"name":"registry-ca-cert","configMap":{"name":"registry-ca-cert"}}},{"op":"add","path":"/spec/template/spec/containers/0/volumeMounts/-","value":{"name":"registry-ca-cert","mountPath":"/etc/ssl/certs/kind-registry-ca.crt","subPath":"ca.crt","readOnly":true}}]'; \
234+
else \
235+
echo "Registry certificate already mounted, skipping patch"; \
236+
fi; \
237+
else \
238+
echo "Registry certificate not found at hack/registry-certs/registry.crt, skipping patch"; \
239+
fi
240+
223241
.PHONY: deploy
224242
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
225243
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
226244
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
245+
$(MAKE) patch-registry-cert
227246
$(KUBECTL) wait deployment --all --timeout=120s --for=condition=Available -n func-operator-system
228247

229248
.PHONY: deploy-debugger
230249
deploy-debugger: manifests kustomize ## Deploy debug controller to the K8s cluster specified in ~/.kube/config.
231250
cd config/manager && $(KUSTOMIZE) edit set image controller=${DEBUG_IMG}
232251
$(KUSTOMIZE) build config/debug | $(KUBECTL) apply -f -
252+
$(MAKE) patch-registry-cert
233253

234254
.PHONY: undeploy
235255
undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.

hack/create-kind-cluster.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ TEKTON_VERSION="v1.11.0"
1818
KEDA_VERSION="v2.19.0"
1919
KEDA_HTTP_ADDON_VERSION="v0.13.0"
2020

21+
CERT_MANAGER_VERSION="v1.20.2"
22+
TRUST_MANAGER_VERSION="v0.22.0"
23+
2124
GITEA_USER="giteaadmin"
2225
GITEA_PASS="giteapass"
2326

0 commit comments

Comments
 (0)