You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2017/12/01 20:37:43 UTC

[GitHub] rabbah closed pull request #55: Change the invoker to DaemonSet

rabbah closed pull request #55: Change the invoker to DaemonSet
URL: https://github.com/apache/incubator-openwhisk-deploy-kube/pull/55
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/configure/cleanup.sh b/configure/cleanup.sh
index d9b3349..95e5f46 100755
--- a/configure/cleanup.sh
+++ b/configure/cleanup.sh
@@ -11,7 +11,7 @@ kubectl -n openwhisk delete deployment apigateway
 kubectl -n openwhisk delete deployment zookeeper
 kubectl -n openwhisk delete deployment kafka
 kubectl -n openwhisk delete statefulsets controller
-kubectl -n openwhisk delete statefulsets invoker
+kubectl -n openwhisk delete daemonset invoker
 kubectl -n openwhisk delete deployment nginx
 
 # delete configmaps
diff --git a/kubernetes/invoker/README.md b/kubernetes/invoker/README.md
index 15d6d6e..1c3c82c 100644
--- a/kubernetes/invoker/README.md
+++ b/kubernetes/invoker/README.md
@@ -4,10 +4,30 @@ Invoker
 # Deploying
 
 When deploying the Invoker, it needs to be deployed via a
-[StatefulSet](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/).
-This is because each Invoker instance needs to know the instance
-it is for the Kafka topic. The current deployment is a single
-Invoker instance and can be deployed with:
+[DaemonSet](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/).
+This is because there should only ever be at most 1 Invoker
+instance per Kube Node. To set these restrictions, it will be
+up to the Kubernetes deployment operator to properly apply
+the correct labels and taints to each required Kube node.
+
+With the defauts in the current `invoker.yml`, you can setup a
+node to run only Invoker pods with:
+
+```
+kubectl label nodes [node name] openwhisk=invoker
+$ kubectl label nodes 127.0.0.1 openwhisk=invoker
+```
+
+If you would then like to restrict nodes farther so that
+they only run Invoker podes, you can set some taints:
+
+```
+kubectl taint nodes [node name] dedicated=invoker:NoSchedule
+kubectl taint nodes [node name] dedicated=invoker:NoExecute
+```
+
+The taint nodes are optional, but once the invoker label is applied,
+you can create the invokers with:
 
 ```
 kubectl apply -f invoker.yml
diff --git a/kubernetes/invoker/invoker.yml b/kubernetes/invoker/invoker.yml
index f50092f..5611065 100644
--- a/kubernetes/invoker/invoker.yml
+++ b/kubernetes/invoker/invoker.yml
@@ -1,20 +1,29 @@
 ---
-apiVersion: apps/v1beta1
-kind: StatefulSet
+apiVersion: extensions/v1beta1
+kind: DaemonSet
 metadata:
   name: invoker
   namespace: openwhisk
   labels:
     name: invoker
 spec:
-  replicas: 1
-  serviceName: "invoker"
   template:
     metadata:
       labels:
         name: invoker
     spec:
       restartPolicy: Always
+      nodeSelector:
+        openwhisk: "invoker"
+      tolerations:
+        - key: "dedicated"
+          value: "invoker"
+          effect: "NoSchedule"
+          operator: "Equal"
+        - key: "dedicated"
+          value: "invoker"
+          effect: "NoExecute"
+          operator: "Equal"
 
       volumes:
       - name: cgroup
@@ -37,7 +46,7 @@ spec:
       - name: invoker
         imagePullPolicy: Always
         image: openwhisk/invoker
-        command: [ "/bin/bash", "-c", "COMPONENT_NAME=$(hostname | cut -d'-' -f2) /invoker/bin/invoker `hostname | cut -d'-' -f2`" ]
+        command: [ "/bin/bash", "-c", "/invoker/bin/invoker" ]
         env:
           - name: "PORT"
             value: "8080"
@@ -127,6 +136,12 @@ spec:
             value: "test_whisks"
           - name: "DB_WHISK_AUTHS"
             value: "test_subjects"
+
+          # UUID for the pod can be the hostname of the Kube node
+          - name: "INVOKER_ASSIGNED_NAME"
+            valueFrom:
+              fieldRef:
+                fieldPath: spec.nodeName
         ports:
         - name: invoker
           containerPort: 8080
diff --git a/tools/travis/build.sh b/tools/travis/build.sh
index 5d117e6..5ea96b8 100755
--- a/tools/travis/build.sh
+++ b/tools/travis/build.sh
@@ -145,7 +145,7 @@ pushd kubernetes/invoker
   kubectl apply -f invoker.yml
 
   # wait until the invoker is ready
-  statefulsetHealthCheck "invoker"
+  deploymentHealthCheck "invoker"
 popd
 
 # setup nginx
diff --git a/tools/travis/setup.sh b/tools/travis/setup.sh
index 6fdbc42..cc57a64 100755
--- a/tools/travis/setup.sh
+++ b/tools/travis/setup.sh
@@ -64,3 +64,6 @@ sudo chown -R $USER:$USER $HOME/.kube
 # Have seen issues where chown does not instantly change file permissions.
 # When this happens the build.sh cript can have failures.
 sleep 30
+
+# set the invoker label
+kubectl label nodes 127.0.0.1 openwhisk=invoker


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services