Skip to content

Latest commit

 

History

History
109 lines (89 loc) · 4 KB

DEVELOP.md

File metadata and controls

109 lines (89 loc) · 4 KB

Developing the k8s operator

This document is to aid any developers working on building the k8s operator. It is not needed to just use the operator (the operator is not ready for use yet!!)

Dependencies

These need to be installed and configured in order to build the k8s operator

  • operator sdk - version 1.6.2
  • go 1.15.x - install from website, os distro, or homebrew (As of April 2021 1.16 is not supported - see operator-framework/operator-sdk#4690 )
  • Other dependencies as documented by operator-sdk including docker, kubectl, kubernetes
  • make - for the build process
  • A *nix variant or macOS (shell script usage)
  • Ensure you have 'GO111MODULE=on' set

Known issues/gotchas

Creation of the template project

These commands use the operator-sdk to create the initial project. Code is then edited manually. The commands used are included here in case we need to rebuild the template in future and remerge in customized code

operator-sdk init --domain egeria-project.org --license apache2 --owner 'Contributors to the Egeria project' --project-name 'egeria' --repo 'github.com/odpi/egeria-k8s-operator'                                                                                                                              [11:13:14]
operator-sdk create api --group egeria --version v1alpha1 --kind EgeriaPlatform   

Changing the API model

This is needed if the egeria type is modified -- it keeps the go type definitions in sync

make generate

Then we need to build the new CRD with

make manifests

Changing the controller

make install

Building the project and image

make docker-build docker-push IMG=odpi/egeria-k8s-operator:0.1.0

deploy the operator

make install
make deploy IMG=odpi/egeria-k8s-operator:0.1.0

Check the operator controller is active

kubectl get deployment -n egeria-system 

Checking logs of the controller

 kubectl get pods -n egeria-system 

Then use that pod id in the entry below:

kubectl logs egeria-k8s-operator-controller-manager-6bf887c74c-78mwc -n egeria-k8s-operator-system manager

Create an instance of Egeria

 kubectl apply -f config/samples/egeria_v1alpha1_egeriaplatform.yaml         

Lookiing for instances of the egeria CRD:

kubectl get egeria.egeria.odpi.org 

Changing properties of the sample instance

kubectl edit egeria.egeria.odpi.org egeria-sample

ie change the size to 10 to scale

Cleaning up the crd after

 kubectl delete -f config/crd/bases/egeria.egeria-project.org_egeriaplatforms.yaml        
 kustomize build config/default | kubectl delete -f -

Design decisions

  • We are using operator-sdk 1.0.0 for tooling
  • golang is the implementation language for the oeprator
  • operator is cluster-scoped - this is the default and can be revisited in future
  • operator uses a single group 'org.odpi.egeria' for it's APIs - also the default
  • The initial implementation uses a single kind called 'Egeria' - think of this as the k8s resource type we are dealing with
  • We will start with version 1 ('v1')

Bugs

Discussion

See the #egeria-k8s channel on slack at https://slack.odpi.org


License: CC BY 4.0, Copyright Contributors to the ODPi Egeria project.