Go to file
Kubernetes Publisher ec723b2112 Merge pull request #52753 from munnerz/sample-controller
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

sample-controller: add example CRD controller

**What this PR does / why we need it**:

Adds a sample-controller example repository

fixes #52752

**Special notes for your reviewer**:

This is currently based on the sttts:sttts-codegen-scripts branch and should not be merged until that is (ref https://github.com/kubernetes/kubernetes/pull/52186)

**Release note**:

```
Add sample-controller repository
```

/cc @sttts @nikhita @colemickens

Kubernetes-commit: 9a7800f7d2efb88b397674672ac56f898826cf7c
2017-10-26 12:35:59 +00:00
artifacts/examples Add sample CustomResourceDefinition controller 2017-10-09 19:19:34 +01:00
Godeps Merge pull request #52753 from munnerz/sample-controller 2017-10-26 12:35:59 +00:00
hack Add sample CustomResourceDefinition controller 2017-10-09 19:19:34 +01:00
pkg Add sample CustomResourceDefinition controller 2017-10-09 19:19:34 +01:00
vendor Merge pull request #52753 from munnerz/sample-controller 2017-10-26 12:35:59 +00:00
BUILD Add sample CustomResourceDefinition controller 2017-10-09 19:19:34 +01:00
controller.go Add sample CustomResourceDefinition controller 2017-10-09 19:19:34 +01:00
LICENSE Add sample CustomResourceDefinition controller 2017-10-09 19:19:34 +01:00
main.go Add sample CustomResourceDefinition controller 2017-10-09 19:19:34 +01:00
OWNERS Add sample CustomResourceDefinition controller 2017-10-09 19:19:34 +01:00
README.md Add sample CustomResourceDefinition controller 2017-10-09 19:19:34 +01:00

sample-controller

This repository implements a simple controller for watching Foo resources as defined with a CustomResourceDefinition (CRD).

It makes use of the generators in k8s.io/code-generator to generate a typed client, informers, listers and deep-copy functions. You can do this yourself using the ./hack/update-codegen.sh script.

The update-codegen script will automatically generate the following files & directories:

  • pkg/apis/samplecontroller/v1alpha1/zz_generated.deepcopy.go
  • pkg/client/

Changes should not be made to these files manually, and when creating your own controller based off of this implementation you should not copy these files and instead run the update-codegen script to generate your own.

Purpose

This is an example of how to build a kube-like controller with a single type.

Compatibility

HEAD of this repository will match HEAD of k8s.io/apimachinery and k8s.io/client-go.

Where does it come from?

sample-controller is synced from https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/sample-controller. Code changes are made in that location, merged into k8s.io/kubernetes and later synced here.