From 8180c3ffcf90dd5c2bc40e7006715100d7d6386d Mon Sep 17 00:00:00 2001 From: Paul Farver Date: Tue, 24 Sep 2019 20:31:28 +0200 Subject: [PATCH] [stable/cockroachdb] Split template into multiple files (#17242) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Stable/Cockroachdb] Split manifest into files Signed-off-by: Paul Farver * [Stable/Cockroachdb] Clean pr Signed-off-by: Paul Farver * [Stable/Cockroachdb] Bump chart version Signed-off-by: Paul Farver --- stable/cockroachdb/Chart.yaml | 2 +- stable/cockroachdb/templates/clusterrole.yaml | 20 ++ .../templates/clusterrolebinding.yaml | 19 ++ ...-networkpolicy.yaml => networkpolicy.yaml} | 1 - stable/cockroachdb/templates/pdb.yaml | 14 ++ stable/cockroachdb/templates/role.yaml | 19 ++ stable/cockroachdb/templates/rolebinding.yaml | 19 ++ .../templates/service-discovery.yaml | 44 +++++ stable/cockroachdb/templates/service.yaml | 32 ++++ .../cockroachdb/templates/serviceaccount.yaml | 11 ++ ...chdb-statefulset.yaml => statefulset.yaml} | 180 ------------------ 11 files changed, 179 insertions(+), 182 deletions(-) create mode 100644 stable/cockroachdb/templates/clusterrole.yaml create mode 100644 stable/cockroachdb/templates/clusterrolebinding.yaml rename stable/cockroachdb/templates/{cockroachdb-networkpolicy.yaml => networkpolicy.yaml} (99%) create mode 100644 stable/cockroachdb/templates/pdb.yaml create mode 100644 stable/cockroachdb/templates/role.yaml create mode 100644 stable/cockroachdb/templates/rolebinding.yaml create mode 100644 stable/cockroachdb/templates/service-discovery.yaml create mode 100644 stable/cockroachdb/templates/service.yaml create mode 100644 stable/cockroachdb/templates/serviceaccount.yaml rename stable/cockroachdb/templates/{cockroachdb-statefulset.yaml => statefulset.yaml} (50%) diff --git a/stable/cockroachdb/Chart.yaml b/stable/cockroachdb/Chart.yaml index 341b6f97a1..ea0b610d8a 100755 --- a/stable/cockroachdb/Chart.yaml +++ b/stable/cockroachdb/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 name: cockroachdb home: https://www.cockroachlabs.com -version: 2.1.12 +version: 2.1.13 appVersion: 19.1.3 description: CockroachDB is a scalable, survivable, strongly-consistent SQL database. icon: https://raw.githubusercontent.com/cockroachdb/cockroach/master/docs/media/cockroach_db.png diff --git a/stable/cockroachdb/templates/clusterrole.yaml b/stable/cockroachdb/templates/clusterrole.yaml new file mode 100644 index 0000000000..a1bc5a6509 --- /dev/null +++ b/stable/cockroachdb/templates/clusterrole.yaml @@ -0,0 +1,20 @@ +{{- if .Values.Secure.Enabled }} +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}" + labels: + heritage: {{ .Release.Service | quote }} + release: {{ .Release.Name | quote }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + component: "{{ .Release.Name }}-{{ .Values.Component }}" +rules: +- apiGroups: + - certificates.k8s.io + resources: + - certificatesigningrequests + verbs: + - create + - get + - watch +{{- end }} \ No newline at end of file diff --git a/stable/cockroachdb/templates/clusterrolebinding.yaml b/stable/cockroachdb/templates/clusterrolebinding.yaml new file mode 100644 index 0000000000..2629ea9468 --- /dev/null +++ b/stable/cockroachdb/templates/clusterrolebinding.yaml @@ -0,0 +1,19 @@ +{{- if .Values.Secure.Enabled }} +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}" + labels: + heritage: {{ .Release.Service | quote }} + release: {{ .Release.Name | quote }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + component: "{{ .Release.Name }}-{{ .Values.Component }}" +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}" +subjects: +- kind: ServiceAccount + name: {{ template "cockroachdb.serviceAccountName" . }} + namespace: {{ .Release.Namespace | quote }} +{{- end }} \ No newline at end of file diff --git a/stable/cockroachdb/templates/cockroachdb-networkpolicy.yaml b/stable/cockroachdb/templates/networkpolicy.yaml similarity index 99% rename from stable/cockroachdb/templates/cockroachdb-networkpolicy.yaml rename to stable/cockroachdb/templates/networkpolicy.yaml index 7785c90a24..c85a33f273 100644 --- a/stable/cockroachdb/templates/cockroachdb-networkpolicy.yaml +++ b/stable/cockroachdb/templates/networkpolicy.yaml @@ -1,5 +1,4 @@ {{- if .Values.NetworkPolicy.Enabled }} ---- kind: NetworkPolicy apiVersion: {{ template "cockroachdb.networkPolicy.apiVersion" . }} metadata: diff --git a/stable/cockroachdb/templates/pdb.yaml b/stable/cockroachdb/templates/pdb.yaml new file mode 100644 index 0000000000..c6089f45b9 --- /dev/null +++ b/stable/cockroachdb/templates/pdb.yaml @@ -0,0 +1,14 @@ +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}-budget" + labels: + heritage: {{ .Release.Service | quote }} + release: {{ .Release.Name | quote }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + component: "{{ .Release.Name }}-{{ .Values.Component }}" +spec: + selector: + matchLabels: + component: "{{ .Release.Name }}-{{ .Values.Component }}" + maxUnavailable: {{ .Values.MaxUnavailable }} \ No newline at end of file diff --git a/stable/cockroachdb/templates/role.yaml b/stable/cockroachdb/templates/role.yaml new file mode 100644 index 0000000000..a9e72fdd91 --- /dev/null +++ b/stable/cockroachdb/templates/role.yaml @@ -0,0 +1,19 @@ +{{- if .Values.Secure.Enabled }} +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: Role +metadata: + name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}" + labels: + heritage: {{ .Release.Service | quote }} + release: {{ .Release.Name | quote }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + component: "{{ .Release.Name }}-{{ .Values.Component }}" +rules: +- apiGroups: + - "" + resources: + - secrets + verbs: + - create + - get +{{- end }} \ No newline at end of file diff --git a/stable/cockroachdb/templates/rolebinding.yaml b/stable/cockroachdb/templates/rolebinding.yaml new file mode 100644 index 0000000000..536917c1f2 --- /dev/null +++ b/stable/cockroachdb/templates/rolebinding.yaml @@ -0,0 +1,19 @@ +{{- if .Values.Secure.Enabled }} +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: RoleBinding +metadata: + name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}" + labels: + heritage: {{ .Release.Service | quote }} + release: {{ .Release.Name | quote }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + component: "{{ .Release.Name }}-{{ .Values.Component }}" +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}" +subjects: +- kind: ServiceAccount + name: {{ template "cockroachdb.serviceAccountName" . }} + namespace: {{ .Release.Namespace | quote }} +{{- end }} \ No newline at end of file diff --git a/stable/cockroachdb/templates/service-discovery.yaml b/stable/cockroachdb/templates/service-discovery.yaml new file mode 100644 index 0000000000..0b728699e3 --- /dev/null +++ b/stable/cockroachdb/templates/service-discovery.yaml @@ -0,0 +1,44 @@ +apiVersion: v1 +kind: Service +metadata: + # This service only exists to create DNS entries for each pod in the stateful + # set such that they can resolve each other's IP addresses. It does not + # create a load-balanced ClusterIP and should not be used directly by clients + # in most circumstances. + name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}" + labels: + heritage: {{ .Release.Service | quote }} + release: {{ .Release.Name | quote }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + component: "{{ .Release.Name }}-{{ .Values.Component }}" + annotations: + # Use this annotation in addition to the actual field below because the + # annotation will stop being respected soon but the field is broken in + # some versions of Kubernetes: + # https://github.com/kubernetes/kubernetes/issues/58662 + service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" + # Enable automatic monitoring of all instances when Prometheus is running in the cluster. + prometheus.io/scrape: "true" + prometheus.io/path: "_status/vars" + prometheus.io/port: "{{ .Values.ExternalHttpPort }}" +spec: + ports: + - port: {{ .Values.ExternalGrpcPort }} + targetPort: {{ .Values.InternalGrpcPort }} + name: {{ .Values.ExternalGrpcName }} + # The secondary port serves the UI as well as health and debug endpoints. + - port: {{ .Values.ExternalHttpPort }} + targetPort: {{ .Values.InternalHttpPort }} + name: {{ .Values.HttpName }} + {{- if ne .Values.InternalGrpcPort .Values.ExternalGrpcPort }} + - port: {{ .Values.InternalGrpcPort }} + targetPort: {{ .Values.InternalGrpcPort }} + name: {{ .Values.InternalGrpcName }} + {{- end }} + # We want all pods in the StatefulSet to have their addresses published for + # the sake of the other CockroachDB pods even before they're ready, since they + # have to be able to talk to each other in order to become ready. + publishNotReadyAddresses: true + clusterIP: None + selector: + component: "{{ .Release.Name }}-{{ .Values.Component }}" \ No newline at end of file diff --git a/stable/cockroachdb/templates/service.yaml b/stable/cockroachdb/templates/service.yaml new file mode 100644 index 0000000000..f2b42e06a4 --- /dev/null +++ b/stable/cockroachdb/templates/service.yaml @@ -0,0 +1,32 @@ +apiVersion: v1 +kind: Service +metadata: + # This service is meant to be used by clients of the database. It exposes a ClusterIP that will + # automatically load balance connections to the different database pods. + name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}-public" + annotations: +{{ toYaml .Values.Service.annotations | indent 4 }} + labels: + heritage: {{ .Release.Service | quote }} + release: {{ .Release.Name | quote }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + component: "{{ .Release.Name }}-{{ .Values.Component }}" +spec: + type: {{ .Values.Service.type }} + ports: + # The main port, served by gRPC, serves Postgres-flavor SQL, internode + # traffic and the cli. + - port: {{ .Values.ExternalGrpcPort }} + targetPort: {{ .Values.InternalGrpcPort }} + name: {{ .Values.ExternalGrpcName }} + # The secondary port serves the UI as well as health and debug endpoints. + - port: {{ .Values.ExternalHttpPort }} + targetPort: {{ .Values.InternalHttpPort }} + name: {{ .Values.HttpName }} + {{- if ne .Values.InternalGrpcPort .Values.ExternalGrpcPort }} + - port: {{ .Values.InternalGrpcPort }} + targetPort: {{ .Values.InternalGrpcPort }} + name: {{ .Values.InternalGrpcName }} + {{- end }} + selector: + component: "{{ .Release.Name }}-{{ .Values.Component }}" \ No newline at end of file diff --git a/stable/cockroachdb/templates/serviceaccount.yaml b/stable/cockroachdb/templates/serviceaccount.yaml new file mode 100644 index 0000000000..b53cf4e2dc --- /dev/null +++ b/stable/cockroachdb/templates/serviceaccount.yaml @@ -0,0 +1,11 @@ +{{- if and .Values.Secure.Enabled .Values.Secure.ServiceAccount.Create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ template "cockroachdb.serviceAccountName" . }} + labels: + heritage: {{ .Release.Service | quote }} + release: {{ .Release.Name | quote }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + component: "{{ .Release.Name }}-{{ .Values.Component }}" +{{- end }} \ No newline at end of file diff --git a/stable/cockroachdb/templates/cockroachdb-statefulset.yaml b/stable/cockroachdb/templates/statefulset.yaml similarity index 50% rename from stable/cockroachdb/templates/cockroachdb-statefulset.yaml rename to stable/cockroachdb/templates/statefulset.yaml index f1ab4432af..8b2755c309 100644 --- a/stable/cockroachdb/templates/cockroachdb-statefulset.yaml +++ b/stable/cockroachdb/templates/statefulset.yaml @@ -1,183 +1,3 @@ -{{- if .Values.Secure.Enabled }} -{{- if .Values.Secure.ServiceAccount.Create }} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ template "cockroachdb.serviceAccountName" . }} - labels: - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - component: "{{ .Release.Name }}-{{ .Values.Component }}" ---- -{{- end }} -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: Role -metadata: - name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}" - labels: - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - component: "{{ .Release.Name }}-{{ .Values.Component }}" -rules: -- apiGroups: - - "" - resources: - - secrets - verbs: - - create - - get ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRole -metadata: - name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}" - labels: - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - component: "{{ .Release.Name }}-{{ .Values.Component }}" -rules: -- apiGroups: - - certificates.k8s.io - resources: - - certificatesigningrequests - verbs: - - create - - get - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: RoleBinding -metadata: - name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}" - labels: - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - component: "{{ .Release.Name }}-{{ .Values.Component }}" -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}" -subjects: -- kind: ServiceAccount - name: {{ template "cockroachdb.serviceAccountName" . }} - namespace: {{ .Release.Namespace | quote }} ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRoleBinding -metadata: - name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}" - labels: - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - component: "{{ .Release.Name }}-{{ .Values.Component }}" -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}" -subjects: -- kind: ServiceAccount - name: {{ template "cockroachdb.serviceAccountName" . }} - namespace: {{ .Release.Namespace | quote }} ---- -{{- end }} -apiVersion: v1 -kind: Service -metadata: - # This service is meant to be used by clients of the database. It exposes a ClusterIP that will - # automatically load balance connections to the different database pods. - name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}-public" - annotations: -{{ toYaml .Values.Service.annotations | indent 4 }} - labels: - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - component: "{{ .Release.Name }}-{{ .Values.Component }}" -spec: - type: {{ .Values.Service.type }} - ports: - # The main port, served by gRPC, serves Postgres-flavor SQL, internode - # traffic and the cli. - - port: {{ .Values.ExternalGrpcPort }} - targetPort: {{ .Values.InternalGrpcPort }} - name: {{ .Values.ExternalGrpcName }} - # The secondary port serves the UI as well as health and debug endpoints. - - port: {{ .Values.ExternalHttpPort }} - targetPort: {{ .Values.InternalHttpPort }} - name: {{ .Values.HttpName }} - {{- if ne .Values.InternalGrpcPort .Values.ExternalGrpcPort }} - - port: {{ .Values.InternalGrpcPort }} - targetPort: {{ .Values.InternalGrpcPort }} - name: {{ .Values.InternalGrpcName }} - {{- end }} - selector: - component: "{{ .Release.Name }}-{{ .Values.Component }}" ---- -apiVersion: v1 -kind: Service -metadata: - # This service only exists to create DNS entries for each pod in the stateful - # set such that they can resolve each other's IP addresses. It does not - # create a load-balanced ClusterIP and should not be used directly by clients - # in most circumstances. - name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}" - labels: - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - component: "{{ .Release.Name }}-{{ .Values.Component }}" - annotations: - # Use this annotation in addition to the actual field below because the - # annotation will stop being respected soon but the field is broken in - # some versions of Kubernetes: - # https://github.com/kubernetes/kubernetes/issues/58662 - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" - # Enable automatic monitoring of all instances when Prometheus is running in the cluster. - prometheus.io/scrape: "true" - prometheus.io/path: "_status/vars" - prometheus.io/port: "{{ .Values.ExternalHttpPort }}" -spec: - ports: - - port: {{ .Values.ExternalGrpcPort }} - targetPort: {{ .Values.InternalGrpcPort }} - name: {{ .Values.ExternalGrpcName }} - # The secondary port serves the UI as well as health and debug endpoints. - - port: {{ .Values.ExternalHttpPort }} - targetPort: {{ .Values.InternalHttpPort }} - name: {{ .Values.HttpName }} - {{- if ne .Values.InternalGrpcPort .Values.ExternalGrpcPort }} - - port: {{ .Values.InternalGrpcPort }} - targetPort: {{ .Values.InternalGrpcPort }} - name: {{ .Values.InternalGrpcName }} - {{- end }} - # We want all pods in the StatefulSet to have their addresses published for - # the sake of the other CockroachDB pods even before they're ready, since they - # have to be able to talk to each other in order to become ready. - publishNotReadyAddresses: true - clusterIP: None - selector: - component: "{{ .Release.Name }}-{{ .Values.Component }}" ---- -apiVersion: policy/v1beta1 -kind: PodDisruptionBudget -metadata: - name: "{{ printf "%s-%s" .Release.Name .Values.Name | trunc 56 }}-budget" - labels: - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - component: "{{ .Release.Name }}-{{ .Values.Component }}" -spec: - selector: - matchLabels: - component: "{{ .Release.Name }}-{{ .Values.Component }}" - maxUnavailable: {{ .Values.MaxUnavailable }} ---- apiVersion: apps/v1beta1 kind: StatefulSet metadata: