helloworld-operator

command module
v0.0.0-...-479fb59 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: MIT Imports: 11 Imported by: 0

README

Helloworld operator

This is just a simple operator to get started with Operator SDK based on the tutorial, but I wanted to change the naming so I can't just copy-paste.

Bootstrap

Used these values to setup this with operator-sdk cli:

#PWD = this folder!
operator-sdk init --domain maik.fi --repo github.com/maikdotfi/k8s-operator/helloworld-operator
# API group will be maik?
operator-sdk create api --group maik --version v1alpha1 --kind Helloworld --resource --controller

Note this means the resource apiVersion will be maik.maik.fi/v1alpha1 and kind Helloworld, which is a stupid apiVersion and I should have used another group name

Local development

Operators can be developed locally using kind and local registry (running in docker container):

cd kind
sh start.sh

Note: tested on kind 0.11.1

Tests and image build

When you run docker build/push some tests will also be run, make sure these run in a k3d cluster instead of local (unless you have etcd installed locally etc.):

export USE_EXISTING_CLUSTER=true
make docker-build docker-push

Deploy

Deploying to cluster is really simple:

make deploy
Deploying CRD

There's an example CRD in the kind folder:

kubectl apply -f helloworld-crd.yaml

k8s CRD confusion

The naming of this example didn't really please me, I couldn't even figure out how to launch the CRD firstly. Here's how to find out:

kubectl get crds
kubectl explain <name-of-crd>

The crd name looked funky but explain gives sane looking stuff still.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
v1alpha1
Package v1alpha1 contains API Schema definitions for the maik v1alpha1 API group +kubebuilder:object:generate=true +groupName=maik.maik.fi
Package v1alpha1 contains API Schema definitions for the maik v1alpha1 API group +kubebuilder:object:generate=true +groupName=maik.maik.fi

Jump to

Keyboard shortcuts

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