Skip to content

Commit 2f1aff4

Browse files
authored
Merge pull request #2208 from stevehipwell/add-helm-chart
Add helm chart
2 parents 89af8ba + 124fd70 commit 2f1aff4

15 files changed

+577
-1
lines changed
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Lint and Test Chart
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "charts/external-dns/**"
7+
8+
jobs:
9+
lint-test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Set up Helm
18+
uses: azure/setup-helm@v1
19+
with:
20+
version: v3.6.3
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: 3.7
26+
27+
- name: Set up chart-testing
28+
uses: helm/[email protected]
29+
30+
- name: Run chart-testing (list-changed)
31+
id: list-changed
32+
run: |
33+
changed=$(ct list-changed)
34+
if [[ -n "$changed" ]]; then
35+
echo "::set-output name=changed::true"
36+
fi
37+
38+
- name: Run chart-testing (lint)
39+
run: ct lint
40+
41+
- name: Create Kind cluster
42+
uses: helm/[email protected]
43+
with:
44+
wait: 120s
45+
if: steps.list-changed.outputs.changed == 'true'
46+
47+
- name: Run chart-testing (install)
48+
run: ct install

.github/workflows/release-chart.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release Chart
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- "charts/external-dns/**"
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Configure Git
20+
run: |
21+
git config user.name "$GITHUB_ACTOR"
22+
git config user.email "[email protected]"
23+
24+
- name: Install Helm
25+
uses: azure/setup-helm@v1
26+
with:
27+
version: v3.6.3
28+
29+
- name: Run chart-releaser
30+
uses: helm/[email protected]
31+
env:
32+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
33+
CR_RELEASE_NAME_TEMPLATE: "external-dns-helm-chart-{{ .Version }}"

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,7 @@ vendor/
5050
profile.cov
5151

5252
# github codespaces
53-
.venv/
53+
.venv/
54+
55+
# Helm charts
56+
!/charts/external-dns/

charts/external-dns/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/external-dns/Chart.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v2
2+
name: external-dns
3+
description: ExternalDNS synchronizes exposed Kubernetes Services and Ingresses with DNS providers.
4+
type: application
5+
version: 1.2.0
6+
appVersion: 0.9.0
7+
keywords:
8+
- kubernetes
9+
- external-dns
10+
- dns
11+
home: https://github.com/kubernetes-sigs/external-dns/
12+
icon: https://github.com/kubernetes-sigs/external-dns/raw/master/img/external-dns.png
13+
sources:
14+
- https://github.com/kubernetes-sigs/external-dns/
15+
maintainers:
16+
- name: stevehipwell
17+
18+
annotations:
19+
artifacthub.io/changes: |
20+
- kind: added
21+
description: Initial official release.

charts/external-dns/README.md

+66
Large diffs are not rendered by default.
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
***********************************************************************
2+
* External DNS *
3+
***********************************************************************
4+
Chart version: {{ .Chart.Version }}
5+
App version: {{ .Chart.AppVersion }}
6+
Image tag: {{ include "external-dns.image" . }}
7+
***********************************************************************
+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "external-dns.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "external-dns.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "external-dns.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "external-dns.labels" -}}
37+
helm.sh/chart: {{ include "external-dns.chart" . }}
38+
{{ include "external-dns.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "external-dns.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "external-dns.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "external-dns.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "external-dns.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
63+
64+
{{/*
65+
The image to use
66+
*/}}
67+
{{- define "external-dns.image" -}}
68+
{{- printf "%s:%s" .Values.image.repository (default (printf "v%s" .Chart.AppVersion) .Values.image.tag) }}
69+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{- if .Values.rbac.create -}}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
name: {{ template "external-dns.fullname" . }}
6+
labels:
7+
{{- include "external-dns.labels" . | nindent 4 }}
8+
rules:
9+
- apiGroups: [""]
10+
resources: ["services","endpoints","pods"]
11+
verbs: ["get","watch","list"]
12+
- apiGroups: ["extensions","networking.k8s.io"]
13+
resources: ["ingresses"]
14+
verbs: ["get","watch","list"]
15+
- apiGroups: [""]
16+
resources: ["nodes"]
17+
verbs: ["list","watch"]
18+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{- if .Values.rbac.create -}}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRoleBinding
4+
metadata:
5+
name: {{ printf "%s-viewer" (include "external-dns.fullname" .) }}
6+
labels:
7+
{{- include "external-dns.labels" . | nindent 4 }}
8+
roleRef:
9+
apiGroup: rbac.authorization.k8s.io
10+
kind: ClusterRole
11+
name: {{ template "external-dns.fullname" . }}
12+
subjects:
13+
- kind: ServiceAccount
14+
name: {{ template "external-dns.serviceAccountName" . }}
15+
namespace: {{ .Release.Namespace }}
16+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "external-dns.fullname" . }}
5+
labels:
6+
{{- include "external-dns.labels" . | nindent 4 }}
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
{{- include "external-dns.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
labels:
15+
{{- include "external-dns.selectorLabels" . | nindent 8 }}
16+
{{- with .Values.podLabels }}
17+
{{- toYaml . | nindent 8 }}
18+
{{- end }}
19+
{{- with .Values.podAnnotations }}
20+
annotations:
21+
{{- toYaml . | nindent 8 }}
22+
{{- end }}
23+
spec:
24+
{{- with .Values.imagePullSecrets }}
25+
imagePullSecrets:
26+
{{- toYaml . | nindent 8 }}
27+
{{- end }}
28+
serviceAccountName: {{ include "external-dns.serviceAccountName" . }}
29+
{{- with .Values.podSecurityContext }}
30+
securityContext:
31+
{{- toYaml . | nindent 8 }}
32+
{{- end }}
33+
{{- with .Values.priorityClassName }}
34+
priorityClassName: {{ . | quote }}
35+
{{- end }}
36+
{{- with .Values.terminationGracePeriodSeconds }}
37+
terminationGracePeriodSeconds: {{ . }}
38+
{{- end }}
39+
containers:
40+
- name: external-dns
41+
{{- with .Values.securityContext }}
42+
securityContext:
43+
{{- toYaml . | nindent 12 }}
44+
{{- end }}
45+
image: {{ include "external-dns.image" . }}
46+
imagePullPolicy: {{ .Values.image.pullPolicy }}
47+
{{- with .Values.env }}
48+
env:
49+
{{- toYaml . | nindent 12 }}
50+
{{- end }}
51+
args:
52+
- --log-level={{ .Values.logLevel }}
53+
- --log-format={{ .Values.logFormat }}
54+
- --interval={{ .Values.interval }}
55+
{{- if .Values.triggerLoopOnEvent }}
56+
- --events
57+
{{- end }}
58+
{{- range .Values.sources }}
59+
- --source={{ . }}
60+
{{- end }}
61+
- --policy={{ .Values.policy }}
62+
{{- if eq .Values.registry "txt" }}
63+
{{- if .Values.txtOwnerId }}
64+
- --txt-owner-id={{ .Values.txtOwnerId }}
65+
{{- end }}
66+
{{- if .Values.txtPrefix }}
67+
- --txt-prefix={{ .Values.txtPrefix }}
68+
{{- end }}
69+
{{- end }}
70+
{{- range .Values.domainFilters }}
71+
- --domain-filter={{ . }}
72+
{{- end }}
73+
- --provider={{ .Values.provider }}
74+
{{- range .Values.extraArgs }}
75+
- {{ . }}
76+
{{- end }}
77+
ports:
78+
- name: http
79+
protocol: TCP
80+
containerPort: 7979
81+
livenessProbe:
82+
{{- toYaml .Values.livenessProbe | nindent 12 }}
83+
readinessProbe:
84+
{{- toYaml .Values.readinessProbe | nindent 12 }}
85+
{{- with .Values.extraVolumeMounts }}
86+
volumeMounts:
87+
{{- toYaml . | nindent 12 }}
88+
{{- end }}
89+
{{- with .Values.resources }}
90+
resources:
91+
{{- toYaml . | nindent 12 }}
92+
{{- end }}
93+
{{- with .Values.extraVolumes }}
94+
volumes:
95+
{{- toYaml . | nindent 8 }}
96+
{{- end }}
97+
{{- with .Values.nodeSelector }}
98+
nodeSelector:
99+
{{- toYaml . | nindent 8 }}
100+
{{- end }}
101+
{{- with .Values.affinity }}
102+
affinity:
103+
{{- toYaml . | nindent 8 }}
104+
{{- end }}
105+
{{- with .Values.tolerations }}
106+
tolerations:
107+
{{- toYaml . | nindent 8 }}
108+
{{- end }}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "external-dns.fullname" . }}
5+
labels:
6+
{{- include "external-dns.labels" . | nindent 4 }}
7+
spec:
8+
type: ClusterIP
9+
selector:
10+
{{- include "external-dns.selectorLabels" . | nindent 4 }}
11+
ports:
12+
- name: http
13+
port: {{ .Values.service.port }}
14+
targetPort: http
15+
protocol: TCP
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if .Values.serviceAccount.create -}}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ include "external-dns.serviceAccountName" . }}
6+
labels:
7+
{{- include "external-dns.labels" . | nindent 4 }}
8+
{{- with .Values.serviceAccount.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
{{- end }}

0 commit comments

Comments
 (0)