From 2d1b5f2ad3ce72f5a95d2fc98223d1e4a0486f2b Mon Sep 17 00:00:00 2001 From: STRRL Date: Tue, 22 Oct 2024 21:36:09 -0700 Subject: [PATCH] chore: resolve default values CLOUDFLARED_IMAGE and CLOUDFLARED_IMAGE_PULL_POLICY Signed-off-by: STRRL --- hack/dev/deployment.yaml | 4 ++++ pkg/controller/controlled-cloudflared-connector.go | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/hack/dev/deployment.yaml b/hack/dev/deployment.yaml index 640a3a4..bf75e4c 100644 --- a/hack/dev/deployment.yaml +++ b/hack/dev/deployment.yaml @@ -115,6 +115,10 @@ spec: env: - name: CLOUDFLARED_REPLICA_COUNT value: "1" + - name: CLOUDFLARED_IMAGE + value: "cloudflare/cloudflared:latest" + - name: CLOUDFLARED_IMAGE_PULL_POLICY + value: "IfNotPresent" - name: CLOUDFLARE_API_TOKEN valueFrom: secretKeyRef: diff --git a/pkg/controller/controlled-cloudflared-connector.go b/pkg/controller/controlled-cloudflared-connector.go index 16eb784..8cc55dd 100644 --- a/pkg/controller/controlled-cloudflared-connector.go +++ b/pkg/controller/controlled-cloudflared-connector.go @@ -96,8 +96,17 @@ func CreateOrUpdateControlledCloudflared( func cloudflaredConnectDeploymentTemplating(protocol string, token string, namespace string, replicas int32) *appsv1.Deployment { appName := "controlled-cloudflared-connector" + + // Use default values if environment variables are empty image := os.Getenv("CLOUDFLARED_IMAGE") + if image == "" { + image = "cloudflare/cloudflared:latest" + } + pullPolicy := os.Getenv("CLOUDFLARED_IMAGE_PULL_POLICY") + if pullPolicy == "" { + pullPolicy = "IfNotPresent" + } return &appsv1.Deployment{ ObjectMeta: metav1.ObjectMeta{