operator-framework / kubectl-operator

Manage Kubernetes Operators from the command line
https://operatorframework.io/
Apache License 2.0
129 stars 37 forks source link

Failure when adding catalog on macOS #18

Closed its-dave closed 4 years ago

its-dave commented 4 years ago

I am unable to add a particular catalog when running the command kubectl operator catalog add --display-name "IBMCS Operators" --publisher IBM --timeout 15m0s --namespace openshift-marketplace opencloud-operators docker.io/ibmcom/ibm-common-service-catalog:latest which fails with failed to add catalog: get image labels: no match for platform in manifest sha256:3e3fc1e8ff0900bf3ba9b8702a63d65b68d30e5bf4e6b4ce66966c9808fb97eb: not found Other catalogs are able to be added successfully.

Running against OCP 4.4.9 Manifest is able to be pulled with local docker client. Running on macOS 10.15.6, kubectl 1.16.6 / oc 4.2

its-dave commented 4 years ago

I cannot recreate this issue when running on Linux, so I assume it is macOS-specific.

joelanford commented 4 years ago

It looks like docker.io/ibmcom/ibm-common-service-catalog:latest is a manifest list and the kubectl operator plugin is attempting to resolve the manifest list to a platform-specific image.

The reason for getting the labels in the first place is to auto-populate display name and publisher from catalog image labels, but that's not actually part of the index image spec. See https://github.com/operator-framework/kubectl-operator/issues/3. So we could consider just dropping the image label fetching.

The workaround would be to specify the platform-specific image directly in the catalog add call rather than using the manifest list reference.

For example, if targetting a linux/amd64 cluster, you could call it like this:

kubectl operator catalog add \
  --display-name "IBMCS Operators" \
  --publisher IBM \
  --timeout 15m0s \
  --namespace openshift-marketplace \
  opencloud-operators \
  docker.io/ibmcom/ibm-common-service-catalog@sha256:1cfaf28fb2d13cdc377cfa61bf2c6e945a1a42e4d901f2e116566f25b280bc53