mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
core/v1: add unit tests that allow internalTrafficPolicy field when type is ExternalName
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>
This commit is contained in:
parent
60b38ee180
commit
99cb5d2f21
@ -12291,6 +12291,21 @@ func TestValidateServiceCreate(t *testing.T) {
|
||||
featureGates: []featuregate.Feature{features.ServiceInternalTrafficPolicy},
|
||||
numErrs: 0,
|
||||
},
|
||||
{
|
||||
// Typically this should fail validation, but in v1.22 we have existing clusters
|
||||
// that may have allowed internalTrafficPolicy when Type=ExternalName.
|
||||
// This test case ensures we don't break compatibility for internalTrafficPolicy
|
||||
// when Type=ExternalName
|
||||
name: "internalTrafficPolicy field is set when type is ExternalName",
|
||||
tweakSvc: func(s *core.Service) {
|
||||
cluster := core.ServiceInternalTrafficPolicyCluster
|
||||
s.Spec.InternalTrafficPolicy = &cluster
|
||||
s.Spec.Type = core.ServiceTypeExternalName
|
||||
s.Spec.ExternalName = "foo.bar.com"
|
||||
},
|
||||
featureGates: []featuregate.Feature{features.ServiceInternalTrafficPolicy},
|
||||
numErrs: 0,
|
||||
},
|
||||
{
|
||||
name: "invalid internalTraffic field",
|
||||
tweakSvc: func(s *core.Service) {
|
||||
|
Loading…
Reference in New Issue
Block a user