Skip to content
Open
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
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ help: ## Display this help.
.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
go mod vendor; \
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" rbac:roleName=manager-role crd webhook paths="./vendor/github.com/gocrane/api/..." output:crd:artifacts:config=deploy/manifests; \
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" crd webhook paths="./vendor/github.com/gocrane/api/..." output:crd:artifacts:config=deploy/manifests; \
$(CONTROLLER_GEN) rbac:roleName=craned paths=./pkg/controller/... output:rbac:artifacts:config=deploy/craned; \
rm -rf vendor

.PHONY: go-mockgen
Expand Down
10 changes: 0 additions & 10 deletions deploy/craned/rbac.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: craned
rules:
- apiGroups: [ '*' ]
resources: [ '*' ]
verbs: [ "*" ]
---

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
Expand Down
76 changes: 76 additions & 0 deletions deploy/craned/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: craned
rules:
- apiGroups:
- analysis.crane.io
resources:
- '*'
verbs:
- '*'
- apiGroups:
- apps
resources:
- deployments
- deployments/scale
- statefulsets
- statefulsets/scale
verbs:
- get
- list
- watch
- apiGroups:
- autoscaling
resources:
- horizontalpodautoscalers
verbs:
- '*'
- apiGroups:
- autoscaling.crane.io
resources:
- '*'
verbs:
- '*'
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- update
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- update
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- update
- apiGroups:
- ""
resources:
- nodes
- pods
verbs:
- get
- list
- watch
- apiGroups:
- prediction.crane.io
resources:
- '*'
verbs:
- '*'
10 changes: 10 additions & 0 deletions pkg/controller/ehpa/effective_hpa_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ type EffectiveHPAController struct {
Config EhpaControllerConfig
}

//+kubebuilder:rbac:groups=core,resources=pods;nodes,verbs=get;list;watch
//+kubebuilder:rbac:groups=core,resources=configmaps,verbs=get;list;watch;update
//+kubebuilder:rbac:groups=core,resources=events,verbs=create;update;patch
//+kubebuilder:rbac:groups=apps,resources=deployments;deployments/scale;statefulsets;statefulsets/scale,verbs=get;list;watch
//+kubebuilder:rbac:groups=autoscaling,resources=horizontalpodautoscalers,verbs=*
//+kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;update
//+kubebuilder:rbac:groups=analysis.crane.io,resources=*,verbs=*
//+kubebuilder:rbac:groups=autoscaling.crane.io,resources=*,verbs=*
//+kubebuilder:rbac:groups=prediction.crane.io,resources=*,verbs=*

func (c *EffectiveHPAController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
klog.V(4).Infof("Got ehpa %s", req.NamespacedName)

Expand Down