instrumenta / instrumenta/kubeval

(Cluster)RoleBinding with invalid apiGroup isn't caught

Open
#290 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
3.2k
Forks
227
PR merge metrics
No merged PRs in 30d

Description

I expect kubeval to not pass the following YAML. The apiGroup for ServiceAccount subjects should be `""` not `rbac.authorization.k8s.io`. See https://kubernetes.io/docs/reference/access-authn-authz/rbac/#role-binding-examples.

```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: codespots
namespace: codespots
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: my-role
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: ServiceAccount
name: default
namespace: codespots
```

A server-side dry run catches the error.

```
kubectl apply -f /tmp/t.json --dry-run=server
Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply
The RoleBinding "codespots" is invalid: subjects[0].apiGroup: Unsupported value: "rbac.authorization.k8s.io": supported values: ""
```

## Version info

```
kubeval --version
Version: 0.16.1
Commit: f5dba6b486fa18b9179b91e15eb6f2b0f7a5a69e
Date: 2021-03-30T15:17:06Z
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.