Skip to content

Commit

Permalink
add ccm v0.3.2 (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxtof committed May 11, 2023
1 parent 27fcfa4 commit 9de0536
Show file tree
Hide file tree
Showing 10 changed files with 555 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/nutanix-cloud-provider/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
25 changes: 25 additions & 0 deletions charts/nutanix-cloud-provider/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v2
type: application
name: nutanix-cloud-provider
description: Nutanix Cloud Provider
home: https://github.com/nutanix-cloud-native/cloud-provider-nutanix
maintainers:
- name: nutanix-cloud-native-bot
email: [email protected]
icon: https://avatars2.githubusercontent.com/u/6165865?s=200&v=4
keywords:
- Nutanix
- Cloud Controller Manager
- Cloud
- CCM
version: 0.3.2
appVersion: "v0.3.2"
annotations:
artifacthub.io/displayName: "Nutanix Cloud Provider"
artifacthub.io/containsSecurityUpdates: "true"
artifacthub.io/changes: |
- Nutanix Cloud provider upgrade to v0.3.2
- Add Additional Trust Bundle Support
artifacthub.io/maintainers: |
- name: Nutanix Cloud Native Team
email: [email protected]
116 changes: 116 additions & 0 deletions charts/nutanix-cloud-provider/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Nutanix Cloud Provider Helm chart

## Introduction

The cloud-controller-manager is a Kubernetes [control plane](https://kubernetes.io/docs/reference/glossary/?all=true#term-control-plane) component that embeds cloud-specific control logic. The cloud controller manager lets you link your cluster into your cloud provider's API, and separates out the components that interact with that cloud platform from components that only interact with your cluster.

By decoupling the interoperability logic between Kubernetes and the underlying cloud infrastructure, the cloud-controller-manager component enables cloud providers to release features at a different pace compared to the main Kubernetes project.

The cloud-controller-manager is structured using a plugin mechanism that allows different cloud providers to integrate their platforms with Kubernetes.

The Nutanix Cloud Provider is a plugin that allows Nutanix AHV platform integration with Kubernetes by implementing the node controller function.

The node controller is responsible for updating [Node](https://kubernetes.io/docs/concepts/architecture/nodes/) objects when new VMs are created in your Nutanix infrastructure. The node controller obtains information about the hosts running inside your tenancy with the Nutanix Prism Central API. The node controller performs the following functions:

1. Update a Node object with the corresponding server's unique identifier obtained from the Nutanix Prism Central API.
2. Annotating and labelling the Node object with Nutanix-specific information, such as the region the node is deployed into and the nodes the VMs are running on.
3. Obtain the node's hostname and network addresses.
4. Verifying the node's health. In case a node becomes unresponsive, this controller checks with the Nutanix Prism Central API to see if the server has been deactivated / deleted / terminated. If the node has been deleted from the Nutanix infrastructure, the controller deletes the Node object from your Kubernetes cluster.



## Prerequisites

- The Kubernetes cluster needs to be deployed with cloud-provider set to `external`
- Read access account to the Prism Central instance



## Installing the Chart

To install the chart with the name `nutanix-ccm`:

```console
helm repo add nutanix https://nutanix.github.io/helm/

helm install nutanix-ccm nutanix/nutanix-cloud-provider -n <namespace of your choice>
```



## Upgrade

Upgrades can be done using the normal Helm upgrade mechanism

```
helm repo update
helm upgrade nutanix-ccm nutanix/nutanix-cloud-provider -n <namespace of your choice>
```



## Uninstalling the Chart

To uninstall/delete the `nutanix-csi` deployment:

```console
helm delete nutanix-ccm -n <namespace of your choice>
```

## Configuration

The following table lists the configurable parameters of the Nutanix-CSI chart and their default values.

| Parameter | Description | Default |
|-----------------------------|------------------------------------------------------------------|------------------------------------------------------------------|
| `createConfig` | Create config for Nutanix Cloud Provider (if false use existing) | `true` |
| `configName` | Name of the ConfigMap for Nutanix Cloud Provider config | `nutanix-config` |
| `prismCentralEndPoint` | Hostname or IP to connect to Prism Central instance | `10.0.0.1` |
| `prismCentralPort` | Port to connect to Prism Central instance | `9440` |
| `prismCentralInsecure` | Allow insecure server connections to Prism Central instance | `false` |
| `createSecret` | Create secret for Nutanix Cloud Provider (if false use existing) | `true` |
| `secretName` | Name of the secret for Nutanix Cloud Provider credentials | `nutanix-creds` |
| `username` | Username to connect to Prism Central instance | `cpi` |
| `password` | Password to connect to Prism Central instance | `nutanix/4u` |
| `enableCustomLabeling` | Add some additional custom Nutanix labels to nodes | `false` |
| `topologyDiscovery.type` | Define how Topology will be discovered (Prism or Categories) | `Prism` |
| `topologyCategories.region` | Category name used to assign region topology | `region` |
| `topologyCategories.zone` | Category name used to assign zone topology | `zone` |
| `replicas` | Number of instance(s) of Cloud Provider Pod | `1` |
| `image.repository` | Image for Cloud Provider Pod | `ghcr.io/nutanix-cloud-native/cloud-provider-nutanix/controller` |
| `image.pullPolicy` | Image pullPolicy | `IfNotPresent` |
| `image.tag` | Image tag | `appVersion` |
| `imagePullSecrets` | ImagePullSecrets list | `[]` |
| `podAnnotations` | Add annotation to Cloud Provider Pod | `{}` |
| `resources` | Configure resources for Cloud Provider Pod | `refer to values.yaml` |
| `nodeSelector` | Configure nodeSelector for Cloud Provider Pod | `refer to values.yaml` |
| `tolerations` | Configure tolerations for Cloud Provider Pod | `refer to values.yaml` |
| `affinity` | Configure affinity for Cloud Provider Pod | `refer to values.yaml` |



Specify each parameter using the `--set key=value[,key=value]` argument to `helm install` or provide a file with `-f value.yaml`.

### Configuration examples:

Install the provider in the `kube-system` namespace:

```console
helm install nutanix-ccm nutanix/nutanix-cloud-provider -n kube-system --set prismCentralEndPoint=X.X.X.X --set username=admin --set password=xxxxxxxxx --set prismCentralInsecure=true
```
In the above command `prismCentralEndPoint`, `username`, `password`, `prismCentralInsecure` refers to the Prism Central information where the K8s cluster is deployed.

All the options can also be specified in a value.yaml file:

```console
helm install nutanix-ccm nutanix/nutanix-cloud-provider -n kube-system -f value.yaml
```
## Contributing
See the [contributing docs](../../CONTRIBUTING.md).

## Support
### Community Plus

This code is developed in the open with input from the community through issues and PRs. A Nutanix engineering team serves as the maintainer. Documentation is available in the project repository.

Issues and enhancement requests can be submitted in the [Issues tab of this repository](../../issues). Please search for and review the existing open issues before submitting a new issue.
2 changes: 2 additions & 0 deletions charts/nutanix-cloud-provider/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

Nutanix Cloud Provider {{ .Chart.AppVersion }} was deployed in namespace {{ .Release.Namespace }}
62 changes: 62 additions & 0 deletions charts/nutanix-cloud-provider/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "nutanix-cloud-provider.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "nutanix-cloud-provider.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

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

{{/*
Common labels
*/}}
{{- define "nutanix-cloud-provider.labels" -}}
helm.sh/chart: {{ include "nutanix-cloud-provider.chart" . }}
{{ include "nutanix-cloud-provider.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "nutanix-cloud-provider.selectorLabels" -}}
app.kubernetes.io/name: {{ include "nutanix-cloud-provider.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "nutanix-cloud-provider.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "nutanix-cloud-provider.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
k8s-app: nutanix-cloud-controller-manager
name: nutanix-cloud-controller-manager
namespace: {{ .Release.Namespace }}
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
k8s-app: nutanix-cloud-controller-manager
strategy:
type: Recreate
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
k8s-app: nutanix-cloud-controller-manager
spec:
hostNetwork: true
priorityClassName: system-cluster-critical
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: cloud-controller-manager
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
dnsPolicy: Default
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
name: nutanix-cloud-controller-manager
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
args:
- "--leader-elect=true"
- "--cloud-config=/etc/cloud/nutanix_config.json"
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- mountPath: /etc/cloud
name: nutanix-config-volume
readOnly: true
volumes:
- name: nutanix-config-volume
configMap:
name: {{ .Values.configName}}
49 changes: 49 additions & 0 deletions charts/nutanix-cloud-provider/templates/cm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{{- if eq .Values.createConfig true }}
kind: ConfigMap
apiVersion: v1
metadata:
name: {{ .Values.configName}}
namespace: {{ .Release.Namespace }}
data:
nutanix_config.json: |-
{
"prismCentral": {
"address": "{{ .Values.prismCentralEndPoint}}",
"port": {{ .Values.prismCentralPort }},
"insecure": {{ .Values.prismCentralInsecure }},
"credentialRef": {
"kind": "secret",
"name": "{{ .Values.secretName }}",
"namespace": "{{ .Release.Namespace }}"
},
"additionalTrustBundle": {
"kind": "ConfigMap",
"name": "user-ca-bundle",
"namespace": "{{ .Release.Namespace }}"
}
},
"enableCustomLabeling": {{ .Values.enableCustomLabeling }},
{{- if eq .Values.topologyDiscovery.type "Categories" }}
"topologyDiscovery": {
"type": "Categories",
"topologyCategories": {
"regionCategory": "{{ .Values.topologyCategories.region }}",
"zoneCategory": "{{ .Values.topologyCategories.zone }}"
}
{{- else }}
"topologyDiscovery": {
"type": "Prism"
{{- end }}
}
}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: user-ca-bundle
namespace: {{ .Release.Namespace }}
binaryData:
ca.crt: {{ .Values.prismCentralAdditionalTrustBundle }}
{{- end }}
Loading

0 comments on commit 9de0536

Please sign in to comment.