-
Notifications
You must be signed in to change notification settings - Fork 26
/
template.yml
1463 lines (1426 loc) · 51.5 KB
/
template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
apiVersion: v1
kind: Template
metadata:
name: openwhisk-ephemeral
annotations:
openshift.io/display-name: Apache OpenWhisk (Ephemeral)
description: Apache OpenWhisk serverless platform, without persistent storage. You can leave all parameters blank and sensible defaults will be used.
iconClass: icon-apache
tags: serverless, openwhisk
openshift.io/long-description: This template provides a small OpenWhisk installation. Data is not stored on persistent storage, so any restart of the service will result in all data being lost.
openshift.io/provider-display-name: Red Hat, Inc.
openshift.io/documentation-url: https://github.com/projectodd/openwhisk-openshift/
openshift.io/support-url: https://github.com/projectodd/openwhisk-openshift/issues
message: "To get started download the `wsk` CLI from https://github.com/apache/incubator-openwhisk-cli/releases/\n\nYour OpenWhisk authentication token: ${WHISK_SYSTEM_AUTH}\n\nYour OpenWhisk api endpoint can be found in the console UI after closing the template wizard.\n\nConfigure your `wsk` client with `wsk property set --auth <your_auth> --apihost <your_apihost>`"
labels:
template: openwhisk-ephemeral-template
parameters:
- name: CONTROLLER_INSTANCES
description: The desired number of controllers
value: "1"
required: true
- name: CONTROLLER_MEMORY_REQUEST
description: The minimum container memory for each Controller
value: "512Mi"
required: true
- name: CONTROLLER_MEMORY_LIMIT
description: The maximum container memory for each Controller
value: "512Mi"
required: true
- name: CONTROLLER_JAVA_OPTS
description: JVM options to pass to the Controller - recommended to set at least Xmx here
value: "-Xmx256m"
required: true
- name: CONTROLLER_HA
description: Boolean denoting whether HA mode
value: "FALSE"
required: true
- name: CONTROLLER_LOCALBOOKKEEPING
description: Boolean denoting whether load balancer data is local or shared
value: "TRUE"
required: true
- name: CONTROLLER_INVOKER_BUSYTHRESHOLD
description: Value that controllers when the Controller(s) considers the Invoker(s) to be full. This should be less than or equal to INVOKER_MAX_CONTAINERS. Making them equal will give the highest function density but setting it a bit less than INVOKER_MAX_CONTAINERS can improve overall system throughput and reduce Invoker function container thrashing.
value: "8"
required: true
- name: CONTROLLER_INVOKER_BLACKBOXFRACTION
description: What percent of Invokers should be used for blackbox (user-provider container image) actions. At least one Invoker will be dedicated for blackbox actions as long as 2 or more Invokers are deployed no matter what percentage is set here.
value: "10%"
required: true
- name: AKKA_CLUSTER_SEED_NODES
description: Hostnames of akka seed nodes
value: "controller-0.controller:2551"
required: true
- name: INVOKER_INSTANCES
description: The desired number of invokers
value: "1"
required: true
- name: INVOKER_CPU_REQUEST
description: The minimum cpu cores for each Invoker
value: "500m"
required: true
- name: INVOKER_MEMORY_REQUEST
description: The minimum container memory for each Invoker
value: "1Gi"
required: true
- name: INVOKER_MEMORY_LIMIT
description: The maximum container memory for each Invoker
value: "1Gi"
required: true
- name: INVOKER_JAVA_OPTS
description: JVM options to pass to the Invoker - recommended to set at least Xmx here
value: "-Xmx512m"
required: true
- name: INVOKER_MAX_CONTAINERS
description: Maximum function containers per Invoker
value: "8"
required: true
- name : INVOKER_CONTAINER_TIMEOUT
description: Maximum time an idle function container should stick around before the Invoker deletes it. The longer the timeout, the longer functions stay warm. The shorter the timeout, the less resources consumed by idle function containers. Example values - "5 minutes", "30 seconds", etc.
value: "2 minutes"
required: true
- name: INVOKER_CONTAINER_PAUSE_TIMEOUT
description: Maximum time an idle function container should stick around before the Invoker marks it as paused. Example values - "5 seconds", "500 milliseconds", etc.
value: "5 seconds"
required: true
- name: INVOKER_CONTAINER_CONCURRENT_STARTS
description: Maximum number of action containers each Invoker will attempt to start at once. Raise or lower this number depending on your throughput requirements, cold start rate, number of Invokers you deploy, and how quickly your cluster can spin up new pods.
value: "10"
required: true
- name: INVOKER_LOGSTORE_PROVIDER
description: Apache OpenWhisk LogStoreProvider implementation. Setting this to whisk.core.containerpool.logging.LogDriverLogStoreProvider will increase throughput but users will have to find logs another way, like via Kibana.
value: "whisk.core.containerpool.logging.DockerToActivationLogStoreProvider"
required: true
- name: COUCHDB_INSTANCES
description: The desired number of CouchDB nodes
value: "1"
required: true
- name: COUCHDB_CPU_REQUEST
description: The minimum cpu cores for each CouchDB
value: "500m"
required: true
- name: COUCHDB_MEMORY_REQUEST
description: The minimum container memory for each CouchDB
value: "256Mi"
required: true
- name: COUCHDB_MEMORY_LIMIT
description: The maximum container memory for each CouchDB
value: "512Mi"
required: true
- name: COUCHDB_USER
description: CouchDB Username
generate: expression
from: "user[A-Z0-9]{3}"
required: true
- name: COUCHDB_PASSWORD
description: CouchDB Password
generate: expression
from: "[a-zA-Z0-9]{16}"
required: true
- name: COUCHDB_SECRET
description: CouchDB Replication Secret
generate: expression
from: "[a-zA-Z0-9]{16}"
required: true
- name: ZOOKEEPER_NODE_COUNT
description: Number of Zookeper cluster nodes which will be deployed (odd number of nodes is recomended)
displayName: Number of Zookeper cluster nodes (odd number of nodes is recomended)
required: true
value: "1"
- name: KAFKA_NODE_COUNT
description: Number of Kafka cluster nodes which will be deployed
displayName: Number of Kafka cluster nodes
required: true
value: "1"
- name: WHISK_SYSTEM_AUTH
description: OpenWhisk Auth token for whisk.system account
generate: expression
from: "789c46b1-71f6-4ed5-8c54-816aa4f8c502:[a-zA-Z0-9]{64}"
required: true
- name: WHISK_GUEST_AUTH
description: OpenWhisk Auth token for guest account
generate: expression
from: "23bc46b1-71f6-4ed5-8c54-816aa4f8c502:[a-zA-Z0-9]{64}"
required: true
- name: WHISK_ACTIONS_INVOKES_CONCURRENT
description: Default number of concurrenct actions per user
value: "30"
required: true
- name: WHISK_ACTIONS_INVOKES_CONCURRENT_IN_SYSTEM
description: Number of concurrent actions allowed across the entire system
value: "1000"
required: true
- name: WHISK_ACTIONS_INVOKES_PER_MINUTE
description: Default number of action invocations per minute per user
value: "60"
required: true
- name: WHISK_TRIGGERS_FIRES_PER_MINUTE
description: Default number of triggers that can fire per minute per user
value: "60"
required: true
- name: WHISK_DAYS_TO_KEEP_LOGS
description: Number of days to keep activation logs before pruning them from the database
value: "7"
required: true
- name: WHISK_DAYS_TO_KEEP_ACTIVATIONS
description: Number of days to keep activation records before pruning them from the database
value: "30"
required: true
- name: WHISK_ACTIONS_MEMORY_MAX
description: Maximum memory an action is allowed to request.
value: "1024 m"
required: true
- name: WHISK_ACTIONS_MEMORY_MIN
description: Minimum memory an action is allowed to request.
value: "128 m"
required: true
- name: WHISK_ACTIONS_MEMORY_STD
description: Default memory an action requests if unspecified.
value: "256 m"
required: true
- name: WHISK_KAFKA_REPLICATION_FACTOR
description: Replication factor for all OpenWhisk topics
value: "1"
required: true
- name: WHISK_KAFKA_TOPICS_COMPLETED_RETENTION_BYTES
description: Maximum bytes to retain for the completed activations topic for each Controller. Each kafka node will consume this many bytes times the number of Controllers just for the completed topics. So, if this is set to 1GB and you have 3 Controllers then expect up to 3GB of disk space used by the Controller topics.
value: "268435456"
required: true
- name: WHISK_KAFKA_TOPICS_INVOKER_RETENTION_BYTES
description: Maximum bytes to retain for each Invoker topic. Each Kafka node will consume this many bytes times the number of Invokers just for the Invoker topics. So, if this is set to 1GB and you have 10 Invokers then expect up to 10GB of disk space used by the Invoker topics.
value: "268435456"
required: true
- name: OPENWHISK_VERSION
description: The DockerHub tag for openwhisk/{controller,invoker}
value: "rhdemo-9717f07a"
required: true
- name: PROJECTODD_VERSION
description: The DockerHub tag for projectodd images
value: "8ee5579"
required: true
- name: STRIMZI_VERSION
description: The DockerHub tag for strimzi images
value: "0.3.1"
required: true
objects:
- apiVersion: v1
kind: ConfigMap
metadata:
name: whisk.config
data:
whisk_system_namespace: /whisk.system
whisk_version_date: 2018-01-01T00:00:00Z
whisk_version_name: OpenWhisk
whisk_version_tag: latest
- apiVersion: v1
kind: ConfigMap
metadata:
creationTimestamp: null
name: whisk.limits
data:
actions_invokes_concurrent: "${WHISK_ACTIONS_INVOKES_CONCURRENT}"
actions_invokes_concurrentInSystem: "${WHISK_ACTIONS_INVOKES_CONCURRENT_IN_SYSTEM}"
actions_invokes_perMinute: "${WHISK_ACTIONS_INVOKES_PER_MINUTE}"
actions_sequence_maxLength: "50"
triggers_fires_perMinute: "${WHISK_TRIGGERS_FIRES_PER_MINUTE}"
- apiVersion: v1
kind: ConfigMap
metadata:
name: whisk.runtimes
data:
runtimes: |
{
"bypassPullForLocalImages": false,
"defaultImagePrefix": "openwhisk",
"defaultImageTag": "latest",
"runtimes": {
"nodejs": [
{
"kind": "nodejs",
"image": {
"name": "action-nodejs-6"
},
"deprecated": true
},
{
"kind": "nodejs:6",
"default": true,
"image": {
"name": "action-nodejs-6"
},
"deprecated": false
},
{
"kind": "nodejs:8",
"default": false,
"image": {
"name": "action-nodejs-8"
},
"deprecated": false
}
],
"python": [
{
"kind": "python",
"image": {
"name": "action-python-2"
},
"deprecated": false
},
{
"kind": "python:2",
"default": true,
"image": {
"name": "action-python-2"
},
"deprecated": false
},
{
"kind": "python:3",
"image": {
"name": "action-python-3"
},
"deprecated": false
}
],
"swift": [
{
"kind": "swift",
"image": {
"name": "action-swift-3"
},
"deprecated": true
},
{
"kind": "swift:3",
"image": {
"name": "action-swift-3"
},
"deprecated": true
},
{
"kind": "swift:3.1.1",
"default": true,
"image": {
"name": "action-swift-3"
},
"deprecated": false
}
],
"java": [
{
"kind": "java",
"default": true,
"image": {
"name": "action-java-8"
},
"deprecated": false,
"attached": {
"attachmentName": "jarfile",
"attachmentType": "application/java-archive"
},
"sentinelledLogs": false,
"requireMain": true
}
],
"php": [
{
"kind": "php:7.1",
"default": true,
"deprecated": false,
"image": {
"name": "action-php-7"
}
}
]
},
"blackboxes": [
{
"name": "dockerskeleton"
}
]
}
- apiVersion: v1
kind: ConfigMap
metadata:
name: strimzi-openwhisk
labels:
strimzi.io/type: kafka
strimzi.io/kind: cluster
data:
kafka-nodes: "${KAFKA_NODE_COUNT}"
kafka-image: "strimzi/kafka:${STRIMZI_VERSION}"
kafka-healthcheck-delay: "60"
kafka-healthcheck-timeout: "5"
zookeeper-nodes: "${ZOOKEEPER_NODE_COUNT}"
zookeeper-image: "strimzi/zookeeper:${STRIMZI_VERSION}"
zookeeper-healthcheck-delay: "30"
zookeeper-healthcheck-timeout: "5"
KAFKA_DEFAULT_REPLICATION_FACTOR: "${KAFKA_NODE_COUNT}"
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: "${KAFKA_NODE_COUNT}"
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: "${KAFKA_NODE_COUNT}"
kafka-storage: |-
{ "type": "ephemeral" }
zookeeper-storage: |-
{ "type": "ephemeral" }
- apiVersion: v1
kind: Service
metadata:
name: controller
labels:
name: controller
spec:
selector:
name: controller
clusterIP: None
ports:
- port: 8080
targetPort: 8080
name: http
- apiVersion: v1
kind: ConfigMap
metadata:
name: controller.config
data:
controller_opts: "-Dwhisk.spi.LoadBalancerProvider=whisk.core.loadBalancer.ShardingContainerPoolBalancer"
java_opts: "${CONTROLLER_JAVA_OPTS}"
- apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: controller
annotations:
template.alpha.openshift.io/wait-for-ready: "true"
labels:
name: controller
spec:
replicas: ${CONTROLLER_INSTANCES}
serviceName: "controller"
template:
metadata:
labels:
name: controller
spec:
restartPolicy: Always
containers:
- name: controller
imagePullPolicy: IfNotPresent
image: projectodd/controller:${OPENWHISK_VERSION}
command: ["/bin/bash", "-c", "COMPONENT_NAME=$(hostname | cut -d'-' -f2) CONFIG_akka_remote_netty_tcp_hostname=$(hostname).controller /init.sh `hostname | cut -d'-' -f2`"]
ports:
- name: controller
containerPort: 8080
- name: akka
containerPort: 2551
resources:
requests:
memory: ${CONTROLLER_MEMORY_REQUEST}
limits:
memory: ${CONTROLLER_MEMORY_LIMIT}
env:
# Properties for controller HA configuration
# Must change these if changing number of replicas
- name: "CONTROLLER_LOCALBOOKKEEPING"
value: ${CONTROLLER_LOCALBOOKKEEPING}
- name: "CONTROLLER_HA"
value: ${CONTROLLER_HA}
- name: "CONTROLLER_INSTANCES"
value: ${CONTROLLER_INSTANCES}
- name: "AKKA_CLUSTER_SEED_NODES"
value: ${AKKA_CLUSTER_SEED_NODES}
- name: "CONFIG_akka_actor_provider"
value: "cluster"
- name: "CONFIG_akka_remote_netty_tcp_bindPort"
value: "2551"
- name: "CONFIG_akka_remote_netty_tcp_port"
value: "2551"
- name: "CONFIG_whisk_loadbalancer_invokerBusyThreshold"
value: "${CONTROLLER_INVOKER_BUSYTHRESHOLD}"
- name: "CONFIG_whisk_loadbalancer_blackboxFraction"
value: "${CONTROLLER_INVOKER_BLACKBOXFRACTION}"
- name: "CONFIG_whisk_memory_max"
value: "${WHISK_ACTIONS_MEMORY_MAX}"
- name: "CONFIG_whisk_memory_min"
value: "${WHISK_ACTIONS_MEMORY_MIN}"
- name: "CONFIG_whisk_memory_std"
value: "${WHISK_ACTIONS_MEMORY_STD}"
- name: "CONFIG_whisk_kafka_replicationFactor"
value: "${WHISK_KAFKA_REPLICATION_FACTOR}"
- name: "CONFIG_whisk_kafka_topics_completed_retentionBytes"
value: "${WHISK_KAFKA_TOPICS_COMPLETED_RETENTION_BYTES}"
# extra JVM arguments
- name: "JAVA_OPTS"
valueFrom:
configMapKeyRef:
name: controller.config
key: java_opts
# extra controller arguments
- name: "CONTROLLER_OPTS"
valueFrom:
configMapKeyRef:
name: controller.config
key: controller_opts
# action runtimes
- name: "RUNTIMES_MANIFEST"
valueFrom:
configMapKeyRef:
name: whisk.runtimes
key: runtimes
# deployment version information
- name: "WHISK_VERSION_NAME"
valueFrom:
configMapKeyRef:
name: whisk.config
key: whisk_version_name
- name: "WHISK_VERSION_DATE"
valueFrom:
configMapKeyRef:
name: whisk.config
key: whisk_version_date
- name: "WHISK_VERSION_BUILDNO"
valueFrom:
configMapKeyRef:
name: whisk.config
key: whisk_version_tag
# specify limits
- name: "LIMITS_ACTIONS_INVOKES_PERMINUTE"
valueFrom:
configMapKeyRef:
name: whisk.limits
key: actions_invokes_perMinute
- name: "LIMITS_ACTIONS_INVOKES_CONCURRENT"
valueFrom:
configMapKeyRef:
name: whisk.limits
key: actions_invokes_concurrent
- name: "LIMITS_ACTIONS_INVOKES_CONCURRENTINSYSTEM"
valueFrom:
configMapKeyRef:
name: whisk.limits
key: actions_invokes_concurrentInSystem
- name: "LIMITS_TRIGGERS_FIRES_PERMINUTE"
valueFrom:
configMapKeyRef:
name: whisk.limits
key: triggers_fires_perMinute
- name: "LIMITS_ACTIONS_SEQUENCE_MAXLENGTH"
valueFrom:
configMapKeyRef:
name: whisk.limits
key: actions_sequence_maxLength
# properties for Kafka connection
- name: "KAFKA_HOSTS"
value: "$(STRIMZI_OPENWHISK_KAFKA_SERVICE_HOST):$(STRIMZI_OPENWHISK_KAFKA_SERVICE_PORT_CLIENTS)"
# properties for DB connection
- name: "CONFIG_whisk_couchdb_username"
valueFrom:
secretKeyRef:
name: db.auth
key: db_username
- name: "CONFIG_whisk_couchdb_password"
valueFrom:
secretKeyRef:
name: db.auth
key: db_password
- name: "CONFIG_whisk_couchdb_protocol"
valueFrom:
configMapKeyRef:
name: db.config
key: db_protocol
- name: "CONFIG_whisk_couchdb_host"
value: "$(COUCHDB_SERVICE_HOST)"
- name: "CONFIG_whisk_couchdb_port"
value: "$(COUCHDB_SERVICE_PORT_COUCHDB)"
- name: "CONFIG_whisk_couchdb_provider"
valueFrom:
configMapKeyRef:
name: db.config
key: db_provider
- name: "CONFIG_whisk_couchdb_databases_WhiskActivation"
valueFrom:
configMapKeyRef:
name: db.config
key: db_whisk_activations
- name: "CONFIG_whisk_couchdb_databases_WhiskEntity"
valueFrom:
configMapKeyRef:
name: db.config
key: db_whisk_actions
- name: "CONFIG_whisk_couchdb_databases_WhiskAuth"
valueFrom:
configMapKeyRef:
name: db.config
key: db_whisk_auths
# must match port used in livenessProbe below
- name: "PORT"
value: "8080"
livenessProbe:
httpGet:
path: "/ping"
port: 8080
scheme: "HTTP"
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 10
failureThreshold: 5
readinessProbe:
httpGet:
path: "/ping"
port: 8080
scheme: "HTTP"
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 10
failureThreshold: 5
initContainers:
- name: wait-for-services
image: busybox
command: ['sh', '-cu', 'until nslookup couchdb && nslookup strimzi-openwhisk-kafka; do echo waiting for services; sleep 1; done']
- name: wait-for-couchdb
image: busybox
command: ['sh', '-c', 'until wget -T 5 --spider http://${COUCHDB_SERVICE_HOST}:${COUCHDB_SERVICE_PORT}/${DB_WHISK_ACTIVATIONS}; do echo waiting for couchdb; sleep 2; done;']
env:
- name: "DB_WHISK_ACTIVATIONS"
valueFrom:
configMapKeyRef:
name: db.config
key: db_whisk_activations
- apiVersion: batch/v1
kind: Job
metadata:
name: install-catalog
spec:
activeDeadlineSeconds: 600
template:
metadata:
name: install-catalog
spec:
containers:
- name: catalog
image: projectodd/whisk_catalog:${PROJECTODD_VERSION}
env:
- name: "WHISK_AUTH"
valueFrom:
secretKeyRef:
name: whisk.auth
key: system
- name: "WHISK_API_HOST_NAME"
value: "http://controller:8080"
initContainers:
- name: wait-for-controller
image: busybox
command: ['sh', '-c', 'until wget -T 5 --spider http://controller:8080/ping; do echo waiting for controller; sleep 2; done;']
restartPolicy: Never
- apiVersion: v1
kind: Service
metadata:
name: couchdb
labels:
name: couchdb
spec:
selector:
name: couchdb
ports:
- port: 5984
targetPort: 5984
name: couchdb
- apiVersion: v1
kind: Service
metadata:
name: couchdb-headless
labels:
name: couchdb-headless
spec:
selector:
name: couchdb
ports:
- name: couchdb
port: 5984
clusterIP: None
- apiVersion: v1
kind: ConfigMap
metadata:
name: db.config
data:
db_prefix: test_
db_protocol: http
db_provider: CouchDB
db_whisk_actions: test_whisks
db_whisk_activations: test_activations
db_whisk_auths: test_subjects
db_days_to_keep_logs: "${WHISK_DAYS_TO_KEEP_LOGS}"
db_days_to_keep_activations: "${WHISK_DAYS_TO_KEEP_ACTIVATIONS}"
- apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: couchdb
labels:
name: couchdb
spec:
replicas: ${COUCHDB_INSTANCES}
serviceName: couchdb-headless
template:
metadata:
labels:
name: couchdb
spec:
restartPolicy: Always
volumes:
- name: couchdb-data
emptyDir: {}
containers:
- name: couchdb
imagePullPolicy: IfNotPresent
image: projectodd/whisk_couchdb:${PROJECTODD_VERSION}
command: ["/init.sh"]
ports:
- name: couchdb
containerPort: 5984
- name: epmd
containerPort: 4369
- containerPort: 9100
resources:
requests:
cpu: "${COUCHDB_CPU_REQUEST}"
memory: ${COUCHDB_MEMORY_REQUEST}
limits:
memory: ${COUCHDB_MEMORY_LIMIT}
env:
- name: "DB_PREFIX"
valueFrom:
configMapKeyRef:
name: db.config
key: db_prefix
- name: "DB_HOST"
value: "127.0.0.1"
- name: "DB_PORT"
value: "$(COUCHDB_SERVICE_PORT_COUCHDB)"
- name: "COUCHDB_USER"
valueFrom:
secretKeyRef:
name: db.auth
key: db_username
- name: "COUCHDB_PASSWORD"
valueFrom:
secretKeyRef:
name: db.auth
key: db_password
- name: "COUCHDB_SECRET"
valueFrom:
secretKeyRef:
name: db.auth
key: db_secret
- name: "NODENAME_HOSTNAME"
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: "NODENAME_SUBDOMAIN"
value: "couchdb-headless"
- name: "COUCHDB_NODE_COUNT"
value: "${COUCHDB_INSTANCES}"
- name: "AUTH_WHISK_SYSTEM"
valueFrom:
secretKeyRef:
name: whisk.auth
key: system
- name: "AUTH_GUEST"
valueFrom:
secretKeyRef:
name: whisk.auth
key: guest
volumeMounts:
- name: couchdb-data
mountPath: "/opt/couchdb/data"
readinessProbe:
httpGet:
port: 5984
path: "/_utils/"
initialDelaySeconds: 10
periodSeconds: 15
failureThreshold: 10
timeoutSeconds: 3
- apiVersion: v1
kind: ConfigMap
metadata:
name: invoker.config
data:
docker_image_prefix: "projectodd"
docker_image_tag: ${PROJECTODD_VERSION}
docker_registry: ""
invoker_container_dns: ""
invoker_container_network: bridge
invoker_logs_dir: ""
invoker_opts: "-Dwhisk.spi.ContainerFactoryProvider=whisk.core.containerpool.kubernetes.KubernetesContainerFactoryProvider"
invoker_use_runc: "false"
java_opts: "${INVOKER_JAVA_OPTS}"
- apiVersion: v1
kind: ConfigMap
metadata:
name: invoker
data:
init: |
export COMPONENT_NAME=$(hostname | cut -d'-' -f2)
# Dynamically determine API gateway host
export TOKEN="$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)"
export NAMESPACE="$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)"
export APIGW_HOST=$(curl -s --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt -H "Authorization: Bearer ${TOKEN}" "https://${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}/oapi/v1/namespaces/${NAMESPACE}/routes/openwhisk?pretty=true" | grep '"host":' | head -n 1 | awk -F '"' '{print $4}')
export APIGW_HOST_V2=${APIGW_HOST}
export WHISK_API_HOST_NAME=${APIGW_HOST}
exec /init.sh
- apiVersion: v1
kind: ServiceAccount
metadata:
name: openwhisk
- apiVersion: v1
kind: RoleBinding
metadata:
name: openwhisk
roleRef:
name: edit
subjects:
- kind: ServiceAccount
name: openwhisk
- apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: invoker
labels:
name: invoker
spec:
replicas: ${INVOKER_INSTANCES}
serviceName: "invoker"
template:
metadata:
labels:
name: invoker
spec:
restartPolicy: Always
volumes:
- name: invoker-config
configMap:
name: invoker
serviceAccountName: openwhisk
initContainers:
- name: wait-for-services
image: busybox
command: ['sh', '-cu', 'until nslookup couchdb && nslookup strimzi-openwhisk-zookeeper && nslookup strimzi-openwhisk-kafka; do echo waiting for services; sleep 1; done']
- name: wait-for-controller
image: busybox
command: ['sh', '-c', 'until wget -T 5 --spider http://controller:8080/ping; do echo waiting for controller; sleep 2; done;']
containers:
- name: invoker
imagePullPolicy: IfNotPresent
image: projectodd/invoker:${OPENWHISK_VERSION}
command: [ "/bin/bash", "-o", "allexport", "/invoker_config/init" ]
ports:
- name: invoker
containerPort: 8080
resources:
requests:
cpu: "${INVOKER_CPU_REQUEST}"
memory: ${INVOKER_MEMORY_REQUEST}
limits:
memory: ${INVOKER_MEMORY_LIMIT}
volumeMounts:
- name: invoker-config
mountPath: "/invoker_config"
env:
- name: "PORT"
value: "8080"
# Generate stable invoker names from the StatefulSet names
- name: "INVOKER_NAME"
valueFrom:
fieldRef:
fieldPath: metadata.name
# Docker-related options
- name: "INVOKER_CONTAINER_NETWORK"
valueFrom:
configMapKeyRef:
name: invoker.config
key: invoker_container_network
- name: "INVOKER_CONTAINER_DNS"
valueFrom:
configMapKeyRef:
name: invoker.config
key: invoker_container_dns
- name: "INVOKER_USE_RUNC"
valueFrom:
configMapKeyRef:
name: invoker.config
key: invoker_use_runc
- name: "INVOKER_CORESHARE"
value: "1"
- name: "INVOKER_NUMCORE"
value: "${INVOKER_MAX_CONTAINERS}"
- name: "CONFIG_whisk_containerProxy_timeouts_idleContainer"
value: "${INVOKER_CONTAINER_TIMEOUT}"
- name: "CONFIG_whisk_containerProxy_timeouts_pauseGrace"
value: "${INVOKER_CONTAINER_PAUSE_TIMEOUT}"
- name: "CONFIG_whisk_kubernetes_concurrentStarts"
value: "${INVOKER_CONTAINER_CONCURRENT_STARTS}"
- name: "CONFIG_whisk_memory_max"
value: "${WHISK_ACTIONS_MEMORY_MAX}"
- name: "CONFIG_whisk_memory_min"
value: "${WHISK_ACTIONS_MEMORY_MIN}"
- name: "CONFIG_whisk_memory_std"
value: "${WHISK_ACTIONS_MEMORY_STD}"
- name: "CONFIG_whisk_kafka_replicationFactor"
value: "${WHISK_KAFKA_REPLICATION_FACTOR}"
- name: "CONFIG_whisk_kafka_topics_invoker_retentionBytes"
value: "${WHISK_KAFKA_TOPICS_INVOKER_RETENTION_BYTES}"
- name: "DOCKER_IMAGE_PREFIX"
valueFrom:
configMapKeyRef:
name: invoker.config
key: docker_image_prefix
- name: "DOCKER_IMAGE_TAG"
valueFrom:
configMapKeyRef:
name: invoker.config
key: docker_image_tag
- name: "DOCKER_REGISTRY"
valueFrom:
configMapKeyRef:
name: invoker.config
key: docker_registry
# action runtimes
- name: "RUNTIMES_MANIFEST"
valueFrom:
configMapKeyRef:
name: whisk.runtimes
key: runtimes
# extra JVM arguments
- name: "JAVA_OPTS"
valueFrom:
configMapKeyRef:
name: invoker.config
key: java_opts
# extra Invoker arguments
- name: "INVOKER_OPTS"
valueFrom:
configMapKeyRef:
name: invoker.config
key: invoker_opts
# Recommend using "" because logs should go to stdout on kube
- name: "WHISK_LOGS_DIR"
valueFrom:
configMapKeyRef:
name: invoker.config
key: invoker_logs_dir
# properties for Kafka connection
- name: "KAFKA_HOSTS"
value: "$(STRIMZI_OPENWHISK_KAFKA_SERVICE_HOST):$(STRIMZI_OPENWHISK_KAFKA_SERVICE_PORT_CLIENTS)"
# properties for zookeeper connection
- name: "ZOOKEEPER_HOSTS"
value: "$(STRIMZI_OPENWHISK_ZOOKEEPER_SERVICE_HOST):$(STRIMZI_OPENWHISK_ZOOKEEPER_SERVICE_PORT_CLIENTS)"
# properties for DB connection
- name: "CONFIG_whisk_couchdb_username"
valueFrom:
secretKeyRef:
name: db.auth
key: db_username
- name: "CONFIG_whisk_couchdb_password"
valueFrom:
secretKeyRef:
name: db.auth
key: db_password
- name: "CONFIG_whisk_couchdb_protocol"
valueFrom:
configMapKeyRef:
name: db.config
key: db_protocol
- name: "CONFIG_whisk_couchdb_host"
value: "$(COUCHDB_SERVICE_HOST)"
- name: "CONFIG_whisk_couchdb_port"
value: "$(COUCHDB_SERVICE_PORT_COUCHDB)"
- name: "CONFIG_whisk_couchdb_provider"
valueFrom:
configMapKeyRef:
name: db.config
key: db_provider
- name: "CONFIG_whisk_couchdb_databases_WhiskActivation"
valueFrom:
configMapKeyRef:
name: db.config
key: db_whisk_activations
- name: "CONFIG_whisk_couchdb_databases_WhiskEntity"
valueFrom:
configMapKeyRef:
name: db.config
key: db_whisk_actions
- name: "CONFIG_whisk_couchdb_databases_WhiskAuth"
valueFrom:
configMapKeyRef:
name: db.config
key: db_whisk_auths
- name: CONFIG_whisk_kubernetes_namespace
valueFrom:
fieldRef:
fieldPath: metadata.namespace
# Increase Kube API timeouts until we handle timeouts nicer
- name: "CONFIG_whisk_kubernetes_timeouts_run"
value: "10 minutes"
- name: "CONFIG_whisk_kubernetes_timeouts_rm"
value: "10 minutes"
- name: "CONFIG_whisk_kubernetes_timeouts_logs"
value: "10 minutes"
- name: "CONFIG_whisk_spi_LogStoreProvider"
value: "${INVOKER_LOGSTORE_PROVIDER}"
- apiVersion: batch/v1
kind: Job
metadata:
name: preload-openwhisk-runtimes
labels:
name: preload-openwhisk-runtimes
spec:
completions: 1
serviceAccountName: openwhisk