🔴 IMPORTANT: Don't commit any changes made by the script automation to the repository! Only the persons who are responsible for the golden source are allowed to do that!
The documentation is structured in following sections.
- Technical environment
- Setup your environment
- The script automation
- Types of scripts
- Script parameters
🔴 IMPORTANT: For the opm tool installation please read the blog post or just copy the
bin
folder of an existing projectOperator SDK
project to the cloned github project directory, or run the available script automation in b).
OS | Version | Tested |
---|---|---|
macOS | 12.3.1 | OK |
macOS | 11.2.3 | OK |
Table of verifications
Operator | Cluster | Type | Region | Security Group | Public Gateway | Container Registry | Tested | Note |
---|---|---|---|---|---|---|---|---|
Database | Kubernetes (1.23.6_1527) | VPC | us-south | Validated | Validated | Quay.io |
OK | |
Application (microservice) | Kubernetes (1.23.6_1527) | VPC | us-south | Validated | Validated | DockerHub |
Problems | Can't be pulled from DockerHub. Solution delete repo on DockerHub and recreate it. |
Application | OpenShift | VPC | us-south | Validated | Validated | DockerHub and Quay |
Problems | Instance of operators.coreos.com can't be deleted. |
Application | OpenShift | VPC | us-south | Validated | Validated | DockerHub and Quay |
Problems | Operator instance can't be created when using the automation script. |
All local installation versions are related to macOS. You can run to verify the prerequisites the following script. The scipt informs you if the tools are installed, but you need to verify the versions in the terminal output with the version in the following table.
sh scripts/check-prerequisites.sh
Setup of the needed bin
files (controller-gen
, kustomize
, opm
, setup-envtest
) for the operator-sdk projects.
The script will create a temp operator sdk project, to create a the bin file and delete that temp project when it was finished.
sh scripts/check-binfiles-for-operator-sdk-projects.sh
Note: You need to interact with the script, because when you create the first time a bundle. These are the temp values you can use for the script execution. These are the example values:
'Display name : myproblemfix'
,Description : myproblemfix
,Provider's name: myproblemfix
,Any relevant URL:
,Comma-separated keywords : myproblemfix
Comma-separated maintainers: myproblemfix@myproblemfix.net
.
- Example output:
*** Bin folder status: operator-database
controller-gen kustomize opm setup-envtest
*** Bin folder status: operator-database
controller-gen kustomize opm setup-envtest
Tools or frameworks | Version/s | (G)obal, (L) ocal or (C)loud installed | Tested |
---|---|---|---|
Podman Client / Server | 4.1.0 / 4.3.0 | G | OK |
Operator SDK | v1.18.0, v1.18.1, v1.19.1 | G | OK |
Go | go1.17.6 (operator-sdk v1.18.0, v1.18.1 ) (worked also with v1.19.1 ) | G | OK |
Go | go1.17.8 (operator-sdk v1.19.1) | G | NOT TESTED |
Kubernetes cluster (VPC) | 1.23.6_1527 | C | OK |
kubectl client | 1.23 | L | OK |
kubectl server | v1.23.6+IKS | C | OK |
oc server | 4.7.0 | C | OK |
oc client | 4.10.9 | C | OK |
operator-database/bin/opm | v1.21.0 | L | OK |
operator-application/bin/opm | v1.21.0 | L | OK |
bash | GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin21) | L | OK |
sed | 12.3.1 | L | OK |
awk | awk version 20200816 | L | OK |
cURL | 7.79.1 | L | OK |
grep | 2.6.0-FreeBSD | L | OK |
tar | bsdtar 3.5.1 | L | OK |
container registry | DockerHub, Quay(Red Hat) | C | OK |
IBM Cloud Services used | Version | Tested |
---|---|---|
IBM Cloud Kubernetess Service (on VPC) | v1.23.6+IKS | OK |
Red Hat OpenShift on IBM Cloud (on VPC) | 4.10.9_1515 | OK |
IBM Cloud Object Storage | TBD | TBD |
IBM Cloud 'Virtual Private Cloud' | TBD | TBD |
If you want to run the samples without modifications, nothing needs to be changed.
If you want to change them, replace REGISTRY
and ORG
with your registry account and change the version numbers in versions_local.env
file.
- Create a
version_local.env
file based on the template.
cat versions_local.env-template > versions_local.env
- Open the
versions_local.env
in Visual Studio Code
code versions_local.env
- Change the values to your needs
export REGISTRY='quay.io'
export ORG='tsuedbroecker'
export COMMON_TAG='v1.0.36'
- Open a terminal in the project and use the
versions_local.env
as input for your environment variables
source versions_local.env
podman login $REGISTRY
The following image shoew a simplified system overview of the system we are going to setup with the automation scripts.
The current 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 sourcesversions_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 load to the git repo. -
Resets the cluster environment:
- OLM installation
- Cert manager installation
- Prometheus operator installation
- Clean the installed operators and application to that example
-
Creates following containers images:
-
Database operator
relatedDatabase-service
(quarkus application), a custom database which provides stateful setsoperator-database
(operator), this operator creates an instance of theDatabase-service
operator-database-backup
(quarkus application), this is an application which will be instantiated later from theoperator-database
to create a backup on an object storage databaseoperator-database-bundle
, that is a container image which will be created by the operator-sdk and will be used later inside theoperator-database-catalog
which is relevant for theOLM
usage.operator-database-catalog
, that container image contains a reference to theoperator-database-bundle
and will be used in the context ofOLM
-
Application operator
relatedsimple-microservice
(quarkus application), a simple microservice to display messages and runs as a stateless applicationoperator-application-autoscaler
(go application), that application implements a cron job to manage the scaling for the instances of thesimple-microservice
which were created by theoperator-application
operator.operator-application
(operator), this operator creates an instance of thesimple-microservice
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 for theOLM
usage.operator-application-catalog
, that container image contains a reference to theoperator-application-bundle
and will be used in the context ofOLM
-
-
It ensures based on templates that the manual configuration for the
operator-application
templates andoperator-database
templates are right configured to be ready for OLM usage. There are templates forKubernetes
and forOpenShift
. -
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
) -
Resto
There are five types of scripts:
- check
- install-required
- demo
- ci
- delete
-
Definition:
xxx == Kubernetes or OpenShift
-
Table overview:
Installs the required components for Kubernetes or OpenShift.
Component | Kubernetes | OpenShift |
---|---|---|
CertManager | Yes | Yes |
OLM | Yes | No |
Prometheus Operator | Yes | No |
Prometheus Instance | Yes | Only configuration |
Setup or delete based on the golden source versions (version.env).
- Definition:
yyy == Kubernetes or OpenShift
xxx == delete or setup
- Table overview:
Name | Kubernetes | OpenShift | Parameters |
---|---|---|---|
demo-kubernetes-operators.sh | Yes | No | app demo reset |
demo-kubernetes-operator-application.sh | Yes | No | demo reset |
demo-kubernetes-operator-database.sh | Yes | No | demo |
demo-opershift-operators.sh | No | Yes | app demo reset |
demo-opershift-operator-application.sh | No | Yes | demo reset |
demo-opershift-operator-database.sh | No | Yes | demo |
- Setup demo for Kubernetes
sh scripts/demo-kubernetes-operators.sh app demo reset
- Setup demo for OpenShift
sh scripts/demo-openshift-operators.sh app demo reset
- Definition:
Creates all operators or specific operators of the project in Kubernetes or OpenShift.
-
www == create or delete
-
xxx == operator or operators
-
zzz == Kubernetes or OpenShift
-
Table overview:
Here is a list of available ci scripts.
Name | Kubernetes | OpenShift | Creates Database Operator | Creates Application Operator |
---|---|---|---|---|
ci-create-operator-database-kubernetes.sh | Yes | No | Yes | No |
ci-create-operator-application-kubernetes.sh | Yes | No | No | Yes |
ci-create-operators-kubernetes.sh | Yes | No | Yes | Yes |
ci-create-operator-database-openshift.sh | No | Yes | Yes | No |
ci-create-operator-application-openshift.sh | No | Yes | No | Yes |
ci-create-operators-openshift.sh | No | Yes | Yes | Yes |
Deletes all depending on the Platfrom such as the operators, OLM, Prometheus or Cert-Manager.
xxx == Kubernetes or OpenShift
Verifies, if the tools and the frameworks mentioned above are installed.
Verifies the setup of the needed bin
files (controller-gen
, kustomize
, opm
, setup-envtest
) for the operator-sdk projects.
🔴 IMPORTANT: The order of the parameters is hard coded!
That scripts creates the operators in Kubernetes and has following parameter options.
- Kubernetes
Parameter combination | versions.env | versions_local.env | delete all and setup prerequisites | creates operator database |
creates operator application |
reset podman |
---|---|---|---|---|---|---|
database local |
no | yes | no | yes | no | no |
database local reset |
no | yes | yes | yes | no | no |
database local reset podman_reset |
no | yes | yes | yes | no | yes |
app local |
no | yes | no | yes | yes | no |
app local reset |
no | yes | yes | yes | yes | no |
app local reset podman_reset |
no | yes | yes | yes | yes | yes |
-
First parameter: ('database' or 'app')
- Use 'database' for setup the database operator only
- Use 'app' for setup the database and application operator.
-
Second parameter: ('local' or 'ci')
-
Use 'local' for using the
versions_local.env
file as input for the container tags. -
Use 'ci' for using the
versions.env
file as input for the container tags. ONLY FOR GOLDEN SOURCE!
-
-
Third parameter: ('reset')
- Use 'reset' to deinstall the operators and prereq and reinstall them.
-
Fourth parameter: ('podman_reset')
- Use 'podman_reset' to delete podman vm, create a new podman vm with size of 15, and start podman.
database
- The script does create all container images related to thedatabase-operator
local
- The script usesversions_local.env
as input for the environment variables.reset
- Deletes all Kubernetes components related to the example:olm
,cert-manager
,prometheus-operator
,database-operator
andapplication-operator
podman_reset
- Reset the podman vm by deleting the default-vm and create one with the size of 15 gig and start podman.
sh scripts/ci-create-operators-kubernetes.sh database local reset podman_reset
That scripts creates the operators in Kubernetes and has following parameter options.
- OpenShifft
Parameter combination | versions.env | versions_local.env | delete all and setup prerequisites | creates operator database |
creates operator application |
reset podman |
---|---|---|---|---|---|---|
database local |
no | yes | no | yes | no | no |
database local reset |
no | yes | yes | yes | no | no |
database local reset podman_reset |
no | yes | yes | yes | no | yes |
app local |
no | yes | no | yes | yes | no |
app local reset |
no | yes | yes | yes | yes | no |
app local reset podman_reset |
no | yes | yes | yes | yes | yes |
-
First parameter: ('database' or 'app')
- Use 'database' for setup the database operator only
- Use 'app' for setup the database and application operator.
-
Second parameter: ('local' or 'ci')
-
Use 'local' for using the
versions_local.env
file as input for the container tags. -
Use 'ci' for using the
versions.env
file as input for the container tags. ONLY FOR GOLDEN SOURCE!
-
-
Third parameter: ('reset')
- Use 'reset' to deinstall the operators and prereq and reinstall them.
-
Fourth parameter: ('podman_reset')
- Use 'podman_reset' to delete podman vm, create a new podman vm with size of 15, and start podman.
database
- The script does create all container images related to thedatabase-operator
local
- The script usesversions_local.env
as input for the environment variables.reset
- Deletes all Kubernetes components related to the example:cert-manager
,prometheus-configuration
,database-operator
andapplication-operator
podman_reset
- Reset the podman vm by deleting the default-vm and create one with the size of 15 gig and start podman.
sh scripts/ci-create-operators-openshift.sh database local reset podman_reset