Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add analysis rule for Gateway API resources (#54)
* Add analysis rule for Gateway API resources
- Loading branch information
1 parent
11bd12a
commit 1a4b516
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# | ||
# Install: | ||
# kubectl apply -f testdata/whocan/gatewat-api-operator.yaml | ||
# | ||
# Run: | ||
# bin/rbac-tool who-can get gateways | grep gateway-network-operator | ||
# | ||
# Expect: | ||
# | ||
# ServiceAccount | gateway-network-operator-sa | test | ||
# User | gateway-network-operator-user | | ||
# | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: gateway-network-operator-role | ||
rules: | ||
- apiGroups: ["gateway.networking.k8s.io"] | ||
resources: ["*"] | ||
verbs: ["create", "update", "delete", "patch"] | ||
|
||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
# This role binding allows "jane" to read pods in the "default" namespace. | ||
# You need to already have a Role named "pod-reader" in that namespace. | ||
kind: RoleBinding | ||
metadata: | ||
name: gateway-network-operator | ||
namespace: test | ||
subjects: | ||
# You can specify more than one "subject" | ||
- kind: User | ||
name: gateway-network-operator-user # "name" is case sensitive | ||
apiGroup: rbac.authorization.k8s.io # You can specify more than one "subject" | ||
- kind: ServiceAccount | ||
name: gateway-network-operator-sa # "name" is case sensitive | ||
namespace: test | ||
roleRef: | ||
# "roleRef" specifies the binding to a Role / ClusterRole | ||
kind: ClusterRole #this must be Role or ClusterRole | ||
name: gateway-network-operator-role # this must match the name of the Role or ClusterRole you wish to bind to | ||
apiGroup: rbac.authorization.k8s.io | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: gateway-network-operator-sa | ||
namespace: test |