Skip to content

Commit 8080863

Browse files
committed
Merge branch 'main' of github.com:drycc/controller into main
2 parents d2ca0b0 + 40f04d9 commit 8080863

8 files changed

Lines changed: 26 additions & 11 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Drycc Controller
22

3-
[![Build Status](https://drone.drycc.cc/api/badges/drycc/controller/status.svg)](https://drone.drycc.cc/drycc/controller)
3+
[![Build Status](https://woodpecker.drycc.cc/api/badges/drycc/controller/status.svg)](https://woodpecker.drycc.cc/drycc/controller)
44
[![codecov.io](https://codecov.io/github/drycc/controller/coverage.svg?branch=main)](https://codecov.io/github/drycc/controller?branch=main)
55
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fdrycc%2Fcontroller.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fdrycc%2Fcontroller?ref=badge_shield)
66

@@ -80,4 +80,4 @@ kubectl get pod --namespace=drycc -w | grep drycc-controller
8080

8181

8282
## License
83-
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fdrycc%2Fcontroller.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fdrycc%2Fcontroller?ref=badge_large)
83+
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fdrycc%2Fcontroller.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fdrycc%2Fcontroller?ref=badge_large)

charts/controller/templates/_helpers.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ env:
2626
- name: "DRYCC_APP_RUNTIME_CLASS"
2727
value: "{{ .Values.appRuntimeClass }}"
2828
{{- end }}
29+
{{- if (.Values.appDNSPolicy) }}
30+
- name: "DRYCC_APP_DNS_POLICY"
31+
value: "{{ .Values.appDNSPolicy }}"
32+
{{- end }}
2933
{{- if (.Values.appPodExecTimeout) }}
3034
- name: "DRYCC_APP_POD_EXEC_TIMEOUT"
3135
value: "{{ .Values.appPodExecTimeout }}"

charts/controller/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ k8sApiVerifyTls: "true"
2020
appStorageClass: "drycc-storage"
2121
# Set runtimeClassName. It is used for application.
2222
appRuntimeClass: ""
23+
# Set appDNSPolicy. It is used for application.
24+
# See: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy
25+
appDNSPolicy: ""
2326
# set timeout seconds. It is used for pod exec
2427
appPodExecTimeout: 3600
2528
# Set api replicas

rootfs/api/models/app.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,11 @@ def _get_entrypoint(self, container_type):
153153
"""
154154
Return the kubernetes "container command" to be sent off to the scheduler.
155155
"""
156-
entrypoint = ['/bin/sh', '-c']
156+
entrypoint = []
157157
release = self.release_set.filter(failed=False).latest()
158+
if release is not None and release.build is not None:
159+
if release.build.procfile and container_type in release.build.procfile:
160+
entrypoint = ['/bin/sh', '-c']
158161
if self._get_stack(release) == "buildpack":
159162
if container_type in release.build.procfile:
160163
entrypoint = [container_type]
@@ -1113,6 +1116,7 @@ def _gather_app_settings(self, release, app_settings, process_type, replicas, vo
11131116
'annotations': json.loads(settings.KUBERNETES_POD_DEFAULT_ANNOTATIONS),
11141117
'healthcheck': healthcheck,
11151118
'runtime_class_name': settings.DRYCC_APP_RUNTIME_CLASS,
1119+
'dns_policy': settings.DRYCC_APP_DNS_POLICY,
11161120
'lifecycle_post_start': config.lifecycle_post_start,
11171121
'lifecycle_pre_stop': config.lifecycle_pre_stop,
11181122
'routable': routable,

rootfs/api/settings/production.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,8 @@
330330

331331
DRYCC_APP_RUNTIME_CLASS = os.environ.get('DRYCC_APP_RUNTIME_CLASS', "")
332332

333+
DRYCC_APP_DNS_POLICY = os.environ.get('DRYCC_APP_DNS_POLICY', "")
334+
333335
DRYCC_APP_POD_EXEC_TIMEOUT = int(os.environ.get('DRYCC_APP_POD_EXEC_TIMEOUT', "3600"))
334336

335337
DRYCC_DEFAULT_CONFIG_TAGS = os.environ.get('DRYCC_DEFAULT_CONFIG_TAGS', '')
@@ -350,17 +352,17 @@
350352
KUBERNETES_REQUEST_MEMORY_RATIO = int(os.environ.get('KUBERNETES_REQUEST_MEMORY_RATIO', '2'))
351353

352354
# Minimum CPU limit, units are represented in the millicpu of CPUs
353-
KUBERNETES_LIMITS_MIN_CPU = 125
355+
KUBERNETES_LIMITS_MIN_CPU = int(os.environ.get('KUBERNETES_LIMITS_MIN_CPU', '125'))
354356
# Max CPU limit, units are represented in the millicpu of CPUs
355-
KUBERNETES_LIMITS_MAX_CPU = 32 * 1000
357+
KUBERNETES_LIMITS_MAX_CPU = int(os.environ.get('KUBERNETES_LIMITS_MAX_CPU', 32 * 1000))
356358
# Minimum Memory limit, units are represented in Megabytes(M)
357-
KUBERNETES_LIMITS_MIN_MEMORY = 128
359+
KUBERNETES_LIMITS_MIN_MEMORY = int(os.environ.get('KUBERNETES_LIMITS_MIN_MEMORY', '128'))
358360
# Max Memory limit, units are represented in Megabytes(M)
359-
KUBERNETES_LIMITS_MAX_MEMORY = 128 * 1024
361+
KUBERNETES_LIMITS_MAX_MEMORY = int(os.environ.get('KUBERNETES_LIMITS_MAX_MEMORY', 128 * 1024))
360362
# Minimum Stroage Volume limit, units are represented in Gigabytes(G)
361-
KUBERNETES_LIMITS_MIN_VOLUME = 1
363+
KUBERNETES_LIMITS_MIN_VOLUME = int(os.environ.get('KUBERNETES_LIMITS_MIN_VOLUME', 1))
362364
# Max Stroage Volume limit, units are represented in Gigabytes(G)
363-
KUBERNETES_LIMITS_MAX_VOLUME = 1024 * 16
365+
KUBERNETES_LIMITS_MAX_VOLUME = int(os.environ.get('KUBERNETES_LIMITS_MAX_VOLUME', 1024 * 16))
364366

365367
# Default pod spec for application.
366368
KUBERNETES_POD_DEFAULT_RESOURCES = os.environ.get(

rootfs/api/tests/test_pods.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ def test_run_command_good(self, mock_requests):
589589
response = self.client.post(url, body)
590590
self.assertEqual(response.status_code, 200, response.data)
591591
app = App.objects.get(id=app_id)
592-
self.assertEqual(app._get_entrypoint('cmd'), ['/bin/sh', '-c'])
592+
self.assertEqual(app._get_entrypoint('cmd'), [])
593593

594594
# procfile workflow
595595
build.sha = 'somereallylongsha'

rootfs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Drycc controller requirements
22
backoff==2.1.2
3-
django==4.1.2
3+
django==4.1.7
44
channels==3.0.5
55
aiohttp==v3.8.1
66
django-cors-headers==3.13.0

rootfs/scheduler/resources/pod.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ def manifest(self, namespace, name, image, **kwargs):
158158
# pod runtimeClassName
159159
if kwargs.get('runtime_class_name', ''):
160160
spec['runtimeClassName'] = kwargs.get('runtime_class_name')
161+
if kwargs.get('dns_policy', ''):
162+
spec['dnsPolicy'] = kwargs.get('dns_policy')
161163

162164
# what should the pod do if it exits
163165
spec['restartPolicy'] = kwargs.get('restart_policy', 'Always')

0 commit comments

Comments
 (0)