Developer guide
Operator SDK
Prerequisites
NiFiKop has been validated with :
- go version v1.15+.
- docker version 18.09+
- kubectl version v1.16+
- Helm version v3.4.2
- Operator sdk version v1.3.0
Initial setup
Checkout the project.
Operator sdk
The full list of command is available here : https://sdk.operatorframework.io/docs/upgrading-sdk-version/v1.0.0/#cli-changes
Build NiFiKop
Local environment
If you prefer working directly with your local go environment you can simply uses :
Run NiFiKop
We can quickly run NiFiKop in development mode (on your local host), then it will use your kubectl configuration file to connect to your kubernetes cluster.
There are several ways to execute your operator :
- Using your IDE directly
- Executing directly the Go binary
- deploying using the Helm charts
If you want to configure your development IDE, you need to give it environment variables so that it will uses to connect to kubernetes.
Run the Operator Locally with the Go Binary
This method can be used to run the operator locally outside of the cluster. This method may be preferred during development as it facilitates faster deployment and testing.
Set the name of the operator in an environment variable
Deploy the CRDs.
And deploy the operator.
This will run the operator in the default
namespace using the default Kubernetes config file at $HOME/.kube/config
.
Deploy using the Helm Charts
This section provides an instructions for running the operator Helm charts with an image that is built from the local branch.
Build the image from the current branch.
Push the image to docker hub (or to whichever repo you want to use)
info
The image tag is a combination of the version as defined in verion/version.go
and the branch name.
Install the Helm chart.
important
The image.repository
and image.tag
template variables have to match the names from the image that we pushed in the previous step.
info
We set the chart name to the branch, but it can be anything.
Lastly, verify that the operator is running.
Helm
The NiFiKop operator is released in the orange-incubator
helm repository.
In order to package the chart you need to run the following command.