vmware-tanzu / kubeapps

A web-based UI for deploying and managing applications in Kubernetes clusters
Other
4.98k stars 706 forks source link

GetAvailablePackageSummaries returns empty list from OCI Registry #7269

Open kvaps opened 10 months ago

kvaps commented 10 months ago

Describe the bug

Catalog is empty when using FluxCD and OCI Registry.

To Reproduce Steps to reproduce the behavior:

Install Kubeapps with FluxCD

Create:

---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
  name: podinfo
spec:
  interval: 1m0s
  url: oci://ghcr.io/stefanprodan/charts
  type: "oci"
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmChart
metadata:
  name: podinfo
  namespace: default
spec:
  interval: 5m0s
  chart: podinfo
  reconcileStrategy: ChartVersion
  sourceRef:
    kind: HelmRepository
    name: podinfo
  version: '6.*'

Open Catalog, you'll get an empty list.

Request to /apis/kubeappsapis.core.packages.v1alpha1.RepositoriesService/GetPackageRepositorySummaries reutrns:

 grpc-message:
grpc-status: 0

Expected behavior

Screenshots

Screenshot 2024-01-03 at 23 15 40

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

kvaps commented 10 months ago

Also if you try to install helmchart using CLI:

---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: podinfo
  namespace: default
spec:
  interval: 10m
  timeout: 5m
  chart:
    spec:
      chart: podinfo
      version: '6.5.*'
      sourceRef:
        kind: HelmRepository
        name: podinfo
      interval: 5m
  releaseName: podinfo
  install:
    remediation:
      retries: 3
  upgrade:
    remediation:
      retries: 3
  test:
    enable: true
  values:
    replicaCount: 2

It will snow There is a problem with this package: this package has missing information, some actions might not be available.. warngin and not allow to upodate the release via Kubeapps:

Screenshot 2024-01-03 at 23 21 18

From the flux side, all the resources are ok:

# k get helmchart
NAME              CHART     VERSION   SOURCE KIND      SOURCE NAME   AGE   READY   STATUS
default-podinfo   podinfo   6.5.*     HelmRepository   podinfo       22m   True    pulled 'podinfo' chart with version '6.5.4'
podinfo           podinfo   6.*       HelmRepository   podinfo       27m   True    pulled 'podinfo' chart with version '6.5.4'
# k get helmrepository
NAME      URL                                 AGE   READY   STATUS
podinfo   oci://ghcr.io/stefanprodan/charts   27m   True    Helm repository is ready
# k get helmreleases
NAME      AGE   READY   STATUS
podinfo   26m   True    Release reconciliation succeeded
antgamdia commented 10 months ago

Thanks for filing the issue and providing information on how to repro it. I've been having a quick look at the issue and, yep, I can reproduce it. I'd say it is happening because of how Flux marks the repo as "ready" (source):

Because the OCI Helm repository is a data container, there’s nothing to report for READY and STATUS columns above. The existence of the object can be considered to be ready for use.

However, our logs show:

I0108 17:32:17.537549 1 repo.go:576] Skipping packages for repository [helmrepositories:default:podinfo] because it is not in 'Ready' state

It seems we wrongly have assumed a "ready" state would eventually pop up:

https://github.com/vmware-tanzu/kubeapps/blob/f0eb78b873378b00e29fc19b4b01efecb4d963bb/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/repo.go#L574

I assume (not 100% sure, though) adding this scenario ("a HelmRepo not explicitly ready, but pointing to an OCI repo") here would make the trick:

https://github.com/vmware-tanzu/kubeapps/blob/f0eb78b873378b00e29fc19b4b01efecb4d963bb/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/repo.go#L854