Skip to content

Commit 9d5f97f

Browse files
committed
chore(controller): remove cluster domain
1 parent 5e67774 commit 9d5f97f

11 files changed

Lines changed: 22 additions & 52 deletions

charts/controller/templates/_helpers.tpl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ env:
1717
value: "{{ (tpl .Values.filerImage .) }}"
1818
- name: "DRYCC_FILER_IMAGE_PULL_POLICY"
1919
value: "{{ (tpl .Values.filerImagePullPolicy .) }}"
20-
- name: "KUBERNETES_CLUSTER_DOMAIN"
21-
value: "{{ .Values.global.clusterDomain }}"
2220
- name: "DRYCC_APP_GATEWAY_CLASS"
2321
value: "{{ .Values.appGatewayClass }}"
2422
{{- if (.Values.appStorageClass) }}
@@ -69,7 +67,7 @@ env:
6967
name: valkey-creds
7068
key: password
7169
- name: DRYCC_VALKEY_URL
72-
value: "redis://:$(VALKEY_PASSWORD)@drycc-valkey.{{.Release.Namespace}}.svc.{{.Values.global.clusterDomain}}:16379/0"
70+
value: "redis://:$(VALKEY_PASSWORD)@drycc-valkey:16379/0"
7371
{{- end }}
7472
{{- if (.Values.databaseReplicaUrl) }}
7573
- name: DRYCC_DATABASE_REPLICA_URL
@@ -96,9 +94,9 @@ env:
9694
name: database-creds
9795
key: password
9896
- name: DRYCC_DATABASE_URL
99-
value: "postgres://$(DRYCC_PG_USER):$(DRYCC_PG_PASSWORD)@drycc-database.{{.Release.Namespace}}.svc.{{.Values.global.clusterDomain}}:5432/controller"
97+
value: "postgres://$(DRYCC_PG_USER):$(DRYCC_PG_PASSWORD)@drycc-database:5432/controller"
10098
- name: DRYCC_DATABASE_REPLICA_URL
101-
value: "postgres://$(DRYCC_PG_USER):$(DRYCC_PG_PASSWORD)@drycc-database-replica.{{.Release.Namespace}}.svc.{{.Values.global.clusterDomain}}:5432/controller"
99+
value: "postgres://$(DRYCC_PG_USER):$(DRYCC_PG_PASSWORD)@drycc-database-replica:5432/controller"
102100
{{- end }}
103101
{{- if (.Values.workflowManagerUrl) }}
104102
- name: WORKFLOW_MANAGER_URL
@@ -120,7 +118,7 @@ env:
120118
key: victoriametrics-url
121119
{{- else if .Values.victoriametrics.enabled }}
122120
- name: "DRYCC_VICTORIAMETRICS_URL"
123-
value: "http://drycc-victoriametrics-vmselect.{{$.Release.Namespace}}.svc.{{$.Values.global.clusterDomain}}:8481"
121+
value: "http://drycc-victoriametrics-vmselect:8481"
124122
{{- end }}
125123
{{- if .Values.passport.enabled }}
126124
- name: "DRYCC_PASSPORT_URL"
@@ -157,7 +155,7 @@ env:
157155
key: passport-secret
158156
{{- end }}
159157
- name: QUICKWIT_SEARCHER_URL
160-
value: http://drycc-quickwit-searcher.{{ $.Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:7280
158+
value: http://drycc-quickwit-searcher:7280
161159
- name: QUICKWIT_LOG_INDEX_PREFIX
162160
value: {{ .Values.quickwit.logIndexPrefix }}
163161
{{- range $key, $value := .Values.environment }}

charts/controller/templates/controller-celery-deloyment.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ spec:
3434
- netcat
3535
- -v
3636
- -u
37-
- $(DRYCC_DATABASE_URL),$(DRYCC_VALKEY_URL),$(DRYCC_DATABASE_REPLICA_URL)
38-
- -a
39-
- $(DRYCC_CONTROLLER_API_SERVICE_HOST):$(DRYCC_CONTROLLER_API_SERVICE_PORT)
37+
- $(DRYCC_DATABASE_URL),$(DRYCC_VALKEY_URL),$(DRYCC_DATABASE_REPLICA_URL),http://drycc-controller-api
4038
{{- include "controller.envs" . | indent 8 }}
4139
containers:
4240
- name: drycc-controller-celery

charts/controller/templates/controller-cronjob-daily.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ spec:
2929
- netcat
3030
- -v
3131
- -u
32-
- $(DRYCC_DATABASE_URL),$(DRYCC_VALKEY_URL),$(DRYCC_DATABASE_REPLICA_URL)
33-
- -a
34-
- $(DRYCC_CONTROLLER_API_SERVICE_HOST):$(DRYCC_CONTROLLER_API_SERVICE_PORT)
32+
- $(DRYCC_DATABASE_URL),$(DRYCC_VALKEY_URL),$(DRYCC_DATABASE_REPLICA_URL),http://drycc-controller-api
3533
{{- include "controller-job.envs" . | indent 12 }}
3634
containers:
3735
- image: {{.Values.imageRegistry}}/{{.Values.imageOrg}}/controller:{{.Values.imageTag}}

charts/controller/templates/controller-cronjob-hourly.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ spec:
3030
- -v
3131
- -u
3232
- $(DRYCC_DATABASE_URL),$(DRYCC_VALKEY_URL),$(DRYCC_DATABASE_REPLICA_URL)
33-
- -a
34-
- $(DRYCC_CONTROLLER_API_SERVICE_HOST):$(DRYCC_CONTROLLER_API_SERVICE_PORT)
33+
- -u
34+
- $(DRYCC_DATABASE_URL),$(DRYCC_VALKEY_URL),$(DRYCC_DATABASE_REPLICA_URL),http://drycc-controller-api
3535
{{- include "controller-job.envs" . | indent 12 }}
3636
containers:
3737
- image: {{.Values.imageRegistry}}/{{.Values.imageOrg}}/controller:{{.Values.imageTag}}

charts/controller/templates/controller-mutate-deloyment.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ spec:
2424
- netcat
2525
- -v
2626
- -u
27-
- $(DRYCC_DATABASE_URL),$(DRYCC_VALKEY_URL),$(DRYCC_DATABASE_REPLICA_URL)
28-
- -a
29-
- $(DRYCC_CONTROLLER_API_SERVICE_HOST):$(DRYCC_CONTROLLER_API_SERVICE_PORT)
27+
- $(DRYCC_DATABASE_URL),$(DRYCC_VALKEY_URL),$(DRYCC_DATABASE_REPLICA_URL),http://drycc-controller-api
3028
{{- include "controller.envs" . | indent 8 }}
3129
containers:
3230
- name: drycc-controller

charts/controller/values.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,6 @@ victoriametrics:
178178
global:
179179
# Admin email, used for each component to send email to administrator
180180
email: "drycc@drycc.cc"
181-
# A domain name consists of one or more parts.
182-
# Periods (.) are used to separate these parts.
183-
# Each part must be 1 to 63 characters in length and can contain lowercase letters, digits, and hyphens (-).
184-
# It must start and end with a lowercase letter or digit.
185-
clusterDomain: "cluster.local"
186181
# The public resolvable hostname to build your cluster with.
187182
#
188183
# This will be the hostname that is used to build endpoints such as "drycc.$HOSTNAME"

rootfs/api/models/service.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import logging
22
from functools import partial
33
from django.db import models
4-
from django.conf import settings
54
from django.contrib.auth import get_user_model
65
from api.utils import validate_json
76
from api.exceptions import ServiceUnavailable
@@ -53,9 +52,7 @@ def name(self):
5352

5453
@property
5554
def domain(self):
56-
return "{}.{}.svc.{}".format(
57-
self.name, self.namespace, settings.KUBERNETES_CLUSTER_DOMAIN
58-
)
55+
return "{}.{}.svc".format(self.name, self.namespace)
5956

6057
@property
6158
def namespace(self):

rootfs/api/settings/production.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,18 +266,11 @@ def randstr(k):
266266
# the k8s namespace in which the controller and workflow were installed.
267267
WORKFLOW_NAMESPACE = os.environ.get('WORKFLOW_NAMESPACE', 'drycc')
268268

269-
# kubernetes cluster domain
270-
KUBERNETES_CLUSTER_DOMAIN = os.environ.get("KUBERNETES_CLUSTER_DOMAIN", "cluster.local")
271269
# default scheduler settings
272270
SCHEDULER_MODULE = 'scheduler'
273271
SCHEDULER_URL = "https://{}:{}".format(
274-
# accessing the k8s api server by IP address rather than hostname avoids
275-
# intermittent DNS errors
276-
os.environ.get(
277-
'KUBERNETES_SERVICE_HOST',
278-
'kubernetes.default.svc.{}'.format(KUBERNETES_CLUSTER_DOMAIN)
279-
),
280-
os.environ.get('KUBERNETES_SERVICE_PORT', '443')
272+
os.environ.get('KUBERNETES_SERVICE_HOST', 'kubernetes.default'),
273+
os.environ.get('KUBERNETES_SERVICE_PORT', '443'),
281274
)
282275

283276
K8S_API_VERIFY_TLS = os.environ.get('K8S_API_VERIFY_TLS', 'true').lower() == "true"

rootfs/api/tests/test_app.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,7 @@ def test_app_verify_application_health_success(self, mock_requests):
452452

453453
# create app
454454
app_id = self.create_app()
455-
hostname = 'http://{}.{}.svc.{}:80/'.format(
456-
app_id, app_id, settings.KUBERNETES_CLUSTER_DOMAIN)
455+
hostname = 'http://{}.{}.svc:80/'.format(app_id, app_id)
457456
mr = mock_requests.register_uri('GET', hostname, responses)
458457

459458
# deploy app to get verification
@@ -488,8 +487,7 @@ def test_app_verify_application_health_failure_404(self, mock_requests):
488487
# create app
489488
app_id = self.create_app()
490489

491-
hostname = 'http://{}.{}.svc.{}:80/'.format(
492-
app_id, app_id, settings.KUBERNETES_CLUSTER_DOMAIN)
490+
hostname = 'http://{}.{}.svc:80/'.format(app_id, app_id)
493491
mr = mock_requests.register_uri('GET', hostname, responses)
494492
# deploy app to get verification
495493
url = "/v2/apps/{}/build".format(app_id)
@@ -512,8 +510,7 @@ def _raise_exception(request, ctx):
512510
# create app
513511
app_id = self.create_app()
514512
# function tries to hit router 10 times
515-
hostname = 'http://{}.{}.svc.{}:80/'.format(
516-
app_id, app_id, settings.KUBERNETES_CLUSTER_DOMAIN)
513+
hostname = 'http://{}.{}.svc:80/'.format(app_id, app_id)
517514
mr = mock_requests.register_uri('GET', hostname, text=_raise_exception)
518515

519516
# deploy app to get verification

rootfs/api/tests/test_service.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from django.contrib.auth import get_user_model
22
from django.core.cache import cache
3-
from django.conf import settings
43

54
from api.tests import DryccTransactionTestCase
65
from api.tests.test_gateway import RouteTest
@@ -50,8 +49,7 @@ def test_service_basic_ops(self):
5049
self.assertEqual(response.status_code, 200, response.data)
5150
self.assertEqual(len(response.data['services']), 1)
5251
expected0 = {
53-
"domain": "%s-%s.%s.svc.%s" % (
54-
app_id, "test", app_id, settings.KUBERNETES_CLUSTER_DOMAIN),
52+
"domain": "%s-%s.%s.svc" % (app_id, "test", app_id),
5553
"ports": [{
5654
'name': "%s-%s-%s-%s" % (app_id, "test", 'udp', 5000),
5755
'port': 5000,
@@ -75,8 +73,7 @@ def test_service_basic_ops(self):
7573

7674
# add new port
7775
expected1 = {
78-
"domain": "%s-%s.%s.svc.%s" % (
79-
app_id, "test", app_id, settings.KUBERNETES_CLUSTER_DOMAIN),
76+
"domain": "%s-%s.%s.svc" % (app_id, "test", app_id),
8077
"ports": [
8178
{
8279
'name': "%s-%s-%s-%s" % (app_id, "test", 'udp', 5000),
@@ -124,8 +121,7 @@ def test_service_basic_ops(self):
124121
self.assertEqual(response.status_code, 200, response.data)
125122
self.assertEqual(len(response.data['services']), 2)
126123
expected2 = {
127-
"domain": "%s-%s.%s.svc.%s" % (
128-
app_id, "test2", app_id, settings.KUBERNETES_CLUSTER_DOMAIN),
124+
"domain": "%s-%s.%s.svc" % (app_id, "test2", app_id),
129125
"ports": [{
130126
'name': "%s-%s-%s-%s" % (app_id, "test2", 'udp', 5000),
131127
'port': 5000,

0 commit comments

Comments
 (0)