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

Add OpenStack standalone control plane Helm chart and templates #696

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
22 changes: 22 additions & 0 deletions config/dev/openstack-managedcluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ManagedCluster
metadata:
name: openstack-dev
namespace: ${NAMESPACE}
spec:
template: openstack-standalone-cp-0-0-1
credential: openstack-cluster-identity-cred
config:
controlPlaneNumber: 1
workersNumber: 1
controlPlane:
flavor: ${OPENSTACK_CONTROL_PLANE_MACHINE_FLAVOR}
image:
filter:
name: ${OPENSTACK_IMAGE_NAME}
worker:
flavor: ${OPENSTACK_NODE_MACHINE_FLAVOR}
image:
filter:
name: ${OPENSTACK_IMAGE_NAME}
authURL: ${OS_AUTH_URL}
23 changes: 23 additions & 0 deletions templates/cluster/openstack-standalone-cp/.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/
19 changes: 19 additions & 0 deletions templates/cluster/openstack-standalone-cp/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v2
name: openstack-standalone-cp
description: |
An HMC template to deploy a k0s cluster on OpenStack with bootstrapped control plane nodes.
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.0.1
# 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: "1.31.1+k0s.1"
annotations:
cluster.x-k8s.io/provider: infrastructure-openstack, control-plane-k0smotron, bootstrap-k0smotron
cluster.x-k8s.io/bootstrap-k0smotron: v1beta1
cluster.x-k8s.io/control-plane-k0smotron: v1beta1
cluster.x-k8s.io/infrastructure-openstack: v1beta1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- define "cluster.name" -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "openstackmachinetemplate.controlplane.name" -}}
{{- include "cluster.name" . }}-cp-mt
{{- end }}

{{- define "openstackmachinetemplate.worker.name" -}}
{{- include "cluster.name" . }}-worker-mt
{{- end }}

{{- define "k0scontrolplane.name" -}}
{{- include "cluster.name" . }}-cp
{{- end }}

{{- define "k0sworkerconfigtemplate.name" -}}
{{- include "cluster.name" . }}-machine-config
{{- end }}

{{- define "machinedeployment.name" -}}
{{- include "cluster.name" . }}-md
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: {{ include "cluster.name" . }}
spec:
{{- with .Values.clusterNetwork }}
clusterNetwork:
{{- toYaml . | nindent 4 }}
{{- end }}
controlPlaneRef:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: K0sControlPlane
name: {{ include "k0scontrolplane.name" . }}
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackCluster
name: {{ include "cluster.name" . }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: K0sControlPlane
metadata:
name: {{ include "k0scontrolplane.name" . }}
spec:
k0sConfigSpec:
args:
- --enable-worker
- --enable-cloud-provider
- --kubelet-extra-args="--cloud-provider=external"
- --disable-components=konnectivity-server
k0s:
apiVersion: k0s.k0sproject.io/v1beta1
kind: ClusterConfig
metadata:
name: k0s
spec:
api:
extraArgs:
anonymous-auth: "true"
extensions:
helm:
repositories:
- name: openstack
url: https://kubernetes.github.io/cloud-provider-openstack/
charts:
- name: openstack-ccm
chartname: openstack/openstack-cloud-controller-manager
version: 2.31.1
order: 1
namespace: kube-system
values: |
secret:
enabled: true
name: openstack-cloud-config
create: false
nodeSelector:
node-role.kubernetes.io/control-plane: "true"
tolerations:
- key: node.cloudprovider.kubernetes.io/uninitialized
value: "true"
effect: NoSchedule
- key: node-role.kubernetes.io/control-plane
effect: NoSchedule
- key: node-role.kubernetes.io/master
effect: NoSchedule
- name: openstack-csi
chartname: openstack/openstack-cinder-csi
version: 2.31.2
order: 2
namespace: kube-system
values: |
bnallapeta marked this conversation as resolved.
Show resolved Hide resolved
storageClass:
enabled: true
delete:
isDefault: false
allowVolumeExpansion: true
retain:
isDefault: false
allowVolumeExpansion: false
secret:
enabled: true
name: openstack-cloud-config
create: false
csi:
plugin:
nodePlugin:
kubeletDir: /var/lib/k0s/kubelet
network:
provider: calico
calico:
mode: vxlan
machineTemplate:
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
name: {{ include "openstackmachinetemplate.controlplane.name" . }}
namespace: {{ .Release.Namespace }}
replicas: {{ .Values.controlPlaneNumber }}
version: {{ .Values.k0s.version }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: K0sWorkerConfigTemplate
metadata:
name: {{ include "k0sworkerconfigtemplate.name" . }}
spec:
template:
spec:
args:
- --enable-cloud-provider
- --kubelet-extra-args="--cloud-provider=external"
version: {{ .Values.k0s.version }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: {{ include "machinedeployment.name" . }}
spec:
clusterName: {{ include "cluster.name" . }}
replicas: {{ .Values.workersNumber }}
selector:
matchLabels:
cluster.x-k8s.io/cluster-name: {{ include "cluster.name" . }}
template:
metadata:
labels:
cluster.x-k8s.io/cluster-name: {{ include "cluster.name" . }}
spec:
bootstrap:
configRef:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: K0sWorkerConfigTemplate
name: {{ include "k0sworkerconfigtemplate.name" . }}
clusterName: {{ include "cluster.name" . }}
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
name: {{ include "openstackmachinetemplate.worker.name" . }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackCluster
metadata:
name: {{ include "cluster.name" . }}
spec:
{{- if .Values.apiServerLoadBalancer }}
apiServerLoadBalancer:
{{- toYaml .Values.apiServerLoadBalancer | nindent 4 }}
{{- end }}
{{- if .Values.bastion.enabled }}
bastion:
{{- with .Values.bastion.spec }}
spec:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.externalNetwork }}
externalNetwork:
{{- toYaml .Values.externalNetwork | nindent 4 }}
{{- end }}
{{- if .Values.identityRef }}
identityRef:
name: {{ .Values.identityRef.name }}
cloudName: {{ .Values.identityRef.cloudName | default "openstack" }}
region: {{ .Values.identityRef.region | default "RegionOne" }}
{{- end }}
managedSecurityGroups:
{{- toYaml .Values.managedSecurityGroups | nindent 4 }}
{{- if .Values.managedSubnets }}
managedSubnets:
{{- toYaml .Values.managedSubnets | nindent 4 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
metadata:
name: {{ include "openstackmachinetemplate.controlplane.name" . }}
spec:
template:
spec:
flavor: {{ .Values.controlplane.flavor }}
identityRef:
name: {{ .Values.identityRef.name }}
region: {{ .Values.identityRef.region }}
cloudName: {{ .Values.identityRef.cloudName}}
image:
filter:
name: {{ .Values.controlplane.image.filter.name }}
{{- if .Values.controlplane.image.filter.tags }}
tags:
{{- range $tag := .Values.controlplane.image.filter.tags }}
- {{ $tag }}
{{- end }}
{{- end }}
{{- if gt (len .Values.controlplane.portOpts) 0 }}
a13x5 marked this conversation as resolved.
Show resolved Hide resolved
portOpts:
{{ .Values.controlplane.portOpts | toYaml | nindent 8 }}
{{- end }}
{{- if gt (len .Values.controlplane.securityGroups) 0 }}
securityGroups:
{{ .Values.controlplane.securityGroups | toYaml | nindent 8 }}
{{- end }}
{{- if not ( .Values.controlplane.sshPublicKey | empty) }}
sshKeyName: {{ .Values.controlplane.sshPublicKey }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
metadata:
name: {{ include "openstackmachinetemplate.worker.name" . }}
spec:
template:
spec:
flavor: {{ .Values.worker.flavor }}
identityRef:
name: {{ .Values.identityRef.name }}
region: {{ .Values.identityRef.region }}
cloudName: {{ .Values.identityRef.cloudName}}
image:
filter:
name: {{ .Values.worker.image.filter.name }}
{{- if .Values.worker.image.filter.tags }}
tags:
{{- range $tag := .Values.worker.image.filter.tags }}
- {{ $tag }}
{{- end }}
{{- end }}
{{- if gt (len .Values.worker.portOpts) 0 }}
portOpts:
{{ .Values.worker.portOpts | toYaml | nindent 8 }}
{{- end }}
{{- if gt (len .Values.worker.securityGroups) 0 }}
securityGroups:
{{ .Values.worker.securityGroups | toYaml | nindent 8 }}
{{- end }}
{{- if not ( .Values.worker.sshPublicKey | empty) }}
sshKeyName: {{ .Values.worker.sshPublicKey }}
{{- end }}
Loading
Loading