Merge pull request #229 from unguiculus/feature/chart-update

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Enhance Helm chart and apply best practices

* Update Chart.yaml
* Make templates namespaced
* Update config table in README.md
* Apply best practices for RBAC
  (see
https://github.com/kubernetes/helm/blob/master/docs/chart_best_practices/rbac.md)
* Add extra args for cert-manager container
* Make list indentation consistent
* Apply standard labels on all resources
* Add some content to NOTES.txt

```release-note
action required: Enhance Helm chart in-line with best practices. This may require a change to your values.yaml files/--set flags.
```
This commit is contained in:
jetstack-ci-bot 2018-01-16 18:53:09 +00:00 committed by GitHub
commit 894ab3e399
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 144 additions and 60 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
.DS_Store
.idea
/acmesolver
/controller
/hack/build/dockerfiles/cert-manager-*_*_*

View File

@ -1,4 +1,12 @@
apiVersion: v1
description: A Helm chart for Kubernetes
name: cert-manager
version: 0.1.0
version: 0.2.0
appVersion: 0.2.3
description: A Helm chart for cert-manager
home: https://github.com/jetstack/cert-manager
keywords:
- cert-manager
- kube-lego
- letsencrypt
- tls
sources:
- https://github.com/jetstack/cert-manager

View File

@ -44,15 +44,25 @@ The command removes all the Kubernetes components associated with the chart and
The following tables lists the configurable parameters of the cert-manager chart and their default values.
| Parameter | Description | Default |
| ---------------------- | --------------------------------------- | ---------------------------------------------- |
| `image.repository` | Image repository | `quay.io/jetstack/cert-manager-controller` |
| `image.tag` | Image tag | `v0.2.3` |
| `image.pullPolicy` | Image pull policy | `Always` |
| `replicaCount` | Number of cert-manager replicas | `1` |
| `createCustomResource` | Create CRD/TPR with this release | `true` |
| `rbac.enabled` | Create RBAC resources with this release | `true` |
| `resources` | CPU/Memory resource requests/limits | `None` |
| Parameter | Description | Default |
| --------- | ----------- | ------- |
| `image.repository` | Image repository | `quay.io/jetstack/cert-manager-controller` |
| `image.tag` | Image tag | `v0.2.3` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `replicaCount` | Number of cert-manager replicas | `1` |
| `createCustomResource` | Create CRD/TPR with this release | `true` |
| `extraArgs` | Optional flags for cert-manager | `[]` |
| `rbac.create` | If `true`, create and use RBAC resources | `true`
| `serviceAccount.create` | If `true`, create a new service account | `true`
| `serviceAccount.name` | Service account to be used. If not set and `serviceAccount.create` is `true`, a name is generated using the fullname template | ``
| `resources` | CPU/memory resource requests/limits | `requests: {cpu: 10m, memory: 32Mi}` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `ingressShim.enabled` | Enable ingress-shim for automatic ingress integration | `true`|
| `ingressShim.extraArgs` | Optional flags for ingress-shim | `[]` |
| `ingressShim.resources` | CPU/memory resource requests/limits for ingress-shim | `requests: {cpu: 10m, memory: 32Mi}` |
| `ingressShim.image.repository` | Image repository for ingress-shim | `quay.io/jetstack/cert-manager-ingress-shim` |
| `ingressShim.image.tag` | Image tag for ingress-shim. Defaults to `image.tag` if empty | `` |
| `ingressShim.image.pullPolicy` | Image pull policy for ingress-shim | `IfNotPresent` |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.

View File

@ -0,0 +1,5 @@
cert-manager has been deployed successfully!
You may now go ahead and create issuers and certificates.
See https://github.com/jetstack/cert-manager/blob/master/docs/README.md

View File

@ -2,7 +2,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- define "cert-manager.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
@ -10,7 +10,26 @@ Expand the name of the chart.
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).
*/}}
{{- define "fullname" -}}
{{- define "cert-manager.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- $fullname := printf "%s-%s" $name .Release.Name -}}
{{- default $fullname .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "cert-manager.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "cert-manager.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "cert-manager.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

View File

@ -4,6 +4,11 @@ apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: certificates.certmanager.k8s.io
labels:
app: {{ template "cert-manager.name" . }}
chart: {{ template "cert-manager.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
group: certmanager.k8s.io
version: v1alpha1
@ -18,6 +23,6 @@ metadata:
name: certificate.certmanager.k8s.io
description: "A specification for a cert-manager certificate"
versions:
- name: v1alpha1
- name: v1alpha1
{{- end -}}
{{- end -}}

View File

@ -4,6 +4,11 @@ apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: clusterissuers.certmanager.k8s.io
labels:
app: {{ template "cert-manager.name" . }}
chart: {{ template "cert-manager.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
group: certmanager.k8s.io
version: v1alpha1

View File

@ -1,40 +1,41 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}
name: {{ template "cert-manager.fullname" . }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app: {{ template "cert-manager.name" . }}
chart: {{ template "cert-manager.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
strategy:
type: Recreate
template:
metadata:
labels:
app: {{ template "name" . }}
app: {{ template "cert-manager.name" . }}
release: {{ .Release.Name }}
spec:
serviceAccount: {{ template "fullname" . }}
serviceAccountName: {{ template "fullname" . }}
serviceAccountName: {{ template "cert-manager.serviceAccountName" . }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.extraArgs }}
args:
{{- range .Values.extraArgs }}
- {{ . }}
{{- end }}
{{ toYaml .Values.extraArgs | indent 12 }}
{{- end }}
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- if .Values.ingressShim.enabled }}
- name: ingress-shim
image: "{{ .Values.ingressShim.image.repository }}:{{ default .Values.ingressShim.image.tag | default .Values.image.tag }}"
image: "{{ .Values.ingressShim.image.repository }}:{{ default .Values.ingressShim.image.tag .Values.image.tag }}"
imagePullPolicy: {{ .Values.ingressShim.image.pullPolicy }}
{{- if .Values.ingressShim.extraArgs }}
args:
{{- range .Values.ingressShim.extraArgs }}
- {{ . }}
{{- end }}
{{ toYaml .Values.ingressShim.extraArgs | indent 12 }}
{{- end }}
resources:
{{ toYaml .Values.ingressShim.resources | indent 12 }}
{{- end }}

View File

@ -4,6 +4,11 @@ apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: issuers.certmanager.k8s.io
labels:
app: {{ template "cert-manager.name" . }}
chart: {{ template "cert-manager.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
group: certmanager.k8s.io
version: v1alpha1
@ -11,13 +16,18 @@ spec:
kind: Issuer
plural: issuers
scope: Namespaced
{{ else if .Capabilities.APIVersions.Has "extensions/v1beta1" }}
{{ else if .Capabilities.APIVersions.Has "extensions/v1beta1" }}
apiVersion: extensions/v1beta1
kind: ThirdPartyResource
metadata:
name: issuer.certmanager.k8s.io
labels:
app: {{ template "cert-manager.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
description: "A specification for a cert-manager issuer"
versions:
- name: v1alpha1
- name: v1alpha1
{{- end -}}
{{- end -}}

View File

@ -1,39 +1,39 @@
{{- if .Values.rbac.enabled -}}
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: {{ template "fullname" . }}
name: {{ template "cert-manager.fullname" . }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app: {{ template "cert-manager.name" . }}
chart: {{ template "cert-manager.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
rules:
- apiGroups: ["certmanager.k8s.io"]
resources: ["certificates", "issuers", "clusterissuers"]
verbs: ["*"]
- apiGroups: [""]
resources: ["secrets", "events", "endpoints", "services", "pods"]
verbs: ["*"]
- apiGroups: ["extensions"]
resources: ["ingresses"]
verbs: ["*"]
- apiGroups: ["certmanager.k8s.io"]
resources: ["certificates", "issuers", "clusterissuers"]
verbs: ["*"]
- apiGroups: [""]
resources: ["secrets", "events", "endpoints", "services", "pods"]
verbs: ["*"]
- apiGroups: ["extensions"]
resources: ["ingresses"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: {{ template "fullname" . }}
name: {{ template "cert-manager.fullname" . }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app: {{ template "cert-manager.name" . }}
chart: {{ template "cert-manager.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "fullname" . }}
name: {{ template "cert-manager.fullname" . }}
subjects:
- name: {{ template "fullname" . }}
namespace: {{ .Release.Namespace | quote }}
kind: ServiceAccount
- name: {{ template "cert-manager.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
kind: ServiceAccount
{{- end -}}

View File

@ -1,9 +1,11 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "fullname" . }}
name: {{ template "cert-manager.serviceAccountName" . }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app: {{ template "cert-manager.name" . }}
chart: {{ template "cert-manager.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- end -}}

View File

@ -6,32 +6,50 @@ replicaCount: 1
image:
repository: quay.io/jetstack/cert-manager-controller
tag: v0.2.3
pullPolicy: Always
pullPolicy: IfNotPresent
createCustomResource: true
rbac:
enabled: true
# Specifies whether RBAC resources should be created
create: true
serviceAccount:
# Specifies whether a service account should be created
create: true
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name:
# Optional additional arguments
extraArgs: []
# Use this flag to set a namespace that cert-manager will use to store
# supporting resources required for each ClusterIssuer (default is kube-system)
# - --cluster-resource-namespace=kube-system
resources:
requests:
cpu: 10m
memory: 32Mi
# Optional additional arguments for cert-manager
extraArgs: []
nodeSelector: {}
ingressShim:
enabled: true
# Optional additional arguments for ingress-shim
extraArgs: []
resources:
requests:
cpu: 10m
memory: 32Mi
image:
repository: quay.io/jetstack/cert-manager-ingress-shim
# Defaults to image.tag.
# You should only change this if you know what you are doing!
# tag: v0.2.3
pullPolicy: Always
pullPolicy: IfNotPresent