Skip to content

09 Exercise

Daniel Morinigo edited this page Jan 16, 2020 · 1 revision

ConfigMapReplica

Create a Cluster scoped CRD and controller to fullfil the following business requirements:

  1. Have a resource to easily maintain content, this resource should be able to automatically synced to multiple namespaces
  2. It is recommended to use labels to select the target namespaces
  3. Removing the replica resource should cleanup all the replicas from all target namespaces
  4. The replica configmaps should have the same name as the ConfigMapReplica instance
  5. Know the current state of the replicas by checking the ConfigMapReplica resource details

What should I do?

  1. Use kubebuilder or sample-controller to implement the controller
  2. Use TDD/BDD to implement tests first then implement the business logic

For examples on how to use kubernetes clients on creating unit tests please check:

  • client-go
  • [https://github.com/danielfbm/k8s-design-workshop/tree/master/kubebuilder]

I strongly recomment to implement the controller and test cases by yourself to deepen the learning process, and there is a step by step example implementation that can be used as reference.

Have fun!

Clone this wiki locally