Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name and Namespace exchanged in CRDs origin labels #780

Closed
yoadey opened this issue Sep 29, 2023 · 0 comments · Fixed by #781
Closed

Name and Namespace exchanged in CRDs origin labels #780

yoadey opened this issue Sep 29, 2023 · 0 comments · Fixed by #781
Labels
bug Something isn't working

Comments

@yoadey
Copy link

yoadey commented Sep 29, 2023

Describe the bug
The origin labels of helm.toolkit.fluxcd.io/name and helm.toolkit.fluxcd.io/namespace are exchanged, e.g. in traefik helm.toolkit.fluxcd.io/name is set to flux-system and helm.toolkit.fluxcd.io/namespace is set to traefik.

Steps to reproduce
Create a helm release for traefik and deploy it with CRDs enabled:

apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
  name: traefik
  namespace: flux-system
spec:
  interval: 120m
  url: https://traefik.github.io/charts
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: traefik
  namespace: flux-system
spec:
  interval: 5m
  chart:
    spec:
      chart: traefik
      version: '24.0.0'
      sourceRef:
        kind: HelmRepository
        name: traefik
      interval: 30m

Check the origin labels of the CRDs, e.g. ingressroutetcps.traefik.containo.us

Screenshots and recordings

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.6.2
  creationTimestamp: "2023-09-14T14:50:32Z"
  generation: 1
  labels:
    helm.toolkit.fluxcd.io/name: flux-system
    helm.toolkit.fluxcd.io/namespace: traefik
  name: ingressroutetcps.traefik.containo.us

Flux version
flux: v2.1.1

Other Information
The wrong line should be the following, where namespace and name are in the wrong order:
https://github.com/fluxcd/helm-controller/blob/39fd287f736df12497c4dc0a73c489f4a489eef8/internal/runner/runner.go#L444C41-L444C41

		if err = mergeLabels(info.Object, originLabels(namespace, name)); err != nil {

Code of Conduct
I agree to follow this project's Code of Conduct

@stefanprodan stefanprodan added the bug Something isn't working label Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants