Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions charts/ddns-proxy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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"
9 changes: 9 additions & 0 deletions charts/ddns-proxy/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions charts/ddns-proxy/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -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 -}}
9 changes: 9 additions & 0 deletions charts/ddns-proxy/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
67 changes: 67 additions & 0 deletions charts/ddns-proxy/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
16 changes: 16 additions & 0 deletions charts/ddns-proxy/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
36 changes: 36 additions & 0 deletions charts/ddns-proxy/values.yaml
Original file line number Diff line number Diff line change
@@ -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