Pull CloudRepo Helm charts from Argo CD and Flux
Argo CD and Flux are GitOps tools for Kubernetes, and both can install a Helm chart from an OCI registry (Argo CD, Flux). CloudRepo keeps a Helm chart as an OCI artifact in a Docker repository (see Helm Charts (OCI)), so each tool can pull your chart from there with a repository token. This page shows, for each tool, the Kubernetes objects that do it. Each tool’s own documentation defines every field, and the page links it.
Before you start
Section titled “Before you start”- A chart in a CloudRepo Docker repository. Log in, push and pull on the
Helm page shows how to package and push one. The blocks below use that page’s example: the chart
docs-helm, version1.0.0, in the repositoryyour-repo. - A repository token that reaches the repository. Use a Read only token: both tools only pull, and each keeps the
token in a Kubernetes Secret. Create it under Repository Tokens, as an
account that outlives any one person (see
The rule every guide follows). Use a Generic token, whose
value starts with
crp_v1_: an npm-format token is turned away at this registry. - Your account email address, which is the username (
you@example.combelow).
The token never goes in a manifest you commit, and never on a command line. Each section below says how its Secret gets the token instead.
Argo CD
Section titled “Argo CD”Argo CD reads a repository’s details from a Secret in its own namespace, argocd unless you installed it elsewhere
(Declarative Setup, Repositories).
For a Helm chart in an OCI registry, that Secret sets type: helm and enableOCI: "true"
(Declarative Setup, Helm).
Describe the repository
Section titled “Describe the repository”apiVersion: v1kind: Secretmetadata: name: cloudrepo-helm namespace: argocd labels: argocd.argoproj.io/secret-type: repositorystringData: name: cloudrepo type: helm enableOCI: "true" url: your-org.mycloudrepo.io/repositories/your-repo username: you@example.com- The label
argocd.argoproj.io/secret-type: repositorymarks the Secret as a repository, as in Argo CD’s own examples. name,typeandurlare the three fields Argo CD requires of a Helm repository Secret, andenableOCIis set to"true"for charts from an OCI registry.urlis the repository address thathelm pushtakes on the Helm page, withoutoci://. Argo CD’s example of a public OCI chart says of its address: “the oci:// syntax is not included” (Helm user guide).usernameis your account email address.
There is no password line in this manifest, on purpose.
Give the Secret the token
Section titled “Give the Secret the token”Argo CD takes the password from the password key of this same Secret. The password is the repository token. Put it
there by one of these routes, so it is in no manifest you commit and on no command line:
- From a file. Save the Secret above with a
passwordline added in a file that stays out of Git, apply it withkubectl apply -f, and delete the file. This is the form of Argo CD’s own example, a Secret withusernameandpasswordunderstringData. - From a sealed secret. Argo CD’s documentation suggests
bitnami-labs/sealed-secrets to store an encrypted Secret definition
as a Kubernetes manifest. It warns that the labels are removed and have to be added again, as the
Sealed Secrets README
describes, so the sealed Secret must still end up with the
argocd.argoproj.io/secret-type: repositorylabel. - From an external secret. An operator that writes the Secret from your secret store, such as
External Secrets Operator. The Secret it writes needs the same label and
every key above, and a
passwordkey holding the token.
Create the Application
Section titled “Create the Application”apiVersion: argoproj.io/v1alpha1kind: Applicationmetadata: name: docs-helm namespace: argocdspec: project: default source: chart: docs-helm repoURL: your-org.mycloudrepo.io/repositories/your-repo targetRevision: 1.0.0 destination: name: in-cluster namespace: defaultchartis the chart’s name andtargetRevisionits version: the name and the version thathelm pulltakes on the Helm page. For an application from a Helm repository, Argo CD requireschartwhere a Git source haspath(Declarative Setup, Applications).repoURLis the same address as the Secret’surl, again withoutoci://.- The Application’s namespace is the one your Argo CD runs in, typically
argocd. destinationis the shape of Argo CD’s own example of a public OCI chart (Helm user guide): the cluster Argo CD runs in, and the namespace the chart installs into.
Flux reads a registry login from a Secret that a HelmRepository names with secretRef, and a HelmRelease installs
a chart from that HelmRepository
(HelmRepository,
HelmRelease).
Flux’s documentation marks the oci type of HelmRepository as in maintenance mode, and points to its OCIRepository
API for improved support for OCI Helm charts
(HelmRepository, Type). This page shows the
HelmRepository form.
Create the Secret
Section titled “Create the Secret”secretRef names a Secret in the same namespace as the HelmRepository. For an OCI HelmRepository, Flux accepts a
Secret of type kubernetes.io/dockerconfigjson
(HelmRepository, Secret reference).
Make that Secret from a Docker login with the token on standard input, as under
Create the image pull secret on the Docker pull page, with
two changes. Add --namespace default to its kubectl create secret command (or the namespace you put the
HelmRepository in), so the Secret is beside the HelmRepository below. Keep the Secret’s name, cloudrepo: the
secretRef below uses it.
Flux’s own command for an OCI login Secret, flux create secret oci, takes the password as a flag
(flux create secret oci), which puts the token on the command
line. This page does not use it.
Add the repository
Section titled “Add the repository”apiVersion: source.toolkit.fluxcd.io/v1kind: HelmRepositorymetadata: name: cloudrepo namespace: defaultspec: type: "oci" interval: 5m0s url: oci://your-org.mycloudrepo.io/repositories/your-repo secretRef: name: cloudrepotype: "oci"makes it an OCI Helm repository. Flux’s choices fortypearedefaultfor a Helm HTTP/S repository andocifor an OCI Helm repository.urlstarts withoci://and ends at the repository, the address thathelm pushtakes on the Helm page. Flux expects an OCIurlto point to a registry repository (HelmRepository, URL).secretRef.nameis the Secret made above.intervalis set as in Flux’s own OCI example, though Flux’s documentation says an OCIHelmRepositoryignores it.
Install the chart
Section titled “Install the chart”apiVersion: helm.toolkit.fluxcd.io/v2kind: HelmReleasemetadata: name: docs-helm namespace: defaultspec: interval: 15m chart: spec: chart: docs-helm version: "1.0.0" sourceRef: kind: HelmRepository name: cloudrepo interval: 5mchartis the chart’s name alone, as Flux’s documentation says for aHelmRepositorysource, andversionis the version thathelm pulltakes on the Helm page (HelmChart, Chart and Version). Left out,versiondefaults to the latest version of the chart.sourceRefnames theHelmRepositoryabove, in the same namespace.- The two
intervalvalues are those of Flux’s own example of aHelmReleasefrom aHelmRepository(HelmRelease).
If a chart does not sync
Section titled “If a chart does not sync”Rule out the token and the address with Helm first. Log in and pull the same chart with the same token, as under Log in, push and pull on the Helm page. If Helm cannot, the Troubleshooting section there lists what CloudRepo answers for a refused token, a wrong address and a chart it cannot find.
If Helm pulls the chart and the tool does not, the token and the address work at CloudRepo with Helm’s client, and the difference is in the tool’s setup or in how the tool reaches the registry. Check your objects against the tool’s pages linked above, and email support@cloudrepo.io with the tool, its version, and the error it reports (never the token).