Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Added the changes for include finalizer as a default controller markers (v3+ only) #1688

Merged
merged 1 commit into from
Sep 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ type {{ .Resource.Kind }}Reconciler struct {

// +kubebuilder:rbac:groups={{ .Resource.Domain }},resources={{ .Resource.Plural }},verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups={{ .Resource.Domain }},resources={{ .Resource.Plural }}/status,verbs=get;update;patch
// +kubebuilder:rbac:groups={{ .Resource.Domain }},resources={{ .Resource.Plural }}/finalizers,verbs=update

func (r *{{ .Resource.Kind }}Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
_ = context.Background()
Expand Down
42 changes: 42 additions & 0 deletions testdata/project-v3-multigroup/config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ rules:
- patch
- update
- watch
- apiGroups:
- crew.testproject.org
resources:
- captains/finalizers
verbs:
- update
- apiGroups:
- crew.testproject.org
resources:
Expand All @@ -38,6 +44,12 @@ rules:
- patch
- update
- watch
- apiGroups:
- foo.policy.testproject.org
resources:
- healthcheckpolicies/finalizers
verbs:
- update
- apiGroups:
- foo.policy.testproject.org
resources:
Expand All @@ -58,6 +70,12 @@ rules:
- patch
- update
- watch
- apiGroups:
- sea-creatures.testproject.org
resources:
- krakens/finalizers
verbs:
- update
- apiGroups:
- sea-creatures.testproject.org
resources:
Expand All @@ -78,6 +96,12 @@ rules:
- patch
- update
- watch
- apiGroups:
- sea-creatures.testproject.org
resources:
- leviathans/finalizers
verbs:
- update
- apiGroups:
- sea-creatures.testproject.org
resources:
Expand All @@ -98,6 +122,12 @@ rules:
- patch
- update
- watch
- apiGroups:
- ship.testproject.org
resources:
- cruisers/finalizers
verbs:
- update
- apiGroups:
- ship.testproject.org
resources:
Expand All @@ -118,6 +148,12 @@ rules:
- patch
- update
- watch
- apiGroups:
- ship.testproject.org
resources:
- destroyers/finalizers
verbs:
- update
- apiGroups:
- ship.testproject.org
resources:
Expand All @@ -138,6 +174,12 @@ rules:
- patch
- update
- watch
- apiGroups:
- ship.testproject.org
resources:
- frigates/finalizers
verbs:
- update
- apiGroups:
- ship.testproject.org
resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type CaptainReconciler struct {

// +kubebuilder:rbac:groups=crew.testproject.org,resources=captains,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=crew.testproject.org,resources=captains/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=crew.testproject.org,resources=captains/finalizers,verbs=update

func (r *CaptainReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
_ = context.Background()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type HealthCheckPolicyReconciler struct {

// +kubebuilder:rbac:groups=foo.policy.testproject.org,resources=healthcheckpolicies,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=foo.policy.testproject.org,resources=healthcheckpolicies/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=foo.policy.testproject.org,resources=healthcheckpolicies/finalizers,verbs=update

func (r *HealthCheckPolicyReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
_ = context.Background()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type KrakenReconciler struct {

// +kubebuilder:rbac:groups=sea-creatures.testproject.org,resources=krakens,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=sea-creatures.testproject.org,resources=krakens/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=sea-creatures.testproject.org,resources=krakens/finalizers,verbs=update

func (r *KrakenReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
_ = context.Background()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type LeviathanReconciler struct {

// +kubebuilder:rbac:groups=sea-creatures.testproject.org,resources=leviathans,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=sea-creatures.testproject.org,resources=leviathans/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=sea-creatures.testproject.org,resources=leviathans/finalizers,verbs=update

func (r *LeviathanReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
_ = context.Background()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type CruiserReconciler struct {

// +kubebuilder:rbac:groups=ship.testproject.org,resources=cruisers,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=ship.testproject.org,resources=cruisers/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=ship.testproject.org,resources=cruisers/finalizers,verbs=update

func (r *CruiserReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
_ = context.Background()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type DestroyerReconciler struct {

// +kubebuilder:rbac:groups=ship.testproject.org,resources=destroyers,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=ship.testproject.org,resources=destroyers/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=ship.testproject.org,resources=destroyers/finalizers,verbs=update

func (r *DestroyerReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
_ = context.Background()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type FrigateReconciler struct {

// +kubebuilder:rbac:groups=ship.testproject.org,resources=frigates,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=ship.testproject.org,resources=frigates/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=ship.testproject.org,resources=frigates/finalizers,verbs=update

func (r *FrigateReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
_ = context.Background()
Expand Down
18 changes: 18 additions & 0 deletions testdata/project-v3/config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ rules:
- patch
- update
- watch
- apiGroups:
- crew.testproject.org
resources:
- admirals/finalizers
verbs:
- update
- apiGroups:
- crew.testproject.org
resources:
Expand All @@ -38,6 +44,12 @@ rules:
- patch
- update
- watch
- apiGroups:
- crew.testproject.org
resources:
- captains/finalizers
verbs:
- update
- apiGroups:
- crew.testproject.org
resources:
Expand All @@ -58,6 +70,12 @@ rules:
- patch
- update
- watch
- apiGroups:
- crew.testproject.org
resources:
- firstmates/finalizers
verbs:
- update
- apiGroups:
- crew.testproject.org
resources:
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v3/controllers/admiral_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type AdmiralReconciler struct {

// +kubebuilder:rbac:groups=crew.testproject.org,resources=admirals,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=crew.testproject.org,resources=admirals/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=crew.testproject.org,resources=admirals/finalizers,verbs=update

func (r *AdmiralReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
_ = context.Background()
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v3/controllers/captain_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type CaptainReconciler struct {

// +kubebuilder:rbac:groups=crew.testproject.org,resources=captains,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=crew.testproject.org,resources=captains/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=crew.testproject.org,resources=captains/finalizers,verbs=update

func (r *CaptainReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
_ = context.Background()
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v3/controllers/firstmate_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type FirstMateReconciler struct {

// +kubebuilder:rbac:groups=crew.testproject.org,resources=firstmates,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=crew.testproject.org,resources=firstmates/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=crew.testproject.org,resources=firstmates/finalizers,verbs=update

func (r *FirstMateReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
_ = context.Background()
Expand Down