Skip to content

Commit

Permalink
feat(external-dns-extensions): add new Helm chart for external-dns ex…
Browse files Browse the repository at this point in the history
…tensions

- Added a new Helm chart for managing external-dns CRDs.
- Included templates for DNSEndpoint resources.
- Provided values.yaml file to customize the deployment.
- Created README.md with instructions on how to deploy and customize the chart.
- Added LICENSE file.

Also, updated argo-cd and cert-manager extension templates:
- Enhanced metadata section in multiple yaml files under argo-cd and cert-manager extensions. Now supports custom labels and annotations.
  • Loading branch information
winromulus committed Jul 6, 2024
1 parent 0a972db commit 980f52d
Show file tree
Hide file tree
Showing 12 changed files with 232 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/charts/argo-cd-extensions/templates/01-appprojects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ kind: AppProject
metadata:
name: {{ $fullName }}
namespace: {{ $item.namespace | default $.Release.Namespace | default "default" }}
labels:
{{- include "argo-cd-extensions.labels" $ | nindent 4 }}
{{- with $item.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if $item.annotations }}
annotations:
{{- toYaml $item.annotations | nindent 4 }}
{{- end }}
spec:
{{- if $item.description }}
description: {{ $item.description }}
Expand Down
9 changes: 9 additions & 0 deletions src/charts/argo-cd-extensions/templates/02-applications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ kind: Application
metadata:
name: {{ $fullName }}
namespace: {{ $item.namespace | default $.Release.Namespace | default "default" }}
labels:
{{- include "argo-cd-extensions.labels" $ | nindent 4 }}
{{- with $item.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if $item.annotations }}
annotations:
{{- toYaml $item.annotations | nindent 4 }}
{{- end }}
spec:
project: {{ $item.project | default "default" }}
sources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ kind: Certificate
metadata:
name: {{ $fullName }}
namespace: {{ $item.namespace | default $.Release.Namespace | default "default" }}
labels:
{{- include "cert-manager-extensions.labels" $ | nindent 4 }}
{{- with $item.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if $item.annotations }}
annotations:
{{- toYaml $item.annotations | nindent 4 }}
{{- end }}
spec:
secretName: {{ $item.secretName }}
issuerRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ kind: ClusterIssuer
metadata:
name: {{ $fullName}}
namespace: {{ $item.namespace | default $.Release.Namespace | default "default" }}
labels:
{{- include "cert-manager-extensions.labels" $ | nindent 4 }}
{{- with $item.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if $item.annotations }}
annotations:
{{- toYaml $item.annotations | nindent 4 }}
{{- end }}
spec:
{{- if $item.acme }}
acme:
Expand Down
9 changes: 9 additions & 0 deletions src/charts/cert-manager-extensions/templates/issuers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ kind: Issuer
metadata:
name: {{ $fullName}}
namespace: {{ $item.namespace | default $.Release.Namespace | default "default" }}
labels:
{{- include "cert-manager-extensions.labels" $ | nindent 4 }}
{{- with $item.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if $item.annotations }}
annotations:
{{- toYaml $item.annotations | nindent 4 }}
{{- end }}
spec:
{{- if $item.acme }}
acme:
Expand Down
23 changes: 23 additions & 0 deletions src/charts/external-dns-extensions/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
19 changes: 19 additions & 0 deletions src/charts/external-dns-extensions/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v2
name: external-dns-extensions
description: A Helm chart for external-dns extensions
type: application
version: 1.0.0
appVersion: 1.0.0


icon: https://raw.githubusercontent.com/emberstack/CDN/main/projects/helm-charts/generic/emberstack_icon.png
keywords:
- external-dns
- dns
- DNSEndpoint
home: https://github.com/emberstack/helm-charts
sources:
- https://github.com/emberstack/helm-charts
maintainers:
- name: winromulus
email: helm-charts@emberstack.com
21 changes: 21 additions & 0 deletions src/charts/external-dns-extensions/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 emberstack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
18 changes: 18 additions & 0 deletions src/charts/external-dns-extensions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# cert-manager Helm Extensions
This chart provides templates for external-dns CRDs. It can be used as the base for dynamic resources.
> Requirements: external-dns installed in the cluster.
### Deployment to Kubernetes using Helm

Use Helm to install the latest released chart:
```shellsession
$ helm repo add emberstack https://emberstack.github.io/helm-charts
$ helm repo update
$ helm upgrade --install external-dns-extensions emberstack/external-dns-extensions
```

You can customize the values of the helm deployment by using the following Values:

| Parameter | Description | Default |
| ------------------------------------ | --------------------------------------------------| --------------------- |
| `dnsEndpoints` | Array of DNSEndpoints to template | `[]` |
53 changes: 53 additions & 0 deletions src/charts/external-dns-extensions/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "external-dns-extensions.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "external-dns-extensions.fullname" -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "external-dns-extensions.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "external-dns-extensions.labels" -}}
helm.sh/chart: {{ include "external-dns-extensions.chart" . }}
{{ include "external-dns-extensions.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "external-dns-extensions.selectorLabels" -}}
app.kubernetes.io/name: {{ include "external-dns-extensions.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "external-dns-extensions.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "external-dns-extensions.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
43 changes: 43 additions & 0 deletions src/charts/external-dns-extensions/templates/dnsEndpoints.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{- range .Values.dnsEndpoints }}
{{- $item := . -}}
{{- if $item.enabled }}
{{- $fullName := $item.fullnameOverride | default (print (include "external-dns-extensions.fullname" $) "-" $item.name) }}
---
apiVersion: externaldns.k8s.io/v1alpha1
kind: DNSEndpoint
metadata:
name: {{ $fullName }}
namespace: {{ $item.namespace | default $.Release.Namespace | default "default" }}
labels:
{{- include "external-dns-extensions.labels" $ | nindent 4 }}
{{- with $item.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if $item.annotations }}
annotations:
{{- toYaml $item.annotations | nindent 4 }}
{{- end }}
spec:
endpoints:
{{- range $endpoint := $item.endpoints }}
- dnsName: {{ $endpoint.dnsName }}
{{- if $endpoint.labels }}
labels:
{{- toYaml $endpoint.labels | nindent 8 }}
{{- end }}
{{- if $endpoint.providerSpecific }}
providerSpecific:
{{- toYaml $endpoint.providerSpecific | nindent 8 }}
{{- end }}
{{- if $endpoint.recordTTL }}
recordTTL: {{ $endpoint.recordTTL }}
{{- end }}
recordType: {{ $endpoint.recordType }}
{{- if $endpoint.setIdentifier }}
setIdentifier: {{ $endpoint.setIdentifier }}
{{- end }}
targets:
{{- toYaml $endpoint.targets | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions src/charts/external-dns-extensions/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
nameOverride: ""
fullnameOverride: ""

dnsEndpoints:
- name: "test-endpoint"
enabled: true
endpoints:
- dnsName: "test-endpoint.example.com"
recordType: "A"
targets: [8.8.8.8]

0 comments on commit 980f52d

Please sign in to comment.