There are two different verifications available, depending on what is being verified:
- The cluster deployment approach utilizes a built image, but without the OLM configuration of the OperatorHub approach.
- The OperatorHub way enables the validation of OperatorHub bundle configuration with an OpenShift environment. This includes all the necessary config for integration with OLM (Operator Lifecycle Manager).
This will deploy an image of the operator into a Kubernetes/OpenShift cluster.
docker login quay.ioMake and push a Docker image of the operator:
make docker-build docker-push IMG=quay.io/{user}/application-services-operator:{version}Utilize the operator make commands to install the CRD and deploy the operator:
make install
make deploy
cat <<EOF | kubectl apply -f -
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: application-services-metering-operator-admin
subjects:
- kind: ServiceAccount
name: application-services-metering-operator
namespace: default
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: ""
EOFVerify the operator is running:
kubectl get allInstall a Meter custom resource to commence metering:
cat <<EOF | kubectl apply -f -
apiVersion: applicationservices.redhat.com/v1
kind: Meter
metadata:
name: application-services-metering-operator
spec:
includeInfrastructure: true
meterCollectionEnabled: true
EOFThere are two repositories that can be used for verifying a new operator release:
One of these git repositories will be required to validate the operator through the OperatorHub.
- Podman running
- For macOS,
podman machine initand thenpodman machine start
- For macOS,
- OPM installed and available on path
From within a version directory under /operators/application-services-metering-operator, run:
operator-sdk bundle validate --select-optional name=operatorhub .This command provides details on any errors in the operator manifests that need resolution. At the current time, the following messages are expected and don't cause an issue:
ERRO[0000] Error: Value application-services-metering-operator: invalid service account found in bundle. sa name cannot match service account defined for deployment spec in CSV
ERRO[0000] Error: Value application-services-metering-operator: invalid service account found in bundle. sa name cannot match service account defined for deployment spec in CSV
WARN[0000] Warning: Value : (application-services-metering-operator.v0.6.0) csv.Spec.minKubeVersion is not informed. It is recommended you provide this information. Otherwise, it would mean that your operator project can be distributed and installed in any cluster version available, which is not necessarily the case for all projects.From the /operators/application-services-metering-operator directory:
podman build -f {version}/Dockerfile -t application-services-metering-operator:v{version} {version}/
podman push application-services-metering-operator:v{version} quay.io/{user}/application-services-metering-operator:v{version}Where {version} should be replaced with the version matching the bundle directory name for the version being tested.
Login in to quay.io:
podman login quay.ioPackage an OperatorHub catalog that includes the version of the operator to be verified:
opm index add --bundles quay.io/{user}/application-services-metering-operator:v{version} --from-index quay.io/operatorhubio/catalog:latest --tag quay.io/{user}/my-test-catalog:latestNOTE: Need to run podman login quay.io before each use of opm index!
podman push quay.io/{user}/my-test-catalog:latestWe need to update the OperatorHub catalog in the OpenShift instance used for testing.
Once logged in with oc login, run:
cat <<EOF | kubectl apply -f -
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: my-test-catalog
namespace: openshift-marketplace
spec:
sourceType: grpc
image: quay.io/{user}/my-test-catalog:latest
EOFAllow about 10s after success before accessing the OperatorHub to ensure it's been reloaded.
Open OperatorHub and search for "meter" to find the operator. Select it, verify the version available is the one added to the temporary catalog, and click "Install".
Once installed, open the operator view and click "Meter" and "Create Meter".
Be sure to select "includeInfrastructure" if you want to measure infrastructure components as well as application ones.
Click on "Monitoring" and then "Metrics" in the left hand menu of the OpenShift Console.
In the search field, start typing appsvcs_cpu_usage_cores or appsvcs_cores_by_product:sum,
select the desired metric, and then run the query.
If workloads are running that utilize the required labels, they will be aggregated under one of the three Application Services product areas: Runtimes, Integration, and Process Automation.