Skip to content

Commit

Permalink
✨ Added the changes for include finalizer as a default controller mar…
Browse files Browse the repository at this point in the history
…kers
  • Loading branch information
prafull01 committed Sep 21, 2020
1 parent 1b5953e commit 2383d4b
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,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 }}/status;{{ .Resource.Plural }}/finalizers,verbs=get;update;patch
func (r *{{ .Resource.Kind }}Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
_ = context.Background()
Expand Down
7 changes: 7 additions & 0 deletions testdata/project-v3-multigroup/config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ rules:
- apiGroups:
- crew.testproject.org
resources:
- captains/finalizers
- captains/status
verbs:
- get
Expand All @@ -41,6 +42,7 @@ rules:
- apiGroups:
- foo.policy.testproject.org
resources:
- healthcheckpolicies/finalizers
- healthcheckpolicies/status
verbs:
- get
Expand All @@ -61,6 +63,7 @@ rules:
- apiGroups:
- sea-creatures.testproject.org
resources:
- krakens/finalizers
- krakens/status
verbs:
- get
Expand All @@ -81,6 +84,7 @@ rules:
- apiGroups:
- sea-creatures.testproject.org
resources:
- leviathans/finalizers
- leviathans/status
verbs:
- get
Expand All @@ -101,6 +105,7 @@ rules:
- apiGroups:
- ship.testproject.org
resources:
- cruisers/finalizers
- cruisers/status
verbs:
- get
Expand All @@ -121,6 +126,7 @@ rules:
- apiGroups:
- ship.testproject.org
resources:
- destroyers/finalizers
- destroyers/status
verbs:
- get
Expand All @@ -141,6 +147,7 @@ rules:
- apiGroups:
- ship.testproject.org
resources:
- frigates/finalizers
- frigates/status
verbs:
- get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,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/status;captains/finalizers,verbs=get;update;patch

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 @@ -35,7 +35,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/status;healthcheckpolicies/finalizers,verbs=get;update;patch

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 @@ -35,7 +35,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/status;krakens/finalizers,verbs=get;update;patch

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 @@ -35,7 +35,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/status;leviathans/finalizers,verbs=get;update;patch

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 @@ -35,7 +35,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/status;cruisers/finalizers,verbs=get;update;patch

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 @@ -35,7 +35,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/status;destroyers/finalizers,verbs=get;update;patch

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 @@ -35,7 +35,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/status;frigates/finalizers,verbs=get;update;patch

func (r *FrigateReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
_ = context.Background()
Expand Down
3 changes: 3 additions & 0 deletions testdata/project-v3/config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ rules:
- apiGroups:
- crew.testproject.org
resources:
- admirals/finalizers
- admirals/status
verbs:
- get
Expand All @@ -41,6 +42,7 @@ rules:
- apiGroups:
- crew.testproject.org
resources:
- captains/finalizers
- captains/status
verbs:
- get
Expand All @@ -61,6 +63,7 @@ rules:
- apiGroups:
- crew.testproject.org
resources:
- firstmates/finalizers
- firstmates/status
verbs:
- get
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v3/controllers/admiral_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,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/status;admirals/finalizers,verbs=get;update;patch

func (r *AdmiralReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
_ = context.Background()
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v3/controllers/captain_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,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/status;captains/finalizers,verbs=get;update;patch

func (r *CaptainReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
_ = context.Background()
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v3/controllers/firstmate_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,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/status;firstmates/finalizers,verbs=get;update;patch

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

0 comments on commit 2383d4b

Please sign in to comment.