-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
454 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# 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 | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v1 | ||
appVersion: "2024.11.02.05" | ||
description: A FreeDNS webhook dns01 solver for cert-manager | ||
name: freedns-webhook | ||
version: 0.1.1 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "freedns-webhook.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 "freedns-webhook.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 -}} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "freedns-webhook.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{- define "freedns-webhook.selfSignedIssuer" -}} | ||
{{ printf "%s-selfsign" (include "freedns-webhook.fullname" .) }} | ||
{{- end -}} | ||
|
||
{{- define "freedns-webhook.rootCAIssuer" -}} | ||
{{ printf "%s-ca" (include "freedns-webhook.fullname" .) }} | ||
{{- end -}} | ||
|
||
{{- define "freedns-webhook.rootCACertificate" -}} | ||
{{ printf "%s-ca" (include "freedns-webhook.fullname" .) }} | ||
{{- end -}} | ||
|
||
{{- define "freedns-webhook.servingCertificate" -}} | ||
{{ printf "%s-webhook-tls" (include "freedns-webhook.fullname" .) }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: apiregistration.k8s.io/v1 | ||
kind: APIService | ||
metadata: | ||
name: v1alpha1.{{ .Values.groupName }} | ||
labels: | ||
app: {{ include "freedns-webhook.name" . }} | ||
chart: {{ include "freedns-webhook.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
annotations: | ||
cert-manager.io/inject-ca-from: "{{ .Release.Namespace }}/{{ include "freedns-webhook.servingCertificate" . }}" | ||
spec: | ||
group: {{ .Values.groupName }} | ||
groupPriorityMinimum: 1000 | ||
versionPriority: 15 | ||
service: | ||
name: {{ include "freedns-webhook.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
version: v1alpha1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "freedns-webhook.fullname" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
app: {{ include "freedns-webhook.name" . }} | ||
chart: {{ include "freedns-webhook.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app: {{ include "freedns-webhook.name" . }} | ||
release: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ include "freedns-webhook.name" . }} | ||
release: {{ .Release.Name }} | ||
spec: | ||
serviceAccountName: {{ include "freedns-webhook.fullname" . }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
args: | ||
- --v=2 | ||
- --tls-cert-file=/tls/tls.crt | ||
- --tls-private-key-file=/tls/tls.key | ||
envFrom: | ||
- secretRef: | ||
name: {{ include "freedns-webhook.fullname" . }}-auth | ||
env: | ||
- name: GROUP_NAME | ||
value: {{ .Values.groupName | quote }} | ||
ports: | ||
- name: https | ||
containerPort: 443 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
scheme: HTTPS | ||
path: /healthz | ||
port: https | ||
readinessProbe: | ||
httpGet: | ||
scheme: HTTPS | ||
path: /healthz | ||
port: https | ||
volumeMounts: | ||
- name: certs | ||
mountPath: /tls | ||
readOnly: true | ||
resources: | ||
{{ toYaml .Values.resources | indent 12 }} | ||
volumes: | ||
- name: certs | ||
secret: | ||
secretName: {{ include "freedns-webhook.servingCertificate" . }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{ toYaml . | indent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{ toYaml . | indent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{ toYaml . | indent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
# Create a selfsigned Issuer, in order to create a root CA certificate for | ||
# signing webhook serving certificates | ||
apiVersion: cert-manager.io/v1 | ||
kind: Issuer | ||
metadata: | ||
name: {{ include "freedns-webhook.selfSignedIssuer" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
app: {{ include "freedns-webhook.name" . }} | ||
chart: {{ include "freedns-webhook.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
spec: | ||
selfSigned: {} | ||
|
||
--- | ||
|
||
# Generate a CA Certificate used to sign certificates for the webhook | ||
apiVersion: cert-manager.io/v1 | ||
kind: Certificate | ||
metadata: | ||
name: {{ include "freedns-webhook.rootCACertificate" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
app: {{ include "freedns-webhook.name" . }} | ||
chart: {{ include "freedns-webhook.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
spec: | ||
secretName: {{ include "freedns-webhook.rootCACertificate" . }} | ||
duration: 43800h # 5y | ||
issuerRef: | ||
name: {{ include "freedns-webhook.selfSignedIssuer" . }} | ||
commonName: "ca.freedns-webhook.cert-manager" | ||
isCA: true | ||
|
||
--- | ||
|
||
# Create an Issuer that uses the above generated CA certificate to issue certs | ||
apiVersion: cert-manager.io/v1 | ||
kind: Issuer | ||
metadata: | ||
name: {{ include "freedns-webhook.rootCAIssuer" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
app: {{ include "freedns-webhook.name" . }} | ||
chart: {{ include "freedns-webhook.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
spec: | ||
ca: | ||
secretName: {{ include "freedns-webhook.rootCACertificate" . }} | ||
|
||
--- | ||
|
||
# Finally, generate a serving certificate for the webhook to use | ||
apiVersion: cert-manager.io/v1 | ||
kind: Certificate | ||
metadata: | ||
name: {{ include "freedns-webhook.servingCertificate" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
app: {{ include "freedns-webhook.name" . }} | ||
chart: {{ include "freedns-webhook.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
spec: | ||
secretName: {{ include "freedns-webhook.servingCertificate" . }} | ||
duration: 8760h # 1y | ||
issuerRef: | ||
name: {{ include "freedns-webhook.rootCAIssuer" . }} | ||
dnsNames: | ||
- {{ include "freedns-webhook.fullname" . }} | ||
- {{ include "freedns-webhook.fullname" . }}.{{ .Release.Namespace }} | ||
- {{ include "freedns-webhook.fullname" . }}.{{ .Release.Namespace }}.svc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "freedns-webhook.fullname" . }} | ||
labels: | ||
app: {{ include "freedns-webhook.name" . }} | ||
chart: {{ include "freedns-webhook.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
--- | ||
# Grant the webhook permission to read the ConfigMap containing the Kubernetes | ||
# apiserver's requestheader-ca-certificate. | ||
# This ConfigMap is automatically created by the Kubernetes apiserver. | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: {{ include "freedns-webhook.fullname" . }}:webhook-authentication-reader | ||
namespace: kube-system | ||
labels: | ||
app: {{ include "freedns-webhook.name" . }} | ||
chart: {{ include "freedns-webhook.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: extension-apiserver-authentication-reader | ||
subjects: | ||
- apiGroup: "" | ||
kind: ServiceAccount | ||
name: {{ include "freedns-webhook.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
--- | ||
# apiserver gets the auth-delegator role to delegate auth decisions to | ||
# the core apiserver | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ include "freedns-webhook.fullname" . }}:auth-delegator | ||
labels: | ||
app: {{ include "freedns-webhook.name" . }} | ||
chart: {{ include "freedns-webhook.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: system:auth-delegator | ||
subjects: | ||
- apiGroup: "" | ||
kind: ServiceAccount | ||
name: {{ include "freedns-webhook.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
--- | ||
# Grant cert-manager permission to validate using our apiserver | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ include "freedns-webhook.fullname" . }}:domain-solver | ||
labels: | ||
app: {{ include "freedns-webhook.name" . }} | ||
chart: {{ include "freedns-webhook.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
rules: | ||
- apiGroups: | ||
- {{ .Values.groupName }} | ||
resources: | ||
- '*' | ||
verbs: | ||
- 'create' | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ include "freedns-webhook.fullname" . }}:domain-solver | ||
labels: | ||
app: {{ include "freedns-webhook.name" . }} | ||
chart: {{ include "freedns-webhook.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ include "freedns-webhook.fullname" . }}:domain-solver | ||
subjects: | ||
- apiGroup: "" | ||
kind: ServiceAccount | ||
name: {{ .Values.certManager.serviceAccountName }} | ||
namespace: {{ .Values.certManager.namespace }} | ||
--- | ||
# Grant pod account permission to validate using our apiserver | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ include "freedns-webhook.fullname" . }}:flowcontrol | ||
labels: | ||
app: {{ include "freedns-webhook.name" . }} | ||
chart: {{ include "freedns-webhook.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
rules: | ||
- apiGroups: | ||
- "flowcontrol.apiserver.k8s.io" | ||
resources: | ||
- 'prioritylevelconfigurations' | ||
- 'flowschemas' | ||
verbs: | ||
- 'list' | ||
- 'watch' | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ include "freedns-webhook.fullname" . }}:flowcontrol | ||
labels: | ||
app: {{ include "freedns-webhook.name" . }} | ||
chart: {{ include "freedns-webhook.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ include "freedns-webhook.fullname" . }}:flowcontrol | ||
subjects: | ||
- apiGroup: "" | ||
kind: ServiceAccount | ||
name: {{ include "freedns-webhook.fullname" . }} | ||
namespace: {{ .Release.Namespace }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
type: Opaque | ||
data: | ||
FREEDNS_USERNAME: {{ required "Please provide the value of freedns.auth.FREEDNS_USERNAME" .Values.freedns.auth.FREEDNS_USERNAME | b64enc | quote }} | ||
FREEDNS_PASSWORD: {{ required "Please provide the value of freedns.auth.FREEDNS_PASSWORD" .Values.freedns.auth.FREEDNS_PASSWORD | b64enc | quote }} | ||
metadata: | ||
name: {{ include "freedns-webhook.fullname" . }}-auth | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
app: {{ include "freedns-webhook.name" . }} | ||
chart: {{ include "freedns-webhook.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
type: Opaque |
Oops, something went wrong.