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

Report descriptive error for invalid chart repository URLs / index data #654

Open
jacobbaek opened this issue Apr 5, 2022 · 5 comments · May be fixed by #824
Open

Report descriptive error for invalid chart repository URLs / index data #654

jacobbaek opened this issue Apr 5, 2022 · 5 comments · May be fixed by #824
Labels
area/helm Helm related issues and pull requests enhancement New feature or request good first issue Good for newcomers

Comments

@jacobbaek
Copy link

jacobbaek commented Apr 5, 2022

Hi,

I gonna use private helm chart repository that is working on GitLab CE.
So i made helmrepository and helmrelease following this guideline.
but as you can see, below error message printed for helmrepsitory resource that i made.

jacob@dubaek:~/workspace/flux$ kubectl get helmrepository -n ingress-nginx
NAME                 URL                                                       READY   STATUS                                                                                        AGE
ingress-helm-chart   https://gitlab.example.com/anyone/ingress-cache-helm   False   error converting YAML to JSON: yaml: line 3: mapping values are not allowed in this context   11h

I already did run flux bootstrap and there is running the source-controller (ghcr.io/fluxcd/source-controller:v0.21.2) at the cluster.

You can check the YAML file that was used to create helmrepository.

---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: HelmRepository
metadata:
  name: ingress-helm-chart
  namespace: ingress-nginx
spec:
  interval: 1m
  url: https://gitlab.example.com/anyone/ingress-cache-helm
  secretRef: 
    name: exampledotcom-ca

I can not find what makes syntax error or invalid line.
if i applied upper YAML file without "secretRef" line, it succeed.
So i think the "secretRef" has something wrong, but I could not find any problem.

Can anyone give some advice or if this issue turn out to be error, please fix it.

@aryan9600
Copy link
Member

Hey, did you by any chance use a tab character when adding .spec.secretRef? YAML doesn't allow tabs.

@jacobbaek
Copy link
Author

Hi aryan9600,

i already check the tab character are in the yaml file.
But i can not find and there is only whitespace.

below result that is run 'set list' on the VIM.

---$
apiVersion: source.toolkit.fluxcd.io/v1beta1$
kind: HelmRepository$
metadata:$
  name: ingress-helm-chart$
  namespace: ingress-nginx$
spec:$
  interval: 1m$
  url: https://gitlab.example.com/anyone/ingress-cache-helm$
  secretRef:$
    name: exampledotcom-ca$
$

@hiddeco
Copy link
Member

hiddeco commented Apr 5, 2022

The problem is likely that GitLab does not serve the expected index.yaml on https://gitlab.example.com/anyone/ingress-cache-helm/index.yaml, resulting in the source-controller (and Helm) attempting to consume the HTML document that is being served as YAML. Eventually resulting in this error.

You either need to figure out what the right URL is for static GitLab content (like https://raw.githubusercontent.com/<repository>/<branch>/index.yaml is for GitHub), or consume the charts in the Git repository using a GitRepository object.

As a rule of thumb for easy debugging: if helm is able to consume a URL using helm repo add <name> <url> [--username <username> --password <password], this should work with a HelmRepository object as well.

@hiddeco
Copy link
Member

hiddeco commented Apr 5, 2022

We could be nicer (like the helm CLI), and report something along the lines of:

$ helm repo add foo https://example.com
Error: looks like "https://example.com" is not a valid chart repository or cannot be reached: failed to fetch https://example.com/index.yaml : 404 Not Found

@hiddeco hiddeco changed the title mapping values are not allowed in this context Report descriptive error for invalid chart repository URLs / index data Apr 5, 2022
@hiddeco hiddeco added enhancement New feature or request good first issue Good for newcomers area/helm Helm related issues and pull requests labels Apr 5, 2022
@jacobbaek
Copy link
Author

Thanks @hiddeco

I was confused, the error message was happen by parsing the YAML. i did not think about the fetching the helm chart index.html.
I checked for helm chart has index.html and it's work with that helm chart Repo is working.

Also you suggest to improve the error message, right?
I also agree and hope to change the message.

Thanks for your kindly support.

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 enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants