make
e.g.
docker tag quay.io/kiegroup/kie-cloud-operator:<version> quay.io/<your-registry-username>/kie-cloud-operator:<version>
docker push quay.io/<your-registry-username>/kie-cloud-operator:<version>
If the quay.io repository where the images were pushed is private, a pull secret will need to be configured, otherwise all operator related images must be public.
To install this operator on OpenShift 4 for end-to-end testing, make sure you have access to a quay.io (https://quay.io/) account to create an application repository. Follow the authentication instructions for Operator Courier to obtain an account token. This token is in the form of "basic XXXXXXXXX" and both words are required for the command.
Also note that the push command does not overwrite an existing repository, and it needs to be deleted before a new version can be built and uploaded. Once the bundle has been uploaded, create an Operator Source to load your operator bundle in OpenShift.
To create the bundle image follow the steps
- Create your own bundle
- Push the bundle on the container registry
- Build the index
- Push the index on the container registry
- Disable default catalog sources on Openshift
- Write your Catalog-source
- Create your catalog source on Openshift
- Write your Subscription
- Create your Subscription on Openshift
To Restore your cluster from your bundle image changes follow the steps
- Cleanup your catalog-source
i.e. 7.12.0-1 version Remove the following line from deploy/olm-catalog/dev/7.12.0-1/manifest/businessautomation-operator.clusterserviceversion.yaml
replaces: businessautomation-operator.<last-version>
Set your registry id, like quay username with USERNAME as env
export USERNAME=<your-registry-id>
activate Cekit and run the following command
$ make bundle-dev
the last log line is something like this:
INFO Image built and available under following tags: quay.io/<your_quay_username>/rhpam-operator-bundle:7.12.1, quay.io/${USERNAME}/rhpam-operator-bundle:latest
VERSION=$(go run getversion.go)
USERNAME=<your_quay_username>
$ docker push quay.io/${USERNAME}/rhpam-operator-bundle:${VERSION}
opm index add --bundles quay.io/${USERNAME}/rhpam-operator-bundle:${VERSION} --tag quay.io/${USERNAME}/rhpam-operator-index:${VERSION}
Log in into your quay.io account:
podman login quay.io
Push the index on your quay repository
podman push quay.io/${USERNAME}/rhpam-operator-index:${VERSION}
To test your Operator, with bundle and index you need to disable the default source like the operator hub
oc patch OperatorHub cluster --type json -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": true}]'
A catalog source is repository of CSVs, CRDs, and packages that define an application.
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: xxxxxname
namespace: openshift-marketplace
spec:
sourceType: grpc
image: xxxxximage
displayName: My Operator Catalog
publisher: grpc
Choose a CATALOG_SOURCE_NAME something like "my-operator-manifests"
Example of catalog-source.yaml
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: my-operator-manifests
namespace: openshift-marketplace
spec:
sourceType: grpc
image: quay.io/<your_quay_id>/rhpam-operator-index:7.12.1
displayName: My Operator Catalog
publisher: grpc
oc create -f catalog-source.yaml
A subscription keeps CSVs up to date by tracking a channel in a package.
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: businessautomation-operator
namespace: <your-namespace>
spec:
channel: stable
name: businessautomation-operator
source: $CATALOG_SOURCE_NAME
sourceNamespace: openshift-marketplace
Example of subscription.yaml
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: businessautomation-operator
namespace: my-namespace
spec:
channel: stable
name: businessautomation-operator
source: my-operator-manifests
sourceNamespace: openshift-marketplace
You could create the subscription copying the yaml in the the OCP UI or from cli with Openshift Client
oc create -f subscription.yaml
On OpenShift go to your project (e.g. my-namespace) to see your subscription and your operator, this could take a variable time to be visible.
After your test are completed, to restore the Operator hub and remove your catalog source delete your catalog source and run the following command:
oc patch OperatorHub cluster --type json -p '[{"op": "add", "path": "/spec/disableAllDefaultSources", "value": false}]'
It will take a few minutes for the operator to become visible under the OperatorHub section of the OpenShift console Catalog. It can be easily found by filtering the provider type to Custom.
Use the OLM console to subscribe to the Kie Cloud
Operator Catalog Source within your namespace. Once subscribed,
use the console to Create KieApp
or create one manually as seen below.
$ oc create -f deploy/crs/v2/kieapp_rhpam_trial.yaml
kieapp.app.kiegroup.org/rhpam-trial created
oc delete kieapp rhpam-trial
Change log level at runtime w/ the DEBUG
environment variable. e.g. -
make mod
make clean
DEBUG="true" operator-sdk run local --watch-namespace <namespace>
Also at runtime, change registry for rhpam ImageStreamTags -
INSECURE=true REGISTRY=<registry url> operator-sdk run local --watch-namespace<namespace>
Before submitting PR, please be sure to generate, vet, format, and test your code. This all can be done with one command.
make test
Requires cekit
v3.11 and rhpkg
-
# local build
make rhel
# scratch build
make rhel-scratch
# release candidate
make rhel-release
CSV Generation
make csv