Skip to content

Commit 8c140e0

Browse files
authored
Dedicated Invokers (#5292)
* Support dedicated invokers. This is to provide dedicated invokers for a namespace. Operators can configure a dedicated namespace for invokers and all activations from the namespace will be delivered to the dedicated invokers only. * Add documentation.
1 parent d55d8fe commit 8c140e0

File tree

4 files changed

+49
-1
lines changed

4 files changed

+49
-1
lines changed

ansible/roles/invoker/tasks/deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@
283283
"CONFIG_whisk_invoker_https_keystoreFlavor": "{{ invoker.ssl.storeFlavor }}"
284284
"CONFIG_whisk_invoker_https_clientAuth": "{{ invoker.ssl.clientAuth }}"
285285
"CONFIG_whisk_invoker_resource_tags": "{% if tags is defined %} '{{ tags | join(',') }}' {% else %} '' {% endif %}"
286+
"CONFIG_whisk_invoker_dedicated_namespaces": "{% if dedicatedNamespaces is defined %} '{{ dedicatedNamespaces | join(',') }}' {% else %} '' {% endif %}"
286287
"CONFIG_whisk_containerProxy_timeouts_idleContainer": "{{ whisk.containerProxy.timeouts.idleContainer }}"
287288
"CONFIG_whisk_containerProxy_timeouts_pauseGrace": "{{ whisk.containerProxy.timeouts.pauseGrace }}"
288289
"CONFIG_whisk_containerProxy_timeouts_keepingDuration": "{{ whisk.containerProxy.timeouts.keepingDuration }}"

common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,4 +319,5 @@ object ConfigKeys {
319319
val whiskInvokerPassword = "whisk.invoker.password"
320320

321321
val invokerResourceTags = "whisk.invoker.resource.tags"
322+
val invokerDedicatedNamespaces = "whisk.invoker.dedicated.namespaces"
322323
}

core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/Invoker.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ object Invoker {
114114
.filter(_ != "")
115115
.map(_.split(",").toSeq)
116116
.getOrElse(Seq.empty[String])
117+
val dedicatedNamespaces: Seq[String] = Some(loadConfigOrThrow[String](ConfigKeys.invokerDedicatedNamespaces))
118+
.map(_.trim())
119+
.filter(_ != "")
120+
.map(_.split(",").toSeq)
121+
.getOrElse(Seq.empty[String])
117122

118123
logger.info(this, s"invoker tags: (${tags.mkString(", ")})")
119124
// Prepare Kamon shutdown
@@ -202,7 +207,8 @@ object Invoker {
202207
cmdLineArgs.displayedName,
203208
poolConfig.userMemory,
204209
None,
205-
tags)
210+
tags,
211+
dedicatedNamespaces)
206212

207213
val msgProvider = SpiLoader.get[MessagingProvider]
208214
if (msgProvider

docs/dedicated-invokers.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!--
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
-->
19+
20+
# Dedicated Invokers
21+
22+
Actions run on any invokers in OpenWhisk. But users may want to run their actions on a certain invoker(s) for some reason such as IP-based ACL.
23+
This is to provide dedicated invokers for a namespace. Operators can configure a dedicated namespace for invokers and all activations from the namespace will be delivered to the dedicated invokers only.
24+
25+
## Tagging Invokers
26+
Operators can configure any tags for invokers.
27+
28+
```bash
29+
invoker0 ansible_host=${INVOKER01} tags="['dedicated']" dedicatedNamespaces="['namespace1']"
30+
invoker1 ansible_host=${INVOKER02} tags="['dedicated']" dedicatedNamespaces="['namespace2']"
31+
```
32+
33+
Users can add the following annotations to their actions.
34+
35+
```
36+
wsk action update params tests/dat/actions/params.js -i -a invoker-resources '["dedicated"]'
37+
```
38+
39+
So this feature is based on the [tag-based-scheduling](./tag-based-scheduling.md).
40+
The `dedicatedNamespaces` field is used to make sure the invokers are not used by other than allowed namespaces and users can decide whether to run their actions on dedicated invokers using the `dedicated` tag.

0 commit comments

Comments
 (0)