Repository: doitintl/kube-no-trouble (go)

Issue:
networking.k8s.io/v1beta1 should be flagged deprecated also
Since 1.19 has moved ingress to v1 could we alert on both v1beta1 strings? 

		"Ingress": {
			"old": ["extensions/v1beta1"],
			"new": "networking.k8s.io/v1beta1"

https://v1-19.docs.kubernetes.io/docs/setup/release/notes/#deprecations-and-removals
_Ingress and IngressClass resources have graduated to networking.k8s.io/v1. Ingress and IngressClass types in the extensions/v1beta1 and networking.k8s.io/v1beta1 API versions are deprecated and will no longer be served in 1.22+_


Once again thanks for the fantastic tool!


Pull request description:
feat: Cover deprecated `networking.k8s.io/v1beta1` - Ingress* resources
Cover deprecated `networking.k8s.io/v1beta1` - Ingress* resources

As per https://kubernetes.io/docs/reference/using-api/deprecation-guide/, add `networking.k8s.io/v1beta1` group of resources.

Part of #135
Fixes #94

Patch:
diff --git a/fixtures/ingressclass-v1beta1.yaml b/fixtures/ingressclass-v1beta1.yaml
new file mode 100644
index 0000000..f53e0f2
--- /dev/null
+++ b/fixtures/ingressclass-v1beta1.yaml
@@ -0,0 +1,10 @@
+apiVersion: networking.k8s.io/v1beta1
+kind: IngressClass
+metadata:
+  name: external-lb
+spec:
+  controller: example.com/ingress-controller
+  parameters:
+    apiGroup: k8s.example.com
+    kind: IngressParameters
+    name: external-lb
diff --git a/pkg/collector/cluster.go b/pkg/collector/cluster.go
index bbe2ae7..3e1bf8d 100644
--- a/pkg/collector/cluster.go
+++ b/pkg/collector/cluster.go
@@ -78,6 +78,7 @@ func (c *ClusterCollector) Get() ([]map[string]interface{}, error) {
 		schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1", Resource: "networkpolicies"},
 		schema.GroupVersionResource{Group: "policy", Version: "v1beta1", Resource: "podsecuritypolicies"},
 		schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "ingresses"},
+		schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1", Resource: "ingressclasses"},
 		schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "csidrivers"},
 		schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "csinodes"},
 		schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "storageclasses"},
diff --git a/pkg/rules/rego/deprecated-1-22.rego b/pkg/rules/rego/deprecated-1-22.rego
index e6da032..fe9c041 100644
--- a/pkg/rules/rego/deprecated-1-22.rego
+++ b/pkg/rules/rego/deprecated-1-22.rego
@@ -22,9 +22,14 @@ deprecated_resource(r) = api {
 deprecated_api(kind, api_version) = api {
 	deprecated_apis = {
 		"Ingress": {
-			"old": ["extensions/v1beta1"],
-			"new": "networking.k8s.io/v1beta1",
-			"since": "1.14",
+			"old": ["extensions/v1beta1", "networking.k8s.io/v1beta1"],
+			"new": "networking.k8s.io/v1",
+			"since": "1.19",
+		},
+		"IngressClass": {
+			"old": ["networking.k8s.io/v1beta1"],
+			"new": "networking.k8s.io/v1",
+			"since": "1.19",
 		},
 		"TokenReview": {
 			"old": ["authentication.k8s.io/v1beta1"],


Test patch:
diff --git a/test/rules_122_test.go b/test/rules_122_test.go
index 620422a..59bc2bb 100644
--- a/test/rules_122_test.go
+++ b/test/rules_122_test.go
@@ -21,6 +21,8 @@ func TestRego122(t *testing.T) {
 		{"StorageClass", []string{"../fixtures/storageclass-v1beta1.yaml"}, []string{"StorageClass"}},
 		{"VolumeAttachment", []string{"../fixtures/volumeattachment-v1beta1.yaml"}, []string{"VolumeAttachment"}},
 		{"PriorityClass", []string{"../fixtures/priorityclass-v1beta1.yaml"}, []string{"PriorityClass"}},
+		{"Ingress", []string{"../fixtures/ingress-v1beta1.yaml"}, []string{"Ingress"}},
+		{"IngressClass", []string{"../fixtures/ingressclass-v1beta1.yaml"}, []string{"IngressClass"}},
 	}
 
 	for _, tc := range testCases {