mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-24 19:12:02 +00:00
kubelet: validate service names with slashes
Signed-off-by: Stephen Kitt <skitt@redhat.com>
This commit is contained in:
parent
dbfab994bf
commit
9f2a02a723
@ -136,6 +136,7 @@ func Test_validateServices(t *testing.T) {
|
|||||||
serviceColon = "svc:foo"
|
serviceColon = "svc:foo"
|
||||||
invalidServiceNewline = "svc\n"
|
invalidServiceNewline = "svc\n"
|
||||||
invalidServiceNewlineDot = "svc.foo\n"
|
invalidServiceNewlineDot = "svc.foo\n"
|
||||||
|
invalidServiceSlash = "svc/foo"
|
||||||
)
|
)
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
@ -150,6 +151,7 @@ func Test_validateServices(t *testing.T) {
|
|||||||
{name: "colon service", services: []string{serviceColon}},
|
{name: "colon service", services: []string{serviceColon}},
|
||||||
{name: "invalid service new line", services: []string{invalidServiceNewline}, wantErr: true},
|
{name: "invalid service new line", services: []string{invalidServiceNewline}, wantErr: true},
|
||||||
{name: "invalid service with dot", services: []string{invalidServiceNewlineDot}, wantErr: true},
|
{name: "invalid service with dot", services: []string{invalidServiceNewlineDot}, wantErr: true},
|
||||||
|
{name: "invalid service with slash", services: []string{invalidServiceSlash}, wantErr: true},
|
||||||
{name: "long service", services: []string{strings.Repeat(service1, 100)}, wantErr: true},
|
{name: "long service", services: []string{strings.Repeat(service1, 100)}, wantErr: true},
|
||||||
{name: "max number of services", services: []string{service1, service2, serviceDot, serviceUnderscore, serviceAt}, wantErr: true},
|
{name: "max number of services", services: []string{service1, service2, serviceDot, serviceUnderscore, serviceAt}, wantErr: true},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user