-
Notifications
You must be signed in to change notification settings - Fork 499
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'issue-1182' of github.com:aylei/tidb-operator into issu…
…e-1182
- Loading branch information
Showing
10 changed files
with
281 additions
and
21 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
22 changes: 22 additions & 0 deletions
22
charts/tidb-operator/templates/admission/certManager/certificate.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,22 @@ | ||
{{- if and (eq .Values.admissionWebhook.enabled true) (eq .Values.admissionWebhook.certProvider "certManager") }} | ||
apiVersion: cert-manager.io/v1alpha2 | ||
kind: Certificate | ||
metadata: | ||
name: tidb-admission-webhook-crt | ||
labels: | ||
app.kubernetes.io/name: {{ template "chart.name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: admission-cert-create | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
spec: | ||
secretName: tidb-admission-webhook-certs | ||
commonName: tidb-admission-webhook | ||
dnsNames: | ||
- tidb-admission-webhook | ||
- tidb-admission-webhook.{{ $.Release.Namespace }} | ||
- tidb-admission-webhook.{{ $.Release.Namespace }}.svc | ||
issuerRef: | ||
name: tidb-selfsigning-issuer | ||
kind: ClusterIssuer | ||
{{- end }} |
14 changes: 14 additions & 0 deletions
14
charts/tidb-operator/templates/admission/certManager/issuer.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,14 @@ | ||
{{- if and (eq .Values.admissionWebhook.enabled true) (eq .Values.admissionWebhook.certProvider "certManager") }} | ||
apiVersion: cert-manager.io/v1alpha2 | ||
kind: ClusterIssuer | ||
metadata: | ||
name: tidb-selfsigning-issuer | ||
labels: | ||
app.kubernetes.io/name: {{ template "chart.name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: admission-cert-create | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
spec: | ||
selfSigned: {} | ||
{{- end }} |
42 changes: 42 additions & 0 deletions
42
charts/tidb-operator/templates/admission/jobPatch/pre-install-secret-job.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,42 @@ | ||
{{- if and (eq .Values.admissionWebhook.enabled true) (eq .Values.admissionWebhook.certProvider "autoGenerator") }} | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ template "chart.name" . }}-admission-create | ||
annotations: | ||
"helm.sh/hook": pre-install,pre-upgrade | ||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
labels: | ||
app.kubernetes.io/name: {{ template "chart.name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: admission-cert-create | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
spec: | ||
{{- if .Capabilities.APIVersions.Has "batch/v1alpha1" }} | ||
# Alpha feature since k8s 1.12 | ||
ttlSecondsAfterFinished: 0 | ||
{{- end }} | ||
template: | ||
metadata: | ||
name: {{ template "chart.name" . }}-admission-create | ||
labels: | ||
app: {{ template "chart.name" . }}-admission-create | ||
serviceAccountName: tidb-admission-webhook-sa | ||
securityContext: | ||
runAsNonRoot: true | ||
runAsUser: 2000 | ||
spec: | ||
restartPolicy: OnFailure | ||
containers: | ||
- name: create | ||
image: {{ .Values.admissionWebhook.autoGenerator.image.repository }}:{{ .Values.admissionWebhook.autoGenerator.image.tag }} | ||
imagePullPolicy: {{ .Values.imagePullPolicy | default "IfNotPresent" }} | ||
args: | ||
- create | ||
- --host=tidb-admission-webhook,tidb-admission-webhook.{{ $.Release.Namespace }},tidb-admission-webhook.{{ $.Release.Namespace }}.svc | ||
- --namespace={{ $.Release.Namespace }} | ||
- --secret-name=tidb-admission-webhook-certs | ||
- --key-name=key.pem | ||
- --cert-name=cert.pem | ||
{{- end }} |
61 changes: 61 additions & 0 deletions
61
charts/tidb-operator/templates/admission/jobPatch/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,61 @@ | ||
{{- if and (eq .Values.admissionWebhook.enabled true) (eq .Values.admissionWebhook.certProvider "autoGenerator") }} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: tidb-admission-webhook-sa | ||
annotations: | ||
"helm.sh/hook": pre-install,pre-upgrade,post-install,post-upgrade,post-delete | ||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
labels: | ||
app.kubernetes.io/name: {{ template "chart.name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: admission-cert | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: tidb-admission-webhook-role | ||
annotations: | ||
"helm.sh/hook": pre-install,pre-upgrade,post-install,post-upgrade,post-delete | ||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
labels: | ||
app.kubernetes.io/name: {{ template "chart.name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: admission-cert | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- secrets | ||
verbs: | ||
- get | ||
- create | ||
- delete | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: {{ template "chart.name" . }}-rb | ||
annotations: | ||
"helm.sh/hook": pre-install,pre-upgrade,post-install,post-upgrade,post-delete | ||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
labels: | ||
app.kubernetes.io/name: {{ template "chart.name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: admission-cert | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: tidb-admission-webhook-role | ||
subjects: | ||
- kind: ServiceAccount | ||
name: tidb-admission-webhook-sa | ||
namespace: {{ $.Release.Namespace }} | ||
--- | ||
{{- end }} |
17 changes: 17 additions & 0 deletions
17
charts/tidb-operator/templates/admission/selfProvide/certSecret.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,17 @@ | ||
{{- if and (eq .Values.admissionWebhook.enabled true) (eq .Values.admissionWebhook.certProvider "selfProvider") }} | ||
apiVersion: v1 | ||
data: | ||
ca: {{ .Values.admissionWebhook.selfProvider.ca }} | ||
cert.pem: {{ .Values.admissionWebhook.selfProvider.cert }} | ||
key.pem: {{ .Values.admissionWebhook.selfProvider.key }} | ||
kind: Secret | ||
metadata: | ||
name: tidb-admission-webhook-certs | ||
labels: | ||
app.kubernetes.io/name: {{ template "chart.name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: admission-cert | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
type: Opaque | ||
{{- 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
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
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
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