Fix example test code
This commit adapts the example test case to 1.23.
This commit is contained in:
@@ -160,10 +160,6 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
|
|||||||
AllowPodAffinityNamespaceSelector: true,
|
AllowPodAffinityNamespaceSelector: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
pspValidationOptions := policy_validation.PodSecurityPolicyValidationOptions{
|
|
||||||
AllowEphemeralVolumeType: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enable CustomPodDNS for testing
|
// Enable CustomPodDNS for testing
|
||||||
// feature.DefaultFeatureGate.Set("CustomPodDNS=true")
|
// feature.DefaultFeatureGate.Set("CustomPodDNS=true")
|
||||||
switch t := obj.(type) {
|
switch t := obj.(type) {
|
||||||
@@ -283,11 +279,7 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
|
|||||||
if t.Namespace == "" {
|
if t.Namespace == "" {
|
||||||
t.Namespace = api.NamespaceDefault
|
t.Namespace = api.NamespaceDefault
|
||||||
}
|
}
|
||||||
gv := schema.GroupVersion{
|
errors = networking_validation.ValidateIngressCreate(t)
|
||||||
Group: networking.GroupName,
|
|
||||||
Version: legacyscheme.Scheme.PrioritizedVersionsForGroup(networking.GroupName)[0].Version,
|
|
||||||
}
|
|
||||||
errors = networking_validation.ValidateIngressCreate(t, gv)
|
|
||||||
case *networking.IngressClass:
|
case *networking.IngressClass:
|
||||||
/*
|
/*
|
||||||
if t.Namespace == "" {
|
if t.Namespace == "" {
|
||||||
@@ -301,7 +293,7 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
|
|||||||
errors = networking_validation.ValidateIngressClass(t)
|
errors = networking_validation.ValidateIngressClass(t)
|
||||||
|
|
||||||
case *policy.PodSecurityPolicy:
|
case *policy.PodSecurityPolicy:
|
||||||
errors = policy_validation.ValidatePodSecurityPolicy(t, pspValidationOptions)
|
errors = policy_validation.ValidatePodSecurityPolicy(t)
|
||||||
case *apps.ReplicaSet:
|
case *apps.ReplicaSet:
|
||||||
if t.Namespace == "" {
|
if t.Namespace == "" {
|
||||||
t.Namespace = api.NamespaceDefault
|
t.Namespace = api.NamespaceDefault
|
||||||
@@ -405,7 +397,7 @@ func TestExampleObjectSchemas(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"admin/dns": {
|
"admin/dns": {
|
||||||
"busybox": {&api.Pod{}},
|
"busybox": {&api.Pod{}},
|
||||||
"dns-horizontal-autoscaler": {&apps.Deployment{}},
|
"dns-horizontal-autoscaler": {&api.ServiceAccount{}, &rbac.ClusterRole{}, &rbac.ClusterRoleBinding{}, &apps.Deployment{}},
|
||||||
"dnsutils": {&api.Pod{}},
|
"dnsutils": {&api.Pod{}},
|
||||||
},
|
},
|
||||||
"admin/logging": {
|
"admin/logging": {
|
||||||
@@ -453,7 +445,7 @@ func TestExampleObjectSchemas(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"admin/sched": {
|
"admin/sched": {
|
||||||
"clusterrole": {&rbac.ClusterRole{}},
|
"clusterrole": {&rbac.ClusterRole{}},
|
||||||
"my-scheduler": {&api.ServiceAccount{}, &rbac.ClusterRoleBinding{}, &rbac.ClusterRoleBinding{}, &apps.Deployment{}},
|
"my-scheduler": {&api.ServiceAccount{}, &rbac.ClusterRoleBinding{}, &rbac.ClusterRoleBinding{}, &api.ConfigMap{}, &apps.Deployment{}},
|
||||||
"pod1": {&api.Pod{}},
|
"pod1": {&api.Pod{}},
|
||||||
"pod2": {&api.Pod{}},
|
"pod2": {&api.Pod{}},
|
||||||
"pod3": {&api.Pod{}},
|
"pod3": {&api.Pod{}},
|
||||||
@@ -592,6 +584,7 @@ func TestExampleObjectSchemas(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"pods/probe": {
|
"pods/probe": {
|
||||||
"exec-liveness": {&api.Pod{}},
|
"exec-liveness": {&api.Pod{}},
|
||||||
|
"grpc-liveness": {&api.Pod{}},
|
||||||
"http-liveness": {&api.Pod{}},
|
"http-liveness": {&api.Pod{}},
|
||||||
"pod-with-http-healthcheck": {&api.Pod{}},
|
"pod-with-http-healthcheck": {&api.Pod{}},
|
||||||
"pod-with-tcp-socket-healthcheck": {&api.Pod{}},
|
"pod-with-tcp-socket-healthcheck": {&api.Pod{}},
|
||||||
@@ -620,11 +613,15 @@ func TestExampleObjectSchemas(t *testing.T) {
|
|||||||
"security-context-4": {&api.Pod{}},
|
"security-context-4": {&api.Pod{}},
|
||||||
},
|
},
|
||||||
"pods/storage": {
|
"pods/storage": {
|
||||||
"projected": {&api.Pod{}},
|
"projected": {&api.Pod{}},
|
||||||
"pv-claim": {&api.PersistentVolumeClaim{}},
|
"projected-secret-downwardapi-configmap": {&api.Pod{}},
|
||||||
"pv-pod": {&api.Pod{}},
|
"projected-secrets-nondefault-permission-mode": {&api.Pod{}},
|
||||||
"pv-volume": {&api.PersistentVolume{}},
|
"projected-service-account-token": {&api.Pod{}},
|
||||||
"redis": {&api.Pod{}},
|
"pv-claim": {&api.PersistentVolumeClaim{}},
|
||||||
|
"pv-duplicate": {&api.Pod{}},
|
||||||
|
"pv-pod": {&api.Pod{}},
|
||||||
|
"pv-volume": {&api.PersistentVolume{}},
|
||||||
|
"redis": {&api.Pod{}},
|
||||||
},
|
},
|
||||||
"policy": {
|
"policy": {
|
||||||
"baseline-psp": {&policy.PodSecurityPolicy{}},
|
"baseline-psp": {&policy.PodSecurityPolicy{}},
|
||||||
|
|||||||
Reference in New Issue
Block a user