This operator manages the lifecycle of ManageIQ application on a OCP4 cluster.
There are five high level steps for running ManageIQ under operator control:
- Step 1. Deploy the ManageIQ Custom Resource Definition (CRD) (If it is not already.)
- Step 2. Ensure that you have a namespace to deploy in
- Step 3. Set up RBAC
- Step 4. Run The Operator
- Step 5. Perform any optional custom configurations
- Step 6. Run ManageIQ by creating the Custom Resource (CR)
The details of the five steps are as follows:
The ManageIQ CRD needs to be defined on the cluster. If it is already available it does not need to be created again.
To determine if it is already available execute command:
$ oc get crds | grep manageiqs.manageiq.org
If it is not already available it can be deployed with command:
$ oc create -f deploy/crds/manageiq.org_manageiqs_crd.yaml
If you don't already have a namespace to deploy into, you'll want to create one now. It's a good idea to deploy ManageIQ in its own namespace, although it can share a namespace if desired.
Use the following command to create a new namespace:
$ oc new-project manageiq
$ oc create -f deploy/role.yaml
$ oc create -f deploy/role_binding.yaml
$ oc create -f deploy/service_account.yaml
There are three different ways the operator can be run.
-
The default in the operator.yaml is for the latest manageiq-operator image. So no change is required. Simply create the operator.
$ oc create -f deploy/operator.yaml
-
1 - Build your operator image:
$ operator-sdk build docker.io/<your_username_or_organization>/manageiq-operator:latest
2 - Push your new custom image to the registry:
$ docker push docker.io/<your_username_or_organization>/manageiq-operator:latest
3 - Update the operator deployment yaml file with your custom image:
$ sed -i 's|docker.io/manageiq/manageiq-operator:latest|docker.io/<your_username_or_organization>/manageiq-operator:latest|g' deploy/operator.yaml
4 - Run your custom image from the registry:
$ oc create -f deploy/operator.yaml
-
$ operator-sdk run --local --namespace=<your namespace>
see the Customizing the installation section below
$ oc create -f deploy/crds/manageiq.org_v1alpha1_manageiq_cr.yaml
To create the bundle image and push it to an image registry do:
$ operator-sdk bundle create docker.io/example/manageiq-bundle:0.0.1 --image-builder podman --directory deploy/olm-catalog/manageiq-operator/0.0.1/ --channels alpha --default-channel alpha
$ podman push docker.io/example/manageiq-bundle:0.0.1
ManageIQ can be run with an external messaging server. To do this, create the required OpenShift secret with the correct parameters using the template for messaging and provide those secret names as kafkaSecret
in manageiq.org_v1alpha1_manageiq_cr.yaml
.
If you want to use a custom TLS certificate, one can be created with:
oc create secret tls tls-secret --cert=tls.crt --key=tls.key` and setting the secret name as `tlsSecret` in `manageiq.org_v1alpha1_manageiq_cr.yaml`.
If authentication is required in order to pull the images, a secret containing the credentials needs to be created.
If your secret is named image-pull-secret
, no additional changes are required to the custom resource.
If you use a different name for the secret, that will need to be defined in the custom resource as imagePullSecret: your-secret-name
Modify deploy/crds/manageiq.org_v1alpha1_manageiq_cr.yaml
as follows:
Note: The domain here will work for a Code Ready Containers cluster. Change it to one that will work for your environment. Additional parameters are available and documented in the Custom Resource Definition
apiVersion: manageiq.org/v1alpha1
kind: ManageIQ
metadata:
name: miq
spec:
applicationDomain: "miqproject.apps-crc.testing"
To run ManageIQ with OpenID-Connect Authentication, include these steps at Step 5. Perform any optional custom configurations from above.
For this example we tested with Keycloak version 11.0
- Create a secret containing the OpenID-Connect's
Client ID
andClient Secret
You pick the name for <name of your openshift client secret>
The values for CLIENT_ID
and CLIENT_SECRET
come from your Keycloak client definition.
$ oc create secret generic <name of your openshift client secret> \
--from-literal=CLIENT_ID=<your Keycloak client ID> \
--from-literal=CLIENT_SECRET=<your Keycloak client secret>
- Modify the Custom Resource (CR) .yaml file to identify your OpenID-Connect provider URL and the secret just created.
Here is an example of deploy/crds/manageiq.org_v1alpha1_manageiq_cr.yaml
for OpenID-Connect authentication:
apiVersion: manageiq.org/v1alpha1
kind: ManageIQ
metadata:
name: miq
spec:
applicationDomain: "miqproject.apps-crc.testing"
httpdAuthenticationType: openid-connect
oidcProviderURL: https://<your keycloak FQDN>/auth/realms/<your Keycloak Realm>/.well-known/openid-configuration
oidcClientSecret: <name of your openshift client secret>
To configure OpenID-Connect with a CA certificate follow these steps:
- Acquire the CA certificate
Precisely how to obtain the CA certificate is beyond the scope of this document. These instructions assume the CA certificate has been retrieved and stored as a file on the local system.
- Create a secret containing the CA certificate
You pick the name for <name of your openshift OIDC CA cert>
oc create secret generic <name of your openshift OIDC CA cert> --from-file=<path to your OIDC CA cert file>
- Modify the Custom Resource (CR) .yaml file to identify the secret just created.
Add a line for the oidcCaCertSecret:
under the spec:
section:
...
spec:
...
oidcCaCertSecret: <name of your openshift OIDC CA cert>
Uninstalling only involves a few steps:
WARNING: This includes Persistent Volume Claims and secrets, so all data stored by ManageIQ will be removed. The following command removes everything except for the operator:
$ oc delete -f deploy/crds/manageiq.org_v1alpha1_manageiq_cr.yaml
If you deployed the operator using Step 4 option 1 or 2, run the following to remove it:
$ oc delete -f deploy/operator.yaml
$ oc delete -f deploy/role.yaml
$ oc delete -f deploy/role_binding.yaml
$ oc delete -f deploy/service_account.yaml
$ oc delete project manageiq
WARNING: Ensure that there are no other ManageIQs running on the cluster since this is a cluster-wide change.
$ oc delete -f deploy/crds/manageiq.org_manageiqs_crd.yaml