Skip to content

Commit 1ce862a

Browse files
committed
Prepare to deploy new scheduler
1 parent 952fb0d commit 1ce862a

19 files changed

+816
-13
lines changed

docs/configurationChoices.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ components is not currently supported:
4545
better management of the database and decouples its lifecycle from that of the OpenWhisk deployment.
4646
- The event providers: alarmprovider and kafkaprovider.
4747
48+
### Openwhisk Scheduler
49+
50+
By default, the scheduler is enabled. To disable the scheduler, add the following
51+
to your `mycluster.yaml`
52+
53+
```yaml
54+
scheduler:
55+
enable: false
56+
```
57+
4858
### Using an external database
4959

5060
You may want to use an external CouchDB or Cloudant instance instead
@@ -180,6 +190,8 @@ k8s:
180190
enabled: false
181191
```
182192

193+
Currently, etcd persistence is not supported.
194+
183195
### Selectively Deploying Event Providers
184196

185197
The default settings of the Helm chart will deploy OpenWhisk's alarm

docs/k8s-custom-build-cluster-scaleup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Modifying the above mentioned parameters, one can easily increase the concurrenc
4040
In order to further increase the scale-up beyond `Small Scale`, one needs to modify the following additional configurations appropriately (on top of the above mentioned):
4141
* `invoker:jvmHeapMB`: jvmHeap memory available to each invoker instance. May or may not require increase based on running functions. For more information check `troubleshooting` below.
4242
* `invoker:containerFactory:_:replicaCount`: number of invoker instances that will be used to handle the incoming workload. By default, there is only one invoker instance which can become overwhelmed if workload goes beyond a certain threshold.
43-
* `controller:replicaCount`: number of controller instances that will be used to handle the incoming workload. Same as invoker instances.
43+
* `controller:replicaCount`: number of controller instances that will be used to handle the incoming workload. Same as invoker and scheduler instances.
4444
* `invoker:options`: Log processing at the invoker can become a bottleneck for the KubernetesContainerFactory. One might try disabling invoker log processing by setting it to `-Dwhisk.spi.LogStoreProvider=org.apache.openwhisk.core.containerpool.logging.LogDriverLogStoreProvider`. In general, one needs to offload log processing from the invoker to a node-level log store provider if one is trying to push a large load through the system.
4545

4646
## Troubleshooting

docs/k8s-kind.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ OpenWhisk apihost property to be set to localhost:31001
9494
## Hints and Tips
9595

9696
If you are working on the core OpenWhisk system and want
97-
to use a locally built controller or invoker image to test
98-
your changes, you need to push the image to the docker image
97+
to use a locally built controller, invoker, or scheduler image
98+
to test your changes, you need to push the image to the docker image
9999
repository inside the `kind` cluster.
100100

101101
For example, suppose I had a local change to the controller

helm/openwhisk/templates/_helpers.tpl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ app: {{ template "openwhisk.fullname" . }}
4242
{{ .Release.Name }}-controller.{{ .Release.Namespace }}.svc.{{ .Values.k8s.domain }}
4343
{{- end -}}
4444

45+
{{/* hostname for scheduler */}}
46+
{{- define "openwhisk.scheduler_host" -}}
47+
{{ .Release.Name }}-scheduler.{{ .Release.Namespace }}.svc.{{ .Values.k8s.domain }}
48+
{{- end -}}
49+
4550
{{/* hostname for database */}}
4651
{{- define "openwhisk.db_host" -}}
4752
{{- if .Values.db.external -}}
@@ -68,6 +73,15 @@ app: {{ template "openwhisk.fullname" . }}
6873
{{- end -}}
6974
{{- end -}}
7075

76+
{{/* hostname for etcd */}}
77+
{{- define "openwhisk.etcd_host" -}}
78+
{{- if .Values.etcd.external -}}
79+
{{ .Values.etcd.host }}
80+
{{- else -}}
81+
{{ .Release.Name }}-etcd.{{ .Release.Namespace }}.svc.{{ .Values.k8s.domain }}
82+
{{- end -}}
83+
{{- end -}}
84+
7185
{{/* client connection string for zookeeper cluster (server1:port,server2:port, ... serverN:port)*/}}
7286
{{- define "openwhisk.zookeeper_connect" -}}
7387
{{- if .Values.zookeeper.external -}}
@@ -224,12 +238,20 @@ app: {{ template "openwhisk.fullname" . }}
224238
value: {{ .Values.whisk.kafka.topics.health.retentionMs | quote }}
225239
- name: "CONFIG_whisk_kafka_topics_health_segmentBytes"
226240
value: {{ .Values.whisk.kafka.topics.health.segmentBytes | quote }}
241+
227242
- name: "CONFIG_whisk_kafka_topics_invoker_retentionBytes"
228243
value: {{ .Values.whisk.kafka.topics.invoker.retentionBytes | quote }}
229244
- name: "CONFIG_whisk_kafka_topics_invoker_retentionMs"
230245
value: {{ .Values.whisk.kafka.topics.invoker.retentionMs | quote }}
231246
- name: "CONFIG_whisk_kafka_topics_invoker_segmentBytes"
232247
value: {{ .Values.whisk.kafka.topics.invoker.segmentBytes | quote }}
248+
249+
- name: "CONFIG_whisk_kafka_topics_scheduler_retentionBytes"
250+
value: {{ .Values.whisk.kafka.topics.scheduler.retentionBytes | quote }}
251+
- name: "CONFIG_whisk_kafka_topics_scheduler_retentionMs"
252+
value: {{ .Values.whisk.kafka.topics.scheduler.retentionMs | quote }}
253+
- name: "CONFIG_whisk_kafka_topics_scheduler_segmentBytes"
254+
value: {{ .Values.whisk.kafka.topics.scheduler.segmentBytes | quote }}
233255
{{- end -}}
234256

235257
{{/* tlssecretname for ingress */}}

helm/openwhisk/templates/_readiness.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@
5757
command: ["sh", "-c", "result=1; until [ $result -eq 0 ]; do echo 'Checking controller readiness'; wget -T 5 --spider $READINESS_URL; result=$?; sleep 1; done; echo 'Success: controller is ready'"]
5858
{{- end -}}
5959

60+
{{/* Init container that waits for scheduler to be ready */}}
61+
{{- define "openwhisk.readiness.waitForScheduler" -}}
62+
- name: "wait-for-scheduler"
63+
image: "{{- .Values.docker.registry.name -}}{{- .Values.busybox.imageName -}}:{{- .Values.busybox.imageTag -}}"
64+
imagePullPolicy: "IfNotPresent"
65+
env:
66+
- name: "READINESS_URL"
67+
value: http://{{ include "openwhisk.scheduler_host" . }}:{{ .Values.scheduler.port }}/ping
68+
command: ["sh", "-c", "result=1; until [ $result -eq 0 ]; do echo 'Checking scheduler readiness'; wget -T 5 --spider $READINESS_URL; result=$?; sleep 1; done; echo 'Success: scheduler is ready'"]
69+
{{- end -}}
70+
6071
{{/* Init container that waits for at least 1 healthy invoker */}}
6172
{{- define "openwhisk.readiness.waitForHealthyInvoker" -}}
6273
- name: "wait-for-healthy-invoker"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
# This file is needed for Akka Cluster Bootstrapping
19+
---
20+
kind: ClusterRole
21+
apiVersion: rbac.authorization.k8s.io/v1
22+
metadata:
23+
name: pod-reader
24+
rules:
25+
- apiGroups: [""]
26+
resources: ["pods"]
27+
verbs: ["get", "watch", "list"]
28+
29+
# Core pods are allowed to get information about other pods
30+
---
31+
apiVersion: rbac.authorization.k8s.io/v1
32+
kind: RoleBinding
33+
metadata:
34+
name: {{ .Release.Name }}-read-pods
35+
labels:
36+
{{ include "openwhisk.label_boilerplate" . | indent 4 }}
37+
roleRef:
38+
apiGroup: rbac.authorization.k8s.io
39+
kind: ClusterRole
40+
name: pod-reader
41+
subjects:
42+
- kind: ServiceAccount
43+
name: {{ .Release.Name }}-core
44+
namespace: {{ .Release.Namespace | quote }}

helm/openwhisk/templates/controller-pod.yaml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ spec:
6060
{{- if not .Values.controller.lean }}
6161
# The controller must wait for kafka and/or couchdb to be ready before it starts
6262
{{ include "openwhisk.readiness.waitForKafka" . | indent 6 }}
63+
# Note: we may need to wait for etcd
6364
{{- end }}
6465
{{ include "openwhisk.readiness.waitForCouchDB" . | indent 6 }}
6566
{{- if eq .Values.activationStoreBackend "ElasticSearch" }}
@@ -85,7 +86,7 @@ spec:
8586
- name: controller
8687
containerPort: {{ .Values.controller.port }}
8788
- name: akka-remoting
88-
containerPort: 2552
89+
containerPort: 25520
8990
- name: akka-mgmt-http
9091
containerPort: 19999
9192
{{- if .Values.controller.lean }}
@@ -114,6 +115,11 @@ spec:
114115
- name: "TZ"
115116
value: {{ .Values.docker.timezone | quote }}
116117

118+
- name: "POD_IP"
119+
valueFrom:
120+
fieldRef:
121+
fieldPath: status.podIP
122+
117123
- name: "CONFIG_whisk_info_date"
118124
valueFrom:
119125
configMapKeyRef:
@@ -137,6 +143,15 @@ spec:
137143
- name: "RUNTIMES_MANIFEST"
138144
value: {{ template "openwhisk.runtimes_manifest" . }}
139145

146+
# scheduler settings
147+
{{ if .Values.scheduler.enable }}
148+
- name: "CONFIG_whisk_spi_LoadBalancerProvider"
149+
value: "org.apache.openwhisk.core.loadBalancer.FPCPoolBalancer"
150+
151+
- name: "CONFIG_whisk_spi_EntitlementSpiProvider"
152+
value: "org.apache.openwhisk.core.entitlement.FPCEntitlementProvider"
153+
{{ end }}
154+
140155
# Action limits
141156
{{ include "openwhisk.limitsEnvVars" . | indent 8 }}
142157

@@ -151,11 +166,22 @@ spec:
151166
value: "{{ include "openwhisk.kafka_connect" . }}"
152167
{{ include "openwhisk.kafkaConfigEnvVars" . | indent 8 }}
153168

169+
# etcd properties
170+
- name: "CONFIG_whisk_etcd_hosts"
171+
value: {{ include "openwhisk.etcd_host" . }}:{{ .Values.etcd.port }}
172+
173+
- name: "CONFIG_whisk_etcd_lease_timeout"
174+
value: {{ .Values.etcd.lease_timeout | quote }}
175+
176+
- name: "CONFIG_whisk_etcd_pool_threads"
177+
value: {{ .Values.etcd.pool_threads | quote }}
178+
154179
# properties for DB connection
155180
{{ include "openwhisk.dbEnvVars" . | indent 8 }}
156181

157182
- name: "CONTROLLER_INSTANCES"
158183
value: {{ .Values.controller.replicaCount | quote }}
184+
159185
{{- if gt (int .Values.controller.replicaCount) 1 }}
160186
- name: "CONFIG_whisk_cluster_useClusterBootstrap"
161187
value: "true"
@@ -169,7 +195,11 @@ spec:
169195
value: "name={{ .Release.Name }}-controller"
170196
- name: "CONFIG_akka_discovery_kubernetesApi_podPortName"
171197
value: "akka-mgmt-http"
198+
{{- else }}
199+
- name: "CONFIG_akka_cluster_seedNodes_0"
200+
value: "akka://controller-actor-system@$(POD_IP):25520"
172201
{{- end }}
202+
173203
{{- if .Values.metrics.prometheusEnabled }}
174204
- name: "OPENWHISK_ENCODED_CONFIG"
175205
value: {{ template "openwhisk.whiskconfig" . }}
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
{{ if not .Values.etcd.external }}
19+
apiVersion: apps/v1
20+
kind: Deployment
21+
metadata:
22+
name: {{ .Release.Name }}-etcd
23+
labels:
24+
name: {{ .Release.Name }}-etcd
25+
{{ include "openwhisk.label_boilerplate" . | indent 4 }}
26+
spec:
27+
replicas: {{ .Values.etcd.replicaCount }}
28+
selector:
29+
matchLabels:
30+
name: {{ .Release.Name }}-etcd
31+
{{- if .Values.k8s.persistence.enabled }}
32+
strategy:
33+
type: "Recreate"
34+
{{- end }}
35+
template:
36+
metadata:
37+
labels:
38+
name: {{ .Release.Name }}-etcd
39+
{{ include "openwhisk.label_boilerplate" . | indent 8 }}
40+
spec:
41+
restartPolicy: {{ .Values.etcd.restartPolicy }}
42+
43+
{{- if .Values.affinity.enabled }}
44+
affinity:
45+
{{ include "openwhisk.affinity.core" . | indent 8 }}
46+
{{ include "openwhisk.affinity.selfAntiAffinity" ( printf "%s-etcd" .Release.Name | quote ) | indent 8 }}
47+
{{- end }}
48+
49+
{{- if .Values.toleration.enabled }}
50+
tolerations:
51+
{{ include "openwhisk.toleration.core" . | indent 8 }}
52+
{{- end }}
53+
54+
{{- if .Values.k8s.persistence.enabled }}
55+
volumes:
56+
- name: etcd-data
57+
persistentVolumeClaim:
58+
claimName: {{ .Release.Name }}-etcd-pvc
59+
{{- end }}
60+
61+
{{- if .Values.k8s.persistence.enabled }}
62+
initContainers:
63+
- name: etcd-init
64+
image: "{{- .Values.docker.registry.name -}}{{- .Values.busybox.imageName -}}:{{- .Values.busybox.imageTag -}}"
65+
command:
66+
- chown
67+
- -v
68+
- -R
69+
- 999:999
70+
- /data
71+
volumeMounts:
72+
- mountPath: /data
73+
name: etcd-data
74+
readOnly: false
75+
{{- end }}
76+
{{ include "openwhisk.docker.imagePullSecrets" . | indent 6 }}
77+
# TODO: current command will always restart from scratch.
78+
containers:
79+
- name: etcd
80+
image: "{{- .Values.docker.registry.name -}}{{- .Values.etcd.imageName -}}:{{- .Values.etcd.imageTag -}}"
81+
command:
82+
- /usr/local/bin/etcd
83+
- --data-dir=/data
84+
- --name
85+
- etcd0
86+
- --initial-advertise-peer-urls
87+
- http://127.0.0.1:2480
88+
- --advertise-client-urls
89+
- http://0.0.0.0:2379
90+
- --listen-peer-urls
91+
- http://127.0.0.1:2480
92+
- --listen-client-urls
93+
- http://0.0.0.0:2379
94+
- --initial-cluster
95+
- etcd0=http://127.0.0.1:2480
96+
- --initial-cluster-state
97+
- new
98+
- --initial-cluster-token
99+
- openwhisk-etcd-token
100+
- --quota-backend-bytes
101+
- "0"
102+
- --snapshot-count
103+
- "100000"
104+
- --auto-compaction-retention
105+
- "1"
106+
- --auto-compaction-mode
107+
- periodic
108+
- --log-level
109+
- info
110+
imagePullPolicy: {{ .Values.etcd.imagePullPolicy | quote }}
111+
{{- if .Values.k8s.persistence.enabled }}
112+
volumeMounts:
113+
- mountPath: /data
114+
name: etcd-data
115+
readOnly: false
116+
{{- end }}
117+
ports:
118+
- name: etcd
119+
containerPort: {{ .Values.etcd.port }}
120+
{{ end }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
{{- if and (not .Values.etcd.external) .Values.k8s.persistence.enabled }}
19+
apiVersion: v1
20+
kind: PersistentVolumeClaim
21+
metadata:
22+
name: {{ .Release.Name }}-etcd-pvc
23+
labels:
24+
{{ include "openwhisk.label_boilerplate" . | indent 4 }}
25+
spec:
26+
{{- if not .Values.k8s.persistence.hasDefaultStorageClass }}
27+
storageClassName: {{ .Values.k8s.persistence.explicitStorageClass }}
28+
{{- end }}
29+
accessModes:
30+
- ReadWriteOnce
31+
resources:
32+
requests:
33+
storage: {{ .Values.etcd.persistence.size }}
34+
{{- end }}

0 commit comments

Comments
 (0)