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 23, 2024
1 parent a198bc7 commit d20f702
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ const (
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 @@ -103,6 +103,7 @@ func GetDefaultProviders() []Provider {
{Name: ProviderAWSName},
{Name: ProviderAzureName},
{Name: ProviderVSphereName},
{Name: ProviderOpenStackName},
{Name: ProviderSveltosName},
}
}
Expand Down
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-4
- name: cluster-api-provider-aws
template: cluster-api-provider-aws-0-0-4
- name: cluster-api-provider-openstack
template: cluster-api-provider-openstack-0-0-1
- name: projectsveltos
template: projectsveltos-0-44-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ProviderTemplate
metadata:
name: cluster-api-provider-openstack-0-0-1
annotations:
helm.sh/resource-policy: keep
spec:
helm:
chartSpec:
chart: cluster-api-provider-openstack
version: 0.0.1
interval: 10m0s
sourceRef:
kind: HelmRepository
name: hmc-templates

0 comments on commit d20f702

Please sign in to comment.