Skip to content

Commit

Permalink
Merge pull request #165 from doitintl/certificates-v1beta1
Browse files Browse the repository at this point in the history
feat: Cover deprecated `certificates.k8s.io/v1beta1` API group
  • Loading branch information
stepanstipl authored Jun 11, 2021
2 parents 5a2d6a5 + db7dfb5 commit e54bb80
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fixtures/certificatesigningrequest-v1beta1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: certificates.k8s.io/v1beta1
kind: CertificateSigningRequest
metadata:
name: example.com
spec:
request: aGVsbG9YWAo=
usages:
- key encipherment
- server auth
1 change: 1 addition & 0 deletions pkg/collector/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (c *ClusterCollector) Get() ([]map[string]interface{}, error) {
schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1", Resource: "roles"},
schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1", Resource: "rolebindings"},
schema.GroupVersionResource{Group: "coordination.k8s.io", Version: "v1", Resource: "leases"},
schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1beta1", Resource: "certificatesigningrequests"},
}
gvrs = append(gvrs, c.additionalResources...)

Expand Down
5 changes: 5 additions & 0 deletions pkg/rules/rego/deprecated-1-22.rego
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ deprecated_api(kind, api_version) = api {
"new": "rbac.authorization.k8s.io/v1",
"since": "1.8",
},
"CertificateSigningRequest": {
"old": ["certificates.k8s.io/v1beta1"],
"new": "certificates.k8s.io/v1",
"since": "1.19",
},
}

deprecated_apis[kind].old[_] == api_version
Expand Down
1 change: 1 addition & 0 deletions test/rules_122_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func TestRego122(t *testing.T) {
{"Ingress", []string{"../fixtures/ingress-v1beta1.yaml"}, []string{"Ingress"}},
{"IngressClass", []string{"../fixtures/ingressclass-v1beta1.yaml"}, []string{"IngressClass"}},
{"Lease", []string{"../fixtures/lease-v1beta1.yaml"}, []string{"Lease"}},
{"CertificateSigningRequest", []string{"../fixtures/certificatesigningrequest-v1beta1.yaml"}, []string{"CertificateSigningRequest"}},
}

for _, tc := range testCases {
Expand Down

0 comments on commit e54bb80

Please sign in to comment.