Publishing Operators using Custom Operator Registry [STEP-4]

 


1. Download opm from the url given below 
    

      https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/latest-4.6/

      Download file with name opm-linux-*.tar.gz  [* version number]

2. Install opm

    Go to the downloaded path,extract and install      

    tar xvf opm-linux-4.6.52.tar.gz

    mv opm /usr/local/bin/

3. Generate custom service version.

  cd /root/web

 operator-sdk generate csv --csv-version 1.0.0 --interactive=true

 Above command will ask for inputs. Will results in creating a directory  /root/web/deploy/olm-catalog



4. Copy resources files.

   cp /root/web/deploy/service_account.yaml  /root/web/deploy/olm-catalog/web/manifests/ 

   cp /root/web/deploy/role.yaml  /root/web/deploy/olm-catalog/web/manifests/ 

   gedit /root/web/deploy/olm-catalog/web/manifests/role_binding.yaml

   Add content from following url: https://github.com/anandpavithran/operator-yaml/role_binding.yaml


5. Build and publish operator bundle using the following commands.

    operator-sdk bundle create --generate-only

    podman build -f bundle.Dockerfile -t quay.io/yourreponame/web-bundle:1.0.0 . 

    [Note: A dot at the end]

    podman push quay.io/yourreponame/web-bundle:1.0.0 

    [Note: Don't forget to make repository public] 


6. Validate the bundle manifest

   operator-sdk bundle validate /root/web/deploy/olm-catalog/web 


7. Add the bundle in to registry image and publish it.

  opm index add --bundles quay.io/anandpavithran/web-bundle:1.0.0

--tag quay.io/anandpavithran/operator-registry:0.1-RC --build-tool podman

  podman push quay.io/anandpavithran/operator-registry:0.1-RC

[Note: Don't forget to make repository public] 


8. Verify the Catalog Source and pod  by using following command 

  oc get catalogsource,pod -n openshift-marketplace 


9. Configure Catalog Source on Openshift and verify.

    gedit /root/catalog-source.yaml

    Copy the content from file catalog-source.yaml of  https://github.com/anandpavithran/operator-yaml/catalog-source.yaml 

Edit :Replace 'yourname'

oc create -f catalog-source.yaml

oc get catalogsource,pod -n openshift-marketplace 



10. Install WEB operator and  test.



Ensure steps in following links have completed


Step-2

Step-3 [Up to step-7]
https://openshift-operator-intro.blogspot.com/2022/01/creating-simple-web-operator-using.html

Comments

Popular posts from this blog

Install Go [STEP-1]

Install Operator-SDK on Linux-[STEP-2]

Creating a simple Web Operator using Operator SDK Ansible framework-[STEP-3]