kubeapps icon indicating copy to clipboard operation
kubeapps copied to clipboard

GetAvailablePackageSummaries returns empty list from OCI Registry

Open kvaps opened this issue 2 years ago • 2 comments

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

  • Available podinfo chart in Catalog

Screenshots

Screenshot 2024-01-03 at 23 15 40

Desktop (please complete the following information):

  • Version v2.9.0
  • Kubernetes version v1.29.0-rc.1
  • Package version:
flux: v2.0.1
helm-controller: v0.36.2
image-automation-controller: v0.36.1
image-reflector-controller: v0.30.0
kustomize-controller: v1.1.1
notification-controller: v1.1.0
source-controller: v1.1.2

Additional context Add any other context about the problem here.

kvaps avatar Jan 03 '24 22:01 kvaps

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

kvaps avatar Jan 03 '24 22:01 kvaps

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

antgamdia avatar Jan 08 '24 17:01 antgamdia