Skip to content

Commit

Permalink
Update Rancher cluster template for vSphere (#27)
Browse files Browse the repository at this point in the history
* Dump chart version to 0.1.3

* Fix typo for azureconfig

* Rename vsphereconfig

* Remove useless taints field

* Delete comment

* Define tags as an array

* Update vSphere config
  • Loading branch information
devpro authored Aug 22, 2023
1 parent 35aea07 commit a06f3c4
Show file tree
Hide file tree
Showing 17 changed files with 155 additions and 54 deletions.
2 changes: 1 addition & 1 deletion charts/rancher-cluster-templates/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: rancher-cluster-templates
description: Helm chart for managing Rancher cluster templates
type: application
version: "0.1.2"
version: "0.1.3"
appVersion: "0.1.0"
annotations:
catalog.cattle.io/type: cluster-template
Expand Down
28 changes: 14 additions & 14 deletions charts/rancher-cluster-templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ helm uninstall my-cluster -n fleet-default

💡 Node driver must be enabled in Rancher prior to Helm chart installation

Provider | Example | Template | Node Driver
---------------------------------|----------------------------------------------------------|---------------------------------------------------------|----------------
**Amazon Web Services (AWS)** | [values_aws](examples/values_aws.yaml) | [amazonec2config](templates/amazonec2config.yaml) | `Amazon EC2`
[**Azure**](docs/azure.md) | [values_azure](examples/values_azure.yaml) | [azureconfig](templates/azureconfig.yaml) | `Azure`
**CloudScale** | [values_cloudscale](examples/values_cloudscale.yaml) | [cloudscaleconfig](templates/cloudscaleconfig.yaml) | `Cloudscale`
**Digitial Ocean** | [values_digitalocean](examples/values_digitalocean.yaml) | [digitaloceanconfig](templates/digitaloceanconfig.yaml) | `DigitalOcean`
**Exoscale** | [values_digitalocean](examples/values_digitalocean.yaml) | [digitaloceanconfig](templates/digitaloceanconfig.yaml) | `Exoscale`
**Equinix Metal (prev. Packet)** | [values_equinix](examples/values_equinix.yaml) | [packetconfig](templates/packetconfig.yaml) | `Equinix Metal`
**Harvester** | [values_harvester](examples/values_harvester.yaml) | [harvesterconfig](templates/harvesterconfig.yaml) | `Harvester`
**Linode** | [values_linode](examples/values_linode.yaml) | [linodeconfig](templates/linodeconfig.yaml) | `Linode`
**Nutanix** | [values_nutanix](examples/values_nutanix.yaml) | [nutanixconfig](templates/nutanixconfig.yaml) | `Nutanix`
**OpenStack** | [values_openstack](examples/values_openstack.yaml) | [openstackconfig](templates/openstackconfig.yaml) | `OpenStack`
**Outscale** | [values_aws](examples/values_outscale.yaml) | [outscaleconfig](templates/outscaleconfig.yaml) | `Outscale`
**VMware vSphere** | [values_vsphere](examples/values_vsphere.yaml) | [vsphereconfig](templates/vsphereconfig.yaml) | `vSphere`
Provider | Example | Template | Node Driver
---------------------------------|----------------------------------------------------------|---------------------------------------------------------------------|----------------
**Amazon Web Services (AWS)** | [values_aws](examples/values_aws.yaml) | [amazonec2config](templates/amazonec2config.yaml) | `Amazon EC2`
[**Azure**](docs/azure.md) | [values_azure](examples/values_azure.yaml) | [azureconfig](templates/azureconfig.yaml) | `Azure`
**CloudScale** | [values_cloudscale](examples/values_cloudscale.yaml) | [cloudscaleconfig](templates/cloudscaleconfig.yaml) | `Cloudscale`
**Digitial Ocean** | [values_digitalocean](examples/values_digitalocean.yaml) | [digitaloceanconfig](templates/digitaloceanconfig.yaml) | `DigitalOcean`
**Exoscale** | [values_digitalocean](examples/values_digitalocean.yaml) | [digitaloceanconfig](templates/digitaloceanconfig.yaml) | `Exoscale`
**Equinix Metal (prev. Packet)** | [values_equinix](examples/values_equinix.yaml) | [packetconfig](templates/packetconfig.yaml) | `Equinix Metal`
**Harvester** | [values_harvester](examples/values_harvester.yaml) | [harvesterconfig](templates/harvesterconfig.yaml) | `Harvester`
**Linode** | [values_linode](examples/values_linode.yaml) | [linodeconfig](templates/linodeconfig.yaml) | `Linode`
**Nutanix** | [values_nutanix](examples/values_nutanix.yaml) | [nutanixconfig](templates/nutanixconfig.yaml) | `Nutanix`
**OpenStack** | [values_openstack](examples/values_openstack.yaml) | [openstackconfig](templates/openstackconfig.yaml) | `OpenStack`
**Outscale** | [values_aws](examples/values_outscale.yaml) | [outscaleconfig](templates/outscaleconfig.yaml) | `Outscale`
**VMware vSphere** | [values_vsphere](examples/values_vsphere.yaml) | [vmwarevsphereconfig.yaml](templates/vmwarevsphereconfig.yaml.yaml) | `vSphere`

### Automation

Expand Down
1 change: 0 additions & 1 deletion charts/rancher-cluster-templates/examples/values_aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ nodepools:
controlplane: true
worker: true
labels: {}
taints: {}
quantity: 1
paused: false
name: nodepool-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ nodepools:
controlplane: true
worker: true
labels: {}
taints: {}
quantity: 1
paused: false
name: nodepool-1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ nodepools:
controlplane: true
worker: true
labels: {}
taints: {}
quantity: 1
name: nodepool-1
image: ubuntu-20-04-x64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ nodepools:
controlplane: true
worker: true
labels: {}
taints: {}
quantity: 1
name: nodepool-1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ nodepools:
controlplane: true
worker: true
labels: {}
taints: {}
quantity: 1
name: nodepool-1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ nodepools:
controlplane: true
worker: true
labels: {}
taints: {}
quantity: 1
name: harvester-nodepool-1
diskSize: 40
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ nodepools:
controlplane: true
worker: true
labels: {}
taints: {}
quantity: 1
name: nodepool-1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ nodepools:
controlplane: true
worker: true
labels: {}
taints: {}
quantity: 1
name: nodepool-1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ nodepools:
controlplane: true
worker: true
labels: {}
taints: {}
quantity: 1
name: nodepool-1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ nodepools:
controlplane: true
worker: true
labels: {}
taints: {}
quantity: 1
name: nodepool-1
region: eu-west-2
Expand Down
35 changes: 30 additions & 5 deletions charts/rancher-cluster-templates/examples/values_vsphere.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,39 @@ nodepools:
- etcd: true
controlplane: true
worker: true
annotations: {}
labels: {}
taints: {}
quantity: 1
paused: false
name: nodepool-1
# region: ""
taints: {}
# cfgparam: [] # VM configuration parameters, used for guestinfo
# cloneFrom: ""
# cloudConfig: | # contents of cloud-config yaml file to put into the ISO user-data; Format should be:
# #cloud-config
# <custom cloud-config>
# cloudinit: "" # filepath or url to add to guestinfo, filepath will be read and base64 encoded before adding
# contentLibrary: "" # if cloneFrom is set
cpuCount: "2"
creationType: "vm"
diskSize: "20480"
sshPort: "22"
sshUserGroup: staff
creationType: "vm" # supported: vm, template, library, legacy
# customAttribute:
# - "200=mycustom value"
# datastore: ""
# datastoreCluster: ""
diskSize: "20480" # in MB
# folder: "" # folder for the docker VM, which must already exist in the datacenter
# hostsystem: "" # compute resource where the docker VM will be instantiated, this can be omitted if using a cluster with DRS
# memorySize: "2048" # in MB
# network: "" # vSphere network where the virtual machine will be attached
# pool: "" # resource pool
sshPort: "22" # if using a non-B2D image
sshUserGroup: staff # if using a non-B2D image the uploaded keys will need chown'ed, defaults to staff e.g. docker:staff
# tag:
# - "urn:xxx"
# vappIpallocationpolicy: "" # supported: dhcp, fixed, transient and fixedAllocated
# vappIpprotocol: "" # supported: IPv4 and IPv6)
# vappProperty: []
# vappTransport: "" # supported: iso and com.vmware.guestInfo (OVF environment transports)
# vcenter: "" # vCenter IP or hostname
vcenterPort: 443
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ sshUser: {{ $nodepool.sshUser }}
subnetId: {{ $nodepool.subnetId }}
{{- end }}
{{- if $nodepool.tags }}
tags: {{ $nodepool.tags }}
tags: {{ join "," $nodepool.tags }}
{{- end }}
{{- if $nodepool.useEbsOptimizedInstance }}
useEbsOptimizedInstance: {{ $nodepool.useEbsOptimizedInstance }}
Expand Down
3 changes: 1 addition & 2 deletions charts/rancher-cluster-templates/templates/azureconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{{- if eq .Values.cloudprovider "azure" }}
{{- range $index, $nodepool := .Values.nodepools }}
---
# Azure configuration (ref. azureconfigs.rke-machine-config.cattle.io CRD)
apiVersion: rke-machine-config.cattle.io/v1
kind: AzureConfig
metadata:
name: {{ $nodepool.name }}
namespace: fleet-default
{{- if $nodepool.annotations }}
labels:
annotations:
{{- toYaml $nodepool.annotations | indent 4 }}
{{- end }}
{{- if $nodepool.labels }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,63 +1,116 @@
{{- if eq .Values.cloudprovider "vsphere" }}
{{- range $index, $nodepool := .Values.nodepools }}
---
# VMware vSphere configuration (ref. vmwarevsphereconfigs.rke-machine-config.cattle.io CRD)
apiVersion: rke-machine-config.cattle.io/v1
kind: VmwarevsphereConfig
metadata:
name: {{ $nodepool.name }}
namespace: fleet-default
# annotations:
# key: string
{{- if $nodepool.labels }}
{{- if $nodepool.annotations }}
annotations:
{{- toYaml $nodepool.annotations | indent 4 }}
{{- end }}
{{- if $nodepool.labels }}
labels:
{{ toYaml $nodepool.labels | indent 4 }}
{{- end }}
{{- toYaml $nodepool.labels | indent 4 }}
{{- end }}
# boot2dockerUrl: string
{{- if $nodepool.cfgparam }}
cfgparam: {{ $nodepool.cfgparam }}
{{- end }}
{{- if $nodepool.cloneFrom }}
cloneFrom: {{ $nodepool.cloneFrom }}
{{- end }}
{{- if $nodepool.cloudConfig }}
cloudConfig: |
{{ $nodepool.cloudConfig | indent 2 }}
{{- end }}
{{- if $nodepool.cloudinit }}
cloudinit: {{ $nodepool.cloudinit }}
{{- end }}
common:
# cloudCredentialSecretName: string
{{- if $nodepool.labels }}
# cloudCredentialSecretName: string
{{- if $nodepool.labels }}
labels:
{{ toYaml $nodepool.labels | indent 4 }}
{{- end }}
{{- if $nodepool.taints }}
{{- toYaml $nodepool.labels | indent 4 }}
{{- end }}
{{- if $nodepool.taints }}
taints:
{{ toYaml $nodepool.taints | indent 4 }}
{{- end }}
{{- toYaml $nodepool.taints | indent 4 }}
{{- end }}
{{- if $nodepool.contentLibrary }}
contentLibrary: {{ $nodepool.contentLibrary }}
{{- end }}
{{- if $nodepool.cpuCount }}
cpuCount: {{ $nodepool.cpuCount | quote }}
{{- end }}
{{- if $nodepool.creationType }}
creationType: {{ $nodepool.creationType }}
{{- end }}
{{- if $nodepool.customAttribute }}
customAttribute: {{ $nodepool.customAttribute }}
{{- end }}
{{- if $nodepool.datacenter }}
datacenter: {{ $nodepool.datacenter }}
datastore: {{ $nodepool.datastore }}
{{- end }}
{{- if $nodepool.region }}
datastore: {{ $nodepool.region }}
{{- end }}
{{- if $nodepool.datastoreCluster }}
datastoreCluster: {{ $nodepool.datastoreCluster }}
{{- end }}
{{- if $nodepool.diskSize }}
diskSize: {{ $nodepool.diskSize | quote }}
{{- end }}
{{- if $nodepool.folder }}
folder: {{ $nodepool.folder }}
{{- end }}
{{- if $nodepool.hostsystem }}
hostsystem: {{ $nodepool.hostsystem }}
{{- end }}
{{- if $nodepool.memorySize }}
memorySize: {{ $nodepool.memorySize | quote }}
{{- end }}
{{- if $nodepool.network }}
network: {{ $nodepool.network }}
pool: {{ $nodepool.pool }}
{{- end }}
# os: string
# password: string
{{- if $nodepool.pool }}
pool: {{ $nodepool.pool }}
{{- end }}
# providerID: string
# sshPassword: string
{{- if $nodepool.sshPort }}
sshPort: {{ $nodepool.sshPort | quote }}
{{- end }}
{{- if $nodepool.sshUser }}
sshUser: {{ $nodepool.sshUser }}
{{- end }}
{{- if $nodepool.sshUserGroup }}
sshUserGroup: {{ $nodepool.sshUserGroup }}
tag: {{ $nodepool.tag }}
{{- end }}
{{- if $nodepool.tags }}
tag: {{ $nodepool.tags }}
{{- end }}
# username: string
{{- if $nodepool.vappIpallocationpolicy }}
vappIpallocationpolicy: {{ $nodepool.vappIpallocationpolicy }}
{{- end }}
{{- if $nodepool.vappIpprotocol }}
vappIpprotocol: {{ $nodepool.vappIpprotocol }}
{{- end }}
{{- if $nodepool.vappProperty }}
vappProperty: {{ $nodepool.vappProperty }}
{{- end }}
{{- if $nodepool.vappTransport }}
vappTransport: {{ $nodepool.vappTransport }}
{{- end }}
{{- if $nodepool.vcenter }}
vcenter: {{ $nodepool.vcenter }}
{{- end }}
{{- if $nodepool.vcenterPort }}
vcenterPort: {{ $nodepool.vcenterPort | quote }}
{{- end }}
{{- end }}
{{- end }}
44 changes: 39 additions & 5 deletions charts/rancher-cluster-templates/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,17 @@ nodepools: []
# maxUnavailable: "5"
# machineDeploymentAnnotations: {}
# machineDeploymentLabels: {}
# region: "" # AWS, Azure, Outscale
# region: "" # AWS, Azure, Outscale, vSphere
# machineImage: "" # AWS, Azure, Outscale
# instanceType: "" # AWS, Azure, Outscale
# storageType: "" # AWS, Azure, Outscale
# sshUser: "" # AWS, Azure
# sshUser: "" # AWS, Azure, vSphere
# openPorts: # AWS, Azure
# - 42/tcp
# diskSize: "30" # Azure, Outscale
# - 42/tcp
# diskSize: "30" # Azure, Outscale, vSphere
# tags: # AWS, vSphere
# - foo
# - bar
# blockDurationMinutes: 0 # AWS spot instance duration in minutes (60, 120, 180, 240, 300, or 360)
# deviceName: "/dev/sda1" # AWS root device name
# encryptEbsVolume: false # AWS Encrypt the EBS volume using the AWS Managed CMK
Expand All @@ -73,7 +76,6 @@ nodepools: []
# monitoring: false # AWS flag to enable CloudWatch monitoring
# privateAddressOnly: false # AWS flag to only use a private IP address
# requestSpotInstance: false # AWS flag to request spot instance
# tags: "foo,bar" # AWS tags (e.g. key1,value1,key2,value2)
# retries: 5 # AWS retry count for recoverable failures (use -1 to disable)
# rootSize: 16 # AWS root disk size (in GB)
# spotPrice: 0.5 # AWS spot instance bid price (in dollar)
Expand All @@ -99,3 +101,35 @@ nodepools: []
# usePrivateIp: false # Azure only
# virtualNetwork: "vnet-AZURE_PREFIX" # Azure only
# diskIops: "1500" # Outscale only
# cfgparam: # vSphere only
# - string
# cloneFrom: "" # vSphere only
# cloudConfig: "" # vSphere only
# taints: # vSphere only
# - effect: string
# key: string
# timeAdded: string
# value: string
# contentLibrary: "" # vSphere only
# cpuCount: "" # vSphere only
# creationType: "" # vSphere only
# customAttribute: # vSphere only
# - string
# datastore: "" # vSphere only
# datastoreCluster: "" # vSphere only
# diskSize: "" # vSphere only
# folder: "" # vSphere only
# hostsystem: "" # vSphere only
# memorySize: "" # vSphere only
# network: # vSphere only
# - string
# pool: "" # vSphere only
# sshPort: "" # vSphere only
# sshUserGroup: "" # vSphere only
# vappIpallocationpolicy: "" # vSphere only
# vappIpprotocol: "" # vSphere only
# vappProperty: # vSphere only
# - string
# vappTransport: "" # vSphere only
# vcenter: "" # vSphere only
# vcenterPort: "" # vSphere only

0 comments on commit a06f3c4

Please sign in to comment.