Skip to content

Yu-Jack/wrangler-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

This is an example project for using rancher/wrangler

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published