Skip to content

Commit

Permalink
Add OpenStack provider support with configuration and templates
Browse files Browse the repository at this point in the history
Signed-off-by: Bharath Nallapeta <[email protected]>
  • Loading branch information
bnallapeta committed Dec 3, 2024
1 parent e38f582 commit 0493422
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ const (
// Provider CAPA
ProviderCAPAName = "cluster-api-provider-aws"
// Provider Azure
ProviderAzureName = "cluster-api-provider-azure"
ProviderAzureName = "cluster-api-provider-azure"
// Provider vSphere
ProviderVSphereName = "cluster-api-provider-vsphere"
// Provider OpenStack
ProviderOpenStackName = "cluster-api-provider-openstack"
// Provider K0smotron
ProviderK0smotronName = "k0smotron"
// Provider Sveltos
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/management_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func GetDefaultProviders() []Provider {
{Name: ProviderCAPAName},
{Name: ProviderAzureName},
{Name: ProviderVSphereName},
{Name: ProviderOpenStackName},
{Name: ProviderSveltosName},
}
}
Expand Down
23 changes: 23 additions & 0 deletions config/dev/openstack-managedcluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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
region: RegionOne
controlPlane:
flavor: m1.medium
image:
filter:
name: "ubuntu-2204-kube-v1.31.1"
worker:
flavor: m1.medium
image:
filter:
name: "ubuntu-2204-kube-v1.31.1"
authURL: ${OS_AUTH_URL}
23 changes: 23 additions & 0 deletions templates/provider/cluster-api-provider-openstack/.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/
24 changes: 24 additions & 0 deletions templates/provider/cluster-api-provider-openstack/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: cluster-api-provider-openstack
description: A Helm chart for Cluster API provider OpenStack
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
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: "v0.11.3"
annotations:
cluster.x-k8s.io/provider: infrastructure-openstack
cluster.x-k8s.io/v1beta1: v1beta1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: InfrastructureProvider
metadata:
name: openstack
spec:
version: v0.11.3
{{- if .Values.configSecret.name }}
configSecret:
name: {{ .Values.configSecret.name }}
namespace: {{ .Values.configSecret.namespace | default .Release.Namespace | trunc 63 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- if and .Values.configSecret.create .Values.configSecret.name }}
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.configSecret.name }}
namespace: {{ .Values.configSecret.namespace | default .Release.Namespace | trunc 63 }}
stringData:
{{ toYaml .Values.config | indent 2 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "Schema for configuration secret settings used in the OpenStack deployment.",
"type": "object",
"required": [
"configSecret"
],
"properties": {
"configSecret": {
"type": "object",
"description": "Settings for the OpenStack configuration secret.",
"required": [
"create",
"name"
],
"properties": {
"create": {
"type": "boolean",
"description": "Indicates whether a new secret should be created."
},
"name": {
"type": "string",
"description": "The name of the OpenStack configuration secret."
},
"namespace": {
"type": "string",
"description": "The namespace where the OpenStack configuration secret will be created or referenced."
}
}
},
"config": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
6 changes: 6 additions & 0 deletions templates/provider/cluster-api-provider-openstack/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
configSecret:
create: false
name: ""
namespace: ""

config: {}
2 changes: 2 additions & 0 deletions templates/provider/hmc-templates/files/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ spec:
template: cluster-api-provider-vsphere-0-0-3
- name: cluster-api-provider-aws
template: cluster-api-provider-aws-0-0-3
- name: cluster-api-provider-openstack
template: cluster-api-provider-openstack-0-0-1
- name: projectsveltos
template: projectsveltos-0-42-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ProviderTemplate
metadata:
name: cluster-api-provider-openstack-0-0-1
annotations:
helm.sh/resource-policy: keep
spec:
helm:
chartName: cluster-api-provider-openstack
chartVersion: 0.0.1

0 comments on commit 0493422

Please sign in to comment.