Files
John Garbutt d60ae3f89c Start using csi_cinder_volume_binding_mode config
By default, since release 0.8.0 of capi-helm, it has
been defaulting to WaitForFirstConsumer for additional
storage classes.
https://github.com/azimuth-cloud/capi-helm-charts/commit/854172966653138a60c329215fe9bb18726353e6

Note, if you are upgrading from an older version,
we hit some upgrade issues due to immutable storage
classes being unable to be updated.

As a work around, we are actully making use of the
existing config, to keep the behaviour the same as
the current release of the capi-helm-charts.
But those using older versions, before 0.8.0, may
need to change the configuration to match their existing
choices, ahead of their upgrade.

Change-Id: If90e0143f56ee378f5401b01623c159836fef29c
Signed-off-by: John Garbutt <john.garbutt@stackhpc.com>
2025-12-08 10:17:50 +00:00

173 lines
5.3 KiB
Python

# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo_config import cfg
capi_helm_group = cfg.OptGroup(
name="capi_helm", title="Helm Cluster API Driver configuration"
)
capi_helm_opts = [
cfg.StrOpt(
"kubeconfig_file",
default="",
help=(
"Path to a kubeconfig file for a management cluster,"
"for use in the Cluster API driver. "
"Defaults to the environment variable KUBECONFIG, "
"or if not defined ~/.kube/config"
),
),
cfg.StrOpt(
"namespace_prefix",
default="magnum",
help=(
"Resources for each openstack cluster are created in a "
"separate namespace within the CAPI Management cluster "
"specified by the configuration: [capi_helm]/kubeconfig_file "
"You should modify this prefix when two magnum deployments "
"want to share a single CAPI management cluster."
),
),
cfg.StrOpt(
"helm_chart_repo",
default="https://azimuth-cloud.github.io/capi-helm-charts",
help=(
"Reference to the helm chart repository for "
"the cluster API driver. "
"Note that if helm_chart_name starts with oci:// "
"you will want this to set this to the empty string."
),
),
cfg.StrOpt(
"helm_chart_name",
default="openstack-cluster",
help=(
"Name of the helm chart to use from the repo specified "
"by the config: capi_driver.helm_chart_repo"
),
),
cfg.StrOpt(
"default_helm_chart_version",
default="0.10.1",
help=(
"Version of the helm chart specified "
"by the config: capi_driver.helm_chart_repo "
"and capi_driver.helm_chart_name. "
"A cluster label can override this."
),
),
cfg.IntOpt(
"minimum_flavor_ram",
default=2048,
help=("Minimum RAM for flavor used to " "create a Kubernetes node."),
),
cfg.IntOpt(
"minimum_flavor_vcpus",
default=2,
help=("Minimum VCPUS for flavor used to " "create a Kubernetes node."),
),
cfg.StrOpt(
"csi_cinder_default_volume_type",
help=("Default StorageClass volume type for persistent volumes."),
),
cfg.StrOpt(
"csi_cinder_reclaim_policy",
default="Retain",
help=(
"Policy for reclaiming dynamically created "
"persistent volumes. Can be 'Retain' or 'Delete'."
),
),
cfg.BoolOpt(
"csi_cinder_allow_volume_expansion",
default=True,
help=(
"Allows the users to resize the volume by "
"editing the corresponding PVC object."
),
),
cfg.ListOpt(
"csi_cinder_allowed_topologies",
default=[],
help=(
"Select the Nodes where the application "
"Pods may be scheduled based on Node labels."
),
),
cfg.StrOpt(
"csi_cinder_fstype",
default="ext4",
help=("Filesystem type for persistent volumes."),
),
cfg.StrOpt(
"csi_cinder_volume_binding_mode",
default="WaitForFirstConsumer",
choices=["WaitForFirstConsumer", "Immediate"],
help=(
"The volumeBindingMode field controls when "
"volume binding and dynamic provisioning should occur."
),
),
cfg.StrOpt(
"csi_cinder_availability_zone",
default="nova",
help=("The default availability zone to use for Cinder volumes."),
),
cfg.StrOpt(
"app_cred_interface_type",
default="public",
help=(
"The value to use in the interface field of "
"generated application credentials."
),
),
cfg.StrOpt(
"api_resources",
default={},
help=(
"""
Dictionary of cluster api resources to modify
api_version and plural names in string format.
"Example:"
'{
"K8sControlPlane": {
"api_version": "controlplane.cluster.x-k8s.io/v1beta1",
"plural_name": "kubeadmcontrolplanes"
},
"OpenstackCluster": {
"api_version": "infrastructure.cluster.x-k8s.io/v1beta1",
},
}'
"""
),
),
cfg.ListOpt(
"k8s_control_plane_resource_conditions",
default=[
"MachinesReady",
"Ready",
"EtcdClusterHealthy",
"ControlPlaneComponentsHealthy",
],
help=(
"List of conditions to check for kubernetes control plane "
"resource to consider as ready."
),
),
]
CONF = cfg.CONF
CONF.register_group(capi_helm_group)
CONF.register_opts(capi_helm_opts, group=capi_helm_group)