Skip to content

Redundant validation on chart name #1367

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

Closed
Varun-Mehrotra opened this issue Feb 7, 2024 · 2 comments · Fixed by #1377
Closed

Redundant validation on chart name #1367

Varun-Mehrotra opened this issue Feb 7, 2024 · 2 comments · Fixed by #1377
Assignees
Labels
area/helm Helm related issues and pull requests area/oci OCI related issues and pull requests bug Something isn't working

Comments

@Varun-Mehrotra
Copy link

Hello,

I'm setting up a workflow with the following components:

  1. Private Dockerhub OCI repository where my Helm Charts are stored
  2. EKS Cluster
  3. Below Kustomizations stored in a Private Github repo
  4. Flux deploying my Kustomizations to my EKS Cluster

I've setup the following HelmRepository:

apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
  name: my-dockerhub-oci
  namespace: flux-system
spec:
  type: "oci"
  interval: 1m
  url: oci://registry-1.docker.io/my-org
  secretRef:
    name: dockerhub-credentials  

and the following HelmRelease:

apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
  name: my-application
  namespace: flux-system
spec:
  interval: 1m
  chart:
    spec:
      chart: internal.my-chart
      version: "2024.3.0"
      sourceRef:
        kind: HelmRepository
        name: my-dockerhub-oci
        namespace: flux-system
      interval: 1m
  values:
    key: value

The issue I'm running into is that the internal.my-chart format isn't supported, specifically the . and I'm receiving the following error on my HelmRelease object:

HelmChart ''flux-system/flux-system-my-application'' is not ready: invalid chart reference: invalid chart name ''internal.my-chart'': a valid name must be lower case letters and numbers and MAY be separated with dashes (-)

And when I remove the internal. it works without any issues (but obviously targeting the wrong chart).

Now the reason that I'm submitting this issues is that my chart has already been uploaded to our Dockerhub OCI repo and helm pull works, making the validation that's going on here redundant; if there were an error with the name the OCI repo would've already errored before it even gets pushed in.

I was wondering what the reason for this drift from typical helm functionality and if there really isn't, if it's possible to remove the redundant validation.

Seems like this regex just needs to be altered:

return fmt.Errorf("invalid chart name '%s': a valid name must be lower case letters and numbers and MAY be separated with dashes (-) or slashes (/)", r.Name)

I'm happy to make those contributions myself 😃

@stefanprodan stefanprodan added bug Something isn't working area/helm Helm related issues and pull requests area/oci OCI related issues and pull requests labels Feb 20, 2024
@Varun-Mehrotra
Copy link
Author

Hey thanks for making the change @darkowlzz, just kinda curious now, how do I consume this change or when will it be available?

@darkowlzz
Copy link
Contributor

darkowlzz commented Mar 20, 2024

It's not released yet. You can build your own source-controller image from https://github.com/fluxcd/source-controller/tree/release/v1.2.x branch to use it now, make docker-build IMG=<image> TAG=<tag>.
We don't have any plan for another patch release yet. This is most likely to be included in Flux v2.3 release planned for some time in April. It'll be safer to build from the aforementioned branch as the main branch may have other changes that are not ready to be release yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/helm Helm related issues and pull requests area/oci OCI related issues and pull requests bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants