vshn / appcat-service-postgresql

AppCat Service Provider for PostgreSQL
https://vshn.github.io/appcat-service-postgresql/
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Render PostgresqlStandaloneOperatorConfig in Helm chart #77

Closed ccremer closed 2 years ago

ccremer commented 2 years ago

Summary

As cluster-admin\ I want to deploy the operator config objects through the Helm chart\ So that I can deploy the operator fully configured with the mandatory configuration and don't need to manually do it myself.

Context

Objects of type PostgresqlStandaloneOperatorConfig need to be deployed per major version in order for the operator to work. This object contains configuration that may contain cloud-specific settings or additional Helm values.

This issue is about adding this object to the chart, so it can be rolled out as part of the installation.

Values structure proposal:

standaloneOperatorConfigs:
  platform-config-v14:
    postgresMajorVersion: ""
    spec:
      <the-spec-in-verbatim>

The key under standaloneOperatorConfigs is the metadata.name of the resource. This allows multiple objects to be rendered, and can be easily overwritten through values hierarchy.

Rendered output example:

apiVersion: postgresql.appcat.vshn.io/v1alpha1
kind: PostgresqlStandaloneOperatorConfig
metadata:
  labels:
    postgresql.appcat.vshn.io/major-version: v14
  name: platform-config-v14
  namespace: {{ .Release.Namespace }} # replaced by Helm
spec: # This is all coming from <the-spec-in-verbatim> from values proposal
  defaultDeploymentStrategy: HelmChart
  helmProviderConfigReference: provider-helm
  helmReleaseTemplate:
    chart:
      name: postgresql
      repository: https://charts.bitnami.com/bitnami
      version: 11.1.23
    values:
      key: value
  resourceMaxima:
    memoryLimit: 6Gi
    storageCapacity: 500Gi
  resourceMinima:
    memoryLimit: 512Mi
    storageCapacity: 5Gi

Out of Scope

Further links

Acceptance Criteria

Given Helm value `standaloneOperatorConfigs.platform-config-v14` with spec as outlined in the proposal
When Helm renders the templates
Then a resource is rendered similar to the example given above

Implementation Ideas

Template prosa code:

{{- range $key,$value := .Values.standaloneOperatorConfigs }}
apiVersion: postgresql.appcat.vshn.io/v1alpha1
kind: PostgresqlStandaloneOperatorConfig
metadata:
  labels:
    postgresql.appcat.vshn.io/major-version: {{ $value.postgresMajorVersion }}
    {{- include "provider-postgresql.labels" . | nindent 4 }}
  name: {{ $key }}
  namespace: {{ $Release.Namespace }}
spec:
  {{ $value | toYaml | nindent 2 }}
{{- end }}