mirror of https://github.com/k3s-io/k3s
Merge pull request #1238 from brendandburns/service
Add an earlier check and error for names that won't work for services.pull/6/head
commit
fb4199cba7
|
@ -29,6 +29,7 @@ import (
|
|||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/wait"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
|
||||
"github.com/golang/glog"
|
||||
|
@ -174,6 +175,9 @@ func portsFromString(spec string) []api.Port {
|
|||
|
||||
// RunController creates a new replication controller named 'name' which creates 'replicas' pods running 'image'.
|
||||
func RunController(image, name string, replicas int, client client.Interface, portSpec string, servicePort int) error {
|
||||
if servicePort > 0 && !util.IsDNSLabel(name) {
|
||||
return fmt.Errorf("Service creation requested, but an invalid name for a service was provided (%s). Service names must be valid DNS labels.", name)
|
||||
}
|
||||
controller := &api.ReplicationController{
|
||||
JSONBase: api.JSONBase{
|
||||
ID: name,
|
||||
|
|
Loading…
Reference in New Issue