external: add alias rbd pool name to support . pools name
if restricted permission was on the . was appended to k8s secret and
failed to create the secret so added a alias name is user wan't to suuport
pool with . in name
Signed-off-by: parth-gr <paarora@redhat.com>
(cherry picked from commit 6c3dabcf5f)
This commit is contained in:
1 parent
63418a0050
commit
44c44d637e
2 files changed
+39
-6
No files matched your search
@@ -39,6 +39,7 @@ python3 create-external-cluster-resources.py --rbd-data-pool-name <pool_name> --
|
||||
- `--namespace`: Namespace where CephCluster will run, for example `rook-ceph-external`
|
||||
- `--format bash`: The format of the output
|
||||
- `--rbd-data-pool-name`: The name of the RBD data pool
|
||||
- `--alias-rbd-data-pool-name`: Provides an alias for the RBD data pool name, necessary if a special character is present in the pool name such as a period or underscore
|
||||
- `--rgw-endpoint`: (optional) The RADOS Gateway endpoint in the format `<IP>:<PORT>`
|
||||
- `--rgw-pool-prefix`: (optional) The prefix of the RGW pools. If not specified, the default prefix is `default`
|
||||
- `--rgw-tls-cert-path`: (optional) RADOS Gateway endpoint TLS certificate file path
|
||||
|
||||
@@ -369,6 +369,12 @@ class RadosJSON:
|
||||
required=False,
|
||||
help="Provides the name of the RBD datapool",
|
||||
)
|
||||
output_group.add_argument(
|
||||
"--alias-rbd-data-pool-name",
|
||||
default="",
|
||||
required=False,
|
||||
help="Provides an alias for the RBD data pool name, necessary if a special character is present in the pool name such as a period or underscore",
|
||||
)
|
||||
output_group.add_argument(
|
||||
"--rgw-endpoint",
|
||||
default="",
|
||||
@@ -816,6 +822,30 @@ class RadosJSON:
|
||||
|
||||
return caps, entity
|
||||
|
||||
def get_entity(self, entity, rbd_pool_name, alias_rbd_pool_name, cluster_name):
|
||||
if (
|
||||
rbd_pool_name.count(".") != 0
|
||||
or rbd_pool_name.count("_") != 0
|
||||
or alias_rbd_pool_name != ""
|
||||
# checking alias_rbd_pool_name is not empty as there maybe a special character used other than . or _
|
||||
):
|
||||
if alias_rbd_pool_name == "":
|
||||
raise ExecutionFailureException(
|
||||
"please set the '--alias-rbd-data-pool-name' flag as the rbd data pool name contains '.' or '_'"
|
||||
)
|
||||
if (
|
||||
alias_rbd_pool_name.count(".") != 0
|
||||
or alias_rbd_pool_name.count("_") != 0
|
||||
):
|
||||
raise ExecutionFailureException(
|
||||
"'--alias-rbd-data-pool-name' flag value should not contain '.' or '_'"
|
||||
)
|
||||
entity = f"{entity}-{cluster_name}-{alias_rbd_pool_name}"
|
||||
else:
|
||||
entity = f"{entity}-{cluster_name}-{rbd_pool_name}"
|
||||
|
||||
return entity
|
||||
|
||||
def get_rbd_provisioner_caps_and_entity(self):
|
||||
entity = "client.csi-rbd-provisioner"
|
||||
caps = {
|
||||
@@ -825,12 +855,15 @@ class RadosJSON:
|
||||
}
|
||||
if self._arg_parser.restricted_auth_permission:
|
||||
rbd_pool_name = self._arg_parser.rbd_data_pool_name
|
||||
alias_rbd_pool_name = self._arg_parser.alias_rbd_data_pool_name
|
||||
cluster_name = self._arg_parser.cluster_name
|
||||
if rbd_pool_name == "" or cluster_name == "":
|
||||
raise ExecutionFailureException(
|
||||
"mandatory flags not found, please set the '--rbd-data-pool-name', '--cluster-name' flags"
|
||||
)
|
||||
entity = f"{entity}-{cluster_name}-{rbd_pool_name}"
|
||||
entity = self.get_entity(
|
||||
entity, rbd_pool_name, alias_rbd_pool_name, cluster_name
|
||||
)
|
||||
caps["osd"] = f"profile rbd pool={rbd_pool_name}"
|
||||
|
||||
return caps, entity
|
||||
@@ -843,12 +876,11 @@ class RadosJSON:
|
||||
}
|
||||
if self._arg_parser.restricted_auth_permission:
|
||||
rbd_pool_name = self._arg_parser.rbd_data_pool_name
|
||||
alias_rbd_pool_name = self._arg_parser.alias_rbd_data_pool_name
|
||||
cluster_name = self._arg_parser.cluster_name
|
||||
if rbd_pool_name == "" or cluster_name == "":
|
||||
raise ExecutionFailureException(
|
||||
"mandatory flags not found, please set the '--rbd-data-pool-name', '--cluster-name' flags"
|
||||
)
|
||||
entity = f"{entity}-{cluster_name}-{rbd_pool_name}"
|
||||
entity = self.get_entity(
|
||||
entity, rbd_pool_name, alias_rbd_pool_name, cluster_name
|
||||
)
|
||||
caps["osd"] = f"profile rbd pool={rbd_pool_name}"
|
||||
|
||||
return caps, entity
|
||||
|
||||
Reference in new issue
Block a user