mirror of
https://github.com/timothymiller/cloudflare-ddns.git
synced 2026-09-20 06:29:03 -03:00
feat: add Helm chart with GHCR OCI publish workflow
- Add charts/cloudflare-ddns/ Helm chart (env-var config, hostNetwork by default) - Add .github/workflows/helm.yml — lint → package → push to oci://ghcr.io/timothymiller - Update README Kubernetes section with Helm install guide (quick install, values.yaml, upgrade/uninstall) - Keep k8s/cloudflare-ddns.yml as legacy raw-manifest fallback
This commit is contained in:
34
charts/cloudflare-ddns/templates/_helpers.tpl
Normal file
34
charts/cloudflare-ddns/templates/_helpers.tpl
Normal file
@@ -0,0 +1,34 @@
|
||||
{{- define "cloudflare-ddns.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "cloudflare-ddns.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "cloudflare-ddns.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "cloudflare-ddns.labels" -}}
|
||||
helm.sh/chart: {{ include "cloudflare-ddns.chart" . }}
|
||||
{{ include "cloudflare-ddns.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "cloudflare-ddns.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "cloudflare-ddns.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
106
charts/cloudflare-ddns/templates/deployment.yaml
Normal file
106
charts/cloudflare-ddns/templates/deployment.yaml
Normal file
@@ -0,0 +1,106 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "cloudflare-ddns.fullname" . }}
|
||||
labels:
|
||||
{{- include "cloudflare-ddns.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "cloudflare-ddns.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "cloudflare-ddns.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
hostNetwork: {{ .Values.hostNetwork }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
env:
|
||||
- name: CLOUDFLARE_API_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ default (include "cloudflare-ddns.fullname" .) .Values.cloudflare.existingSecret }}
|
||||
key: {{ .Values.cloudflare.existingSecretKey }}
|
||||
{{- if .Values.domains }}
|
||||
- name: DOMAINS
|
||||
value: {{ .Values.domains | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.ip4Domains }}
|
||||
- name: IP4_DOMAINS
|
||||
value: {{ .Values.ip4Domains | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.ip6Domains }}
|
||||
- name: IP6_DOMAINS
|
||||
value: {{ .Values.ip6Domains | quote }}
|
||||
{{- end }}
|
||||
- name: IP4_PROVIDER
|
||||
value: {{ .Values.ip4Provider | quote }}
|
||||
- name: IP6_PROVIDER
|
||||
value: {{ .Values.ip6Provider | quote }}
|
||||
- name: UPDATE_CRON
|
||||
value: {{ .Values.updateCron | quote }}
|
||||
- name: UPDATE_ON_START
|
||||
value: {{ .Values.updateOnStart | quote }}
|
||||
- name: DELETE_ON_STOP
|
||||
value: {{ .Values.deleteOnStop | quote }}
|
||||
- name: TTL
|
||||
value: {{ .Values.ttl | quote }}
|
||||
- name: PROXIED
|
||||
value: {{ .Values.proxied | quote }}
|
||||
{{- if .Values.recordComment }}
|
||||
- name: RECORD_COMMENT
|
||||
value: {{ .Values.recordComment | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.managedRecordsCommentRegex }}
|
||||
- name: MANAGED_RECORDS_COMMENT_REGEX
|
||||
value: {{ .Values.managedRecordsCommentRegex | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.wafLists }}
|
||||
- name: WAF_LISTS
|
||||
value: {{ .Values.wafLists | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.shoutrrr }}
|
||||
- name: SHOUTRRR
|
||||
value: {{ .Values.shoutrrr | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.healthchecks }}
|
||||
- name: HEALTHCHECKS
|
||||
value: {{ .Values.healthchecks | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.uptimeKuma }}
|
||||
- name: UPTIMEKUMA
|
||||
value: {{ .Values.uptimeKuma | quote }}
|
||||
{{- end }}
|
||||
- name: DETECTION_TIMEOUT
|
||||
value: {{ .Values.detectionTimeout | quote }}
|
||||
- name: UPDATE_TIMEOUT
|
||||
value: {{ .Values.updateTimeout | quote }}
|
||||
- name: EMOJI
|
||||
value: {{ .Values.emoji | quote }}
|
||||
- name: QUIET
|
||||
value: {{ .Values.quiet | quote }}
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
11
charts/cloudflare-ddns/templates/secret.yaml
Normal file
11
charts/cloudflare-ddns/templates/secret.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
{{- if not .Values.cloudflare.existingSecret }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "cloudflare-ddns.fullname" . }}
|
||||
labels:
|
||||
{{- include "cloudflare-ddns.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
stringData:
|
||||
CLOUDFLARE_API_TOKEN: {{ required "cloudflare.apiToken is required when cloudflare.existingSecret is not set" .Values.cloudflare.apiToken | quote }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user