This repo contains a sample operator build by using toolkit provided by the Kubebuilder framework. The idea is to create a simplified version of Kubenetes Deployment
, and call it AppScaler
.
- Kubernetes 1.17+ / Openshift 3.11+ cluster
- Unpack and install
oc
binary - here - Golang 1.13
- Kubebuilder 2.0.0
- Deploy a cluster
- oc cluster up (openshift)
- Minikube
We need to scaffold our operator code with kubebulder. Recommend to have a look at kubebuilder Getting Started to get a grasp.
kubebuilder init --domain example.com --license apache2
kubebuilder create api --group deploy --version v1 --kind AppScaler
This will generate our initial project structure, similar to one hosted in this repo. Notice initial template for our CR in the ./config/samples
directory. You may edit it at any moment to match the CR specification in the appscaler_types, and then deploy it in your cluster.
apiVersion: sample.example.com/v1
kind: AppScaler
metadata:
name: appscaler-sample
namespace: test
spec:
replicas: 2
image: "docker.io/busybox"
command: ["sleep", "10000"]
make
make manifests
make install
make run
oc create -f ./samples