Skip to content

Commit c8dc801

Browse files
committed
[vm] Always expose VMs with a service
## What this PR does When VMs are created without a public IP, no service is created for them and they have no in-cluster DNS name. This PR fixes this and resolves #1731. ### Release note ```release-note [vm] Always expose VMs with at least a ClusterIP service. ``` Signed-off-by: Timofei Larkin <[email protected]>
1 parent fe7bdcf commit c8dc801

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

‎packages/apps/virtual-machine/templates/service.yaml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{- if .Values.external }}
21
---
32
apiVersion: v1
43
kind: Service
@@ -7,17 +6,22 @@ metadata:
76
labels:
87
apps.cozystack.io/user-service: "true"
98
{{- include "virtual-machine.labels" . | nindent 4 }}
9+
{{- if .Values.external }}
1010
annotations:
1111
networking.cozystack.io/wholeIP: "true"
12+
{{- end }}
1213
spec:
1314
type: {{ ternary "LoadBalancer" "ClusterIP" .Values.external }}
15+
{{- if .Values.external }}
1416
externalTrafficPolicy: Local
1517
{{- if ((include "cozy-lib.network.disableLoadBalancerNodePorts" $) | fromYaml) }}
1618
allocateLoadBalancerNodePorts: false
1719
{{- end }}
20+
{{- end }}
1821
selector:
1922
{{- include "virtual-machine.selectorLabels" . | nindent 4 }}
2023
ports:
24+
{{- if .Values.external }}
2125
{{- if and (eq .Values.externalMethod "WholeIP") (not .Values.externalPorts) }}
2226
- port: 65535
2327
{{- else }}
@@ -27,4 +31,6 @@ spec:
2731
targetPort: {{ . }}
2832
{{- end }}
2933
{{- end }}
34+
{{- else }}
35+
- port: 65535
3036
{{- end }}

‎packages/apps/vm-instance/templates/service.yaml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{- if .Values.external }}
21
---
32
apiVersion: v1
43
kind: Service
@@ -7,17 +6,22 @@ metadata:
76
labels:
87
apps.cozystack.io/user-service: "true"
98
{{- include "virtual-machine.labels" . | nindent 4 }}
9+
{{- if .Values.external }}
1010
annotations:
1111
networking.cozystack.io/wholeIP: "true"
12+
{{- end }}
1213
spec:
1314
type: {{ ternary "LoadBalancer" "ClusterIP" .Values.external }}
15+
{{- if .Values.external }}
1416
externalTrafficPolicy: Local
1517
{{- if ((include "cozy-lib.network.disableLoadBalancerNodePorts" $) | fromYaml) }}
1618
allocateLoadBalancerNodePorts: false
1719
{{- end }}
20+
{{- end }}
1821
selector:
1922
{{- include "virtual-machine.selectorLabels" . | nindent 4 }}
2023
ports:
24+
{{- if .Values.external }}
2125
{{- if and (eq .Values.externalMethod "WholeIP") (not .Values.externalPorts) }}
2226
- port: 65535
2327
{{- else }}
@@ -27,4 +31,6 @@ spec:
2731
targetPort: {{ . }}
2832
{{- end }}
2933
{{- end }}
34+
{{- else }}
35+
- port: 65535
3036
{{- end }}

0 commit comments

Comments
 (0)