Skip to content

Commit

Permalink
make charts
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaqiluo committed Oct 24, 2024
1 parent fe2bf55 commit 52ecde0
Show file tree
Hide file tree
Showing 15 changed files with 706 additions and 0 deletions.
Binary file not shown.
24 changes: 24 additions & 0 deletions charts/rancher-vsphere-cpi/105.0.0+up1.9.1/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
annotations:
catalog.cattle.io/certified: rancher
catalog.cattle.io/display-name: vSphere CPI
catalog.cattle.io/kube-version: '>= 1.27.0-0 < 1.32.0-0'
catalog.cattle.io/namespace: kube-system
catalog.cattle.io/os: linux
catalog.cattle.io/permits-os: linux,windows
catalog.cattle.io/rancher-version: '>= 2.10.0-0'
catalog.cattle.io/release-name: vsphere-cpi
apiVersion: v1
appVersion: 1.9.1
description: vSphere Cloud Provider Interface (CPI)
icon: https://charts.rancher.io/assets/logos/vsphere-cpi.svg
keywords:
- infrastructure
maintainers:
- email: jiaqi.luo@suse.com
name: Jiaqi Luo
- email: brad.davidson@suse.com
name: Brad Davidson
name: rancher-vsphere-cpi
sources:
- https://github.com/kubernetes/cloud-provider-vsphere
version: 105.0.0+up1.9.1
59 changes: 59 additions & 0 deletions charts/rancher-vsphere-cpi/105.0.0+up1.9.1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# vSphere Cloud Provider Interface (CPI)

[vSphere Cloud Provider Interface (CPI)](https://github.com/kubernetes/cloud-provider-vsphere) is responsible for running all the platform specific control loops that were previously run in core Kubernetes components like the KCM and the kubelet, but have been moved out-of-tree to allow cloud and infrastructure providers to implement integrations that can be developed, built and released independent of Kubernetes core. The official documentation and tutorials can be found [here](https://vsphere-csi-driver.sigs.k8s.io/driver-deployment/prerequisites.html).

**This chart requires being deployed into the `kube-system` namespace.**

## Prerequisites

- vSphere 6.7 U3+
- Kubernetes v1.14+
- A Secret on your Kubernetes cluster that contains vSphere credentials (Refer to `README` or `Detailed Descriptions`)

## Installation

This chart requires a Secret in your Kubernetes cluster that contains the server URL and credentials to connect to the vCenter. You can have the chart generate it for you, or create it yourself and provide the name of the Secret during installation.

<span style="color:orange">Warning</span>: When the option to generate the Secret is enabled, the credentials are visible in the API to authorized users. If you create the Secret yourself they will not be visible.

You can create a Secret in one of the following ways:
### <B>Option 1</b>: Create a Secret using the Rancher UI
Go to your cluster's project (Same project you will be installing the chart) > Resources > Secrets > Add Secret.
```yaml
# Example of data required in the Secret
<host-1>.username: <username>
<host-1>.password: <password>
```
### <B>Option 2</b>: Create a Secret using kubectl
Replace placeholders with actual values, and execute the following:
```bash
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: <secret-name>
namespace: <charts-namespace>
data:
<host-1>.username: <base64encoded-username>
<host-1>.password: <base64encoded-password>
EOF
```

More information on managing Secrets using kubectl [here](https://kubernetes.io/docs/tasks/configmap-secret/managing-secret-using-kubectl/).

## Migration

If using this chart to migrate volumes provisioned by the in-tree provider to the out-of-tree CPI + CSI, you need to taint all nodes with the following:
```
node.cloudprovider.kubernetes.io/uninitialized=true:NoSchedule
```

To perform this operation on all nodes in your cluster, the following script has been provided for your convenience:
```bash
# Note: Since this script uses kubectl, ensure that you run `export KUBECONFIG=<path-to-kubeconfig-for-cluster>` before running this script
for node in $(kubectl get nodes | awk '{print $1}' | tail -n +2); do
kubectl taint node $node node.cloudprovider.kubernetes.io/uninitialized=true:NoSchedule
done
```
11 changes: 11 additions & 0 deletions charts/rancher-vsphere-cpi/105.0.0+up1.9.1/app-readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# vSphere Cloud Provider Interface (CPI)

[vSphere Cloud Provider Interface (CPI)](https://github.com/kubernetes/cloud-provider-vsphere) is responsible for running all the platform specific control loops that were previously run in core Kubernetes components like the KCM and the kubelet, but have been moved out-of-tree to allow cloud and infrastructure providers to implement integrations that can be developed, built and released independent of Kubernetes core. The official documentation and tutorials can be found [here](https://vsphere-csi-driver.sigs.k8s.io/driver-deployment/prerequisites.html).

**This chart requires being deployed into the `kube-system` namespace.**

## Prerequisites

- vSphere 6.7 U3+ or vSphere 7.0+
- Kubernetes v1.19+
- A Secret on your Kubernetes cluster that contains vSphere credentials (Refer to `README` or `Detailed Descriptions`)
110 changes: 110 additions & 0 deletions charts/rancher-vsphere-cpi/105.0.0+up1.9.1/questions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
questions:
- variable: vCenter.host
label: vCenter Host
description: IP address or FQDN of the vCenter
type: string
required: true
group: vCenter

- variable: vCenter.datacenters
description: Comma-separated list of paths to data centers. E.g "<dc1-path>, <dc2-path>, ..."
label: Data Centers
type: string
required: true
group: vCenter

- variable: vCenter.credentialsSecret.generate
label: Generate Credential's Secret
description: Generates a secret with the vSphere credentials (If the option to generate it is enabled, credentials will be visible in the API to authorized users)
type: boolean
default: true
required: true
group: vCenter
show_subquestion_if: true
subquestions:
- variable: vCenter.username
label: Username
description: Username for vCenter
type: string
group: vCenter
- variable: vCenter.password
label: Password
description: Password for vCenter
type: password
group: vCenter

- variable: vCenter.credentialsSecret.name
label: Credential's Secret Name
description: Name of the secret with the vSphere credentials (Will not be visible in the API. More info in the README)
default: "vsphere-cpi-creds"
type: string
group: vCenter
show_if: "vCenter.credentialsSecret.generate=false"

- variable: vCenter.labels.generate
label: Define vSphere Tags
description: "vSphere Tags used to determine the zone and region of a Kubernetes node. This labels will be propagated to NodeLabels."
type: boolean
default: false
required: true
group: vCenter
show_subquestion_if: true
subquestions:
- variable: vCenter.labels.region
label: Region
description: vSphere tag which will used to define regions. e.g. eu-central
type: string
group: vCenter
- variable: vCenter.labels.zone
label: Zone
description: vSphere tag which will used to define availability zones
type: string
group: vCenter

- variable: global.ipFamily
label: Node Address IP Family
description: "The IP families of the address(es) to be assigned to the Node. The first selected family will be the Primary. Separate multiple families with a comma. Valid options are 'ipv4' and 'ipv6'."
type: string
default: "ipv4"
required: false
group: Global

- variable: nodesEnable
label: Node address selection filters
description: "Define the way that IP addresses are selected to be assigned to the Kubernetes Node"
type: boolean
default: false
required: false
group: Nodes
show_subquestion_if: true
subquestions:
- variable: nodes.internalNetworkSubnetCidr
label: Internal Network CIDR
description: "The vSphere cloud provider will select the first address that falls within the provided subnet and assign that value to the Internal IP for the node."
type: string
group: Nodes
- variable: nodes.externalNetworkSubnetCidr
label: External Network CIDR
description: "The vSphere cloud provider will select the first address that falls within the provided subnet and assign that value to the External IP for the node."
type: string
group: Nodes
- variable: nodes.internalVmNetworkName
label: Internal VM Network Name
description: "The vSphere cloud provider will select the first address found in the VM network matching the provided name and assign that value to the Internal IP for the node."
type: string
group: Nodes
- variable: nodes.externalVmNetworkName
label: External VM Network Name
description: "The vSphere cloud provider will select the first address found in the VM network matching the provided name and assign that value to the External IP for the node."
type: string
group: Nodes
- variable: nodes.excludeInternalNetworkSubnetCidr
label: Exclude Internal Network CIDR
description: "The vSphere cloud provider will never select addresses for the Internal IP that fall within the provided subnet ranges. This configuration has the highest precedence."
type: string
group: Nodes
- variable: nodes.excludeExternalNetworkSubnetCidr
label: Exclude External Network CIDR
description: "The vSphere cloud provider will never select addresses for the External IP that fall within the provided subnet ranges. This configuration has the highest precedence."
type: string
group: Nodes
50 changes: 50 additions & 0 deletions charts/rancher-vsphere-cpi/105.0.0+up1.9.1/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{{- define "system_default_registry" -}}
{{- if .Values.global.cattle.systemDefaultRegistry -}}
{{- printf "%s/" .Values.global.cattle.systemDefaultRegistry -}}
{{- else -}}
{{- "" -}}
{{- end -}}
{{- end -}}

{{- define "applyVersionOverrides" -}}
{{- $overrides := dict -}}
{{- range $override := .Values.versionOverrides -}}
{{- if semverCompare $override.constraint $.Capabilities.KubeVersion.Version -}}
{{- $_ := mergeOverwrite $overrides $override.values -}}
{{- end -}}
{{- end -}}
{{- $_ := mergeOverwrite .Values $overrides -}}
{{- end -}}

{{/*
Windows cluster will add default taint for linux nodes,
add below linux tolerations to workloads could be scheduled to those linux nodes
*/}}
{{- define "linux-node-tolerations" -}}
- key: "cattle.io/os"
value: "linux"
effect: "NoSchedule"
operator: "Equal"
{{- end -}}

{{- define "linux-node-selector" -}}
kubernetes.io/os: linux
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "chartName" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Labels that should be added on each resource
*/}}
{{- define "labels" -}}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "chartName" . }}
{{- end -}}


Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: vsphere-cloud-config
labels:
vsphere-cpi-infra: config
component: {{ .Chart.Name }}-cloud-controller-manager
{{- include "labels" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
data:
vsphere.yaml: |
# Global properties in this section will be used for all specified vCenters unless overriden in VirtualCenter section.
global:
secretName: {{ .Values.vCenter.credentialsSecret.name | quote }}
secretNamespace: {{ $.Release.Namespace | quote }}
port: {{ .Values.vCenter.port }}
insecureFlag: {{ .Values.vCenter.insecureFlag }}
{{- with .Values.global.ipFamily }}
ipFamily:
{{- splitList "," . | toYaml | nindent 8 }}
{{- end }}
{{ with .Values.vCenter }}
# vcenter section
vcenter:
{{ .host | quote }}:
server: {{ .host | quote }}
datacenters:
- {{ .datacenters | quote }}
{{- if .labels.generate }}
# labels for regions and zones
labels:
region: {{ .labels.region | quote }}
zone: {{ .labels.zone | quote }}
{{- end }}
{{- end }}
{{- if .Values.nodesEnable }}
{{- with .Values.nodes }}
nodes:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- end }}
Loading

0 comments on commit 52ecde0

Please sign in to comment.