From 336327656e16c5074ceb70631fc840878dd7e723 Mon Sep 17 00:00:00 2001 From: Igor Karpovich Date: Sat, 21 Mar 2026 15:33:18 +0000 Subject: [PATCH] feat: add helm chart and usage docs --- README.md | 46 ++++++++++++++ charts/ddns-proxy/Chart.yaml | 6 ++ charts/ddns-proxy/templates/NOTES.txt | 9 +++ charts/ddns-proxy/templates/_helpers.tpl | 24 ++++++++ charts/ddns-proxy/templates/configmap.yaml | 9 +++ charts/ddns-proxy/templates/deployment.yaml | 67 +++++++++++++++++++++ charts/ddns-proxy/templates/service.yaml | 16 +++++ charts/ddns-proxy/values.yaml | 36 +++++++++++ 8 files changed, 213 insertions(+) create mode 100644 charts/ddns-proxy/Chart.yaml create mode 100644 charts/ddns-proxy/templates/NOTES.txt create mode 100644 charts/ddns-proxy/templates/_helpers.tpl create mode 100644 charts/ddns-proxy/templates/configmap.yaml create mode 100644 charts/ddns-proxy/templates/deployment.yaml create mode 100644 charts/ddns-proxy/templates/service.yaml create mode 100644 charts/ddns-proxy/values.yaml diff --git a/README.md b/README.md index d4afc60..e541c16 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,52 @@ docker run --rm -p 8080:8080 \ -config /config.yaml ``` +## Run (Helm) + +Chart path: +- `charts/ddns-proxy` + +Create a values file with runtime config: + +```yaml +image: + repository: ghcr.io/ikarpovich/ddns-proxy + tag: v0.1.1 + +config: + server: + listen_addr: ":8080" + trusted_proxy_cidrs: [] + read_timeout: 10s + write_timeout: 15s + clients: + - name: node1 + token: replace-me + provider: cloudflare + record: + domain: example.com + sub_domain: home + credentials: + secret: replace-me +``` + +Install: + +```bash +helm upgrade --install ddns-proxy ./charts/ddns-proxy \ + --namespace ddns-proxy \ + --create-namespace \ + -f values.yaml +``` + +Probe check: + +```bash +kubectl -n ddns-proxy port-forward svc/ddns-proxy 8080:8080 +curl -sS http://127.0.0.1:8080/healthz +curl -sS http://127.0.0.1:8080/readyz +``` + ## Test ```bash diff --git a/charts/ddns-proxy/Chart.yaml b/charts/ddns-proxy/Chart.yaml new file mode 100644 index 0000000..392e818 --- /dev/null +++ b/charts/ddns-proxy/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: ddns-proxy +description: Token-authenticated DDNS proxy service +type: application +version: 0.1.0 +appVersion: "v0.1.1" diff --git a/charts/ddns-proxy/templates/NOTES.txt b/charts/ddns-proxy/templates/NOTES.txt new file mode 100644 index 0000000..16e7098 --- /dev/null +++ b/charts/ddns-proxy/templates/NOTES.txt @@ -0,0 +1,9 @@ +1. Get the service endpoint: + + kubectl get svc -n {{ .Release.Namespace }} {{ include "ddns-proxy.fullname" . }} + +2. Verify health endpoints: + + kubectl port-forward -n {{ .Release.Namespace }} svc/{{ include "ddns-proxy.fullname" . }} 8080:{{ .Values.service.port }} + curl -sS http://127.0.0.1:8080/healthz + curl -sS http://127.0.0.1:8080/readyz diff --git a/charts/ddns-proxy/templates/_helpers.tpl b/charts/ddns-proxy/templates/_helpers.tpl new file mode 100644 index 0000000..35c114f --- /dev/null +++ b/charts/ddns-proxy/templates/_helpers.tpl @@ -0,0 +1,24 @@ +{{- define "ddns-proxy.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "ddns-proxy.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := include "ddns-proxy.name" . -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{- define "ddns-proxy.labels" -}} +helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} +app.kubernetes.io/name: {{ include "ddns-proxy.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} diff --git a/charts/ddns-proxy/templates/configmap.yaml b/charts/ddns-proxy/templates/configmap.yaml new file mode 100644 index 0000000..c7a4c62 --- /dev/null +++ b/charts/ddns-proxy/templates/configmap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "ddns-proxy.fullname" . }}-config + labels: + {{- include "ddns-proxy.labels" . | nindent 4 }} +data: + config.yaml: | +{{ toYaml .Values.config | indent 4 }} diff --git a/charts/ddns-proxy/templates/deployment.yaml b/charts/ddns-proxy/templates/deployment.yaml new file mode 100644 index 0000000..43994e6 --- /dev/null +++ b/charts/ddns-proxy/templates/deployment.yaml @@ -0,0 +1,67 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "ddns-proxy.fullname" . }} + labels: + {{- include "ddns-proxy.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "ddns-proxy.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "ddns-proxy.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + containers: + - name: ddns-proxy + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + - "-config" + - "/etc/ddns-proxy/config.yaml" + ports: + - name: http + containerPort: 8080 + protocol: TCP + livenessProbe: + httpGet: + path: {{ .Values.livenessProbe.path }} + port: http + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + readinessProbe: + httpGet: + path: {{ .Values.readinessProbe.path }} + port: http + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + volumeMounts: + - name: config + mountPath: /etc/ddns-proxy + readOnly: true + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumes: + - name: config + configMap: + name: {{ include "ddns-proxy.fullname" . }}-config + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/ddns-proxy/templates/service.yaml b/charts/ddns-proxy/templates/service.yaml new file mode 100644 index 0000000..bfc1c2b --- /dev/null +++ b/charts/ddns-proxy/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "ddns-proxy.fullname" . }} + labels: + {{- include "ddns-proxy.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + app.kubernetes.io/name: {{ include "ddns-proxy.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/charts/ddns-proxy/values.yaml b/charts/ddns-proxy/values.yaml new file mode 100644 index 0000000..ac168eb --- /dev/null +++ b/charts/ddns-proxy/values.yaml @@ -0,0 +1,36 @@ +replicaCount: 1 + +image: + repository: ghcr.io/ikarpovich/ddns-proxy + tag: latest + pullPolicy: IfNotPresent + +service: + type: ClusterIP + port: 8080 + +resources: {} + +nodeSelector: {} +tolerations: [] +affinity: {} + +podAnnotations: {} + +config: + server: + listen_addr: ":8080" + trusted_proxy_cidrs: [] + read_timeout: 10s + write_timeout: 15s + clients: [] + +livenessProbe: + path: /healthz + initialDelaySeconds: 3 + periodSeconds: 10 + +readinessProbe: + path: /readyz + initialDelaySeconds: 3 + periodSeconds: 10