Skip to content

Commit 49ce4ae

Browse files
committed
feat(k8s): add k8s cluster domain
1 parent cd5fe01 commit 49ce4ae

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

charts/controller/templates/controller-deployment.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ spec:
7676
value: "{{ .Values.global.registry_secret_prefix }}"
7777
- name: "IMAGE_PULL_POLICY"
7878
value: "{{ .Values.app_pull_policy }}"
79+
- name: "KUBERNETES_CLUSTER_DOMAIN"
80+
value: "{{ .Values.global.cluster_domain }}"
7981
{{- if (.Values.app_storage_class) }}
8082
- name: "DRYCC_APP_STORAGE_CLASS"
8183
value: "{{ .Values.app_storage_class }}"
@@ -133,7 +135,7 @@ spec:
133135
fieldRef:
134136
fieldPath: metadata.namespace
135137
- name: DRYCC_NSQD_ADDRS
136-
value: "{{range $i := until $nsqdNodeCount}}drycc-nsqd-{{$i}}.drycc-nsqd.{{ $.Release.Namespace }}.svc.cluster.local:{{$.Values.nsqd.tcp_port}}{{if lt (add 1 $i) $nsqdNodeCount}},{{end}}{{end}}"
138+
value: "{{range $i := until $nsqdNodeCount}}drycc-nsqd-{{$i}}.drycc-nsqd.{{$.Release.Namespace}}.svc.{{$.Values.global.cluster_domain}}:{{$.Values.nsqd.tcp_port}}{{if lt (add 1 $i) $nsqdNodeCount}},{{end}}{{end}}"
137139
{{- range $key, $value := .Values.environment }}
138140
- name: {{ $key }}
139141
value: {{ $value | quote }}

charts/controller/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ global:
6464
use_rbac: false
6565
# Please check `kubernetes.io/ingress.class`
6666
ingress_class: ""
67+
# A domain name consists of one or more parts.
68+
# Periods (.) are used to separate these parts.
69+
# Each part must be 1 to 63 characters in length and can contain lowercase letters, digits, and hyphens (-).
70+
# It must start and end with a lowercase letter or digit.
71+
cluster_domain: "cluster.local"
6772
# The public resolvable hostname to build your cluster with.
6873
#
6974
# This will be the hostname that is used to build endpoints such as "drycc.$HOSTNAME"

rootfs/api/settings/production.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,12 @@
250250
SCHEDULER_URL = "https://{}:{}".format(
251251
# accessing the k8s api server by IP address rather than hostname avoids
252252
# intermittent DNS errors
253-
os.environ.get('KUBERNETES_SERVICE_HOST', 'kubernetes.default.svc.cluster.local'),
253+
os.environ.get(
254+
'KUBERNETES_SERVICE_HOST',
255+
'kubernetes.default.svc.{}'.format(os.environ.get(
256+
"KUBERNETES_CLUSTER_DOMAIN", "cluster.local"
257+
))
258+
),
254259
os.environ.get('KUBERNETES_SERVICE_PORT', '443')
255260
)
256261

0 commit comments

Comments
 (0)