$ flux-local --log-level DEBUG build hr -A
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:flux_local.tool.selector:Building HelmRelease selector from args: {'log_level': 'DEBUG', 'command': 'build', 'cls': <class 'flux_local.tool.build.BuildHelmReleaseAction'>, 'helmrelease': None, 'path': None, 'sources': None, 'all_namespaces': True, 'namespace': 'flux-system', 'label_selector': None, 'skip_crds': True, 'skip_secrets': True, 'skip_kinds': None, 'skip_invalid_kustomization_paths': False, 'kustomize_build_flags': '', 'kube_version': None, 'api_versions': None, 'registry_config': None, 'skip_invalid_helm_release_paths': True}
DEBUG:flux_local.git_repo:Processing cluster with selector ResourceSelector(path=PathSelector(path=None, sources=None), cluster=MetadataSelector(enabled=True, name='flux-system', namespace='flux-system', label_selector=None, skip_crds=True, skip_secrets=True, skip_kinds=None, visitor=None), kustomization=MetadataSelector(enabled=True, name=None, namespace=None, label_selector=None, skip_crds=True, skip_secrets=True, skip_kinds=None, visitor=ResourceVisitor(func=<bound method ContentOutput.call_async of <flux_local.visitor.ContentOutput object at 0x7143941d8d70>>)), helm_repo=MetadataSelector(enabled=True, name=None, namespace=None, label_selector=None, skip_crds=True, skip_secrets=True, skip_kinds=None, visitor=ResourceVisitor(func=<function HelmVisitor.repo_visitor.<locals>.add_repo at 0x7143941f3ba0>)), helm_release=MetadataSelector(enabled=True, name=None, namespace=None, label_selector=None, skip_crds=True, skip_secrets=True, skip_kinds=None, visitor=ResourceVisitor(func=<function HelmVisitor.release_visitor.<locals>.add_release at 0x7143941f3ce0>)), oci_repo=MetadataSelector(enabled=True, name=None, namespace=None, label_selector=None, skip_crds=True, skip_secrets=True, skip_kinds=None, visitor=ResourceVisitor(func=<function HelmVisitor.repo_visitor.<locals>.add_repo at 0x7143941f3b00>)), doc_visitor=None)
DEBUG:flux_local.context:[Trace] > Cluster 'None'
DEBUG:git.util:sys.platform='linux', git_executable='git'
DEBUG:git.cmd:Popen(['git', 'rev-parse', '--show-toplevel'], cwd=/home/teeuwen/minimalrepro, stdin=None, shell=False, universal_newlines=False)
DEBUG:flux_local.git_repo:Visiting path (None) .
DEBUG:flux_local.context:[Trace] > Cluster 'None' > Kustomization '.'
DEBUG:flux_local.command:Running command: (. (abs)) kustomize cfg grep 'kind=^(Kustomization|ConfigMap|Secret)$' .
DEBUG:flux_local.command:Running command: kustomize cfg grep 'spec.sourceRef.kind=GitRepository|OCIRepository'
DEBUG:flux_local.command:Running command: kustomize cfg grep 'kind=^(ConfigMap|Secret)$'
DEBUG:flux_local.context:[Trace] < Cluster 'None' > Kustomization '.' (0.02s)
DEBUG:flux_local.git_repo:Found 2 new Kustomizations
DEBUG:flux_local.git_repo:Kustomization 'podinfo-config' sourceRef.kind 'GitRepository' of 'flux-system'
DEBUG:flux_local.git_repo:Kustomization 'podinfo' sourceRef.kind 'GitRepository' of 'flux-system'
DEBUG:flux_local.git_repo:Visiting path (None) clusters/prod/podinfo-config
DEBUG:flux_local.context:[Trace] > Cluster 'None' > Kustomization 'flux-system/podinfo-config'
DEBUG:flux_local.git_repo:Visiting path (None) apps/podinfo
DEBUG:flux_local.context:[Trace] > Cluster 'None' > Kustomization 'flux-system/podinfo'
DEBUG:flux_local.command:Running command: flux build ks podinfo --dry-run --kustomization-file /dev/stdin --path /home/teeuwen/minimalrepro/apps/podinfo --namespace flux-system
DEBUG:flux_local.command:Running command: flux build ks podinfo-config --dry-run --kustomization-file /dev/stdin --path /home/teeuwen/minimalrepro/clusters/prod/podinfo-config --namespace flux-system
DEBUG:flux_local.command:Running command: kustomize cfg grep 'kind=^(Kustomization|ConfigMap|Secret)$'
DEBUG:flux_local.command:Running command: kustomize cfg grep 'kind=^(Kustomization|ConfigMap|Secret)$'
DEBUG:flux_local.command:Running command: kustomize cfg grep 'spec.sourceRef.kind=GitRepository|OCIRepository'
DEBUG:flux_local.command:Running command: kustomize cfg grep 'spec.sourceRef.kind=GitRepository|OCIRepository'
DEBUG:flux_local.command:Running command: kustomize cfg grep 'kind=^(ConfigMap|Secret)$'
DEBUG:flux_local.command:Running command: kustomize cfg grep 'kind=^(ConfigMap|Secret)$'
DEBUG:flux_local.context:[Trace] < Cluster 'None' > Kustomization 'flux-system/podinfo' (0.04s)
DEBUG:flux_local.context:[Trace] < Cluster 'None' > Kustomization 'flux-system/podinfo-config' (0.05s)
DEBUG:flux_local.git_repo:Found 0 new Kustomizations
DEBUG:flux_local.git_repo:Kustomization flux-system/podinfo waiting for {'flux-system/podinfo-config'}
DEBUG:flux_local.git_repo:Processing kustomization 'podinfo-config': clusters/prod/podinfo-config
DEBUG:flux_local.context:[Trace] > Cluster 'None' > Build 'flux-system/podinfo-config'
DEBUG:flux_local.command:Running command: kustomize cfg grep 'kind=^(CustomResourceDefinition|Secret)$' --invert-match
DEBUG:flux_local.command:Running command: kustomize cfg grep 'kind=^(ConfigMap|HelmRepository|OCIRepository|HelmRelease|Secret)$'
DEBUG:flux_local.context:[Trace] < Cluster 'None' > Build 'flux-system/podinfo-config' (0.01s)
DEBUG:flux_local.git_repo:Processing kustomization 'podinfo': apps/podinfo
DEBUG:flux_local.context:[Trace] > Cluster 'None' > Build 'flux-system/podinfo'
DEBUG:flux_local.command:Running command: kustomize cfg grep 'kind=^(CustomResourceDefinition|Secret)$' --invert-match
DEBUG:flux_local.command:Running command: kustomize cfg grep 'kind=^(ConfigMap|HelmRepository|OCIRepository|HelmRelease|Secret)$'
DEBUG:flux_local.context:[Trace] < Cluster 'None' > Build 'flux-system/podinfo' (0.01s)
DEBUG:flux_local.values:Expanding value reference ValuesReference(kind='ConfigMap', name='podinfo-values', values_key='values.yaml', target_path=None, optional=False)
DEBUG:flux_local.values:Expanding value reference ValuesReference(kind='ConfigMap', name='podinfo-values', values_key='values.yaml', target_path=None, optional=False)
WARNING:flux_local.values:Unable to find ConfigMap podinfo/podinfo-values referenced
DEBUG:flux_local.context:[Trace] < Cluster 'None' (0.09s)
DEBUG:flux_local.visitor:Inflating Helm charts in cluster
DEBUG:flux_local.helm:Updating 1 repositories
DEBUG:flux_local.visitor:Waiting for inflate tasks to complete
DEBUG:flux_local.command:Running command: helm template podinfo oci://ghcr.io/stefanprodan/charts/podinfo --namespace podinfo --repository-cache /tmp/tmprim4cnyy --repository-config /tmp/tmptworu52i/repository-config.yaml --registry-config /tmp/tmpag2ftd_i.json --skip-crds --skip-tests --version 6.5.0
DEBUG:flux_local.command:Running command: kustomize cfg grep 'kind=^(CustomResourceDefinition|Secret)$' --invert-match
[Rendered manifest output omitted for brevity]
I have a Fluxtomization referencing a Kustomization creating a ConfigMap. Then I have another Fluxtomization depending on the first which creates a HelmRelease. In that HelmRelease, I am unable to reference the aforementioned ConfigMap with
valuesFrom.For context, what I'm trying to achieve here is a setup where I have multiple clusters running the same apps, but with different Helm chart values per cluster (also see example below).
I believe the reason this is not working is because the lookup flux-local does only uses the Fluxtomization it is currently "reconciling" as context, as can be seen here.
I have tried to fiddle with fixing this myself, but have not found a clean solution yet. I think ideally flux-local should walk through the tree of dependent Fluxtomization resources and resolve references to ConfigMaps and Secrets that way. I was not able to determine if flux-local already builds a tree of Fluxtomization dependencies. I was hoping someone else could have a look at this, also because of unfamiliarity with the codebase. Then again, maybe I am missing something really obvious here. Thanks :)
Tested using
flux-local:maindocker image (commit 1bb1330).Debug Logs
Minimal setup to reproduce
EDIT:
I have also tried to see what happens with
flux-local shell, and it indeed is able to resolve the ConfigMap (as I guess it simulates the behavior of Flux's kustomize-controller):However, it doesn't actually seem to use the values from the ConfigMap in the generated resources, as (with the podinfo example above), no Deployment is created for Redis. When I paste the values directly into the HelmRelease (under
spec.values), the Redis Deployment is created.