Skip to content

Commit 28dd323

Browse files
committed
chore(app): add headless service type to chart
In some scenarios, an ExternalName service cannot point to an IP address. For these cases, a headless service + endpoint slice may resolve any issues
1 parent 3227541 commit 28dd323

File tree

4 files changed

+112
-3
lines changed

4 files changed

+112
-3
lines changed

charts/nx-cloud/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: nx-cloud
33
description: Nx Cloud Helm Chart
44
type: application
5-
version: 0.14.1
5+
version: 0.15.0-rc.1
66
maintainers:
77
- name: nx
88
url: "https://nx.app/"
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
global:
2+
imageTag: '2308.22.7'
3+
4+
nxCloudAppURL: 'URL_TO_ACCESS_INGRESS_FROM_DEV_MACHINES'
5+
6+
secret:
7+
name: 'cloudsecret'
8+
nxCloudMongoServerEndpoint: 'NX_CLOUD_MONGO_SERVER_ENDPOINT'
9+
adminPassword: 'ADMIN_PASSWORD'
10+
11+
# When creating new values files for testing, bring over the lines below. The generated environment is quite resource
12+
# constrained and with the default settings from values.yaml some of the pods will fail to schedule.
13+
frontend:
14+
resources:
15+
requests:
16+
memory: '0.5Mi'
17+
cpu: '0.1'
18+
19+
nxApi:
20+
resources:
21+
requests:
22+
memory: '0.5Mi'
23+
cpu: '0.1'
24+
25+
fileServer:
26+
resources:
27+
requests:
28+
memory: '0.5Mi'
29+
cpu: '0.1'
30+
31+
aggregator:
32+
resources:
33+
requests:
34+
memory: '0.5Mi'
35+
cpu: '0.1'
36+
37+
nxCloudWorkflows:
38+
enabled: true
39+
port: 9000
40+
name: 'nx-cloud-workflow-controller-service'
41+
workflowsNamespace: 'nx-cloud-workflows'
42+
43+
externalName: '192.0.2.22'
44+
headless: true
45+
46+
extraManifests:
47+
secret:
48+
apiVersion: v1
49+
kind: Secret
50+
metadata:
51+
name: cloudsecret
52+
namespace: default
53+
type: Opaque
54+
stringData:
55+
NX_CLOUD_MONGO_SERVER_ENDPOINT: "mongodb://127.0.0.1"
56+
ADMIN_PASSWORD: "SOME_ADMIN_PASSWORD"
57+
GITHUB_SECRET: "I_AM_A_SECRET_VALUE"
58+
GH_CLIENT_ID: "I_AM_A_SECRET_VALUE"
59+
GH_CLIENT_SECRET_VALUE: "I_AM_A_SECRET_VALUE"
60+
SOME_SECRET_TOKEN: "I_AM_A_SECRET_VALUE"
61+
GITLAB_ACCESS_TOKEN: "I_AM_A_SECRET_VALUE"
62+
GITHUB_AUTH_CLIENT_ID: "A_GITHUB_ID"
63+
GITHUB_AUTH_CLIENT_SECRET: "A_GITHUB_CLIENT_SECRET"
64+
GITHUB_WEBHOOK_SECRET: "A_GITHUB_SECRET_VALUE"
65+
GITHUB_AUTH_TOKEN: "A_GITHUB_SECRET_VALUE"
66+
GITHUB_APP_PRIVATE_KEY: "A_GITHUB_SECRET_VALUE"
67+
GITHUB_APP_ID: "A_GITHUB_SECRET_VALUE"
68+
AWS_KEY: "MYAWSKEY"
69+
AWS_SECRET: "SUPER_SECRET_AWS_SECRET"

charts/nx-cloud/templates/nx-cloud-workflow-controller-service.yaml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,40 @@
1-
{{- if and .Values.nxCloudWorkflows.enabled .Values.nxCloudWorkflows.externalName }}
1+
{{- if and .Values.nxCloudWorkflows.enabled .Values.nxCloudWorkflows.externalName}}
2+
{{- if .Values.nxCloudWorkflows.headless }}
3+
# Headless service and endpoint slice
4+
---
5+
apiVersion: v1
6+
kind: Service
7+
metadata:
8+
name: {{ .Values.nxCloudWorkflows.name }}
9+
namespace: {{ .Values.global.namespace }}
10+
labels:
11+
app: nx-cloud-workflow-controller
12+
{{- include "nxCloud.app.labels" . | indent 4 }}
13+
spec:
14+
ports:
15+
- port: {{ .Values.nxCloudWorkflows.port }}
16+
protocol: TCP
17+
targetPort: {{ .Values.nxCloudWorkflows.port }}
18+
---
19+
apiVersion: v1
20+
kind: EndpointSlice
21+
metadata:
22+
name: {{ printf "%s-1" .Values.nxCloudWorkflows.name }}
23+
namespace: {{ .Values.global.namespace }}
24+
labels:
25+
kubernetes.io/service-name: {{ .Values.nxCloudWorkflows.name }}
26+
endpointslice.kubernetes.io/manage-by: helm
27+
app: nx-cloud-workflow-controller
28+
{{- include "nxCloud.app.labels" . | indent 4 }}
29+
addressType: IPv4
30+
ports:
31+
- name: ''
32+
protocol: TCP
33+
port: {{ .Values.nxCloudWorkflows.port }}
34+
endpoints:
35+
- addresses:
36+
- {{ .Values.nxCloudWorkflows.externalName }}
37+
{{- else }}
238
---
339
apiVersion: v1
440
kind: Service
@@ -14,3 +50,4 @@ spec:
1450
externalName: {{ .Values.nxCloudWorkflows.externalName }}
1551
{{- end }}
1652
{{- end }}
53+
{{- end }}

charts/nx-cloud/values.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ nxCloudWorkflows:
135135
name: 'nx-cloud-workflow-controller-service'
136136
workflowsNamespace: 'nx-cloud-workflows'
137137

138-
139138
# If externalName is left unset, the applications will look for ane existing service with the name defined
140139
# by `nxCloudWorkflows.name` in the namespace `nxCloudWorkflows.workflowsNamespace`. Use this option if you are
141140
# also running the nx-agents chart in the same cluster as this nx-cloud chart
@@ -145,6 +144,10 @@ nxCloudWorkflows:
145144
# Use this option if your nx-agents are running in a different cluster than this nx-cloud chart
146145
externalName: ''
147146

147+
# If you find that an externalName service is not working as expected, you can set this to true to create a headless service
148+
# which will create an endpoint group as an alternative
149+
headless: false
150+
148151
# Deprecated, use nxApi.deployment.replicas and frontend.deployment.replicas
149152
replicas:
150153
frontend: 1

0 commit comments

Comments
 (0)