This repository has been archived by the owner on Apr 24, 2023. It is now read-only.
/
config-k8s.edn
206 lines (205 loc) · 11.7 KB
/
config-k8s.edn
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
{:agent-query-cache {:ttl-ms 1000}
:authorization {;; Note that internally, Cook will select :http-basic if it's set to true,
;; and fall back to :one-user only if :http-basic is false.
:http-basic #config/env-bool "COOK_HTTP_BASIC_AUTH"
:one-user #config/env "COOK_ONE_USER_AUTH"}
:authorization-config {;; These users have admin privileges when using configfile-admins-auth;
;; e.g., they can view and modify other users' jobs.
;; Sets "admin" and the user defined in "COOK_ONE_USER_AUTH" to be admins for local development.
:admins #{"admin" #config/env "COOK_ONE_USER_AUTH"}
;; What function should be used to perform user authorization?
;; See the docstring in cook.rest.authorization for details.
:authorization-fn cook.rest.authorization/configfile-admins-auth-open-gets
;; users that are allowed to do things on behalf of others
:impersonators #{"poser" "other-impersonator"}}
:mesos {:leader-path "/cook-scheduler"
; because the minikube users and the local users may have different IDs, tests that require file permissions
; (like test_default_container_volumes) will fail without this set.
:run-as-user "root"
; not related to mesos, but needed to enable gpu-support for GKE
:enable-gpu-support true}
:compute-clusters []
:compute-cluster-options
{:compute-cluster-templates
{"gke-1"
{:factory-fn cook.kubernetes.compute-cluster/factory-fn
:config {:dynamic-cluster-config? true
;; Location of the kubernetes config file. Hardcoded to the location specified by bin/make-gke-test-cluster
:config-file "../scheduler/.cook_kubeconfig_1"
:compute-cluster-launch-rate-limits {:expire-minutes 1200
:enforce? true
:bucket-size 10000
:tokens-replenished-per-minute 5000}
:synthetic-pods {:image "gcr.io/google-containers/alpine-with-bash:1.0"
:max-pods-outstanding 128
:user #config/env "USER"
:command "sleep 300"
:pools #{"k8s-alpha" "k8s-gamma"}}
:node-blocklist-labels ["blocklist-nodes-with-this-label-key"]
:cook-pool-taint-name "cook-pool"
:cook-pool-label-name "cook-pool"
:use-google-service-account? false
;; Used to work around auth problems after upgrading k8s client library to 7.0.0
:verifying-ssl false}}
"gke-2"
{:factory-fn cook.kubernetes.compute-cluster/factory-fn
:config {:dynamic-cluster-config? true
;; Location of the kubernetes config file. Hardcoded to the location specified by bin/make-gke-test-cluster
:config-file "../scheduler/.cook_kubeconfig_2"
:compute-cluster-launch-rate-limits {:expire-minutes 1200
:enforce? true
:bucket-size 10000
:tokens-replenished-per-minute 5000}
:synthetic-pods {:image "gcr.io/google-containers/alpine-with-bash:1.0"
:max-pods-outstanding 128
:user #config/env "USER"
:command "sleep 300"
:pools #{"k8s-alpha"}}
:node-blocklist-labels ["blocklist-nodes-with-this-label-key-1" "blocklist-nodes-with-this-label-key-2"]
:cook-pool-taint-name "cook-pool"
:cook-pool-label-name "cook-pool"
:use-google-service-account? false
;; Used to work around auth problems after upgrading k8s client library to 7.0.0
:verifying-ssl false}}}
:load-clusters-on-startup? true
:new-cluster-configurations-fn cook.compute-cluster/dummy-cluster-configurations-fn-memo
:cluster-update-period-seconds 5
:compute-cluster-configurations [{:name "gke-1"
:template "gke-1"
;; Location of the kubernetes config file. Hardcoded to the location specified by bin/make-gke-test-cluster
:config-file "../scheduler/.cook_kubeconfig_1"
:state :running
:state-locked? false}
{:name "gke-2"
:template "gke-2"
;; Location of the kubernetes config file. Hardcoded to the location specified by bin/make-gke-test-cluster
:config-file "../scheduler/.cook_kubeconfig_2"
:state :running
:state-locked? false}]}
:cors-origins ["https?://cors.example.com"]
:database {:datomic-uri #config/env "COOK_DATOMIC_URI"}
:plugins {:job-submission-validator {:batch-timeout-seconds 40
:factory-fn "cook.plugins.demo-plugin/submission-factory"}
:job-launch-filter {:age-out-last-seen-deadline-minutes 10
:age-out-first-seen-deadline-minutes 10000
:age-out-seen-count 10
:factory-fn "cook.plugins.demo-plugin/launch-factory"}}
:hostname #config/env "COOK_HOSTNAME"
:kubernetes {:add-job-label-to-pod-prefix "platform/"
:clobber-synthetic-pods true
:disallowed-container-paths #{"/mnt/bad"}
:disallowed-var-names #{"BADVAR"}
:init-container {:command ["/bin/sh" "-c" "echo sample init container running"]
:image "byrnedo/alpine-curl:latest"}
:memory-limit-job-label-name "platform/memory.allow-usage-above-request"
:sidecar {;; Note that Cook automatically appends the :port given below
;; as the last argument in this :command vector.
:command ["cook-sidecar" "--file-server-port"]
:health-check-endpoint "/readiness-probe"
:image "twosigma/cook-sidecar:latest"
:port 23906
:resource-requirements {:cpu-request 0.1
:cpu-limit 0.1
:memory-request 128.0
:memory-limit 128.0}}
:set-memory-limit? true}
:log {:file #config/env "COOK_LOG_FILE"
:rotate-hourly true
:levels {"datomic.db" :warn
"datomic.kv-cluster" :warn
"datomic.peer" :warn
"cook.scheduler.fenzo-utils" :debug
"cook.scheduler.rebalancer" :debug
"cook.scheduler.scheduler" :debug
"cook.kubernetes.compute-cluster" :debug
:default :info}}
:metrics {:jmx true
:user-metrics-interval-seconds 60}
:nrepl {:enabled? true
:port #config/env-int "COOK_NREPL_PORT"}
:pools {:default "k8s-gamma"
:job-resource-adjustment {:adjust-job-resources-fn cook.kubernetes.api/adjust-job-resources
:pool-regex "^k8s-.+"}
:default-containers
[{:pool-regex "k8s-.*" :container {:type "docker"
:docker {:image "python:3.9",
:network "HOST"
:force-pull-image false
:parameters []}}}]
:disk
[{:pool-regex "^k8s-alpha$"
:max-size 256000.0
:valid-types #{"standard", "pd-ssd"}
:default-type "standard"
:default-request 256.0
:type-map {"standard" "pd-standard"}
:enable-constraint? true
:disk-node-label "cloud.google.com/gke-boot-disk"}]
:valid-gpu-models
[{:pool-regex "k8s-alpha"
:valid-models #{"nvidia-tesla-k80" "nvidia-tesla-p100"}
:default-model "nvidia-tesla-p100"}]
:default-job-constraints
[{:pool-regex "^k8s-.*"
:default-constraints [{:constraint/attribute "node-type"
:constraint/operator :constraint.operator/equals
:constraint/pattern "g1-small"}]}]
:default-env
[{:pool-regex "unused" :env {"foo" "bar"}}
{:pool-regex ".*" :env
{"SAMPLE_DEFAULT_ENV_KEY" "SAMPLE_DEFAULT_ENV_VAL"}}]
:default-pod-labels
[{:pool-regex "unused" :pod-labels {"org.foo/application" "label-val"}}
{:pool-regex ".*" :pod-labels
{"SAMPLE_DEFAULT_POD_LABEL_KEY" "SAMPLE_DEFAULT_POD_LABEL_VAL"}}]}
:port #config/env-int "COOK_PORT"
:ssl {:port #config/env-int "COOK_SSL_PORT"
:keystore-path #config/env "COOK_KEYSTORE_PATH"
:keystore-type "pkcs12"
:keystore-pass "cookstore"}
; Pools can be configured with a :user-limit-normal and a
; :user-limit-constrained, where :user-limit-constrained
; is only used when the entire pool's queue length is
; above the configured :pool-global-threshold
:queue-limits {:per-pool [{:pool-global-threshold 30000
:pool-regex "^.*$"
:user-limit-constrained 1000
:user-limit-normal 5000}]
:update-interval-seconds 5}
:rate-limit {:auth-bypass-limit-per-m 10000
:expire-minutes 1200 ; Expire unused rate limit entries after 20 hours.
; Keep these job-launch and job-submission values as they are for integration tests. Making them smaller can cause
; spurious failures, and making them larger will cause test_rate_limit_launching_jobs to skip itself.
:job-launch {:bucket-size 10000
:enforce? true
:tokens-replenished-per-minute 5000}
:job-submission {:bucket-size 1000
:enforce? true
:tokens-replenished-per-minute 600}
:user-limit-per-m 1000000}
:rebalancer {:dru-scale 1
:interval-seconds 30
:max-preemption 500.0
:min-dru-diff 1.0
:safe-dru-threshold 1.0
:pool-regex "^.*alpha.*$"}
:sandbox-syncer {:sync-interval-ms 1000}
:pg-config {:dbtype "postgresql"
:dbname "cook_local"
:currentSchema "cook_local"
:host "cook-postgres"
:ssl false
:sslfactory "org.postgresql.ssl.NonValidatingFactory"
:password #config/env "PGPASSWORD"
:user "cook_scheduler"}
:scheduler {:offer-incubate-ms 15000
:task-constraints {:command-length-limit 5000
:cpus 10
:memory-gb 48
:retry-limit 15
:timeout-hours 1
:timeout-interval-minutes 1
:docker-parameters-allowed #{"device" "env" "user" "workdir"}}}
:unhandled-exceptions {:log-level :error}
:zookeeper {:local? #config/env-bool "COOK_ZOOKEEPER_LOCAL"
:connection #config/env "COOK_ZOOKEEPER"}}