Signed-off-by: George Jenkins <gvjenkins@gmail.com>
(cherry picked from commit b7a0fd0ddc)
pull/32552/head
Matheus Pimenta 5 months ago committed by George Jenkins
parent 3342dbfec8
commit b52e27609b
No known key found for this signature in database
GPG Key ID: D79D67C9EC016739

@ -84,7 +84,7 @@ func TestLintCmdWithKubeVersionFlag(t *testing.T) {
wantError: false, wantError: false,
}, { }, {
name: "lint chart with deprecated api version with older kube version", name: "lint chart with deprecated api version with older kube version",
cmd: fmt.Sprintf("lint --kube-version 1.21.0 --strict %s", testChart), cmd: fmt.Sprintf("lint --kube-version 1.20.0 --strict %s", testChart),
golden: "output/lint-chart-with-deprecated-api-old-k8s.txt", golden: "output/lint-chart-with-deprecated-api-old-k8s.txt",
wantError: false, wantError: false,
}} }}

@ -1,5 +1,5 @@
==> Linting testdata/testcharts/chart-with-deprecated-api ==> Linting testdata/testcharts/chart-with-deprecated-api
[INFO] Chart.yaml: icon is recommended [INFO] Chart.yaml: icon is recommended
[WARNING] templates/horizontalpodautoscaler.yaml: autoscaling/v2beta1 HorizontalPodAutoscaler is deprecated in v1.22+, unavailable in v1.25+; use autoscaling/v2 HorizontalPodAutoscaler [WARNING] templates/poddisruptionbudget.yaml: policy/v1beta1 PodDisruptionBudget is deprecated in v1.21+, unavailable in v1.25+; use policy/v1 PodDisruptionBudget
Error: 1 chart(s) linted, 1 chart(s) failed Error: 1 chart(s) linted, 1 chart(s) failed

@ -1,5 +1,5 @@
==> Linting testdata/testcharts/chart-with-deprecated-api ==> Linting testdata/testcharts/chart-with-deprecated-api
[INFO] Chart.yaml: icon is recommended [INFO] Chart.yaml: icon is recommended
[WARNING] templates/horizontalpodautoscaler.yaml: autoscaling/v2beta1 HorizontalPodAutoscaler is deprecated in v1.22+, unavailable in v1.25+; use autoscaling/v2 HorizontalPodAutoscaler [WARNING] templates/poddisruptionbudget.yaml: policy/v1beta1 PodDisruptionBudget is deprecated in v1.21+, unavailable in v1.25+; use policy/v1 PodDisruptionBudget
1 chart(s) linted, 0 chart(s) failed 1 chart(s) linted, 0 chart(s) failed

@ -0,0 +1,9 @@
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: deprecated
spec:
maxUnavailable: 1
selector:
matchLabels:
app: deprecated

@ -718,6 +718,7 @@ func TestGetPodList(t *testing.T) {
podList, err := c.GetPodList(namespace, metav1.ListOptions{}) podList, err := c.GetPodList(namespace, metav1.ListOptions{})
clientAssertions := assert.New(t) clientAssertions := assert.New(t)
clientAssertions.NoError(err) clientAssertions.NoError(err)
podList.ResourceVersion = ""
clientAssertions.Equal(&responsePodList, podList) clientAssertions.Equal(&responsePodList, podList)
} }

@ -28,8 +28,8 @@ import (
"strings" "strings"
"github.com/pkg/errors" "github.com/pkg/errors"
"k8s.io/apimachinery/pkg/api/validate/content"
"k8s.io/apimachinery/pkg/api/validation" "k8s.io/apimachinery/pkg/api/validation"
apipath "k8s.io/apimachinery/pkg/api/validation/path"
"k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/apimachinery/pkg/util/yaml" "k8s.io/apimachinery/pkg/util/yaml"
@ -284,7 +284,7 @@ func validateMetadataNameFunc(obj *K8sYamlStruct) validation.ValidateNameFunc {
case "role", "clusterrole", "rolebinding", "clusterrolebinding": case "role", "clusterrole", "rolebinding", "clusterrolebinding":
// https://github.com/kubernetes/kubernetes/blob/v1.20.0/pkg/apis/rbac/validation/validation.go#L32-L34 // https://github.com/kubernetes/kubernetes/blob/v1.20.0/pkg/apis/rbac/validation/validation.go#L32-L34
return func(name string, _ bool) []string { return func(name string, _ bool) []string {
return apipath.IsValidPathSegmentName(name) return content.IsPathSegmentName(name)
} }
default: default:
return validation.NameIsDNSSubdomain return validation.NameIsDNSSubdomain

Loading…
Cancel
Save