Skip to content

Commit

Permalink
Align cert-manager with the design document
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Weidner committed Sep 17, 2019
1 parent a7f9aca commit 9e9a66e
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 14 deletions.
4 changes: 3 additions & 1 deletion staging/cert-manager-setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ TLS certificates from various issuing sources.
`cert-manager` will ensure certificates are valid and up to date periodically, and attempt
to renew certificates at an appropriate time before expiry.

In addition to installing `cert-manager`, `cert-manager-setup` provides the capability to specify a `ClusterIssuer` in the `values.yaml` file which will be applied directly after the `cert-manager` installation has completed.
`cert-manager-setup` deploys the cert-manager

In addition to installing `cert-manager`, `cert-manager-setup` provides the capability to specify a `ClusterIssuer` in the `values.yaml` file which will be applied directly after the `cert-manager` installation has completed. In order for this to happen, `cert-manager-setup` sets up an `Issuer` in the `cert-manager` namespace. It then creates an intermediate certificate from the secret `kubernetes-root-ca` which must already contain ideally the Kubernetes root CA. The `ClusterIssuer` then uses the intermediate certificate derived from the Kubernetes root CA.

# Supported values format

Expand Down
11 changes: 0 additions & 11 deletions staging/cert-manager-setup/templates/clusterissuer.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions staging/cert-manager-setup/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: read-apiservices-rolebinding
namespace: kubeaddons
namespace: cert-manager
subjects:
- kind: ServiceAccount
namespace: kubeaddons
namespace: cert-manager
name: default
roleRef:
kind: ClusterRole
Expand Down
42 changes: 42 additions & 0 deletions staging/cert-manager-setup/templates/issuers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{ if .Values.clusterissuer }}
apiVersion: certmanager.k8s.io/v1alpha1
kind: Issuer
metadata:
name: kubernetes-root-issuer
namespace: cert-manager
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "-4"
spec:
ca:
secretName: kubernetes-root-ca
---
apiVersion: certmanager.k8s.io/v1alpha1
kind: Certificate
metadata:
name: kubernetes-intermediate-ca
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "-3"
spec:
isCA: true
commonName: cert-manager
secretName: kubernetes-intermediate-ca
issuerRef:
name: kubernetes-root-issuer
kind: Issuer
# These are the default usages for reference
usages:
- "digital signature"
- "key encipherment"
---
apiVersion: certmanager.k8s.io/v1alpha1
kind: ClusterIssuer
metadata:
name: {{ required "clusterissuer must have a name" .Values.clusterissuer.name }}
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "-2"
spec:
{{ required "clusterissuer must have a spec" .Values.clusterissuer.spec | toYaml | indent 4 }}
{{ end }}

0 comments on commit 9e9a66e

Please sign in to comment.