Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

using alias in HelmRelease.spec.chart.repository #274

Closed
Fapfood opened this issue Feb 7, 2020 · 7 comments
Closed

using alias in HelmRelease.spec.chart.repository #274

Fapfood opened this issue Feb 7, 2020 · 7 comments
Labels
question Further information is requested

Comments

@Fapfood
Copy link

Fapfood commented Feb 7, 2020

I tried to use alias in HelmRelease.spec.chart.repository. I created secret with our repositories.yml and uncommented both volumes: for repositories and for cache. Unfortunately alias is not parsed. I got this error:
caller=release.go:140 component=release release=prometheus targetNamespace=prometheus resource=prometheus:helmrelease/prometheus helmVersion=v3 erro r="chart unavailable: could not find protocol handler for: "
However when I put actual URL in repository everything works (repository: https://github.jparrowsec.cnpany.com/pages/helm-charts).
The problem may come from that comparision: https://github.com/fluxcd/helm-operator/blob/master/pkg/helm/v3/pull.go#L54. In my opinion it should compare repoURL with entry.Name.

apiVersion: helm.fluxcd.io/v1
kind: HelmRelease
metadata:
  name: prometheus
  namespace: prometheus
  annotations:
    fluxcd.io/automated: "true"
spec:
  chart:
    name: prometheus-operator
    #repository: https://github.jparrowsec.cnpany.com/pages/helm-charts 
    repository: stable 
    version: 8.2.0
  releaseName: prometheus
  values:
apiVersion: v1
repositories:
- caFile: ""
  cache: /var/fluxd/helm/repository/cache/stable-index.yaml
  certFile: ""
  keyFile: ""
  name: stable
  password: ""
  url: https://github.jparrowsec.cnpany.com/pages/helm-charts 
  username: ""
@hiddeco
Copy link
Member

hiddeco commented Feb 7, 2020

You are not using the chart.repository key as it is intended to be used. The Helm operator (at time of writing) expects the chart.repository to equal to the URL of the repository, and thus not the alias.

Working with 'aliases' is a planned feature, details about this can be found here: #142 (comment)

@hiddeco hiddeco added the question Further information is requested label Feb 7, 2020
@Fapfood
Copy link
Author

Fapfood commented Feb 7, 2020

What is the purpose of defining own repositories.yaml? Does it only serve as an authentication point?

@hiddeco
Copy link
Member

hiddeco commented Feb 7, 2020

Does it only serve as an authentication point?

Correct, it allows you to configure certificates and other authentication data for repositories requiring this. If they are publicly available, you do not have to add them to your repositories.yaml.

@Fapfood
Copy link
Author

Fapfood commented Feb 7, 2020

Thank you. You may think about writing this in the documentation more clearly and directly. You mention now that it is better to be explicit, but not that it is a requirement. (https://docs.fluxcd.io/projects/helm-operator/en/latest/references/helmrelease-custom-resource.html#cite-why-repo-urls) Then in many places you mention the file repositories.yaml, so I assumed that I could use aliases.

@hiddeco
Copy link
Member

hiddeco commented Feb 10, 2020

The first two sentences clearly state in my opinion that using an alias in the HelmRelease is not an option:

A HelmRelease must be able to stand on its own. If we used names in the spec, which were resolved to URLs elsewhere (e.g., in a repositories.yaml supplied to the operator), it would be possible to change the meaning of a HelmRelease without altering it.

In addition, a bit higher up on the page the following is stated:

The chart section gives a pointer to the chart; in this case, to a chart in a Helm repo. Since the Helm operator is running in your cluster, and doesn’t have access to local configuration, the repository is given as a URL rather than an alias (the URL in the example is what’s usually aliased as stable).

What phrasing would have made this easier to grasp for you?

@Fapfood
Copy link
Author

Fapfood commented Feb 10, 2020

I treat the first sentence as a feature. For example, I can move all releases to a new location, and change the configuration only in repositories.yaml. Dependency injection pattern. I understand that careless use can be a problem, but it doesn't follow from the sentence that I can't use it.
The second sentence is untrue: doesn’t have access to local configuration - it has access when we mount repositories.yaml.
I would expect the documentation written directly: "You can't use aliases - it won't work, we don't support it." Because the sentences you give are not clear enough in my opinion.

@hiddeco
Copy link
Member

hiddeco commented Feb 10, 2020

Token note of this in the issue linked above, which now supersedes this issue. Thanks for your suggestions 🌷

@hiddeco hiddeco closed this as completed Feb 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants