Automation with Scripts¶
Automation scripts are the recommended way to deploy the sample operators. The scripts provide the following functions:
- Verify workstation prerequisites
- Install prerequisite components to a Kubernetes or OpenShift cluster
- Create a 'demo environment' which deploys working golden images to a Kubernetes or OpenShift cluster
- Continous integration deployment which builds all operators & applications, pushes to a registry and deploys the images using OLM to either Kubernetes or OpenShift
Required Setup¶
Ensure you have followed the steps in the prerequisites section
If you created a version_local.env
file because you plan to build new container images, open a terminal window and use the versions_local.env
as input for your environment variables:
source versions_local.env
podman login $REGISTRY
Script automation process¶
The script automation does following:
The functionality has variations depending on the script you are going to use.
-
It ensures that with two
versions.env
files the tagging for the container images works in a consistent way. -
versions.env
for golden sources -
versions_local.env
for custom local configurations your version ofversions_local.env-template
-
It creates a temp
github tag
related to the last commit before the automation was started. -
It creates various logs
script-automation.log
these files which will not be loaded to the git repo. -
Resets the cluster environment:
- OLM installation
- Cert manager installation
- Prometheus operator installation
- Clean the installed operators
-
Creates following containers images:
-
Database operator
relatedDatabase-service
operator-database
operator-database-backup
operator-database-bundle
, this is a container image which will be created by the operator-sdk and will be used later inside theoperator-database-catalog
which is relevant forOLM
usage.operator-database-catalog
, this container image contains a reference to theoperator-database-bundle
and will be used in the context ofOLM
-
Application operator
relatedsimple-microservice
operator-application-autoscaler
operator-application
operator-application-bundle
, that is a container image which will be created by the operator-sdk and will be used later inside theoperator-application-catalog
which is relevant forOLM
usage.operator-application-catalog
, that container image contains a reference to theoperator-application-bundle
and will be used in the context ofOLM
-
-
It uses templates to generate OLM deployment resources. The resources in the repo under folders 'olm' are not used by the script.
-
Resets the
podman
vm if needed and starts podman. -
It creates
role.yaml
,role-binding.yaml
,clusterserviceversion.yaml
and sample custom resources for the given operators, based on templates. -
It verifies the pre-requisites.
-
Setup of the needed
bin
directory of the operator-sdk projects. (controller-gen
,kustomize
,opm
,setup-envtest
)