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: 3 additions & 0 deletions charts/pulsar-resources-operator/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ kind: ClusterRole
metadata:
creationTimestamp: null
name: {{ include "pulsar-resources-operator.clusterRoleManagerName" . }}
labels:
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rbac.authorization.k8s.io/aggregate-to-admin: "true"
rules:
- apiGroups:
- ""
Expand Down
42 changes: 42 additions & 0 deletions charts/pulsar-resources-operator/tests/rbac_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2024 StreamNative
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

suite: test rbac
templates:
- role.yaml
- role_binding.yaml
tests:
- it: should pass all default settings
asserts:
- isAPIVersion:
of: rbac.authorization.k8s.io/v1
- isKind:
of: ClusterRole
template: role.yaml
- isKind:
of: ClusterRoleBinding
template: role_binding.yaml
- matchRegex:
path: metadata.name
pattern: -pulsar-resources-operator

- it: should reference the agregate to edit and admin roles
asserts:
- template: role.yaml
isSubset:
path: metadata.labels
content:
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rbac.authorization.k8s.io/aggregate-to-admin: "true"
Loading