Skip to content

Option to auto-upgrade CRDs with Helm #2159

@denis-ryzhkov

Description

@denis-ryzhkov
  • As a result of How to handle upgrade of CRDs with Helm #1325
    release notes require a separate manual step to upgrade CRDs like here:
    # Upgrade the operator image & deployment
    helm upgrade -i grafana-operator oci://ghcr.io/grafana/helm-charts/grafana-operator --version v5.19.0
    # Upgrading CRDs
    kubectl apply --server-side --force-conflicts -f https://github.com/grafana/grafana-operator/releases/download/v5.19.0/crds.yaml
    
  • It would be great to give user an option to auto-upgrade grafana-operator CRDs on helm upgrade without extra manual step.
  • Actually, when we tried to implement auto-upgrade of grafana-operator CRDs in our chart kof-operators, it failed on invalid ownership metadata, see the details here, because Helm's special crds directory is an unconditional part of grafana-operator chart here for now.
  • For example, here is how victoria-metrics-operator solved this:
    • Docs of crds.plain value:
      • check if plain or templated CRDs should be created.
      • with this option set to false, all CRDs will be rendered from templates.
      • with this option set to true, all CRDs are immutable and require manual upgrade.
    • Chart.yaml:
      dependencies:
        - name: crds
          version: "0.0.*"
          condition: crds.plain
    • crds chart with Helm's special crds directory,
      which is conditionally installed when crds.plain: true
    • victoria-metrics-operator/templates/crd.yaml template which renders CRDs
      when crds.plain: false, which leads to auto-install and auto-upgrade of CRDs.
      • It also compresses CRDs using compact JSON to avoid Helm's limitation:
        Secret "sh.helm.release.v1.REDACTED.v6" is invalid:
        data: Too long: may not be more than 1048576 bytes
        
  • Could you please implement the same, or will you accept my PR if I implement this for you?

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions