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/04 17:44:05 UTC

[GitHub] rabbah closed pull request #107: Daemon set merge

rabbah closed pull request #107: Daemon set merge
URL: https://github.com/apache/incubator-openwhisk-deploy-kube/pull/107
 
 
   

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 7d4a604..9116e61 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 82bed6b..02c13db 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 defaults 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 pods, 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
@@ -55,7 +75,7 @@ env:
 ```
 ## Kubernetes Host Linux Versions
 
-Unfortunitaly when Deploying OpenWhisk on Kubernetes it currently mounts some
+Unfortunately when Deploying OpenWhisk on Kubernetes it currently mounts some
 of the host OS files for the Invoker process and needs to make some assumptions.
 Because of this, some failures are known to happen on certain Linux versions,
 like CoreOs. If you see an error like:
diff --git a/kubernetes/invoker/invoker.yml b/kubernetes/invoker/invoker.yml
index 11be55d..0587154 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) /init.sh `hostname | cut -d'-' -f2`" ]
+        command: [ "/bin/bash", "-c", "COMPONENT_NAME=$(hostname | cut -d'-' -f2) /init.sh" ]
         env:
           - name: "PORT"
             value: "8080"
@@ -129,6 +138,12 @@ spec:
             value: "test_whisks"
           - name: "DB_WHISK_AUTHS"
             value: "test_subjects"
+
+          # Name for the pod can be the hostname of the Kube node
+          - name: "INVOKER_NAME"
+            valueFrom:
+              fieldRef:
+                fieldPath: spec.nodeName
         ports:
         - name: invoker
           containerPort: 8080
diff --git a/tools/travis/build.sh b/tools/travis/build.sh
index 147d0ab..becff4b 100755
--- a/tools/travis/build.sh
+++ b/tools/travis/build.sh
@@ -153,7 +153,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 a4a2565..7594cb3 100755
--- a/tools/travis/setup.sh
+++ b/tools/travis/setup.sh
@@ -37,3 +37,5 @@ fi
 
 echo "minikube is deployed and reachable"
 
+# set the invoker label
+kubectl label nodes --all 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