diff --git a/api/examples/controller-list.json b/api/examples/controller-list.json index 4cadf176865..e883abac57f 100644 --- a/api/examples/controller-list.json +++ b/api/examples/controller-list.json @@ -3,11 +3,11 @@ "apiVersion": "v1beta1", "items": [ { - "id": "testRun", + "id": "test-run", "desiredState": { "replicas": 2, "replicaSelector": { - "name": "testRun" + "name": "test-run" }, "podTemplate": { "desiredState": { @@ -23,12 +23,12 @@ } }, "labels": { - "name": "testRun" + "name": "test-run" } } }, "labels": { - "name": "testRun" + "name": "test-run" } } ] diff --git a/api/examples/controller.json b/api/examples/controller.json index d385569898b..03910e88c5d 100644 --- a/api/examples/controller.json +++ b/api/examples/controller.json @@ -1,5 +1,5 @@ { - "id": "nginxController", + "id": "nginx-controller", "apiVersion": "v1beta1", "kind": "ReplicationController", "desiredState": { @@ -9,7 +9,7 @@ "desiredState": { "manifest": { "version": "v1beta1", - "id": "nginxController", + "id": "nginx-controller", "containers": [{ "name": "nginx", "image": "dockerfile/nginx", diff --git a/api/examples/pod-list.json b/api/examples/pod-list.json index 01e4fd4de75..5d867de44e4 100644 --- a/api/examples/pod-list.json +++ b/api/examples/pod-list.json @@ -5,8 +5,8 @@ { "id": "my-pod-1", "labels": { - "name": "testRun", - "replicationcontroller": "testRun" + "name": "test-run", + "replicationcontroller": "test-run" }, "desiredState": { "manifest": { @@ -29,8 +29,8 @@ { "id": "my-pod-2", "labels": { - "name": "testRun", - "replicationcontroller": "testRun" + "name": "test-run", + "replicationcontroller": "test-run" }, "desiredState": { "manifest": { diff --git a/examples/guestbook/README.md b/examples/guestbook/README.md index 3e28f0f8707..61fb160a994 100644 --- a/examples/guestbook/README.md +++ b/examples/guestbook/README.md @@ -121,7 +121,7 @@ Use the file `examples/guestbook/redis-slave-controller.json`: ```js { - "id": "redisSlaveController", + "id": "redis-slave-controller", "kind": "ReplicationController", "apiVersion": "v1beta1", "desiredState": { @@ -131,7 +131,7 @@ Use the file `examples/guestbook/redis-slave-controller.json`: "desiredState": { "manifest": { "version": "v1beta1", - "id": "redisSlaveController", + "id": "redis-slave-controller", "containers": [{ "name": "slave", "image": "brendanburns/redis-slave", @@ -153,11 +153,11 @@ to create the replication controller by running: ```shell $ cluster/kubectl.sh create -f examples/guestbook/redis-slave-controller.json -redisSlaveController +redis-slave-controller # cluster/kubectl.sh get replicationcontrollers -NAME IMAGE(S) SELECTOR REPLICAS -redisSlaveController brendanburns/redis-slave name=redisslave 2 +NAME IMAGE(S) SELECTOR REPLICAS +redis-slave-controller brendanburns/redis-slave name=redisslave 2 ``` The redis slave configures itself by looking for the Kubernetes service environment variables in the container environment. In particular, the redis slave is started with the following command: @@ -225,7 +225,7 @@ The pod is described in the file `examples/guestbook/frontend-controller.json`: ```js { - "id": "frontendController", + "id": "frontend-controller", "kind": "ReplicationController", "apiVersion": "v1beta1", "desiredState": { @@ -235,7 +235,7 @@ The pod is described in the file `examples/guestbook/frontend-controller.json`: "desiredState": { "manifest": { "version": "v1beta1", - "id": "frontendController", + "id": "frontend-controller", "containers": [{ "name": "php-redis", "image": "kubernetes/example-guestbook-php-redis", @@ -258,12 +258,12 @@ Using this file, you can turn up your frontend with: ```shell $ cluster/kubectl.sh create -f examples/guestbook/frontend-controller.json -frontendController +frontend-controller $ cluster/kubectl.sh get replicationcontrollers -NAME IMAGE(S) SELECTOR REPLICAS -redisSlaveController brendanburns/redis-slave name=redisslave 2 -frontendController kubernetes/example-guestbook-php-redis name=frontend 3 +NAME IMAGE(S) SELECTOR REPLICAS +redis-slave-controller brendanburns/redis-slave name=redisslave 2 +frontend-controller kubernetes/example-guestbook-php-redis name=frontend 3 ``` Once that's up (it may take ten to thirty seconds to create the pods) you can list the pods in the cluster, to verify that the master, slaves and frontends are running: diff --git a/examples/guestbook/frontend-controller.json b/examples/guestbook/frontend-controller.json index 44dfd4d1c8f..06e3f487768 100644 --- a/examples/guestbook/frontend-controller.json +++ b/examples/guestbook/frontend-controller.json @@ -1,5 +1,5 @@ { - "id": "frontendController", + "id": "frontend-controller", "kind": "ReplicationController", "apiVersion": "v1beta1", "desiredState": { @@ -9,7 +9,7 @@ "desiredState": { "manifest": { "version": "v1beta1", - "id": "frontendController", + "id": "frontend-controller", "containers": [{ "name": "php-redis", "image": "kubernetes/example-guestbook-php-redis", diff --git a/examples/guestbook/redis-slave-controller.json b/examples/guestbook/redis-slave-controller.json index 7830dce44a6..cda7bdcc193 100644 --- a/examples/guestbook/redis-slave-controller.json +++ b/examples/guestbook/redis-slave-controller.json @@ -1,5 +1,5 @@ { - "id": "redisSlaveController", + "id": "redis-slave-controller", "kind": "ReplicationController", "apiVersion": "v1beta1", "desiredState": { @@ -9,7 +9,7 @@ "desiredState": { "manifest": { "version": "v1beta1", - "id": "redisSlaveController", + "id": "redis-slave-controller", "containers": [{ "name": "slave", "image": "brendanburns/redis-slave", diff --git a/examples/walkthrough/k8s201.md b/examples/walkthrough/k8s201.md index 5f123c26ce3..009dc1f53a5 100644 --- a/examples/walkthrough/k8s201.md +++ b/examples/walkthrough/k8s201.md @@ -23,7 +23,7 @@ Replication controllers are the objects to answer these questions. A replicatio An example replica controller that instantiates two pods running nginx looks like: ```yaml -id: nginxController +id: nginx-controller apiVersion: v1beta1 kind: ReplicationController desiredState: diff --git a/examples/walkthrough/replication-controller.yaml b/examples/walkthrough/replication-controller.yaml index bf5106afb79..7273b05e24a 100644 --- a/examples/walkthrough/replication-controller.yaml +++ b/examples/walkthrough/replication-controller.yaml @@ -1,4 +1,4 @@ -id: nginxController +id: nginx-controller apiVersion: v1beta1 kind: ReplicationController desiredState: diff --git a/hack/e2e-suite/guestbook.sh b/hack/e2e-suite/guestbook.sh index 436eb2634a8..bc2956bb763 100755 --- a/hack/e2e-suite/guestbook.sh +++ b/hack/e2e-suite/guestbook.sh @@ -38,10 +38,10 @@ sleep 5 POD_LIST_1=$($KUBECFG '-template={{range.items}}{{.id}} {{end}}' list pods) echo "Pods running: ${POD_LIST_1}" -$KUBECFG stop redisSlaveController +$KUBECFG stop redis-slave-controller # Needed until issue #103 gets fixed sleep 25 -$KUBECFG rm redisSlaveController +$KUBECFG rm redis-slave-controller $KUBECFG delete services/redis-master $KUBECFG delete pods/redis-master diff --git a/hack/test-cmd.sh b/hack/test-cmd.sh index 49522982876..5d48dcaa10b 100755 --- a/hack/test-cmd.sh +++ b/hack/test-cmd.sh @@ -168,8 +168,8 @@ __EOF__ kubectl get replicationcontrollers "${kube_flags[@]}" kubectl create -f examples/guestbook/frontend-controller.json "${kube_flags[@]}" kubectl get replicationcontrollers "${kube_flags[@]}" - kubectl describe replicationcontroller frontendController "${kube_flags[@]}" | grep -q 'Replicas:.*3 desired' - kubectl delete rc frontendController "${kube_flags[@]}" + kubectl describe replicationcontroller frontend-controller "${kube_flags[@]}" | grep -q 'Replicas:.*3 desired' + kubectl delete rc frontend-controller "${kube_flags[@]}" kube::log::status "Testing kubectl(${version}:nodes)" kubectl get nodes "${kube_flags[@]}" diff --git a/pkg/api/validation/validation.go b/pkg/api/validation/validation.go index 8cdaaedfa78..585fbf8481d 100644 --- a/pkg/api/validation/validation.go +++ b/pkg/api/validation/validation.go @@ -467,7 +467,9 @@ func ValidateService(service *api.Service, lister ServiceLister, ctx api.Context } else if !util.IsDNS952Label(service.Name) { allErrs = append(allErrs, errs.NewFieldInvalid("name", service.Name, "")) } - if !util.IsDNSSubdomain(service.Namespace) { + if len(service.Namespace) == 0 { + allErrs = append(allErrs, errs.NewFieldRequired("namespace", service.Namespace)) + } else if !util.IsDNSSubdomain(service.Namespace) { allErrs = append(allErrs, errs.NewFieldInvalid("namespace", service.Namespace, "")) } if !util.IsValidPortNum(service.Spec.Port) { @@ -499,8 +501,12 @@ func ValidateReplicationController(controller *api.ReplicationController) errs.V allErrs := errs.ValidationErrorList{} if len(controller.Name) == 0 { allErrs = append(allErrs, errs.NewFieldRequired("name", controller.Name)) + } else if !util.IsDNSSubdomain(controller.Name) { + allErrs = append(allErrs, errs.NewFieldInvalid("name", controller.Name, "")) } - if !util.IsDNSSubdomain(controller.Namespace) { + if len(controller.Namespace) == 0 { + allErrs = append(allErrs, errs.NewFieldRequired("namespace", controller.Namespace)) + } else if !util.IsDNSSubdomain(controller.Namespace) { allErrs = append(allErrs, errs.NewFieldInvalid("namespace", controller.Namespace, "")) } allErrs = append(allErrs, ValidateReplicationControllerSpec(&controller.Spec).Prefix("spec")...) @@ -582,11 +588,13 @@ func ValidateBoundPod(pod *api.BoundPod) errs.ValidationErrorList { // ValidateMinion tests if required fields in the minion are set. func ValidateMinion(minion *api.Node) errs.ValidationErrorList { allErrs := errs.ValidationErrorList{} - if len(minion.Namespace) != 0 { - allErrs = append(allErrs, errs.NewFieldInvalid("namespace", minion.Namespace, "")) - } if len(minion.Name) == 0 { allErrs = append(allErrs, errs.NewFieldRequired("name", minion.Name)) + } else if !util.IsDNSSubdomain(minion.Name) { + allErrs = append(allErrs, errs.NewFieldInvalid("name", minion.Name, "")) + } + if len(minion.Namespace) != 0 { + allErrs = append(allErrs, errs.NewFieldInvalid("namespace", minion.Namespace, "")) } allErrs = append(allErrs, ValidateLabels(minion.Labels, "labels")...) allErrs = append(allErrs, ValidateLabels(minion.Annotations, "annotations")...) diff --git a/pkg/config/config_test.json b/pkg/config/config_test.json index df694a0bdad..3696e1dfc3e 100644 --- a/pkg/config/config_test.json +++ b/pkg/config/config_test.json @@ -60,8 +60,8 @@ } }, { - "id": "frontendController", - "name": "frontendController", + "id": "frontend-controller", + "name": "frontend-controller", "kind": "ReplicationController", "apiVersion": "v1beta1", "desiredState": { @@ -97,8 +97,8 @@ "labels": {"name": "frontend"} }, { - "id": "redisSlaveController", - "name": "redisSlaveController", + "id": "redis-slave-controller", + "name": "redis-slave-controller", "kind": "ReplicationController", "apiVersion": "v1beta1", "desiredState": { diff --git a/pkg/kubectl/cmd/create_test.go b/pkg/kubectl/cmd/create_test.go index 2253b9f74b0..c7a79c5c2b4 100644 --- a/pkg/kubectl/cmd/create_test.go +++ b/pkg/kubectl/cmd/create_test.go @@ -114,7 +114,7 @@ func TestCreateDirectory(t *testing.T) { cmd.Flags().Set("filename", "../../../examples/guestbook") cmd.Run(cmd, []string{}) - if buf.String() != "frontendController\nfrontend\nredis-master\nredis-master\nredisSlaveController\nredisslave\n" { + if buf.String() != "frontend-controller\nfrontend\nredis-master\nredis-master\nredis-slave-controller\nredisslave\n" { t.Errorf("unexpected output: %s", buf.String()) } } diff --git a/pkg/kubectl/cmd/delete_test.go b/pkg/kubectl/cmd/delete_test.go index 3885d2f9fdd..7fad141e7bf 100644 --- a/pkg/kubectl/cmd/delete_test.go +++ b/pkg/kubectl/cmd/delete_test.go @@ -206,7 +206,7 @@ func TestDeleteDirectory(t *testing.T) { cmd.Flags().Set("filename", "../../../examples/guestbook") cmd.Run(cmd, []string{}) - if buf.String() != "frontendController\nfrontend\nredis-master\nredis-master\nredisSlaveController\nredisslave\n" { + if buf.String() != "frontend-controller\nfrontend\nredis-master\nredis-master\nredis-slave-controller\nredisslave\n" { t.Errorf("unexpected output: %s", buf.String()) } } diff --git a/pkg/registry/controller/rest_test.go b/pkg/registry/controller/rest_test.go index 585a956c0ce..7f58b998f7d 100644 --- a/pkg/registry/controller/rest_test.go +++ b/pkg/registry/controller/rest_test.go @@ -143,7 +143,7 @@ func TestControllerDecode(t *testing.T) { func TestControllerParsing(t *testing.T) { expectedController := api.ReplicationController{ ObjectMeta: api.ObjectMeta{ - Name: "nginxController", + Name: "nginx-controller", Labels: map[string]string{ "name": "nginx", },