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

Unable to add OCI based GCP's Artifact Registry to Kubeapps #4284

Closed
jeunii opened this issue Feb 15, 2022 · 4 comments · Fixed by #4739
Closed

Unable to add OCI based GCP's Artifact Registry to Kubeapps #4284

jeunii opened this issue Feb 15, 2022 · 4 comments · Fixed by #4739
Assignees
Labels
awaiting-more-evidence Need more info to actually get it done. component/apprepository Issue related to kubeapps apprepository

Comments

@jeunii
Copy link

jeunii commented Feb 15, 2022

Description:

I am trying to add an OCI Registry to the App Repository. The OCI registry is GCP's Artifact Registry

OCI registry type is supported.

In GCP I have setup a test repo and can successfully deploy a helm release

helm install hello-chart oci://europe-west4-docker.pkg.dev/sap-cx-pipeline-prod/quickstart-helm-repo/hello-chart --version 0.1.0

NAME: hello-chart
LAST DEPLOYED: Tue Feb 15 14:31:46 2022
NAMESPACE: default
STATUS: deployed
...

I have followed the guide and my config looks like this

Screen Shot 2022-02-15 at 4 30 31 PM

I can create the repo in kubeapps successfully and its displayed on the UI

Screen Shot 2022-02-15 at 4 05 06 PM

But when I click on it I get the error

Unable to fetch package: Unable to get the available package versions for the package "gcp-artifactory-repo%2Fquickstart-helm-repo%2Fhello-chart" using the plugin "helm.packages": rpc error: code = InvalidArgument desc = Incorrect request.AvailablePackageRef.Identifier, currently just 'foo/bar' patters are supported: gcp-artifactory-repo%2Fquickstart-helm-repo%2Fhello-chart

Steps to reproduce the issue:

  1. Create an helm repo of type docker in GCP's artifact registry
  2. Create a Service Account in GCP, give it read rights to artifact registry and generate a token
  3. Add the repo in App Repository in Kubeapps

Describe the results you received:

I cannot view the helm chart in Catalogue section in Kubeapps. Refreshing the repo creates a cronjob which runs succesfully

kl apprepo-apps-sync-sap-cx-pipeline-prod-vwrzr-5bdnx -f

I0215 20:45:25.984389       1 sync.go:87] Last checksum: be382368038c7bccbc194240d29e4813bbde973c4db7469a3eee2668fc17b538
time="2022-02-15T20:45:26Z" level=info msg="icon not found" name="quickstart-helm-repo%2Fhello-chart"
I0215 20:45:26.416882       1 sync.go:115] Repository synced, shallow=false
I0215 20:45:26.419472       1 sync.go:124] Stored repository update in cache, repo.URL= https://europe-west4-docker.pkg.dev/sap-cx-pipeline-prod/
I0215 20:45:26.419494       1 sync.go:125] Successfully added the package repository sap-cx-pipeline-prod to database

The app repository controller also does not show any error

time="2022-02-15T20:45:23Z" level=info msg="Successfully synced 'apps/sap-cx-pipeline-prod'"
time="2022-02-15T20:45:23Z" level=info msg="Event(v1.ObjectReference{Kind:\"AppRepository\", Namespace:\"apps\", Name:\"sap-cx-pipeline-prod\", UID:\"da1febb8-24d2-4d07-8314-ed583d314623\", APIVersion:\"kubeapps.com/v1alpha1\", ResourceVersion:\"142628072\", FieldPath:\"\"}): type: 'Normal' reason: 'Synced' AppRepository synced successfully"

Describe the results you expected:

Expect to see the helm chart and deploy it.

Additional information you deem important (e.g. issue happens only occasionally):

I also uploaded version 0.2.0 to GCP's artifact repository but it still shows version 0.1.0 in kubeapps UI

In GCP:
Screen Shot 2022-02-15 at 4 13 43 PM

In Kubeapps after refreshing the repo
Screen Shot 2022-02-15 at 4 12 57 PM

I also see such errors

Screen Shot 2022-02-15 at 4 32 15 PM

In GCP

Screen Shot 2022-02-15 at 4 33 36 PM

Version of Helm, Kubeapps and Kubernetes:

  • Kubeapps version
v2.4.2
@absoludity
Copy link
Contributor

Originally discussed on slack. I've not bisected to see if it's a recent change since switching to the kubeapps-apis server (assume so) or something we've had in the OCI support from the start (doubt it?), but it seems we've enforced a helm package identifier of foo/bar which doesn't work when an OCI repository is itself partitioned with a slash.

@absoludity absoludity added kind/bug An issue that reports a defect in an existing feature size/S labels Feb 16, 2022
@ppbaena ppbaena added this to Kubeapps Mar 9, 2022
@ppbaena ppbaena moved this to 🗂. Backlog in Kubeapps Mar 9, 2022
@ppbaena ppbaena added next-iteration Issues to be discussed in planning session component/apprepository Issue related to kubeapps apprepository and removed next-iteration Issues to be discussed in planning session labels Mar 28, 2022
@ppbaena ppbaena added this to Kubeapps Mar 31, 2022
@ppbaena ppbaena moved this to 🗂 Backlog in Kubeapps Mar 31, 2022
@ppbaena ppbaena removed the size/S label Apr 1, 2022
@absoludity absoludity added the next-iteration Issues to be discussed in planning session label Apr 26, 2022
@antgamdia
Copy link
Contributor

I had a quick look at the issue (I have repro it, but using Harbor) and the problem seems to be twofold:

  1. As Michael pointed out at Return the repo name in a carvel a pkg summary #4716, we are forcing foo/bar patterns
  2. The (c *OCIRepoClient) GetChart in this file below is not prepared to unescape the chart name coming from the database:
assets=# SELECT ((info ->> 'ID')) FROM charts WHERE chart_id NOT ILIKE '%bitnami/%';
 oci/kubeapps
 oci/kube%2Fapps

but the URL it requests is:

I0518 14:26:22.178671       1 chart.go:417] XXX repoURL: https://harbor-repo.vmware.com/agamez
I0518 14:26:22.178732       1 chart.go:422] XXX url: https://harbor-repo.vmware.com/agamez
I0518 14:26:22.178782       1 chart.go:425] XXX ref: harbor-repo.vmware.com/agamez/kube%2Fapps:8.1.2-dev0

@antgamdia antgamdia self-assigned this May 18, 2022
@antgamdia antgamdia moved this from 🗂 Backlog to 🏗 In Progress in Kubeapps May 18, 2022
@antgamdia antgamdia moved this from 🏗 In Progress to 🔎 In Review in Kubeapps May 18, 2022
Repository owner moved this from 🔎 In Review to ✅ Done in Kubeapps May 19, 2022
Repository owner moved this from 🗂. Backlog to ✅. Done in Kubeapps May 19, 2022
@antgamdia
Copy link
Contributor

As per the comment at #4739 (comment):

Hello. Thank you for this. In which release should I be able to test this ?

Hi @jeunii, I'm reopening the issue since I didn't mean to close it before checking it with you first.

Since the modified component is kubeapps-apis, you only have to replace the "official" image with the one we build once a new commit gets merged into the main branch. For instance, you can execute:

kubectl scale deploy/kubeapps-internal-kubeappsapis -n kubeapps --replicas=0
kubectl set image deployment/kubeapps-internal-kubeappsapis -n kubeapps kubeappsapis=kubeapps/kubeapps-apis
kubectl scale deploy/kubeapps-internal-kubeappsapis -n kubeapps --replicas=1

If it doesn't work, you can always use our local chart; that is, cloning this project and installing the chart defined under /chart/kubeapps, which includes the latest build.

Let us know if this PR fixed your issue, otherwise, we will still continue to investigate it!

@antgamdia antgamdia reopened this May 19, 2022
Repository owner moved this from ✅ Done to 🗒 Todo in Kubeapps May 19, 2022
Repository owner moved this from ✅. Done to 🗒. To Do in Kubeapps May 19, 2022
@antgamdia antgamdia added the awaiting-more-evidence Need more info to actually get it done. label May 19, 2022
@antgamdia antgamdia moved this from 🗒 Todo to 🔎 In Review in Kubeapps May 19, 2022
@ppbaena ppbaena removed the next-iteration Issues to be discussed in planning session label May 23, 2022
@antgamdia antgamdia moved this from 🔎 In Review to ✅ Done in Kubeapps May 31, 2022
@ppbaena ppbaena moved this from ✅ Done to 🗂 Backlog in Kubeapps Jun 6, 2022
@ppbaena ppbaena removed the kind/bug An issue that reports a defect in an existing feature label Jun 6, 2022
@ppbaena
Copy link
Collaborator

ppbaena commented Jun 6, 2022

Hi @jeunii 👋 , could you take a look on this? Do you have any update related to this issue?

Repository owner moved this from 🗂 Backlog to ✅ Done in Kubeapps Jul 14, 2022
Repository owner moved this from 🗒. To Do to ✅. Done in Kubeapps Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-more-evidence Need more info to actually get it done. component/apprepository Issue related to kubeapps apprepository
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants