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

Create Openstack Cluster Stacks for Kubernetes v1.30 #71

Closed
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
9 changes: 8 additions & 1 deletion providers/openstack/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Quickstart

This quickstart guide contains steps to install the [Cluster Stack Operator][CSO] (CSO) utilizing the [Cluster Stack Provider OpenStack][CSPO] (CSPO) to provide [ClusterClasses][ClusterClass] which can be used with the [Kubernetes Cluster API][CAPI] to create Kubernetes Clusters.

This section guides you through all the necessary steps to create a workload Kubernetes cluster on top of the OpenStack infrastructure. The guide describes a path that utilizes the `clusterctl` CLI tool to manage the lifecycle of a CAPI management cluster and employs `kind` to create a local non-production managemnt cluster.

Note that it is a common practice to create a temporary, local [bootstrap cluster](https://cluster-api.sigs.k8s.io/reference/glossary#bootstrap-cluster) which is then used to provision a target [management cluster](https://cluster-api.sigs.k8s.io/reference/glossary#management-cluster) on the selected infrastructure.
Expand Down Expand Up @@ -226,4 +228,9 @@ kube-system openstack-cinder-csi-nodeplugin-crhc4 3/3 R
kube-system openstack-cinder-csi-nodeplugin-d7rzz 3/3 Running 0 7m58s
kube-system openstack-cinder-csi-nodeplugin-nkgq6 3/3 Running 0 6m44s
kube-system openstack-cloud-controller-manager-hp2n2 1/1 Running 0 7m9s
```
```

[CAPI]: https://cluster-api.sigs.k8s.io/
[CSO]: https://github.com/sovereignCloudStack/cluster-stack-operator/
[CSPO]: https://github.com/SovereignCloudStack/cluster-stacks/tree/main/providers/openstack
[ClusterClass]: https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20210526-cluster-class-and-managed-topologies.md
2 changes: 1 addition & 1 deletion providers/openstack/alpha/1-27/cluster-addon/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ dependencies:
version: 2.27.3
name: openstack-alpha-1-27-cluster-addon
type: application
version: << .ClusterAddonVersion >>
version: v1
2 changes: 1 addition & 1 deletion providers/openstack/alpha/1-27/cluster-class/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ description: |
* Openstack Alpha Cluster Class
name: openstack-alpha-1-27-cluster-class
type: application
version: << .ClusterClassVersion >>
version: v1
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ spec:
machineInfrastructure:
ref:
kind: OpenStackMachineTemplate
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
name: {{ .Release.Name }}-{{ .Chart.Version }}-control-plane
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
name: {{ .Release.Name }}-{{ .Chart.Version }}-cluster
workers:
Expand All @@ -29,7 +29,7 @@ spec:
name: {{ .Release.Name }}-{{ .Chart.Version }}
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
name: {{ .Release.Name }}-{{ .Chart.Version }}
variables:
Expand Down Expand Up @@ -164,7 +164,7 @@ spec:
enabledIf: {{ `'{{ ne .controller_flavor "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
Expand All @@ -178,7 +178,7 @@ spec:
enabledIf: {{ `'{{ ne .worker_flavor "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: false
Expand All @@ -195,7 +195,7 @@ spec:
enabledIf: {{ `"{{ if .controller_root_disk }}true{{end}}"` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
Expand All @@ -204,13 +204,13 @@ spec:
path: "/spec/template/spec/rootVolume"
valueFrom:
template: |
diskSize: {{"{{"}} .controller_root_disk {{"}}"}}
sizeGiB: {{"{{"}} .controller_root_disk {{"}}"}}
- name: worker_root_disk
description: "Sets the root disk size in GiB for worker nodes."
enabledIf: {{ `"{{ if .worker_root_disk }}true{{end}}"` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: false
Expand All @@ -222,55 +222,46 @@ spec:
path: "/spec/template/spec/rootVolume"
valueFrom:
template: |
diskSize: {{"{{"}} .worker_root_disk {{"}}"}}
sizeGiB: {{"{{"}} .worker_root_disk {{"}}"}}
- name: external_id
description: "Sets the ID of an external OpenStack Network. This is necessary to get public internet to the VMs."
enabledIf: {{ `'{{ ne .external_id "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: replace
path: "/spec/template/spec/externalNetworkId"
path: "/spec/template/spec/externalNetwork/id"
valueFrom:
variable: external_id
- name: node_cidr
description: "Sets the NodeCIDR for the OpenStack Subnet to be created. Cluster actuator will create a network, a subnet with NodeCIDR, and a router connected to this subnet."
- name: subnet
description: "Sets the NodeCIDR and optional nameservers for the OpenStack Subnet to be created. Cluster actuator will create a network, a subnet with NodeCIDR, and a router connected to this subnet."
enabledIf: {{ `'{{ ne .node_cidr "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: replace
path: "/spec/template/spec/nodeCidr"
path: "/spec/template/spec/managedSubnets"
valueFrom:
variable: node_cidr
- name: dns_nameservers
description: "Sets the list of nameservers for the OpenStack Subnet being created."
enabledIf: {{ `"{{ if .dns_nameservers }}true{{end}}"` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: replace
path: "/spec/template/spec/dnsNameservers"
valueFrom:
variable: dns_nameservers
template: |
- cidr: '{{"{{"}} .node_cidr {{"}}"}}'
dnsNameservers:
{{`{{- range .dns_nameservers }}`}}
- {{`{{ . }}`}}
{{`{{- end }}`}}
- name: openstack_security_groups
description: "Sets the list of the openstack security groups for the worker and the controlplane instances."
enabledIf: {{ `"{{ if .openstack_security_groups }}true{{end}}"` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
Expand All @@ -281,21 +272,21 @@ spec:
- op: add
path: "/spec/template/spec/securityGroups"
valueFrom:
template: {{ `"[ {{ range .openstack_security_groups }} { name: {{ . }}}, {{ end }} ]"` }}
template: {{ `"[ {{ range .openstack_security_groups }} { filter: { name: {{ . }}}}, {{ end }} ]"` }}
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: replace
path: "/spec/template/spec/allowAllInClusterTraffic"
path: "/spec/template/spec/managedSecurityGroups/allowAllInClusterTraffic"
value: false
- name: openstack_loadbalancer_apiserver
description: "Enables custom load balancer for OpenStack API server"
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
Expand All @@ -309,7 +300,7 @@ spec:
enabledIf: {{ `'{{ ne .openstack_loadbalancer_apiserver_provider "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
Expand All @@ -323,17 +314,17 @@ spec:
enabledIf: {{ `'{{ ne .cloud_name "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: replace
path: "/spec/template/spec/cloudName"
path: "/spec/template/spec/identityRef/cloudName"
valueFrom:
variable: cloud_name
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
Expand All @@ -342,15 +333,15 @@ spec:
- {{ .Release.Name }}-{{ .Chart.Version }}
jsonPatches:
- op: replace
path: "/spec/template/spec/cloudName"
path: "/spec/template/spec/identityRef/cloudName"
valueFrom:
variable: cloud_name
- name: secret_name
description: "Sets the name of the clouds secret."
enabledIf: {{ `'{{ ne .secret_name "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
Expand All @@ -360,7 +351,7 @@ spec:
valueFrom:
variable: secret_name
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
Expand All @@ -377,21 +368,22 @@ spec:
enabledIf: {{ `'{{ ne .controller_server_group_id "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
jsonPatches:
- op: add
path: "/spec/template/spec/serverGroupID"
path: "/spec/template/spec/serverGroup"
valueFrom:
variable: controller_server_group_id
template: |
id: {{"{{"}} .controller_server_group_id {{"}}"}}
- name: worker_server_group_id
description: "Sets the server group to assign the worker nodes to."
enabledIf: {{ `'{{ ne .worker_server_group_id "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: false
Expand All @@ -400,15 +392,16 @@ spec:
- {{ .Release.Name }}-{{ .Chart.Version }}
jsonPatches:
- op: add
path: "/spec/template/spec/serverGroupID"
path: "/spec/template/spec/serverGroup"
valueFrom:
variable: worker_server_group_id
template: |
id: {{"{{"}} .worker_server_group_id {{"}}"}}
- name: ssh_key
description: "Sets the ssh key to inject in the nodes."
enabledIf: {{ `'{{ ne .ssh_key "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
metadata:
name: {{ .Release.Name }}-{{ .Chart.Version }}-cluster
spec:
template:
spec:
allowAllInClusterTraffic: true
cloudName: {{ default "openstack" .Values.cloud.name }}
identityRef:
name: {{ default "openstack" .Values.secrets.clouds_yaml }}
kind: Secret
cloudName: {{ default "openstack" .Values.identityRef.cloudName }}
name: {{ default "openstack" .Values.identityRef.name }}
apiServerLoadBalancer:
enabled: {{ .Values.openstack_loadbalancer_apiserver }}
{{- if .Values.restrict_kubeapi }}
allowedCidrs: {{ .Values.restrict_kubeapi }}
allowedCIDRs: {{ .Values.restrict_kubeapi }}
{{- end }}
managedSecurityGroups: true
nodeCidr: {{ .Values.node_cidr }}
dnsNameservers:
{{- range .Values.dns_nameservers }}
- {{ . }}
{{- end }}
externalNetworkId: {{ .Values.external_id }}
managedSecurityGroups:
allowAllInClusterTraffic: true
managedSubnets:
- cidr: {{ .Values.node_cidr }}
dnsNameservers:
{{- range .Values.dns_nameservers }}
- {{ . }}
{{- end }}
externalNetwork:
id: {{ .Values.external_id }}
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
metadata:
name: {{ .Release.Name }}-{{ .Chart.Version }}-control-plane
spec:
template:
spec:
cloudName: {{ default "openstack" .Values.cloud.name }}
flavor: {{ .Values.controller_flavor }}
identityRef:
kind: Secret
name: {{ default "openstack" .Values.secrets.clouds_yaml }}
image: {{ .Values.images.controlPlane.name }}
cloudName: {{ default "openstack" .Values.identityRef.cloudName }}
name: {{ default "openstack" .Values.identityRef.name }}
image:
filter:
name: {{ .Values.images.controlPlane.name }}
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha7
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
metadata:
name: {{ .Release.Name }}-{{ .Chart.Version }}
spec:
template:
spec:
cloudName: {{ default "openstack" .Values.cloud.name }}
flavor: {{ .Values.worker_flavor }}
identityRef:
kind: Secret
name: {{ default "openstack" .Values.secrets.clouds_yaml }}
image: {{ .Values.images.worker.name }}
cloudName: {{ default "openstack" .Values.identityRef.cloudName }}
name: {{ default "openstack" .Values.identityRef.name }}
image:
filter:
name: {{ .Values.images.worker.name }}
12 changes: 5 additions & 7 deletions providers/openstack/alpha/1-27/cluster-class/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ openstack_loadbalancer_apiserver: true
# TBD, currently needed:
images:
controlPlane:
name: ubuntu-capi-image-v1.27.12
name: ubuntu-capi-image-v1.27.13
worker:
name: ubuntu-capi-image-v1.27.12

cloud:
name: "openstack"
secrets:
clouds_yaml: "openstack"
name: ubuntu-capi-image-v1.27.13
identityRef:
name: openstack
cloudName: openstack
Loading