Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce externalMethod=WholeIP for VMs #616

Merged
merged 2 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/apps/versions_map
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,15 @@ virtual-machine 0.4.0 4746d51
virtual-machine 0.5.0 cad9cde
virtual-machine 0.6.0 0e728870
virtual-machine 0.7.0 af58018a
virtual-machine 0.7.1 HEAD
virtual-machine 0.7.1 05857b95
virtual-machine 0.8.0 HEAD
vm-disk 0.1.0 HEAD
vm-instance 0.1.0 ced8e5b9
vm-instance 0.2.0 4f767ee3
vm-instance 0.3.0 0e728870
vm-instance 0.4.0 af58018a
vm-instance 0.4.1 HEAD
vm-instance 0.4.1 05857b95
vm-instance 0.5.0 HEAD
vpn 0.1.0 f642698
vpn 0.2.0 7151424
vpn 0.3.0 a2bcf100
Expand Down
4 changes: 2 additions & 2 deletions packages/apps/virtual-machine/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.7.1
version: 0.8.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.7.1"
appVersion: "0.8.0"
1 change: 1 addition & 0 deletions packages/apps/virtual-machine/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ generate:
&& yq -i -o json ".properties.instanceProfile.optional=true | .properties.instanceProfile.enum = $${PREFERENCES}" values.schema.json
yq -i -o json '.properties.externalPorts.items.type = "integer"' values.schema.json
yq -i -o json '.properties.systemDisk.properties.image.enum = ["ubuntu", "cirros", "alpine", "fedora", "talos"]' values.schema.json
yq -i -o json '.properties.externalMethod.enum = ["wholeIP", "PortList"]' values.schema.json
1 change: 1 addition & 0 deletions packages/apps/virtual-machine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ virtctl ssh <user>@<vm>
| Name | Description | Value |
| ------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------- |
| `external` | Enable external access from outside the cluster | `false` |
| `externalMethod` | specify method to passthrough the traffic to the virtual machine. Allowed values: `WholeIP` and `PortList` | `WholeIP` |
| `externalPorts` | Specify ports to forward from outside the cluster | `[]` |
| `running` | Determines if the virtual machine should be running | `true` |
| `instanceType` | Virtual Machine instance type | `u1.medium` |
Expand Down
8 changes: 8 additions & 0 deletions packages/apps/virtual-machine/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,24 @@ metadata:
name: {{ include "virtual-machine.fullname" . }}
labels:
{{- include "virtual-machine.labels" . | nindent 4 }}
{{- if eq .Values.externalMethod "WholeIP" }}
annotations:
networking.cozystack.io/wholeIP: "true"
{{- end }}
spec:
type: {{ ternary "LoadBalancer" "ClusterIP" .Values.external }}
externalTrafficPolicy: Local
allocateLoadBalancerNodePorts: false
selector:
{{- include "virtual-machine.labels" . | nindent 4 }}
ports:
{{- if eq .Values.externalMethod "WholeIP" }}
- port: 65535
{{- else }}
{{- range .Values.externalPorts }}
- name: port-{{ . }}
port: {{ . }}
targetPort: {{ . }}
{{- end }}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions packages/apps/virtual-machine/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
"description": "Enable external access from outside the cluster",
"default": false
},
"externalMethod": {
"type": "string",
"description": "specify method to passthrough the traffic to the virtual machine. Allowed values: `WholeIP` and `PortList`",
"default": "WholeIP",
"enum": [
"wholeIP",
"PortList"
]
},
"externalPorts": {
"type": "array",
"description": "Specify ports to forward from outside the cluster",
Expand Down
2 changes: 2 additions & 0 deletions packages/apps/virtual-machine/values.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
## @section Common parameters

## @param external Enable external access from outside the cluster
## @param externalMethod specify method to passthrough the traffic to the virtual machine. Allowed values: `WholeIP` and `PortList`
## @param externalPorts [array] Specify ports to forward from outside the cluster
external: false
externalMethod: WholeIP
externalPorts:
- 22

Expand Down
4 changes: 2 additions & 2 deletions packages/apps/vm-instance/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.4.1
version: 0.5.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.4.1"
appVersion: "0.5.0"
1 change: 1 addition & 0 deletions packages/apps/vm-instance/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ generate:
PREFERENCES=$$(yq e '.metadata.name' -o=json -r ../../system/kubevirt-instancetypes/templates/preferences.yaml | yq 'split(" ") | . + [""]' -o json) \
&& yq -i -o json ".properties.instanceProfile.optional=true | .properties.instanceProfile.enum = $${PREFERENCES}" values.schema.json
yq -i -o json '.properties.externalPorts.items.type = "integer"' values.schema.json
yq -i -o json '.properties.externalMethod.enum = ["WholeIP", "PortList"]' values.schema.json
25 changes: 13 additions & 12 deletions packages/apps/vm-instance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,19 @@ virtctl ssh <user>@<vm>

### Common parameters

| Name | Description | Value |
| ------------------ | ---------------------------------------------------------------------------------- | ---------------- |
| `external` | Enable external access from outside the cluster | `false` |
| `externalPorts` | Specify ports to forward from outside the cluster | `[]` |
| `running` | Determines if the virtual machine should be running | `true` |
| `instanceType` | Virtual Machine instance type | `u1.medium` |
| `instanceProfile` | Virtual Machine prefferences profile | `ubuntu` |
| `disks` | List of disks to attach | `[]` |
| `resources.cpu` | The number of CPU cores allocated to the virtual machine | `""` |
| `resources.memory` | The amount of memory allocated to the virtual machine | `""` |
| `sshKeys` | List of SSH public keys for authentication. Can be a single key or a list of keys. | `[]` |
| `cloudInit` | cloud-init user data config. See cloud-init documentation for more details. | `#cloud-config
| Name | Description | Value |
| ------------------ | ---------------------------------------------------------------------------------------------------------- | ---------------- |
| `external` | Enable external access from outside the cluster | `false` |
| `externalMethod` | specify method to passthrough the traffic to the virtual machine. Allowed values: `WholeIP` and `PortList` | `WholeIP` |
| `externalPorts` | Specify ports to forward from outside the cluster | `[]` |
| `running` | Determines if the virtual machine should be running | `true` |
| `instanceType` | Virtual Machine instance type | `u1.medium` |
| `instanceProfile` | Virtual Machine prefferences profile | `ubuntu` |
| `disks` | List of disks to attach | `[]` |
| `resources.cpu` | The number of CPU cores allocated to the virtual machine | `""` |
| `resources.memory` | The amount of memory allocated to the virtual machine | `""` |
| `sshKeys` | List of SSH public keys for authentication. Can be a single key or a list of keys. | `[]` |
| `cloudInit` | cloud-init user data config. See cloud-init documentation for more details. | `#cloud-config
` |

## U Series
Expand Down
8 changes: 8 additions & 0 deletions packages/apps/vm-instance/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,24 @@ metadata:
name: {{ include "virtual-machine.fullname" . }}
labels:
{{- include "virtual-machine.labels" . | nindent 4 }}
{{- if eq .Values.externalMethod "WholeIP" }}
annotations:
networking.cozystack.io/wholeIP: "true"
{{- end }}
spec:
type: {{ ternary "LoadBalancer" "ClusterIP" .Values.external }}
externalTrafficPolicy: Local
allocateLoadBalancerNodePorts: false
selector:
{{- include "virtual-machine.labels" . | nindent 4 }}
ports:
{{- if eq .Values.externalMethod "WholeIP" }}
- port: 65535
{{- else }}
{{- range .Values.externalPorts }}
- name: port-{{ . }}
port: {{ . }}
targetPort: {{ . }}
{{- end }}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions packages/apps/vm-instance/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
"description": "Enable external access from outside the cluster",
"default": false
},
"externalMethod": {
"type": "string",
"description": "specify method to passthrough the traffic to the virtual machine. Allowed values: `WholeIP` and `PortList`",
"default": "WholeIP",
"enum": [
"WholeIP",
"PortList"
]
},
"externalPorts": {
"type": "array",
"description": "Specify ports to forward from outside the cluster",
Expand Down
2 changes: 2 additions & 0 deletions packages/apps/vm-instance/values.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
## @section Common parameters

## @param external Enable external access from outside the cluster
## @param externalMethod specify method to passthrough the traffic to the virtual machine. Allowed values: `WholeIP` and `PortList`
## @param externalPorts [array] Specify ports to forward from outside the cluster
external: false
externalMethod: WholeIP
externalPorts:
- 22

Expand Down