Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 1.53 KB

README.md

File metadata and controls

40 lines (32 loc) · 1.53 KB

start project

$ mkdir -p $HOME/projects/example-inc/

Create a new app-operator project

$ cd $HOME/projects/example-inc/
$ operator-sdk new app-operator --repo github.com/example-inc/app-operator
$ cd app-operator

Add a new API for the custom resource AppService

$ operator-sdk add api --api-version=app.example.com/v1alpha1 --kind=AppService

Add a new controller that watches for AppService

$ operator-sdk add controller --api-version=app.example.com/v1alpha1 --kind=AppService

Build and push the app-operator image to a public registry such as quay.io

$ operator-sdk build quay.io//app-operator

Login to public registry such as quay.io

$ docker login quay.io

Push image

$ docker push quay.io//app-operator

Update the operator manifest to use the built image name (if you are performing these steps on OSX, see note below)

$ sed -i 's|REPLACE_IMAGE|quay.io//app-operator|g' deploy/operator.yaml

On OSX use:

$ sed -i "" 's|REPLACE_IMAGE|quay.io//app-operator|g' deploy/operator.yaml

Setup Service Account

$ kubectl create -f deploy/service_account.yaml

Setup RBAC

$ kubectl create -f deploy/role.yaml $ kubectl create -f deploy/role_binding.yaml

Setup the CRD

$ kubectl create -f deploy/crds/app.example.com_appservices_crd.yaml

Deploy the app-operator

$ kubectl create -f deploy/operator.yaml

Create an AppService CR

The default controller will watch for AppService objects and create a pod for each CR

$ kubectl create -f deploy/crds/app.example.com_v1alpha1_appservice_cr.yaml