operator

module
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2020 License: Apache-2.0

README

Build Status

kAppNav Operator

Used to install Application Navigator. The operator is to read from a custom object that represents the application navigator instance. No "helm install" is needed.

Build

To build the project run:

cd <kappnav project root>/operator 
./build.sh

This will compile the source within a Docker container and download required Go modules into the container at build time.

Install and Uninstall

See README

Local Development

This project was developed with Operator SDK v0.10.0.

Install the Operator SDK using https://github.com/kappnav/build/blob/master/install-operator-sdk.sh. Alternatively, you could do it by hand using the installation instructions for the Operator SDK CLI: https://github.com/operator-framework/operator-sdk/blob/master/doc/user/install-operator-sdk.md (replace the RELEASE_VERSION in the instructions with v0.10.0 since it may not compile with newer versions).

Prerequisites for the Operator SDK are listed here: https://github.com/operator-framework/operator-sdk

If the structs for the Kappnav CRD (located in kappnav_types.go) are modified be sure to run:

operator-sdk generate k8s
operator-sdk generate openapi

This regenerates the CRD and the code that allows a Kappnav CR to be accessed programatically through the k8s APIs.

To build the project using the Operator SDK run:

cd <kappnav project root>/operator 
./buildWithSDK.sh

This will compile the source in your local environment using your local set of dependencies.

Default values

Default values for the operator's configuration are stored in deploy/default_values.yaml. This CR file is included in the Docker image and is read each time a Kappnav CR is reconciled by the operator to fill in defaults for values that were not specified in the CR.

Adding additional CRDs to the operator

Additional CRDs can be added to the deploy/crds/extensions folder. These will be included in the Docker image. The Application CRD is always included in the image. When the operator is installed it will attempt to create each of the CRDs in k8s if they do not already exist.

Adding additional action, sections and status config maps to the operator

Additional action, sections and status config maps should be added to the deploy/maps/action, deploy/maps/sections and deploy/maps/status folders respectively. This supports the same templating language that is used in Helm charts. Variables are addressed by their field names in the Kappnav structs. For instance, the kubeEnv field from the CR would be addressed as .Spec.Env.KubeEnv. Action, sections and status config maps will be initially created when a CR is installed.

Adding additional logic to the controller

If you are adding additional logic for managing resources, provide an implemenation of the NewKappnavExtension function in the utils/extensions.go file that returns an instance of KappnavExtension.

Directories

Path Synopsis
cmd
pkg
apis/actions
Package actions contains actions API versions.
Package actions contains actions API versions.
apis/actions/v1
Package v1 contains API Schema definitions for the actions v1 API group +k8s:deepcopy-gen=package,register +groupName=actions.kappnav.io Package v1 contains API Schema definitions for the actions v1 API group +k8s:deepcopy-gen=package,register +groupName=actions.kappnav.io
Package v1 contains API Schema definitions for the actions v1 API group +k8s:deepcopy-gen=package,register +groupName=actions.kappnav.io Package v1 contains API Schema definitions for the actions v1 API group +k8s:deepcopy-gen=package,register +groupName=actions.kappnav.io
apis/kappnav
Package kappnav contains kappnav API versions.
Package kappnav contains kappnav API versions.
apis/kappnav/v1
Package v1 contains API Schema definitions for the kappnav v1 API group +k8s:deepcopy-gen=package,register +groupName=kappnav.operator.kappnav.io Package v1 contains API Schema definitions for the kappnav v1 API group +k8s:deepcopy-gen=package,register +groupName=kappnav.operator.kappnav.io
Package v1 contains API Schema definitions for the kappnav v1 API group +k8s:deepcopy-gen=package,register +groupName=kappnav.operator.kappnav.io Package v1 contains API Schema definitions for the kappnav v1 API group +k8s:deepcopy-gen=package,register +groupName=kappnav.operator.kappnav.io

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL