fluxcd-community / helm-charts

Community maintained Helm charts for Flux
Apache License 2.0
121 stars 76 forks source link

[flux2] CRDs are not installed when used as dependency #155

Closed cwrau closed 11 months ago

cwrau commented 1 year ago

Describe the bug a clear and concise description of what the bug is.

We have an umbrella chart that depends on flux2

When helm installing that chart it outputs the following error;

Error: INSTALLATION FAILED: unable to build kubernetes objects from release manifest: [resource mapping not found for name: "base-cluster-flux-main" namespace: "flux-system" from "": no matches for kind "GitRepository" in version "source.toolkit.fluxcd.io/v1beta2"

What's your helm version?

version.BuildInfo{Version:"v3.10.3", GitCommit:"835b7334cfe2e5e27870ab3ed4135f136eecc704", GitTreeState:"clean", GoVersion:"go1.19.4"}

What's your kubectl version?

Client Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.1", GitCommit:"8f94681cd294aa8cfd3407b8191f6c70214973a4", GitTreeState:"archive", BuildDate:"2023-01-18T22:38:55Z", GoVersion:"go1.19.5", Compiler:"gc", Platform:"linux/amd64"} Kustomize Version: v4.5.7 Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.9", GitCommit:"9710807c82740b9799453677c977758becf0acbb", GitTreeState:"clean", BuildDate:"2022-12-08T10:08:06Z", GoVersion:"go1.18.9", Compiler:"gc", Platform:"linux/amd64"}

What's the chart version?

2.5.0

What happened?

I tried installing this chart as a dependency of a chart using it's CRDs

What you expected to happen?

That the CRDs would be installed before everything else

How to reproduce it?

helm install our chart into an empty cluster with the following values;

global:
  clusterName: test

Enter the changed values of values.yaml?

NONE

Enter the command that you execute and failing/misfunctioning.

helm install --namespace flux-system --repo https://teutonet.github.io/teutonet-helm-charts base-cluster base-cluster --version x.x.x --values values.yaml

Anything else we need to know?

Maybe this could be solved by also having the CRDs in the crds folder additionally to the templates folder.

I guess then they should be installed before the main installation but also upgraded during upgrades?

Another option would be to just move them into the crds folder and use flux's

  install:
    crds: CreateReplace
  upgrade:
    crds: CreateReplace

(I would prefer the latter, but I would be happy with both 😊)

drewwells commented 1 year ago

This is preventing us from installing 2 fluxes in a cluster. Helm recommends using the crds/ folder. It would be best to use that so we can use helm to turn on or turn off crds --skip-crds

stefanprodan commented 1 year ago

Installing more than one Flux instance on a cluster will break all things as controllers will fight each other.

drewwells commented 1 year ago

Installing more than one Flux instance on a cluster will break all things as controllers will fight each other.

See horizontal scaling, also watch-all-namespaces: https://fluxcd.io/flux/installation/configuration/sharding/

The only issue I am encountering is the naming of the clusterrolebinding

stefanprodan commented 1 year ago

@drewwells I’m well aware of those docs, I wrote them. For sharding, the chart has to be expected to take the number of shards and labels as values, then generate the extra deployments in the same flux-system namespace.