Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Example Go Controller

This controller doesn't do anything useful. It's just an example skeleton for writing Metacontroller hooks with Go.

WARNING

There's a known issue that makes it difficult to produce JSON according to the rules that Metacontroller requires if you import the official Go structs for Kubernetes APIs. In particular, some fields will always be emitted, even if you never set them, which goes against Metacontroller's apply semantics.

Prerequisites

Install Thing Controller

kubectl apply -f thing-controller.yaml

Create a Thing

kubectl apply -f my-thing.yaml

Look at the thing:

kubectl get thing -o yaml

Look at the thing the thing created:

kubectl get pod thing-1 -a

Look at what the thing the thing created said:

kubectl logs thing-1

Clean up

kubectl delete -f thing-controller.yaml

Building

You don't need to build to run the example above, but if you make changes:

go get -u github.com/golang/dep/cmd/dep
dep ensure
go build -o thing-controller

Or just make a new container image:

docker build . -t <yourname>/thing-controller