tigera / operator

Kubernetes operator for installing Calico and Calico Enterprise
Apache License 2.0
187 stars 141 forks source link

[For Reference] Example of adding a new API and Controller #3587

Closed caseydavenport closed 3 weeks ago

caseydavenport commented 3 weeks ago

Description

This is an example PR to show rougly the changes necessary to add the skeleton for a new API and Controller.

NOTE

The commits are broken down and show precisely which commands were run. Specifically:

  1. Generate the new Resource and controller skeleton

    operator-sdk create api --group=operator.tigera.io --version=v1 --kind=DemoResource --resource --controller 
  2. Generate manifests

    make manifests 
  3. Add a new Reconciler to pkg/controller, and point the internal/controller implementation at it.

The next steps here would be to fill out the Add and Reconcile functions in pkg/controller/demoresource/demoresource_controller.go with the specific logic of the new feature.

For PR author

For PR reviewers

A note for code reviewers - all pull requests must have the following:

electricjesus commented 2 weeks ago

Love it.. what version of operator-sdk should I use for this? If we have a specific version that works with our PROJECT file maybe we could consider a dockerized version as a makefile target perhaps?