-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add goddady webhook for cluster_issuer (#942)
- Loading branch information
Showing
18 changed files
with
572 additions
and
6 deletions.
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,22 @@ | ||
# 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 | ||
.vscode/ |
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: 0.3.0 | ||
description: Cert Manager godaddy webhook Helm chart | ||
name: godaddy-webhook | ||
version: 0.3.0 |
Empty file.
64 changes: 64 additions & 0 deletions
64
charts/cert-manager-webhook-godaddy/templates/_helpers.tpl
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,64 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "godaddy-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 "godaddy-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 "godaddy-webhook.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "godaddy-webhook.labels" -}} | ||
app.kubernetes.io/name: {{ include "godaddy-webhook.name" . }} | ||
helm.sh/chart: {{ include "godaddy-webhook.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end -}} | ||
|
||
{{/* | ||
PKI | ||
*/}} | ||
{{- define "godaddy-webhook.selfSignedIssuer" -}} | ||
{{ printf "%s-selfsign" (include "godaddy-webhook.fullname" .) }} | ||
{{- end -}} | ||
|
||
{{- define "godaddy-webhook.rootCAIssuer" -}} | ||
{{ printf "%s-ca" (include "godaddy-webhook.fullname" .) }} | ||
{{- end -}} | ||
|
||
{{- define "godaddy-webhook.rootCACertificate" -}} | ||
{{ printf "%s-ca" (include "godaddy-webhook.fullname" .) }} | ||
{{- end -}} | ||
|
||
{{- define "godaddy-webhook.servingCertificate" -}} | ||
{{ printf "%s-webhook-tls" (include "godaddy-webhook.fullname" .) }} | ||
{{- end -}} |
16 changes: 16 additions & 0 deletions
16
charts/cert-manager-webhook-godaddy/templates/apiservice.yaml
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,16 @@ | ||
apiVersion: apiregistration.k8s.io/v1 | ||
kind: APIService | ||
metadata: | ||
name: v1alpha1.{{ .Values.groupName }} | ||
labels: | ||
{{ include "godaddy-webhook.labels" . | indent 4 }} | ||
annotations: | ||
cert-manager.io/inject-ca-from: "{{ .Release.Namespace }}/{{ include "godaddy-webhook.servingCertificate" . }}" | ||
spec: | ||
group: {{ .Values.groupName }} | ||
groupPriorityMinimum: 1000 | ||
versionPriority: 15 | ||
service: | ||
name: {{ include "godaddy-webhook.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
version: v1alpha1 |
76 changes: 76 additions & 0 deletions
76
charts/cert-manager-webhook-godaddy/templates/deployment.yaml
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 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "godaddy-webhook.fullname" . }} | ||
labels: | ||
{{ include "godaddy-webhook.labels" . | indent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ include "godaddy-webhook.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: {{ include "godaddy-webhook.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
spec: | ||
serviceAccountName: {{ include "godaddy-webhook.fullname" . }} | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
args: | ||
- --tls-cert-file=/tls/tls.crt | ||
- --tls-private-key-file=/tls/tls.key | ||
- --secure-port={{ default 443 .Values.pod.securePort }} | ||
env: | ||
- name: GROUP_NAME | ||
value: {{ .Values.groupName | quote }} | ||
- name: LOGGING_LEVEL | ||
value: {{ .Values.logging.level }} | ||
- name: LOGGING_FORMAT | ||
value: {{ .Values.logging.format }} | ||
- name: LOGGING_TIMESTAMP | ||
value: {{ .Values.logging.timestamp | quote }} | ||
ports: | ||
- name: https | ||
containerPort: {{ default 443 .Values.pod.securePort }} | ||
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 | nindent 12 }} | ||
volumes: | ||
- name: certs | ||
secret: | ||
secretName: {{ include "godaddy-webhook.servingCertificate" . }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 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,64 @@ | ||
--- | ||
# 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 "godaddy-webhook.selfSignedIssuer" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
{{ include "godaddy-webhook.labels" . | indent 4 }} | ||
spec: | ||
selfSigned: {} | ||
|
||
--- | ||
|
||
# Generate a CA Certificate used to sign certificates for the webhook | ||
apiVersion: cert-manager.io/v1 | ||
kind: Certificate | ||
metadata: | ||
name: {{ include "godaddy-webhook.rootCACertificate" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
{{ include "godaddy-webhook.labels" . | indent 4 }} | ||
spec: | ||
secretName: {{ include "godaddy-webhook.rootCACertificate" . }} | ||
duration: 43800h # 5y | ||
issuerRef: | ||
name: {{ include "godaddy-webhook.selfSignedIssuer" . }} | ||
commonName: "ca.godaddy-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 "godaddy-webhook.rootCAIssuer" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
{{ include "godaddy-webhook.labels" . | indent 4 }} | ||
spec: | ||
ca: | ||
secretName: {{ include "godaddy-webhook.rootCACertificate" . }} | ||
|
||
--- | ||
|
||
# Finally, generate a serving certificate for the webhook to use | ||
apiVersion: cert-manager.io/v1 | ||
kind: Certificate | ||
metadata: | ||
name: {{ include "godaddy-webhook.servingCertificate" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: | ||
{{ include "godaddy-webhook.labels" . | indent 4 }} | ||
spec: | ||
secretName: {{ include "godaddy-webhook.servingCertificate" . }} | ||
duration: 8760h # 1y | ||
issuerRef: | ||
name: {{ include "godaddy-webhook.rootCAIssuer" . }} | ||
dnsNames: | ||
- {{ include "godaddy-webhook.fullname" . }} | ||
- {{ include "godaddy-webhook.fullname" . }}.{{ .Release.Namespace }} | ||
- {{ include "godaddy-webhook.fullname" . }}.{{ .Release.Namespace }}.svc |
140 changes: 140 additions & 0 deletions
140
charts/cert-manager-webhook-godaddy/templates/rbac.yaml
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,140 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "godaddy-webhook.fullname" . }} | ||
labels: | ||
{{ include "godaddy-webhook.labels" . | indent 4 }} | ||
--- | ||
# 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 "godaddy-webhook.fullname" . }}:webhook-authentication-reader | ||
namespace: kube-system | ||
labels: | ||
{{ include "godaddy-webhook.labels" . | indent 4 }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: extension-apiserver-authentication-reader | ||
subjects: | ||
- apiGroup: "" | ||
kind: ServiceAccount | ||
name: {{ include "godaddy-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 "godaddy-webhook.fullname" . }}:auth-delegator | ||
labels: | ||
{{ include "godaddy-webhook.labels" . | indent 4 }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: system:auth-delegator | ||
subjects: | ||
- apiGroup: "" | ||
kind: ServiceAccount | ||
name: {{ include "godaddy-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 "godaddy-webhook.fullname" . }}:domain-solver | ||
labels: | ||
{{ include "godaddy-webhook.labels" . | indent 4 }} | ||
rules: | ||
- apiGroups: | ||
- {{ .Values.groupName }} | ||
resources: | ||
- '*' | ||
verbs: | ||
- 'create' | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ include "godaddy-webhook.fullname" . }}:domain-solver | ||
labels: | ||
{{ include "godaddy-webhook.labels" . | indent 4 }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ include "godaddy-webhook.fullname" . }}:domain-solver | ||
subjects: | ||
- apiGroup: "" | ||
kind: ServiceAccount | ||
name: {{ .Values.certManager.serviceAccountName }} | ||
namespace: {{ .Values.certManager.namespace }} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ include "godaddy-webhook.fullname" . }} | ||
labels: | ||
{{ include "godaddy-webhook.labels" . | indent 4 }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ include "godaddy-webhook.fullname" . }} | ||
subjects: | ||
- apiGroup: "" | ||
kind: ServiceAccount | ||
name: {{ include "godaddy-webhook.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ include "godaddy-webhook.fullname" . }} | ||
labels: | ||
{{ include "godaddy-webhook.labels" . | indent 4 }} | ||
rules: | ||
- apiGroups: | ||
- '' | ||
resources: | ||
- 'secrets' | ||
verbs: | ||
- 'get' | ||
--- | ||
# Grant cert-manager-webhook-gandi permission to read the flow control mechanism (APF) | ||
# API Priority and Fairness is enabled by default in Kubernetes 1.20 | ||
# https://kubernetes.io/docs/concepts/cluster-administration/flow-control/ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ include "godaddy-webhook.fullname" . }}:flowcontrol-solver | ||
labels: | ||
{{ include "godaddy-webhook.labels" . | indent 4 }} | ||
rules: | ||
- apiGroups: | ||
- "flowcontrol.apiserver.k8s.io" | ||
resources: | ||
- "prioritylevelconfigurations" | ||
- "flowschemas" | ||
verbs: | ||
- "list" | ||
- "watch" | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ include "godaddy-webhook.fullname" . }}:flowcontrol-solver | ||
labels: | ||
{{ include "godaddy-webhook.labels" . | indent 4 }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ include "godaddy-webhook.fullname" . }}:flowcontrol-solver | ||
subjects: | ||
- apiGroup: "" | ||
kind: ServiceAccount | ||
name: {{ include "godaddy-webhook.fullname" . }} | ||
namespace: {{ .Release.Namespace }} |
Oops, something went wrong.