This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathframeworkbarrier.yaml
134 lines (133 loc) · 5.19 KB
/
frameworkbarrier.yaml
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
# For the full spec setting and usage, see ./pkg/apis/frameworkcontroller/v1/types.go
# For the full frameworkbarrier usage, see ./pkg/barrier/barrier.go
############################### Prerequisite ###################################
# See "[PREREQUISITE]" in this file.
################################################################################
apiVersion: frameworkcontroller.microsoft.com/v1
kind: Framework
metadata:
name: frameworkbarrier
spec:
executionType: Start
retryPolicy:
fancyRetryPolicy: true
maxRetryCount: 0
taskRoles:
- name: server
taskNumber: 10
frameworkAttemptCompletionPolicy:
minFailedTaskCount: 1
minSucceededTaskCount: -1
task:
retryPolicy:
fancyRetryPolicy: false
maxRetryCount: 0
podGracefulDeletionTimeoutSec: 600
pod:
spec:
restartPolicy: Never
containers:
- name: ubuntu
image: ubuntu:trusty
# Using /mnt/frameworkbarrier/injector.sh to inject environment variables,
# such as:
# FB_{UpperCase({TaskRoleName})}_IPS=
# {Task[0].PodIP},...,
# {Task[TaskRole.TaskNumber-1].PodIP}
# FB_{UpperCase({TaskRoleName})}_ADDRESSES=
# {Task[0].PodIP}:${FB_{UpperCase({TaskRoleName})}_PORT},...,
# {Task[TaskRole.TaskNumber-1].PodIP}:${FB_{UpperCase({TaskRoleName})}_PORT}
# Note, the environment variable FB_{UpperCase({TaskRoleName})}_PORT should be
# provided by the caller in advance.
#
# User may need to tweak these environment variables to its own
# input format.
#
# User can also write its own injector script to inject other
# Framework information from the Framework object file:
# /mnt/frameworkbarrier/framework.json.
command: [
"sh", "-c",
"FB_SERVER_PORT=4001 FB_WORKER_PORT=5001 . /mnt/frameworkbarrier/injector.sh && printenv &&
FB_SERVER_PORT=4002 FB_WORKER_PORT=5002 . /mnt/frameworkbarrier/injector.sh && printenv &&
sleep 60"]
ports:
- containerPort: 4001
- containerPort: 4002
volumeMounts:
- name: frameworkbarrier-volume
mountPath: /mnt/frameworkbarrier
# [PREREQUISITE]
# User needs to create a ServiceAccount in the same namespace of this
# Framework with granted permission for frameworkbarrier, if the k8s
# cluster enforces authorization.
# For example, if the cluster enforces RBAC:
# kubectl create serviceaccount frameworkbarrier --namespace default
# kubectl create clusterrole frameworkbarrier \
# --verb=get,list,watch \
# --resource=frameworks
# kubectl create clusterrolebinding frameworkbarrier \
# --clusterrole=frameworkbarrier \
# --user=system:serviceaccount:default:frameworkbarrier
serviceAccountName: frameworkbarrier
initContainers:
- name: frameworkbarrier
# Using official image to demonstrate this example.
image: frameworkcontroller/frameworkbarrier
# Using k8s inClusterConfig, so usually, no need to specify
# KUBE_APISERVER_ADDRESS or KUBECONFIG
#env:
#- name: KUBE_APISERVER_ADDRESS
# value: {http[s]://host:port}
#- name: KUBECONFIG
# value: {Pod Local KubeConfig File Path}
volumeMounts:
- name: frameworkbarrier-volume
mountPath: /mnt/frameworkbarrier
volumes:
- name: frameworkbarrier-volume
emptyDir: {}
- name: worker
taskNumber: 10
frameworkAttemptCompletionPolicy:
minFailedTaskCount: 1
minSucceededTaskCount: -1
task:
retryPolicy:
fancyRetryPolicy: false
maxRetryCount: 0
podGracefulDeletionTimeoutSec: 600
pod:
spec:
restartPolicy: Never
containers:
- name: ubuntu
image: ubuntu:trusty
command: [
"sh", "-c",
"FB_SERVER_PORT=4001 FB_WORKER_PORT=5001 . /mnt/frameworkbarrier/injector.sh && printenv &&
FB_SERVER_PORT=4002 FB_WORKER_PORT=5002 . /mnt/frameworkbarrier/injector.sh && printenv &&
sleep 60"]
ports:
- containerPort: 5001
- containerPort: 5002
volumeMounts:
- name: frameworkbarrier-volume
mountPath: /mnt/frameworkbarrier
# [PREREQUISITE]
# Same as server TaskRole.
serviceAccountName: frameworkbarrier
initContainers:
- name: frameworkbarrier
image: frameworkcontroller/frameworkbarrier
#env:
#- name: KUBE_APISERVER_ADDRESS
# value: {http[s]://host:port}
#- name: KUBECONFIG
# value: {Pod Local KubeConfig File Path}
volumeMounts:
- name: frameworkbarrier-volume
mountPath: /mnt/frameworkbarrier
volumes:
- name: frameworkbarrier-volume
emptyDir: {}