From 6b4726d39b67b945160c945422becdb4d93cfadd Mon Sep 17 00:00:00 2001 From: goltermann Date: Tue, 17 Nov 2015 12:53:46 -0800 Subject: [PATCH] Put DM into its own namespace. --- README.md | 6 +++--- dm/dm.go | 2 +- examples/bootstrap/bootstrap.sh | 6 +++++- examples/bootstrap/bootstrap.yaml | 3 +++ examples/bootstrap/dm-namespace.yaml | 7 +++++++ install.yaml | 20 ++++++++++++++------ manager/manager/deployer_test.go | 4 ++-- 7 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 examples/bootstrap/dm-namespace.yaml diff --git a/README.md b/README.md index 3216d1f3b..bf876b5cb 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ install.yaml` That's it. You can now use `kubectl` to see DM running in your cluster: ``` -kubectl get pod,rc,service +kubectl get pod,rc,service --namespace=dm ``` If you see expandybird-service, manager-service, resourcifier-service, and @@ -70,9 +70,9 @@ The easiest way to interact with Deployment Manager is through the `dm` tool hitting a `kubectl` proxy. To set that up: 1. Build the tool by running `make` in the deployment-manager repository. -1. Run `kubectl proxy --port=8001 &` to start a proxy that lets you interact +1. Run `kubectl proxy --port=8001 --namespace=dm &` to start a proxy that lets you interact with the Kubernetes API server through port 8001 on localhost. `dm` uses -`http://localhost:8001/api/v1/proxy/namespaces/default/services/manager-service:manager` +`http://localhost:8001/api/v1/proxy/namespaces/dm/services/manager-service:manager` as the default service address for DM. ### Using the client diff --git a/dm/dm.go b/dm/dm.go index 1f444345a..6fa1494ae 100644 --- a/dm/dm.go +++ b/dm/dm.go @@ -39,7 +39,7 @@ var ( stdin = flag.Bool("stdin", false, "Reads a configuration from the standard input") properties = flag.String("properties", "", "Properties to use when deploying a template (e.g., --properties k1=v1,k2=v2)") template_registry = flag.String("registry", "kubernetes/deployment-manager/templates", "Github based template registry (owner/repo[/path])") - service = flag.String("service", "http://localhost:8001/api/v1/proxy/namespaces/default/services/manager-service:manager", "URL for deployment manager") + service = flag.String("service", "http://localhost:8001/api/v1/proxy/namespaces/dm/services/manager-service:manager", "URL for deployment manager") binary = flag.String("binary", "../expandybird/expansion/expansion.py", "Path to template expansion binary") ) diff --git a/examples/bootstrap/bootstrap.sh b/examples/bootstrap/bootstrap.sh index c80fd6a48..a1b2776fa 100755 --- a/examples/bootstrap/bootstrap.sh +++ b/examples/bootstrap/bootstrap.sh @@ -41,9 +41,13 @@ pkill -f $MANAGER $MANAGER > $LOGDIR/manager.log 2>&1 --port=8080 --expanderURL=http://localhost:8081 --deployerURL=http://localhost:8082 & echo +echo "Creating dm namespace..." +$KUBECTL create -f dm-namespace.yaml +echo + echo "Starting kubectl proxy..." pkill -f "$KUBECTL proxy" -$KUBECTL proxy --port=8001 & +$KUBECTL proxy --port=8001 --namespace=dm & sleep 1s echo diff --git a/examples/bootstrap/bootstrap.yaml b/examples/bootstrap/bootstrap.yaml index 9b90b2918..a562666fa 100644 --- a/examples/bootstrap/bootstrap.yaml +++ b/examples/bootstrap/bootstrap.yaml @@ -2,6 +2,7 @@ resources: - name: expandybird type: https://raw.githubusercontent.com/kubernetes/deployment-manager/master/templates/replicatedservice/v1/replicatedservice.py properties: + namespace: dm service_port: 8081 target_port: 8080 container_port: 8080 @@ -13,6 +14,7 @@ resources: - name: resourcifier type: https://raw.githubusercontent.com/kubernetes/deployment-manager/master/templates/replicatedservice/v1/replicatedservice.py properties: + namespace: dm service_port: 8082 target_port: 8080 container_port: 8080 @@ -24,6 +26,7 @@ resources: - name: manager type: https://raw.githubusercontent.com/kubernetes/deployment-manager/master/templates/replicatedservice/v1/replicatedservice.py properties: + namespace: dm service_port: 8080 target_port: 8080 container_port: 8080 diff --git a/examples/bootstrap/dm-namespace.yaml b/examples/bootstrap/dm-namespace.yaml new file mode 100644 index 000000000..91eeb5bac --- /dev/null +++ b/examples/bootstrap/dm-namespace.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Namespace +metadata: + labels: + app: dm + name: dm-namespace + name: dm diff --git a/install.yaml b/install.yaml index 166b0cd2b..dd38664ad 100644 --- a/install.yaml +++ b/install.yaml @@ -11,6 +11,14 @@ # limitations under the License. ###################################################################### +--- +apiVersion: v1 +kind: Namespace +metadata: + labels: + app: dm + name: dm-namespace + name: dm --- apiVersion: v1 kind: Service @@ -19,7 +27,7 @@ metadata: app: dm name: expandybird-service name: expandybird-service - namespace: default + namespace: dm spec: ports: - name: expandybird @@ -36,7 +44,7 @@ metadata: app: dm name: expandybird-rc name: expandybird-rc - namespace: default + namespace: dm spec: replicas: 2 selector: @@ -63,7 +71,7 @@ metadata: app: dm name: resourcifier-service name: resourcifier-service - namespace: default + namespace: dm spec: ports: - name: resourcifier @@ -80,7 +88,7 @@ metadata: app: dm name: resourcifier-rc name: resourcifier-rc - namespace: default + namespace: dm spec: replicas: 2 selector: @@ -107,7 +115,7 @@ metadata: app: dm name: manager-service name: manager-service - namespace: default + namespace: dm spec: ports: - name: manager @@ -124,7 +132,7 @@ metadata: app: dm name: manager-rc name: manager-rc - namespace: default + namespace: dm spec: replicas: 1 selector: diff --git a/manager/manager/deployer_test.go b/manager/manager/deployer_test.go index edfe7d6de..d6eaee3ce 100644 --- a/manager/manager/deployer_test.go +++ b/manager/manager/deployer_test.go @@ -37,7 +37,7 @@ resources: apiVersion: v1 metadata: name: test-controller-v1 - namespace: default + namespace: dm labels: k8s-app: test version: v1 @@ -66,7 +66,7 @@ resources: kind: Service metadata: name: test - namespace: default + namespace: dm labels: k8s-app: test version: v1