Skip to content

Commit 5dd0675

Browse files
committed
feat(controller): add app runtime class
1 parent 80398b1 commit 5dd0675

5 files changed

Lines changed: 15 additions & 2 deletions

File tree

charts/controller/templates/_helpers.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ env:
2222
- name: "DRYCC_APP_STORAGE_CLASS"
2323
value: "{{ .Values.appStorageClass }}"
2424
{{- end }}
25+
{{- if (.Values.appRuntimeClass) }}
26+
- name: "DRYCC_APP_RUNTIME_CLASS"
27+
value: "{{ .Values.appRuntimeClass }}"
28+
{{- end }}
2529
{{- if (.Values.appPodExecTimeout) }}
2630
- name: "DRYCC_APP_POD_EXEC_TIMEOUT"
2731
value: "{{ .Values.appPodExecTimeout }}"

charts/controller/values.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ registrationMode: "admin_only"
1616
# Option to disable ssl verification to connect to k8s api server
1717
k8sApiVerifyTls: "true"
1818

19-
# Set storageClassName. It is used for application mount.
19+
# Set storageClassName. It is used for application.
2020
appStorageClass: "drycc-storage"
21+
# Set runtimeClassName. It is used for application.
22+
appRuntimeClass: ""
2123
# set timeout seconds. It is used for pod exec
2224
appPodExecTimeout: 3600
2325
# Set api replicas

rootfs/api/models/app.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,10 +1169,12 @@ def _gather_app_settings(self, release, app_settings, process_type, replicas, vo
11691169
'build_type': release.build.type,
11701170
'annotations': json.loads(settings.KUBERNETES_POD_DEFAULT_ANNOTATIONS),
11711171
'healthcheck': healthcheck,
1172+
'runtime_class_name': settings.DRYCC_APP_RUNTIME_CLASS,
11721173
'lifecycle_post_start': config.lifecycle_post_start,
11731174
'lifecycle_pre_stop': config.lifecycle_pre_stop,
11741175
'routable': routable,
11751176
'deploy_batches': batches,
1177+
'restart_policy': "Always",
11761178
'deploy_timeout': deploy_timeout,
11771179
'deployment_revision_history_limit': deployment_history,
11781180
'release_summary': release.summary,

rootfs/api/settings/production.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,8 @@
328328

329329
DRYCC_APP_STORAGE_CLASS = os.environ.get('DRYCC_APP_STORAGE_CLASS', "")
330330

331+
DRYCC_APP_RUNTIME_CLASS = os.environ.get('DRYCC_APP_RUNTIME_CLASS', "")
332+
331333
DRYCC_APP_POD_EXEC_TIMEOUT = int(os.environ.get('DRYCC_APP_POD_EXEC_TIMEOUT', "3600"))
332334

333335
DRYCC_DEFAULT_CONFIG_TAGS = os.environ.get('DRYCC_DEFAULT_CONFIG_TAGS', '')

rootfs/scheduler/resources/pod.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,12 @@ def manifest(self, namespace, name, image, **kwargs):
155155
}
156156
# pod manifest spec
157157
spec = manifest['spec']
158+
# pod runtimeClassName
159+
if kwargs.get('runtime_class_name', ''):
160+
spec['runtimeClassName'] = kwargs.get('runtime_class_name')
158161

159162
# what should the pod do if it exits
160-
spec['restartPolicy'] = kwargs.get('restartPolicy', 'Always')
163+
spec['restartPolicy'] = kwargs.get('restart_policy', 'Always')
161164

162165
# apply tags as needed to restrict pod to particular node(s)
163166
spec['nodeSelector'] = kwargs.get('tags', {})

0 commit comments

Comments
 (0)