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

Fix aggregated ClusterRoles missing #37

Merged
merged 1 commit into from
Jan 13, 2025
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
56 changes: 56 additions & 0 deletions component/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,65 @@ local vpa_resources() = [
for name in std.objectFields(params.autoscaler)
];

local vpa_aggregated_roles = [
kube.ClusterRole('syn:vertical-pod-autoscaler:view') {
metadata+: {
labels+: {
'rbac.authorization.k8s.io/aggregate-to-admin': 'true',
'rbac.authorization.k8s.io/aggregate-to-edit': 'true',
'rbac.authorization.k8s.io/aggregate-to-view': 'true',
'rbac.authorization.k8s.io/aggregate-to-cluster-reader': 'true',
},
},
rules: [
{
apiGroups: [ 'autoscaling.k8s.io' ],
resources: [ 'verticalpodautoscalers' ],
verbs: [ 'get', 'list', 'watch' ],
},
],
},
kube.ClusterRole('syn:vertical-pod-autoscaler:edit') {
metadata+: {
labels+: {
'rbac.authorization.k8s.io/aggregate-to-admin': 'true',
'rbac.authorization.k8s.io/aggregate-to-edit': 'true',
},
},
rules: [
{
apiGroups: [ 'autoscaling.k8s.io' ],
resources: [ 'verticalpodautoscalers' ],
verbs: [
'create',
'delete',
'deletecollection',
'patch',
'update',
],
},
],
},
kube.ClusterRole('syn:vertical-pod-autoscaler:cluster-reader') {
metadata+: {
labels+: {
'rbac.authorization.k8s.io/aggregate-to-cluster-reader': 'true',
},
},
rules: [
{
apiGroups: [ 'autoscaling.k8s.io' ],
resources: [ 'verticalpodautoscalercheckpoints' ],
verbs: [ 'get', 'list', 'watch' ],
},
],
},
];

// Define outputs below
{
'00_namespace': namespace,
'20_aggregated_rbac': vpa_aggregated_roles,

[if params.allow_autoscaling then '50_vpa_certs']: [ cert_manager_issuer, cert_manager_cert ],
[if std.length(params.autoscaler) > 0 then '60_vpa_resources']: vpa_resources(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations: {}
labels:
name: syn-vertical-pod-autoscaler-view
rbac.authorization.k8s.io/aggregate-to-admin: 'true'
rbac.authorization.k8s.io/aggregate-to-cluster-reader: 'true'
rbac.authorization.k8s.io/aggregate-to-edit: 'true'
rbac.authorization.k8s.io/aggregate-to-view: 'true'
name: syn:vertical-pod-autoscaler:view
rules:
- apiGroups:
- autoscaling.k8s.io
resources:
- verticalpodautoscalers
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations: {}
labels:
name: syn-vertical-pod-autoscaler-edit
rbac.authorization.k8s.io/aggregate-to-admin: 'true'
rbac.authorization.k8s.io/aggregate-to-edit: 'true'
name: syn:vertical-pod-autoscaler:edit
rules:
- apiGroups:
- autoscaling.k8s.io
resources:
- verticalpodautoscalers
verbs:
- create
- delete
- deletecollection
- patch
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations: {}
labels:
name: syn-vertical-pod-autoscaler-cluster-reader
rbac.authorization.k8s.io/aggregate-to-cluster-reader: 'true'
name: syn:vertical-pod-autoscaler:cluster-reader
rules:
- apiGroups:
- autoscaling.k8s.io
resources:
- verticalpodautoscalercheckpoints
verbs:
- get
- list
- watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations: {}
labels:
name: syn-vertical-pod-autoscaler-view
rbac.authorization.k8s.io/aggregate-to-admin: 'true'
rbac.authorization.k8s.io/aggregate-to-cluster-reader: 'true'
rbac.authorization.k8s.io/aggregate-to-edit: 'true'
rbac.authorization.k8s.io/aggregate-to-view: 'true'
name: syn:vertical-pod-autoscaler:view
rules:
- apiGroups:
- autoscaling.k8s.io
resources:
- verticalpodautoscalers
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations: {}
labels:
name: syn-vertical-pod-autoscaler-edit
rbac.authorization.k8s.io/aggregate-to-admin: 'true'
rbac.authorization.k8s.io/aggregate-to-edit: 'true'
name: syn:vertical-pod-autoscaler:edit
rules:
- apiGroups:
- autoscaling.k8s.io
resources:
- verticalpodautoscalers
verbs:
- create
- delete
- deletecollection
- patch
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations: {}
labels:
name: syn-vertical-pod-autoscaler-cluster-reader
rbac.authorization.k8s.io/aggregate-to-cluster-reader: 'true'
name: syn:vertical-pod-autoscaler:cluster-reader
rules:
- apiGroups:
- autoscaling.k8s.io
resources:
- verticalpodautoscalercheckpoints
verbs:
- get
- list
- watch
Loading