postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

Install Postgres Cluster via Helm from OCI Registry

Open DCAL12 opened this issue 1 year ago • 5 comments

Overview

Allow helm install of PostgresCluster resources via Helm in the same way as PGO operator.

Use Case

As with installing the operator via Helm (see #2231), automation tools require installing PostgresCluster via Helm from a hosted repository. Currently we must build each version from https://github.com/CrunchyData/postgres-operator-examples/tree/main/helm/postgres and push to our own OCI registry.

Desired Behavior

A "postgres-cluster" helm chart is hosted alongside the PGO Helm chart at oci://registry.developers.crunchydata.com/crunchydata/pgo. It can be installed in a similar manner as the operator as documented here, and updated with each release.

Environment

Tell us about your environment:

Please provide the following details:

  • Platform: Kubernetes
  • Platform Version: 5.3.1
  • Number of Postgres clusters: 12

DCAL12 avatar May 02 '23 03:05 DCAL12

Hi @DCAL12! Just curious, when you mention that your automation tooling requires installation via Helm from a hosted repository, which tool requires Helm?

tony-landreth avatar May 02 '23 14:05 tony-landreth

I'm currently using ArgoCD, but this is a more general limitation of Helm which requires a packaged chart to run the install command (see here). An alternative would be use a CI pipeline to clone and package the postgres-operator-examples repo and run helm package, but this would preclude the use of gitops tools like ArgoCD which expect the artifact to already be built.

DCAL12 avatar May 02 '23 20:05 DCAL12

I've captured a story for our backlog about your request. Thanks for sharing the additional details!

tony-landreth avatar May 03 '23 19:05 tony-landreth

As a workaround, you could use helm-git or helmfile (which just uses the git plugin under the hood) and reference the repository as follows (for helmfile):

repositories:
  - name: crunchydata
    url: git+https://github.com/CrunchyData/postgres-operator-examples.git@helm?ref=main

releases:
  - name: postgres
    chart: crunchydata/postgrescluster
    values:
      - path/to/your/values.yaml

If the example chart will be published as an official OCI Image, it would be nice, if the databaseInitSQL key does not receive a reference to a existing ConfigMap, but rather a string which will be saved in a ConfigMap maintained by the chart (if the string is not empty). This would provide the benefit that one must not write their own helm chart which only holds the ConfigMap and then reference this by hand in your chart.

ProbstDJakob avatar May 05 '23 12:05 ProbstDJakob

@tony-landreth Any progress on this? Would make it much easier to get started and remove the need to install plugins in ArgoCD..

Using kustomize for now:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: crunchy-psql-crds
  namespace: argocd
spec:
  project: low-priority
  source:
    repoURL: "https://github.com/CrunchyData/postgres-operator-examples.git"
    path: kustomize/install/default
    targetRevision: HEAD
    kustomize:
      namespace: crunchy-psql-operator
  destination:
    server: "https://kubernetes.default.svc"
    namespace: crunchy-psql-operator
  syncPolicy:
    automated:
      selfHeal: true
    syncOptions:
      - ServerSideApply=true
      - PruneLast=true
      - CreateNamespace=true
      - ApplyOutOfSyncOnly=true

zadjadr avatar Jan 25 '24 08:01 zadjadr