Skip to content

Commit

Permalink
fix: rbac
Browse files Browse the repository at this point in the history
Signed-off-by: r3drun3 <[email protected]>
  • Loading branch information
R3DRUN3 committed Feb 13, 2024
1 parent bee98b1 commit b4fd0c8
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 44 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ spec:
selector:
matchLabels:
app: nginx
maxPods: 9
maxPods: 3
namespace: prod
```
Expand Down Expand Up @@ -198,7 +198,7 @@ nginx-deployment-7bf8c77b5b-gsprh 0/1 Terminating 0 33s
```console
2023-11-28T14:07:18+01:00 INFO Reconciling PodDestroyer: default/nginx-destroyer {"controller": "poddestroyer", "controllerGroup": "khaos.stackzoo.io", "controllerKind": "PodDestroyer", "PodDestroyer": {"name":"nginx-destroyer","namespace":"default"}, "namespace": "default", "name": "nginx-destroyer", "reconcileID": "1e16a7d2-825a-4b46-b4e5-ac1228bc1c36"}
2023-11-28T14:07:18+01:00 INFO Selector: {map[app:nginx] []} {"controller": "poddestroyer", "controllerGroup": "khaos.stackzoo.io", "controllerKind": "PodDestroyer", "PodDestroyer": {"name":"nginx-destroyer","namespace":"default"}, "namespace": "default", "name": "nginx-destroyer", "reconcileID": "1e16a7d2-825a-4b46-b4e5-ac1228bc1c36"}
2023-11-28T14:07:18+01:00 INFO MaxPods: 9 {"controller": "poddestroyer", "controllerGroup": "khaos.stackzoo.io", "controllerKind": "PodDestroyer", "PodDestroyer": {"name":"nginx-destroyer","namespace":"default"}, "namespace": "default", "name": "nginx-destroyer", "reconcileID": "1e16a7d2-825a-4b46-b4e5-ac1228bc1c36"}
2023-11-28T14:07:18+01:00 INFO MaxPods: 3 {"controller": "poddestroyer", "controllerGroup": "khaos.stackzoo.io", "controllerKind": "PodDestroyer", "PodDestroyer": {"name":"nginx-destroyer","namespace":"default"}, "namespace": "default", "name": "nginx-destroyer", "reconcileID": "1e16a7d2-825a-4b46-b4e5-ac1228bc1c36"}
2023-11-28T14:07:18+01:00 INFO Namespace: prod {"controller": "poddestroyer", "controllerGroup": "khaos.stackzoo.io", "controllerKind": "PodDestroyer", "PodDestroyer": {"name":"nginx-destroyer","namespace":"default"}, "namespace": "default", "name": "nginx-destroyer", "reconcileID": "1e16a7d2-825a-4b46-b4e5-ac1228bc1c36"}
```

Expand Down Expand Up @@ -228,7 +228,7 @@ metadata:
resourceVersion: "2009"
uid: fbba6287-6f70-406b-821e-9000f097afc5
spec:
maxPods: 9
MaxPods: 3
namespace: prod
selector:
matchLabels:
Expand Down
66 changes: 33 additions & 33 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,51 +74,57 @@ rules:
- update
- watch
- apiGroups:
- khaos.my.domain
- khaos.stackzoo.io
resources:
- randomscalings
- apiserveroverloads
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- khaos.my.domain
- khaos.stackzoo.io
resources:
- randomscalings/status
- apiserveroverloads/finalizers
verbs:
- update
- apiGroups:
- khaos.stackzoo.io
resources:
- apiserveroverloads/status
verbs:
- get
- patch
- update
- apiGroups:
- khaos.stackzoo.io
resources:
- apiserveroverloads
- commandinjections
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- khaos.stackzoo.io
resources:
- apiserveroverloads/finalizers
- commandinjections/finalizers
verbs:
- update
- apiGroups:
- khaos.stackzoo.io
resources:
- apiserveroverloads/status
- commandinjections/status
verbs:
- get
- patch
- update
- apiGroups:
- khaos.stackzoo.io
resources:
- commandinjections
- configmapdestroyers
verbs:
- create
- delete
Expand All @@ -130,21 +136,21 @@ rules:
- apiGroups:
- khaos.stackzoo.io
resources:
- commandinjections/finalizers
- configmapdestroyers/finalizers
verbs:
- update
- apiGroups:
- khaos.stackzoo.io
resources:
- commandinjections/status
- configmapdestroyers/status
verbs:
- get
- patch
- update
- apiGroups:
- khaos.stackzoo.io
resources:
- configmapdestroyers
- consumenamespaceresources
verbs:
- create
- delete
Expand All @@ -156,13 +162,13 @@ rules:
- apiGroups:
- khaos.stackzoo.io
resources:
- configmapdestroyers/finalizers
- consumenamespaceresources/finalizers
verbs:
- update
- apiGroups:
- khaos.stackzoo.io
resources:
- configmapdestroyers/status
- consumenamespaceresources/status
verbs:
- get
- patch
Expand Down Expand Up @@ -216,7 +222,7 @@ rules:
- apiGroups:
- khaos.stackzoo.io
resources:
- eventsentropy
- eventsentropies
verbs:
- create
- delete
Expand All @@ -228,7 +234,7 @@ rules:
- apiGroups:
- khaos.stackzoo.io
resources:
- eventsentropy/status
- eventsentropies/status
verbs:
- get
- patch
Expand Down Expand Up @@ -340,7 +346,7 @@ rules:
- apiGroups:
- khaos.stackzoo.io
resources:
- secretdestroyers
- randomscalings
verbs:
- create
- delete
Expand All @@ -352,21 +358,15 @@ rules:
- apiGroups:
- khaos.stackzoo.io
resources:
- secretdestroyers/finalizers
verbs:
- update
- apiGroups:
- khaos.stackzoo.io
resources:
- secretdestroyers/status
- randomscalings/status
verbs:
- get
- patch
- update
- apiGroups:
- stackzoo.io
- khaos.stackzoo.io
resources:
- consumenamespaceresources
- secretdestroyers
verbs:
- create
- delete
Expand All @@ -376,15 +376,15 @@ rules:
- update
- watch
- apiGroups:
- stackzoo.io
- khaos.stackzoo.io
resources:
- consumenamespaceresources/finalizers
- secretdestroyers/finalizers
verbs:
- update
- apiGroups:
- stackzoo.io
- khaos.stackzoo.io
resources:
- consumenamespaceresources/status
- secretdestroyers/status
verbs:
- get
- patch
Expand Down
2 changes: 1 addition & 1 deletion examples/pod-destroyer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ spec:
selector:
matchLabels:
app: nginx
maxPods: 9
maxPods: 3
namespace: prod
6 changes: 3 additions & 3 deletions internal/controller/consumenamespaceresources_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ type ConsumeNamespaceResourcesReconciler struct {
Scheme *runtime.Scheme
}

// +kubebuilder:rbac:groups=stackzoo.io,resources=consumenamespaceresources,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=stackzoo.io,resources=consumenamespaceresources/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=stackzoo.io,resources=consumenamespaceresources/finalizers,verbs=update
// +kubebuilder:rbac:groups=khaos.stackzoo.io,resources=consumenamespaceresources,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=khaos.stackzoo.io,resources=consumenamespaceresources/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=khaos.stackzoo.io,resources=consumenamespaceresources/finalizers,verbs=update
//+kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;update

func (r *ConsumeNamespaceResourcesReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/eventsentropy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ type EventsEntropyReconciler struct {
Scheme *runtime.Scheme
}

// +kubebuilder:rbac:groups=khaos.stackzoo.io,resources=eventsentropy,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=khaos.stackzoo.io,resources=eventsentropy/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=khaos.stackzoo.io,resources=eventsentropies,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=khaos.stackzoo.io,resources=eventsentropies/status,verbs=get;update;patch
// +kubebuilder:rbac:groups="",resources=events,verbs=create

func (r *EventsEntropyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/randomscaling_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ type RandomScalingReconciler struct {
Scheme *runtime.Scheme
}

// +kubebuilder:rbac:groups=khaos.my.domain,resources=randomscalings,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=khaos.my.domain,resources=randomscalings/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=khaos.stackzoo.io,resources=randomscalings,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=khaos.stackzoo.io,resources=randomscalings/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;update

// Reconcile implements the reconciliation loop for RandomScaling
Expand Down

0 comments on commit b4fd0c8

Please sign in to comment.