Skip to content

Commit

Permalink
chore: resolve default values CLOUDFLARED_IMAGE and CLOUDFLARED_IMAGE…
Browse files Browse the repository at this point in the history
…_PULL_POLICY

Signed-off-by: STRRL <[email protected]>
  • Loading branch information
STRRL committed Oct 23, 2024
1 parent d147cd0 commit 2d1b5f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hack/dev/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions pkg/controller/controlled-cloudflared-connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 2d1b5f2

Please sign in to comment.