Skip to content

Latest commit

 

History

History
21 lines (10 loc) · 958 Bytes

README.md

File metadata and controls

21 lines (10 loc) · 958 Bytes

Introduction

This is demo project to use rancher/wrangler to write controllers. Comparing the client-go and controller-runtime, it provide more convinent interface to write the controllers. Besides, you don't need to generate code with CLI. Instead, it encapsulate into code piece that you could run with golang.

Bootstrap

Run make all.

Leader Election

Like distributed lock, usually we hope there is one controller to monitor the resource to avoid data race or race condition. So, we could make use of wrangler leader.RunOrDie which uses kubernetes lease to achieve the distributed lock.

More example here

Unit test

You could use fake client to do unit test without building a kubernetes environment. But, remember to use custom resource fake client if would like to test custom resource controller behavior.

More example here