Skip to content

Commit

Permalink
Add cloudflare.secretRef for custom secrets
Browse files Browse the repository at this point in the history
This will remove the need to create a secret if the user decides to
bring their own secret.
  • Loading branch information
VoyTechnology committed Nov 10, 2023
1 parent 95c265e commit 6bb1c78
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,33 @@ spec:
- name: CLOUDFLARE_API_TOKEN
valueFrom:
secretKeyRef:
{{- if hasKey .Values.cloudflare "secretRef" }}
name: {{ .Values.cloudflare.secretRef.name }}
key: {{ .Values.cloudflare.secretRef.apiTokenKey }}
{{- else }}
name: cloudflare-api
key: api-token
{{- end }}
- name: CLOUDFLARE_ACCOUNT_ID
valueFrom:
secretKeyRef:
{{- if hasKey .Values.cloudflare "secretRef" }}
name: {{ .Values.cloudflare.secretRef.name }}
key: {{ .Values.cloudflare.secretRef.accountIDKey }}
{{- else }}
name: cloudflare-api
key: cloudflare-account-id
{{- end }}
- name: CLOUDFLARE_TUNNEL_NAME
valueFrom:
secretKeyRef:
{{- if hasKey .Values.cloudflare "secretRef" }}
name: {{ .Values.cloudflare.secretRef.name }}
key: {{ .Values.cloudflare.secretRef.tunnelNameKey }}
{{- else }}
name: cloudflare-api
key: cloudflare-tunnel-name
{{- end }}
- name: NAMESPACE
valueFrom:
fieldRef:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not (hasKey .Values.cloudflare "secretRef") }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -6,3 +7,4 @@ stringData:
api-token: "{{ .Values.cloudflare.apiToken }}"
cloudflare-account-id: "{{ .Values.cloudflare.accountId }}"
cloudflare-tunnel-name: "{{ .Values.cloudflare.tunnelName }}"
{{- end }}
14 changes: 10 additions & 4 deletions helm/cloudflare-tunnel-ingress-controller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.


cloudflare:
apiToken: ""
accountId: ""
tunnelName: ""
accountId: ""
tunnelName: ""
apiToken: ""

# Uncomment if you would like to use an existing secret instead of the creating a new one.
# secretRef:
# name: cloudflare-external-secret
# accountIDKey: account_id
# tunnelNameKey: tunnel_name
# apiTokenKey: api_token

ingressClass:
name: cloudflare-tunnel
Expand Down

0 comments on commit 6bb1c78

Please sign in to comment.