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{