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

[ppc64le] bundle image generated using bundle and bundle-build targets incompatible with opm #1923

Closed
amitsadaphule opened this issue Jan 19, 2021 · 16 comments
Labels
area/olm Related to the Operator Lifecycle Manager kind/question Further information is requested

Comments

@amitsadaphule
Copy link
Contributor

amitsadaphule commented Jan 19, 2021

SUMMARY

I was able to build the binary and image on ppc64le platform. Also, I was able to get kamel install and kamel run commands to work with --olm=false flag on ocp cluster (4.6.8). But in order to get this to work with OLM, I did the following steps in order to use the bundle image to create a custom catalog source for camel-k:

make bundle
operator-sdk bundle validate ./bundle
sed -i 's/docker.io\/apache\/camel-k:1.3.0-SNAPSHOT/image-registry.openshift-image-registry.svc:5000\/camelk\/camel-k:1.3.0/g' bundle/manifests/camel-k.clusterserviceversion.yaml
cd bundle
podman build -f Dockerfile -t docker.io/amitsadaphule/camel-k-bundle:1.3.0 .
podman login docker.io -u amitsadaphule -p <password>
podman push docker.io/amitsadaphule/camel-k-bundle:1.3.0
opm index add -u podman --bundles docker.io/amitsadaphule/camel-k-bundle:1.3.0 --tag $HOST/camelk/camel-k-catalog:1.3.0 -p podman

But that failed with the error "Invalid bundle", log below:

# opm index add -u podman --bundles docker.io/amitsadaphule/camel-k-bundle:1.3.0 --tag $HOST/camelk/camel-k-catalog:1.3.0 -p podman
INFO[0000] building the index                            bundles="[docker.io/amitsadaphule/camel-k-bundle:1.3.0]"
INFO[0000] running /usr/bin/podman pull docker.io/amitsadaphule/camel-k-bundle:1.3.0  bundles="[docker.io/amitsadaphule/camel-k-bundle:1.3.0]"
INFO[0002] running podman create                         bundles="[docker.io/amitsadaphule/camel-k-bundle:1.3.0]"
INFO[0002] running podman cp                             bundles="[docker.io/amitsadaphule/camel-k-bundle:1.3.0]"
INFO[0003] running podman rm                             bundles="[docker.io/amitsadaphule/camel-k-bundle:1.3.0]"
INFO[0003] Could not find optional dependencies file     dir=bundle_tmp870838915 file=bundle_tmp870838915/metadata load=annotations
INFO[0003] found csv, loading bundle                     dir=bundle_tmp870838915 file=bundle_tmp870838915/manifests load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp870838915/manifests file=camel-k-operator_v1_serviceaccount.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp870838915/manifests file=camel-k.clusterserviceversion.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp870838915/manifests file=camel.apache.org_builds.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp870838915/manifests file=camel.apache.org_camelcatalogs.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp870838915/manifests file=camel.apache.org_integrationkits.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp870838915/manifests file=camel.apache.org_integrationplatforms.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp870838915/manifests file=camel.apache.org_integrations.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp870838915/manifests file=camel.apache.org_kameletbindings.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp870838915/manifests file=camel.apache.org_kamelets.yaml load=bundle
ERRO[0004] permissive mode disabled                      bundles="[docker.io/amitsadaphule/camel-k-bundle:1.3.0]" error="Invalid bundle camel-k.v1.3.0, replaces nonexistent bundle camel-k-operator.v1.2.0"
Error: Invalid bundle camel-k.v1.3.0, replaces nonexistent bundle camel-k-operator.v1.2.0

camel-k VERSION

Camel K Client 1.3.0

OS, environment

RHEL 8.2 ppc64le
OCP 4.6.8

Expected Results

opm index add should be successful in creating the catalog image, which can then be used to create a catalogsource, which in turn can help with OLM based installation of the operator.

References

https://medium.com/swlh/deploying-operator-webhooks-with-olm-be5612795840
http://krsacme.com/k8s-operator-custom-catalog/
https://redhat-connect.gitbook.io/certified-operator-guide/ocp-deployment/openshift-deployment
https://www.openshift.com/blog/custom-operator-registry-catalog-source-for-openshift-4.5

Please help me resolve this issue or point me in the right direction to test the OLM based installation using locally generated camel-k image. Thanks!

@astefanutti
Copy link
Member

Thanks a lot for the detailed report.

It seems there is an issue with the replaces field of the bundle:

replaces: camel-k-operator.v1.2.0

Could you please try by removing the field from the CSV?

@amitsadaphule
Copy link
Contributor Author

Thanks @astefanutti ! That got rid of the opm error. Will check further installation now :)

@astefanutti
Copy link
Member

@amitsadaphule thanks a lot for the feedback. Let us know if you face any other issues.

@amitsadaphule
Copy link
Contributor Author

@astefanutti I was able to get the catalogsource added to the local cluster for camel-k with the following yaml:

apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: camel-k-catalog
  namespace: openshift-marketplace
spec:
  sourceType: grpc
  image: image-registry.openshift-image-registry.svc:5000/camelk/camel-k-catalog:1.3.0
  displayName: Camel K catalog
  publisher: Amit Sadaphule

Logs:

# oc create -f catalog-source.yaml
catalogsource.operators.coreos.com/camel-k-catalog created
# oc get catalogsources -A | grep camel
openshift-marketplace   camel-k-catalog       Camel K catalog       grpc   Amit Sadaphule   41m
# oc get packagemanifest -A | grep camel
openshift-marketplace   knative-camel-operator                               Community Operators   21d
openshift-marketplace   red-hat-camel-k                                      Red Hat Operators     21d
openshift-marketplace   camel-k                                              Community Operators   21d
openshift-marketplace   camel-k                                              Camel K catalog       41m

Also, when I executed kamel install for this new package, logs show as if everything is installed as expected. I also see the subscription being added. But the operator does not come up. Logs below:

# ./kamel install --cluster-setup --olm-source=camel-k-catalog --olm-source-namespace=openshift-marketplace
OLM is available in the cluster
Camel K cluster setup completed successfully
# ./kamel install --olm=true --olm-source=camel-k-catalog --olm-source-namespace=openshift-marketplace --force
OLM is available in the cluster
OLM resources are already available: skipping installation
Camel K installed in namespace camelk via OLM subscription
# oc get subscriptions -A | grep camel
camelk      camel-k   camel-k   camel-k-catalog   stable
# oc get all -A | grep camel
openshift-marketplace                              pod/camel-k-catalog-wmqv8                                             1/1     Running     0          42m
openshift-marketplace                              service/camel-k-catalog                            ClusterIP      172.30.176.6     <none>                                 50051/TCP                      42m
camelk      imagestream.image.openshift.io/camel-k                      default-route-openshift-image-registry.apps.shivani-2-46.openshift.com/camelk/camel-k                         1.3.0                                                    3 hours ago
camelk      imagestream.image.openshift.io/camel-k-catalog              default-route-openshift-image-registry.apps.shivani-2-46.openshift.com/camelk/camel-k-catalog                 1.3.0                                                    About an hour ago

I'm not sure what's going wrong here. Am I missing something obvious? Thanks in advance!

@astefanutti
Copy link
Member

Could you please provide the whole definition of the Subscription that is created by the kamel install command?

Also, as a work-around, you may be able to work through this from the OpenShift Web console instead of the Kamel CLI. You should be able to find your CatalogSource from the Operator Hub UI, and then create a Subscription there.

@amitsadaphule
Copy link
Contributor Author

Here is the subscription definition:

# oc describe subscriptions camel-k -n camelk
Name:         camel-k
Namespace:    camelk
Labels:       operators.coreos.com/camel-k.camelk=
Annotations:  <none>
API Version:  operators.coreos.com/v1alpha1
Kind:         Subscription
Metadata:
  Creation Timestamp:  2021-01-20T16:57:54Z
  Generation:          1
  Managed Fields:
    API Version:  operators.coreos.com/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:spec:
        .:
        f:channel:
        f:config:
          .:
          f:resources:
        f:installPlanApproval:
        f:name:
        f:source:
        f:sourceNamespace:
    Manager:      kamel
    Operation:    Update
    Time:         2021-01-20T16:57:54Z
    API Version:  operators.coreos.com/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:labels:
          .:
          f:operators.coreos.com/camel-k.camelk:
    Manager:      olm
    Operation:    Update
    Time:         2021-01-20T16:57:54Z
    API Version:  operators.coreos.com/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:status:
        .:
        f:catalogHealth:
        f:conditions:
        f:lastUpdated:
    Manager:         catalog
    Operation:       Update
    Time:            2021-01-20T16:57:55Z
  Resource Version:  7334261
  Self Link:         /apis/operators.coreos.com/v1alpha1/namespaces/camelk/subscriptions/camel-k
  UID:               e7c90af7-7caf-4d76-995f-56a5e508f53c
Spec:
  Channel:  stable
  Config:
    Resources:
  Install Plan Approval:  Automatic
  Name:                   camel-k
  Source:                 camel-k-catalog
  Source Namespace:       openshift-marketplace
Status:
  Catalog Health:
    Catalog Source Ref:
      API Version:       operators.coreos.com/v1alpha1
      Kind:              CatalogSource
      Name:              camel-k-catalog
      Namespace:         openshift-marketplace
      Resource Version:  7296672
      UID:               a76c1401-cab4-41c5-975f-2113de4c263f
    Healthy:             true
    Last Updated:        2021-01-20T16:57:55Z
    Catalog Source Ref:
      API Version:       operators.coreos.com/v1alpha1
      Kind:              CatalogSource
      Name:              certified-operators
      Namespace:         openshift-marketplace
      Resource Version:  7331642
      UID:               0b2e175e-496b-4520-85ad-fdd0a5085bd8
    Healthy:             true
    Last Updated:        2021-01-20T16:57:55Z
    Catalog Source Ref:
      API Version:       operators.coreos.com/v1alpha1
      Kind:              CatalogSource
      Name:              community-operators
      Namespace:         openshift-marketplace
      Resource Version:  7333327
      UID:               461fcdda-331f-4526-8ec8-e8337e18b2d8
    Healthy:             true
    Last Updated:        2021-01-20T16:57:55Z
    Catalog Source Ref:
      API Version:       operators.coreos.com/v1alpha1
      Kind:              CatalogSource
      Name:              redhat-marketplace
      Namespace:         openshift-marketplace
      Resource Version:  7331623
      UID:               1053d4ab-c99e-4b63-ba1a-bfceac4e4727
    Healthy:             true
    Last Updated:        2021-01-20T16:57:55Z
    Catalog Source Ref:
      API Version:       operators.coreos.com/v1alpha1
      Kind:              CatalogSource
      Name:              redhat-operators
      Namespace:         openshift-marketplace
      Resource Version:  7331492
      UID:               982c539d-9d7d-4e61-964d-4fe1f9e208c6
    Healthy:             true
    Last Updated:        2021-01-20T16:57:55Z
  Conditions:
    Last Transition Time:  2021-01-20T16:57:55Z
    Message:               all available catalogsources are healthy
    Reason:                AllCatalogSourcesHealthy
    Status:                False
    Type:                  CatalogSourcesUnhealthy
  Last Updated:            2021-01-20T16:57:55Z
Events:                    <none>

Also, I had tried to manually create the subscription with the following yaml:

apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: camel-k-subscription
  namespace: openshift-operators
spec:
  channel: stable
  name: camel-k
  source: camel-k-catalog
  sourceNamespace: openshift-marketplace
  installPlanApproval: Automatic
# oc create -f subscription.yaml
subscription.operators.coreos.com/camel-k-subscription created

But that had the same behavior too. No operator pod was shown.

@astefanutti
Copy link
Member

Could you please check the PackageManifest created for your CatalogSource, and make sure the Subscription matches the PackageManifest information? You can follow the documentation from: https://github.com/operator-framework/operator-registry#using-the-index-with-operator-lifecycle-manager.

@amitsadaphule
Copy link
Contributor Author

Thanks a lot @astefanutti ! The following command did the trick:

# ./kamel install --olm-source=camel-k-catalog --olm-source-namespace=openshift-marketplace --olm-channel=alpha
OLM is available in the cluster
Camel K installed in namespace camelk via OLM subscription

in combination with the catalog-source.yaml:

apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: camel-k-catalog
  namespace: openshift-marketplace
spec:
  sourceType: grpc
  image: image-registry.openshift-image-registry.svc:5000/camelk/camel-k-catalog:1.3.0
  displayName: Camel K catalog
  publisher: Amit Sadaphule
# oc get all -A | grep camel
camelk                                             pod/camel-k-operator-7fbb745899-qflcb                                 1/1     Running     0          8s
openshift-marketplace                              pod/camel-k-catalog-m8f9g                                             1/1     Running     0          4m38s
openshift-marketplace                              service/camel-k-catalog                            ClusterIP      172.30.96.139    <none>                                 50051/TCP                      4m38s
camelk                                             deployment.apps/camel-k-operator                         1/1     1            1           11s
camelk                                             replicaset.apps/camel-k-operator-7fbb745899                         1         1         1       9s
camelk      imagestream.image.openshift.io/camel-k                      default-route-openshift-image-registry.apps.shivani-2-46.openshift.com/camelk/camel-k                         1.3.0                                                    8 hours ago
camelk      imagestream.image.openshift.io/camel-k-catalog              default-route-openshift-image-registry.apps.shivani-2-46.openshift.com/camelk/camel-k-catalog                 1.3.0                                                    6 hours ago

@astefanutti
Copy link
Member

Great, thanks for the feedback.

It may be useful that we document these steps of deploying to OLM from source.

@amitsadaphule
Copy link
Contributor Author

Yes, I'll share the link once I publish the build script and documents.

@astefanutti astefanutti added area/olm Related to the Operator Lifecycle Manager kind/question Further information is requested labels Jan 25, 2021
@amitsadaphule
Copy link
Contributor Author

I've published the build-script for ppc64le and the documentation related to validation on Openshift at https://github.com/ppc64le/build-scripts/tree/master/c/camel-k

@astefanutti
Copy link
Member

Thanks for the update. Do you think some of this documentation could be included into Camel K documentation? I'm thinking about the OLM deployment from source for example, that is not cover in the existing documentation AFAIK:

https://github.com/ppc64le/build-scripts/tree/master/c/camel-k#olm-installation-and-validation

@amitsadaphule
Copy link
Contributor Author

Sure @astefanutti ! I'll try and raise a PR in next week with that documentation.

@astefanutti
Copy link
Member

Awesome, thanks @amitsadaphule!

@amitsadaphule
Copy link
Contributor Author

@astefanutti, I've raised #2001. Please review and let me know your feedback.

@astefanutti
Copy link
Member

Thanks @amitsadaphule, I've just reviewed the PR. What do think about closing this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/olm Related to the Operator Lifecycle Manager kind/question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants