[magnum-k8s] Add new config options

Add new config options to the charm so that
users can point to another capi helm repository.

Add config option api_resources to override versions or
names of the cluster api resources. The option
defaults to the ones used by canonical k8s capi
deployment.

Add config option allowed_network_drivers to specify the
CNI that are supported by the capi helm chart. Defaults
to the cilium driver that is supported by Canonical k8s

Change-Id: I6e498ef98391017b4d8175a6a044864dcbff6306
Signed-off-by: Hemanth Nakkina <hemanth.nakkina@canonical.com>
This commit is contained in:
Hemanth Nakkina
2025-08-28 08:48:17 +05:30
parent eb10ed4eda
commit 3d196750ba
2 changed files with 37 additions and 5 deletions

View File

@@ -37,6 +37,39 @@ config:
description: |
Kubeconfig to connect to Cluster API management cluster.
The value should be juju secret.
helm_chart_repo:
default: "''"
type: string
description: |
The helm chart repository path that hosts the capi helm chart.
In case of OCI registry, set the repo path to "''".
Setting the option to "" will leave the magnum-capi-helm
driver option empty and uses defaults from the driver.
helm_chart_name:
default: oci://ghcr.io/canonical/charts/openstack-ck8s-cluster
type: string
description: |
Name of the helm chart to use from the repo specified.
In case of OCI registry, set the registry path as helm_chart_name
capi_api_resources:
default: '{"K8sControlPlane": {"api_version": "controlplane.cluster.x-k8s.io/v1beta2", "plural_name": "ck8scontrolplanes"}, "OpenstackCluster": {"api_version": "infrastructure.cluster.x-k8s.io/v1beta1"}}'
type: string
description: |
Override api resources provided by magnum-capi-helm driver.
Value should be a dictionary in string format
Defaults to settings required to support canonical k8s
allowed_network_drivers:
default: cilium
type: string
description: |
Comma separated list of allowed CNI that can be deployed on
Workload clusters.
Supported drivers for canonical k8s are cilium
containers:
magnum-api:

View File

@@ -69,13 +69,12 @@ ca_file = /usr/local/share/ca-certificates/ca-bundle.pem
driver = log
[cluster_template]
kubernetes_allowed_network_drivers = cilium
kubernetes_allowed_network_drivers = {{ options.allowed_network_drivers }}
[capi_helm]
kubeconfig_file = /etc/magnum/kubeconfig
# Empty repo so that helm chart can be downloaded from OCI registry
helm_chart_repo = ""
helm_chart_name = oci://ghcr.io/canonical/charts/openstack-ck8s-cluster
helm_chart_repo = {{ options.helm_chart_repo }}
helm_chart_name = {{ options.helm_chart_name }}
default_helm_chart_version = 0.1.0
api_resources = {"K8sControlPlane": {"api_version": "controlplane.cluster.x-k8s.io/v1beta2", "plural_name": "ck8scontrolplanes"}, "OpenstackCluster": {"api_version": "infrastructure.cluster.x-k8s.io/v1beta1"}}
api_resources = {{ options.capi_api_resources }}
k8s_control_plane_resource_conditions = MachinesReady,Ready,ControlPlaneComponentsHealthy