mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-17 20:08:17 +02:00
Introduce crds directory for compatibility with Helm v3 (#738)
* Introduce crds directory for compatibility with Helm v3 This commit introduce a crd directory for the helm chart which has all custom resource definitions. The files in the crd directory is plain YAML. The crds got the label `app.kubernetes.io/name: postgres-operator` and removes all the templating. Helm v3 ignores the objects from the `templates` directory which have a `crd-install` hook. This commit addes templates/crds.yaml which generates YAMLs for CRDs. The hooks from these CRDs are detected by Helm v2 as well as v3. Helm v2 executes the hook and Helm v3 ignores the hook (YAML files are not applied) The approach is inspired by the prometheus-operator chart helm/charts@89b233eef6
This commit is contained in:
committed by
Felix Kunde
parent
5f87384d7f
commit
052940862a
@@ -0,0 +1,41 @@
|
||||
apiVersion: apiextensions.k8s.io/v1beta1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: operatorconfigurations.acid.zalan.do
|
||||
labels:
|
||||
app.kubernetes.io/name: postgres-operator
|
||||
annotations:
|
||||
"helm.sh/hook": crd-install
|
||||
spec:
|
||||
group: acid.zalan.do
|
||||
names:
|
||||
kind: OperatorConfiguration
|
||||
listKind: OperatorConfigurationList
|
||||
plural: operatorconfigurations
|
||||
singular: operatorconfiguration
|
||||
shortNames:
|
||||
- opconfig
|
||||
additionalPrinterColumns:
|
||||
- name: Image
|
||||
type: string
|
||||
description: Spilo image to be used for Pods
|
||||
JSONPath: .configuration.docker_image
|
||||
- name: Cluster-Label
|
||||
type: string
|
||||
description: Label for K8s resources created by operator
|
||||
JSONPath: .configuration.kubernetes.cluster_name_label
|
||||
- name: Service-Account
|
||||
type: string
|
||||
description: Name of service account to be used
|
||||
JSONPath: .configuration.kubernetes.pod_service_account_name
|
||||
- name: Min-Instances
|
||||
type: integer
|
||||
description: Minimum number of instances per Postgres cluster
|
||||
JSONPath: .configuration.min_instances
|
||||
- name: Age
|
||||
type: date
|
||||
JSONPath: .metadata.creationTimestamp
|
||||
scope: Namespaced
|
||||
subresources:
|
||||
status: {}
|
||||
version: v1
|
||||
@@ -0,0 +1,53 @@
|
||||
apiVersion: apiextensions.k8s.io/v1beta1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: postgresqls.acid.zalan.do
|
||||
labels:
|
||||
app.kubernetes.io/name: postgres-operator
|
||||
annotations:
|
||||
"helm.sh/hook": crd-install
|
||||
spec:
|
||||
group: acid.zalan.do
|
||||
names:
|
||||
kind: postgresql
|
||||
listKind: postgresqlList
|
||||
plural: postgresqls
|
||||
singular: postgresql
|
||||
shortNames:
|
||||
- pg
|
||||
additionalPrinterColumns:
|
||||
- name: Team
|
||||
type: string
|
||||
description: Team responsible for Postgres CLuster
|
||||
JSONPath: .spec.teamId
|
||||
- name: Version
|
||||
type: string
|
||||
description: PostgreSQL version
|
||||
JSONPath: .spec.postgresql.version
|
||||
- name: Pods
|
||||
type: integer
|
||||
description: Number of Pods per Postgres cluster
|
||||
JSONPath: .spec.numberOfInstances
|
||||
- name: Volume
|
||||
type: string
|
||||
description: Size of the bound volume
|
||||
JSONPath: .spec.volume.size
|
||||
- name: CPU-Request
|
||||
type: string
|
||||
description: Requested CPU for Postgres containers
|
||||
JSONPath: .spec.resources.requests.cpu
|
||||
- name: Memory-Request
|
||||
type: string
|
||||
description: Requested memory for Postgres containers
|
||||
JSONPath: .spec.resources.requests.memory
|
||||
- name: Age
|
||||
type: date
|
||||
JSONPath: .metadata.creationTimestamp
|
||||
- name: Status
|
||||
type: string
|
||||
description: Current sync status of postgresql resource
|
||||
JSONPath: .status.PostgresClusterStatus
|
||||
scope: Namespaced
|
||||
subresources:
|
||||
status: {}
|
||||
version: v1
|
||||
@@ -0,0 +1,6 @@
|
||||
{{ if .Values.crd.create }}
|
||||
{{- range $path, $bytes := .Files.Glob "crds/*.yaml" }}
|
||||
{{ $.Files.Get $path }}
|
||||
---
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -1,103 +0,0 @@
|
||||
{{ if .Values.crd.create }}
|
||||
apiVersion: apiextensions.k8s.io/v1beta1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: postgresqls.acid.zalan.do
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "postgres-operator.name" . }}
|
||||
helm.sh/chart: {{ template "postgres-operator.chart" . }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
annotations:
|
||||
"helm.sh/hook": crd-install
|
||||
spec:
|
||||
group: acid.zalan.do
|
||||
names:
|
||||
kind: postgresql
|
||||
listKind: postgresqlList
|
||||
plural: postgresqls
|
||||
singular: postgresql
|
||||
shortNames:
|
||||
- pg
|
||||
additionalPrinterColumns:
|
||||
- name: Team
|
||||
type: string
|
||||
description: Team responsible for Postgres CLuster
|
||||
JSONPath: .spec.teamId
|
||||
- name: Version
|
||||
type: string
|
||||
description: PostgreSQL version
|
||||
JSONPath: .spec.postgresql.version
|
||||
- name: Pods
|
||||
type: integer
|
||||
description: Number of Pods per Postgres cluster
|
||||
JSONPath: .spec.numberOfInstances
|
||||
- name: Volume
|
||||
type: string
|
||||
description: Size of the bound volume
|
||||
JSONPath: .spec.volume.size
|
||||
- name: CPU-Request
|
||||
type: string
|
||||
description: Requested CPU for Postgres containers
|
||||
JSONPath: .spec.resources.requests.cpu
|
||||
- name: Memory-Request
|
||||
type: string
|
||||
description: Requested memory for Postgres containers
|
||||
JSONPath: .spec.resources.requests.memory
|
||||
- name: Age
|
||||
type: date
|
||||
JSONPath: .metadata.creationTimestamp
|
||||
- name: Status
|
||||
type: string
|
||||
description: Current sync status of postgresql resource
|
||||
JSONPath: .status.PostgresClusterStatus
|
||||
scope: Namespaced
|
||||
subresources:
|
||||
status: {}
|
||||
version: v1
|
||||
---
|
||||
apiVersion: apiextensions.k8s.io/v1beta1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: operatorconfigurations.acid.zalan.do
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "postgres-operator.name" . }}
|
||||
helm.sh/chart: {{ template "postgres-operator.chart" . }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
annotations:
|
||||
"helm.sh/hook": crd-install
|
||||
spec:
|
||||
group: acid.zalan.do
|
||||
names:
|
||||
kind: OperatorConfiguration
|
||||
listKind: OperatorConfigurationList
|
||||
plural: operatorconfigurations
|
||||
singular: operatorconfiguration
|
||||
shortNames:
|
||||
- opconfig
|
||||
additionalPrinterColumns:
|
||||
- name: Image
|
||||
type: string
|
||||
description: Spilo image to be used for Pods
|
||||
JSONPath: .configuration.docker_image
|
||||
- name: Cluster-Label
|
||||
type: string
|
||||
description: Label for K8s resources created by operator
|
||||
JSONPath: .configuration.kubernetes.cluster_name_label
|
||||
- name: Service-Account
|
||||
type: string
|
||||
description: Name of service account to be used
|
||||
JSONPath: .configuration.kubernetes.pod_service_account_name
|
||||
- name: Min-Instances
|
||||
type: integer
|
||||
description: Minimum number of instances per Postgres cluster
|
||||
JSONPath: .configuration.min_instances
|
||||
- name: Age
|
||||
type: date
|
||||
JSONPath: .metadata.creationTimestamp
|
||||
scope: Namespaced
|
||||
subresources:
|
||||
status: {}
|
||||
version: v1
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user