Repository: helm/helm
Pull request #8061 (2020-05-05 21:17:08)

feat(lint): Update lint deprecation list
Add api group:
- apiextensions.k8s.io/v1beta1
- rbac.authorization.k8s.io/v1alpha1

Moved the kinds from API group `extensions/v1` to `extensions/v1beta1` as they don't seemed to have existed in `extensions/v1`.

**What this PR does / why we need it**:
Updates lint deprecation list to provide a more rounded list for checking.

**Special notes for your reviewer**:
Its quite difficult to get exact documentation on API deprecation, so this is more from searching around the API docs etc. Also, shout out to @chadlwilson for raising the auth API group in https://github.com/hickeyma/helm-mapkubeapis/issues/8. Note that some changes was tabing to line up.

**If applicable**:
- [ ] this PR contains documentation
- [ ] this PR contains unit tests
- [ ] this PR has been tested for backwards compatibility



Patch:
diff --git a/pkg/lint/rules/deprecations.go b/pkg/lint/rules/deprecations.go
index c14fedec6..88921408d 100644
--- a/pkg/lint/rules/deprecations.go
+++ b/pkg/lint/rules/deprecations.go
@@ -22,20 +22,36 @@ import "fmt"
 //
 // An empty rvalue indicates that the API is completely deprecated.
 var deprecatedAPIs = map[string]string{
-	"extensions/v1 Deployment":             "apps/v1 Deployment",
-	"extensions/v1 DaemonSet":              "apps/v1 DaemonSet",
-	"extensions/v1 ReplicaSet":             "apps/v1 ReplicaSet",
-	"extensions/v1beta1 PodSecurityPolicy": "policy/v1beta1 PodSecurityPolicy",
-	"extensions/v1beta1 NetworkPolicy":     "networking.k8s.io/v1beta1 NetworkPolicy",
-	"extensions/v1beta1 Ingress":           "networking.k8s.io/v1beta1 Ingress",
-	"apps/v1beta1 Deployment":              "apps/v1 Deployment",
-	"apps/v1beta1 StatefulSet":             "apps/v1 StatefulSet",
-	"apps/v1beta1 DaemonSet":               "apps/v1 DaemonSet",
-	"apps/v1beta1 ReplicaSet":              "apps/v1 ReplicaSet",
-	"apps/v1beta2 Deployment":              "apps/v1 Deployment",
-	"apps/v1beta2 StatefulSet":             "apps/v1 StatefulSet",
-	"apps/v1beta2 DaemonSet":               "apps/v1 DaemonSet",
-	"apps/v1beta2 ReplicaSet":              "apps/v1 ReplicaSet",
+	"extensions/v1beta1 Deployment":                             "apps/v1 Deployment",
+	"extensions/v1beta1 DaemonSet":                              "apps/v1 DaemonSet",
+	"extensions/v1beta1 ReplicaSet":                             "apps/v1 ReplicaSet",
+	"extensions/v1beta1 PodSecurityPolicy":                      "policy/v1beta1 PodSecurityPolicy",
+	"extensions/v1beta1 NetworkPolicy":                          "networking.k8s.io/v1beta1 NetworkPolicy",
+	"extensions/v1beta1 Ingress":                                "networking.k8s.io/v1beta1 Ingress",
+	"apps/v1beta1 Deployment":                                   "apps/v1 Deployment",
+	"apps/v1beta1 StatefulSet":                                  "apps/v1 StatefulSet",
+	"apps/v1beta1 ReplicaSet":                                   "apps/v1 ReplicaSet",
+	"apps/v1beta2 Deployment":                                   "apps/v1 Deployment",
+	"apps/v1beta2 StatefulSet":                                  "apps/v1 StatefulSet",
+	"apps/v1beta2 DaemonSet":                                    "apps/v1 DaemonSet",
+	"apps/v1beta2 ReplicaSet":                                   "apps/v1 ReplicaSet",
+	"apiextensions.k8s.io/v1beta1 CustomResourceDefinition":     "apiextensions.k8s.io/v1 CustomResourceDefinition",
+	"rbac.authorization.k8s.io/v1alpha1 ClusterRole":            "rbac.authorization.k8s.io/v1 ClusterRole",
+	"rbac.authorization.k8s.io/v1alpha1 ClusterRoleList":        "rbac.authorization.k8s.io/v1 ClusterRoleList",
+	"rbac.authorization.k8s.io/v1alpha1 ClusterRoleBinding":     "rbac.authorization.k8s.io/v1 ClusterRoleBinding",
+	"rbac.authorization.k8s.io/v1alpha1 ClusterRoleBindingList": "rbac.authorization.k8s.io/v1 ClusterRoleBindingList",
+	"rbac.authorization.k8s.io/v1alpha1 Role":                   "rbac.authorization.k8s.io/v1 Role",
+	"rbac.authorization.k8s.io/v1alpha1 RoleList":               "rbac.authorization.k8s.io/v1 RoleList",
+	"rbac.authorization.k8s.io/v1alpha1 RoleBinding":            "rbac.authorization.k8s.io/v1 RoleBinding",
+	"rbac.authorization.k8s.io/v1alpha1 RoleBindingList":        "rbac.authorization.k8s.io/v1 RoleBindingList",
+	"rbac.authorization.k8s.io/v1beta1 ClusterRole":             "rbac.authorization.k8s.io/v1 ClusterRole",
+	"rbac.authorization.k8s.io/v1beta1 ClusterRoleList":         "rbac.authorization.k8s.io/v1 ClusterRoleList",
+	"rbac.authorization.k8s.io/v1beta1 ClusterRoleBinding":      "rbac.authorization.k8s.io/v1 ClusterRoleBinding",
+	"rbac.authorization.k8s.io/v1beta1 ClusterRoleBindingList":  "rbac.authorization.k8s.io/v1 ClusterRoleBindingList",
+	"rbac.authorization.k8s.io/v1beta1 Role":                    "rbac.authorization.k8s.io/v1 Role",
+	"rbac.authorization.k8s.io/v1beta1 RoleList":                "rbac.authorization.k8s.io/v1 RoleList",
+	"rbac.authorization.k8s.io/v1beta1 RoleBinding":             "rbac.authorization.k8s.io/v1 RoleBinding",
+	"rbac.authorization.k8s.io/v1beta1 RoleBindingList":         "rbac.authorization.k8s.io/v1 RoleBindingList",
 }
 
 // deprecatedAPIError indicates than an API is deprecated in Kubernetes


Test patch:
diff --git a/pkg/lint/rules/deprecations_test.go b/pkg/lint/rules/deprecations_test.go
index f85d58a0c..1e8d34702 100644
--- a/pkg/lint/rules/deprecations_test.go
+++ b/pkg/lint/rules/deprecations_test.go
@@ -20,7 +20,7 @@ import "testing"
 
 func TestValidateNoDeprecations(t *testing.T) {
 	deprecated := &K8sYamlStruct{
-		APIVersion: "extensions/v1",
+		APIVersion: "extensions/v1beta1",
 		Kind:       "Deployment",
 	}
 	err := validateNoDeprecations(deprecated)