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:
qitpydev
2026-06-09 16:22:54 +07:00
parent bbe2ae4543
commit 7564cb14f0
8 changed files with 377 additions and 2 deletions

View File

@@ -0,0 +1,4 @@
.DS_Store
.git
.gitignore
*.orig

View File

@@ -0,0 +1,16 @@
apiVersion: v2
name: cloudflare-ddns
description: Dynamic DNS client for Cloudflare — keeps A/AAAA records in sync with your public IP
type: application
version: 0.1.0
appVersion: "2.1.2"
home: https://github.com/timothymiller/cloudflare-ddns
sources:
- https://github.com/timothymiller/cloudflare-ddns
keywords:
- ddns
- cloudflare
- dns
maintainers:
- name: timothymiller
url: https://github.com/timothymiller

View 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 }}

View 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 }}

View 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 }}

View File

@@ -0,0 +1,80 @@
image:
repository: timothyjmiller/cloudflare-ddns
pullPolicy: IfNotPresent
# Overrides the image tag — defaults to chart appVersion
tag: ""
# Must stay at 1. Multiple replicas cause duplicate DNS updates.
replicaCount: 1
# Required for IPv6 detection via local interface.
# Safe to disable if you only need IPv4 (IP6_PROVIDER=none).
hostNetwork: true
# --- Authentication ---
# Supply apiToken directly (creates a Secret) OR reference an existing one.
cloudflare:
apiToken: ""
existingSecret: ""
existingSecretKey: "CLOUDFLARE_API_TOKEN"
# --- Domains ---
# Comma-separated. At least one of domains / ip4Domains / ip6Domains must be set.
domains: ""
ip4Domains: ""
ip6Domains: ""
# --- IP Detection ---
# Options: cloudflare.trace, cloudflare.doh, ipify, local,
# local.iface:<name>, local.iface.stable:<name>,
# url:<url>, literal:<ip1,ip2>, none
ip4Provider: "cloudflare.trace"
ip6Provider: "cloudflare.trace"
# --- Scheduling ---
updateCron: "@every 5m"
updateOnStart: true
deleteOnStop: false
# --- DNS Record Settings ---
ttl: 1
# Boolean expression: true, false, is(domain), sub(domain), and combos
proxied: "false"
recordComment: ""
managedRecordsCommentRegex: ""
# --- WAF Lists ---
# Comma-separated, format: account-id/list-name
wafLists: ""
# --- Notifications (Shoutrrr) ---
# Newline-separated URLs: discord://, slack://, telegram://, generic+https://...
shoutrrr: ""
# --- Heartbeat Monitoring ---
healthchecks: ""
uptimeKuma: ""
# --- Timeouts ---
detectionTimeout: "5s"
updateTimeout: "30s"
# --- Output ---
emoji: true
quiet: false
# --- Resources ---
resources:
limits:
memory: 32Mi
cpu: 50m
# Additional env vars for any setting not exposed above
extraEnv: []
# - name: REJECT_CLOUDFLARE_IPS
# value: "false"
podAnnotations: {}
nodeSelector: {}
tolerations: []
affinity: {}