| 1 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 2 |
# use this file except in compliance with the License. You may obtain a copy |
| 3 |
# of the License at |
| 4 |
# |
| 5 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 6 |
# |
| 7 |
# Unless required by applicable law or agreed to in writing, software |
| 8 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 9 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 |
# See the License for the specific language governing permissions and |
| 11 |
# limitations under the License. |
| 12 |
|
| 13 |
from oslo_config import cfg |
| 14 |
|
| 15 |
capi_helm_group = cfg.OptGroup( |
| 16 |
name="capi_helm", title="Helm Cluster API Driver configuration" |
| 17 |
) |
| 18 |
|
| 19 |
capi_helm_opts = [ |
| 20 |
cfg.StrOpt( |
| 21 |
"kubeconfig_file", |
| 22 |
default="", |
| 23 |
help=( |
| 24 |
"Path to a kubeconfig file for a management cluster," |
| 25 |
"for use in the Cluster API driver. " |
| 26 |
"Defaults to the environment variable KUBECONFIG, " |
| 27 |
"or if not defined ~/.kube/config" |
| 28 |
), |
| 29 |
), |
| 30 |
cfg.StrOpt( |
| 31 |
"namespace_prefix", |
| 32 |
default="magnum", |
| 33 |
help=( |
| 34 |
"Resources for each openstack cluster are created in a " |
| 35 |
"separate namespace within the CAPI Management cluster " |
| 36 |
"specified by the configuration: [capi_helm]/kubeconfig_file " |
| 37 |
"You should modify this prefix when two magnum deployments " |
| 38 |
"want to share a single CAPI management cluster." |
| 39 |
), |
| 40 |
), |
| 41 |
cfg.StrOpt( |
| 42 |
"helm_chart_repo", |
| 43 |
default="https://azimuth-cloud.github.io/capi-helm-charts", |
| 44 |
help=( |
| 45 |
"Reference to the helm chart repository for " |
| 46 |
"the cluster API driver. " |
| 47 |
"Note that if helm_chart_name starts with oci:// " |
| 48 |
"you will want this to set this to the empty string." |
| 49 |
), |
| 50 |
), |
| 51 |
cfg.StrOpt( |
| 52 |
"helm_chart_name", |
| 53 |
default="openstack-cluster", |
| 54 |
help=( |
| 55 |
"Name of the helm chart to use from the repo specified " |
| 56 |
"by the config: capi_driver.helm_chart_repo" |
| 57 |
), |
| 58 |
), |
| 59 |
cfg.StrOpt( |
| 60 |
"default_helm_chart_version", |
| 61 |
default="0.10.1", |
| 62 |
help=( |
| 63 |
"Version of the helm chart specified " |
| 64 |
"by the config: capi_driver.helm_chart_repo " |
| 65 |
"and capi_driver.helm_chart_name. " |
| 66 |
"A cluster label can override this." |
| 67 |
), |
| 68 |
), |
| 69 |
cfg.IntOpt( |
| 70 |
"minimum_flavor_ram", |
| 71 |
default=2048, |
| 72 |
help=("Minimum RAM for flavor used to " "create a Kubernetes node."), |
| 73 |
), |
| 74 |
cfg.IntOpt( |
| 75 |
"minimum_flavor_vcpus", |
| 76 |
default=2, |
| 77 |
help=("Minimum VCPUS for flavor used to " "create a Kubernetes node."), |
| 78 |
), |
| 79 |
cfg.StrOpt( |
| 80 |
"csi_cinder_default_volume_type", |
| 81 |
help=("Default StorageClass volume type for persistent volumes."), |
| 82 |
), |
| 83 |
cfg.StrOpt( |
| 84 |
"csi_cinder_reclaim_policy", |
| 85 |
default="Retain", |
| 86 |
help=( |
| 87 |
"Policy for reclaiming dynamically created " |
| 88 |
"persistent volumes. Can be 'Retain' or 'Delete'." |
| 89 |
), |
| 90 |
), |
| 91 |
cfg.BoolOpt( |
| 92 |
"csi_cinder_allow_volume_expansion", |
| 93 |
default=True, |
| 94 |
help=( |
| 95 |
"Allows the users to resize the volume by " |
| 96 |
"editing the corresponding PVC object." |
| 97 |
), |
| 98 |
), |
| 99 |
cfg.ListOpt( |
| 100 |
"csi_cinder_allowed_topologies", |
| 101 |
default=[], |
| 102 |
help=( |
| 103 |
"Select the Nodes where the application " |
| 104 |
"Pods may be scheduled based on Node labels." |
| 105 |
), |
| 106 |
), |
| 107 |
cfg.StrOpt( |
| 108 |
"csi_cinder_fstype", |
| 109 |
default="ext4", |
| 110 |
help=("Filesystem type for persistent volumes."), |
| 111 |
), |
| 112 |
cfg.StrOpt( |
| 113 |
"csi_cinder_volume_binding_mode", |
| 114 |
default="Immediate", |
| 115 |
help=( |
| 116 |
"The volumeBindingMode field controls when " |
| 117 |
"volume binding and dynamic provisioning should occur." |
| 118 |
), |
| 119 |
), |
| 120 |
cfg.StrOpt( |
| 121 |
"csi_cinder_availability_zone", |
| 122 |
default="nova", |
| 123 |
help=("The default availability zone to use for Cinder volumes."), |
| 124 |
), |
| 125 |
cfg.StrOpt( |
| 126 |
"app_cred_interface_type", |
| 127 |
default="public", |
| 128 |
help=( |
| 129 |
"The value to use in the interface field of " |
| 130 |
"generated application credentials." |
| 131 |
), |
| 132 |
), |
| 133 |
] |
| 134 |
|
| 135 |
CONF = cfg.CONF |
| 136 |
CONF.register_group(capi_helm_group) |
| 137 |
CONF.register_opts(capi_helm_opts, group=capi_helm_group) |