diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/pybind/mgr/rook | |
parent | Initial commit. (diff) | |
download | ceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/pybind/mgr/rook')
59 files changed, 19623 insertions, 0 deletions
diff --git a/src/pybind/mgr/rook/.gitignore b/src/pybind/mgr/rook/.gitignore new file mode 100644 index 000000000..211c13153 --- /dev/null +++ b/src/pybind/mgr/rook/.gitignore @@ -0,0 +1 @@ +rook_client diff --git a/src/pybind/mgr/rook/CMakeLists.txt b/src/pybind/mgr/rook/CMakeLists.txt new file mode 100644 index 000000000..79e4e9a2e --- /dev/null +++ b/src/pybind/mgr/rook/CMakeLists.txt @@ -0,0 +1,20 @@ +include(ExternalProject) + +ExternalProject_Add(mgr-rook-client + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rook-client-python/rook_client" + # use INSTALL_DIR for destination dir + INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rook_client" + CONFIGURE_COMMAND "" + BUILD_COMMAND ${CMAKE_COMMAND} -E make_directory <INSTALL_DIR> + COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/ceph <INSTALL_DIR>/ceph + COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/__init__.py <INSTALL_DIR> + COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/_helper.py <INSTALL_DIR> + BUILD_BYPRODUCTS "<INSTALL_DIR>/__init__.py" + INSTALL_COMMAND "") + +add_dependencies(ceph-mgr mgr-rook-client) + +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DESTINATION ${CEPH_INSTALL_DATADIR}/mgr + ${mgr_module_install_excludes} + REGEX "rook-client-python.*" EXCLUDE) diff --git a/src/pybind/mgr/rook/__init__.py b/src/pybind/mgr/rook/__init__.py new file mode 100644 index 000000000..b16bddb73 --- /dev/null +++ b/src/pybind/mgr/rook/__init__.py @@ -0,0 +1,5 @@ +import os +if 'UNITTEST' in os.environ: + import tests + +from .module import RookOrchestrator diff --git a/src/pybind/mgr/rook/ci/Dockerfile b/src/pybind/mgr/rook/ci/Dockerfile new file mode 100644 index 000000000..30ebea574 --- /dev/null +++ b/src/pybind/mgr/rook/ci/Dockerfile @@ -0,0 +1,3 @@ +FROM quay.io/ceph/daemon-base:latest-main +COPY ./tmp_build/orchestrator /usr/share/ceph/mgr/orchestrator +COPY ./tmp_build/rook /usr/share/ceph/mgr/rook diff --git a/src/pybind/mgr/rook/ci/run-rook-e2e-tests.sh b/src/pybind/mgr/rook/ci/run-rook-e2e-tests.sh new file mode 100755 index 000000000..a43e01a89 --- /dev/null +++ b/src/pybind/mgr/rook/ci/run-rook-e2e-tests.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -ex + +# Execute tests +: ${CEPH_DEV_FOLDER:=${PWD}} +${CEPH_DEV_FOLDER}/src/pybind/mgr/rook/ci/scripts/bootstrap-rook-cluster.sh +cd ${CEPH_DEV_FOLDER}/src/pybind/mgr/rook/ci/tests +behave diff --git a/src/pybind/mgr/rook/ci/scripts/bootstrap-rook-cluster.sh b/src/pybind/mgr/rook/ci/scripts/bootstrap-rook-cluster.sh new file mode 100755 index 000000000..4b97df6ba --- /dev/null +++ b/src/pybind/mgr/rook/ci/scripts/bootstrap-rook-cluster.sh @@ -0,0 +1,135 @@ +#!/usr/bin/env bash + +set -eEx + +: ${CEPH_DEV_FOLDER:=${PWD}} +KUBECTL="minikube kubectl --" + +# We build a local ceph image that contains the latest code +# plus changes from the PR. This image will be used by the docker +# running inside the minikube to start the different ceph pods +LOCAL_CEPH_IMG="local/ceph" + +on_error() { + echo "on error" + minikube delete +} + +configure_libvirt(){ + sudo usermod -aG libvirt $(id -un) + sudo su -l $USER # Avoid having to log out and log in for group addition to take effect. + sudo systemctl enable --now libvirtd + sudo systemctl restart libvirtd + sleep 10 # wait some time for libvirtd service to restart +} + +setup_minikube_env() { + + # Check if Minikube is running + if minikube status > /dev/null 2>&1; then + echo "Minikube is running" + minikube stop + minikube delete + else + echo "Minikube is not running" + fi + + rm -rf ~/.minikube + minikube start --memory="4096" --cpus="2" --disk-size=10g --extra-disks=1 --driver kvm2 + # point Docker env to use docker daemon running on minikube + eval $(minikube docker-env -p minikube) +} + +build_ceph_image() { + wget -q -O cluster-test.yaml https://raw.githubusercontent.com/rook/rook/master/deploy/examples/cluster-test.yaml + CURR_CEPH_IMG=$(grep -E '^\s*image:\s+' cluster-test.yaml | sed 's/.*image: *\([^ ]*\)/\1/') + + cd ${CEPH_DEV_FOLDER}/src/pybind/mgr/rook/ci + mkdir -p tmp_build/rook + mkdir -p tmp_build/orchestrator + cp ./../../orchestrator/*.py tmp_build/orchestrator + cp ../*.py tmp_build/rook + + # we use the following tag to trick the Docker + # running inside minikube so it uses this image instead + # of pulling it from the registry + docker build --tag ${LOCAL_CEPH_IMG} . + docker tag ${LOCAL_CEPH_IMG} ${CURR_CEPH_IMG} + + # cleanup + rm -rf tmp_build + cd ${CEPH_DEV_FOLDER} +} + +create_rook_cluster() { + wget -q -O cluster-test.yaml https://raw.githubusercontent.com/rook/rook/master/deploy/examples/cluster-test.yaml + $KUBECTL create -f https://raw.githubusercontent.com/rook/rook/master/deploy/examples/crds.yaml + $KUBECTL create -f https://raw.githubusercontent.com/rook/rook/master/deploy/examples/common.yaml + $KUBECTL create -f https://raw.githubusercontent.com/rook/rook/master/deploy/examples/operator.yaml + $KUBECTL create -f cluster-test.yaml + $KUBECTL create -f https://raw.githubusercontent.com/rook/rook/master/deploy/examples/dashboard-external-http.yaml + $KUBECTL create -f https://raw.githubusercontent.com/rook/rook/master/deploy/examples/toolbox.yaml +} + +wait_for_rook_operator() { + local max_attempts=10 + local sleep_interval=20 + local attempts=0 + $KUBECTL rollout status deployment rook-ceph-operator -n rook-ceph --timeout=180s + PHASE=$($KUBECTL get cephclusters.ceph.rook.io -n rook-ceph -o jsonpath='{.items[?(@.kind == "CephCluster")].status.phase}') + echo "PHASE: $PHASE" + while ! $KUBECTL get cephclusters.ceph.rook.io -n rook-ceph -o jsonpath='{.items[?(@.kind == "CephCluster")].status.phase}' | grep -q "Ready"; do + echo "Waiting for cluster to be ready..." + sleep $sleep_interval + attempts=$((attempts+1)) + if [ $attempts -ge $max_attempts ]; then + echo "Maximum number of attempts ($max_attempts) reached. Exiting..." + return 1 + fi + done +} + +wait_for_ceph_cluster() { + local max_attempts=10 + local sleep_interval=20 + local attempts=0 + $KUBECTL rollout status deployment rook-ceph-tools -n rook-ceph --timeout=30s + while ! $KUBECTL get cephclusters.ceph.rook.io -n rook-ceph -o jsonpath='{.items[?(@.kind == "CephCluster")].status.ceph.health}' | grep -q "HEALTH_OK"; do + echo "Waiting for Ceph cluster installed" + sleep $sleep_interval + attempts=$((attempts+1)) + if [ $attempts -ge $max_attempts ]; then + echo "Maximum number of attempts ($max_attempts) reached. Exiting..." + return 1 + fi + done + echo "Ceph cluster installed and running" +} + +show_info() { + DASHBOARD_PASSWORD=$($KUBECTL -n rook-ceph get secret rook-ceph-dashboard-password -o jsonpath="{['data']['password']}" | base64 --decode && echo) + IP_ADDR=$($KUBECTL get po --selector="app=rook-ceph-mgr" -n rook-ceph --output jsonpath='{.items[*].status.hostIP}') + PORT="$($KUBECTL -n rook-ceph -o=jsonpath='{.spec.ports[?(@.name == "dashboard")].nodePort}' get services rook-ceph-mgr-dashboard-external-http)" + BASE_URL="http://$IP_ADDR:$PORT" + echo "===========================" + echo "Ceph Dashboard: " + echo " IP_ADDRESS: $BASE_URL" + echo " PASSWORD: $DASHBOARD_PASSWORD" + echo "===========================" +} + +#################################################################### +#################################################################### + +trap 'on_error $? $LINENO' ERR + +configure_libvirt +setup_minikube_env +build_ceph_image +create_rook_cluster +wait_for_rook_operator +wait_for_ceph_cluster +show_info + +#################################################################### +#################################################################### diff --git a/src/pybind/mgr/rook/ci/tests/features/rook.feature b/src/pybind/mgr/rook/ci/tests/features/rook.feature new file mode 100644 index 000000000..ae0478f8b --- /dev/null +++ b/src/pybind/mgr/rook/ci/tests/features/rook.feature @@ -0,0 +1,12 @@ +Feature: Testing Rook orchestrator commands + Ceph has been installed using the cluster CRD available in deploy/examples/cluster-test.yaml and + + Scenario: Verify ceph cluster health + When I run + """ + ceph health | grep HEALTH + """ + Then I get + """ + HEALTH_OK + """ diff --git a/src/pybind/mgr/rook/ci/tests/features/steps/implementation.py b/src/pybind/mgr/rook/ci/tests/features/steps/implementation.py new file mode 100644 index 000000000..adde61afd --- /dev/null +++ b/src/pybind/mgr/rook/ci/tests/features/steps/implementation.py @@ -0,0 +1,21 @@ +from behave import * +from utils import * +import re + +@when("I run") +def run_step(context): + context.output = run_commands(context.text) + +@then("I get") +def verify_result_step(context): + print(f"Output is:\n{context.output}\n--------------\n") + assert context.text == context.output + +@then("I get something like") +def verify_fuzzy_result_step(context): + output_lines = context.output.split("\n") + expected_lines = context.text.split("\n") + num_lines = min(len(output_lines), len(expected_lines)) + for n in range(num_lines): + if not re.match(expected_lines[n], output_lines[n]): + raise diff --git a/src/pybind/mgr/rook/ci/tests/features/steps/utils.py b/src/pybind/mgr/rook/ci/tests/features/steps/utils.py new file mode 100644 index 000000000..41a71d0fb --- /dev/null +++ b/src/pybind/mgr/rook/ci/tests/features/steps/utils.py @@ -0,0 +1,29 @@ +import subprocess + +ROOK_CEPH_COMMAND = "minikube kubectl -- -n rook-ceph exec -it deploy/rook-ceph-tools -- " +CLUSTER_COMMAND = "minikube kubectl -- " + + +def execute_command(command: str) -> str: + output = "" + try: + proc = subprocess.run(command, shell=True, capture_output=True, text=True) + output = proc.stdout + except Exception as ex: + output = f"Error executing command: {ex}" + + return output + + +def run_commands(commands: str) -> str: + commands_list = commands.split("\n") + output = "" + for cmd in commands_list: + if cmd.startswith("ceph"): + prefix = ROOK_CEPH_COMMAND + else: + prefix = CLUSTER_COMMAND + command = prefix + cmd + output = execute_command(command) + + return output.strip("\n") diff --git a/src/pybind/mgr/rook/generate_rook_ceph_client.sh b/src/pybind/mgr/rook/generate_rook_ceph_client.sh new file mode 100755 index 000000000..c9ad15ce0 --- /dev/null +++ b/src/pybind/mgr/rook/generate_rook_ceph_client.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +script_location="$(dirname "$(readlink -f "$0")")" +cd "$script_location" + +rm -rf rook_client + + +cp -r ./rook-client-python/rook_client . +rm -rf rook_client/cassandra +rm -rf rook_client/edgefs +rm -rf rook_client/tests diff --git a/src/pybind/mgr/rook/module.py b/src/pybind/mgr/rook/module.py new file mode 100644 index 000000000..fa75db2cf --- /dev/null +++ b/src/pybind/mgr/rook/module.py @@ -0,0 +1,727 @@ +import datetime +import logging +import re +import threading +import functools +import os +import json + +from ceph.deployment import inventory +from ceph.deployment.service_spec import ServiceSpec, NFSServiceSpec, RGWSpec, PlacementSpec +from ceph.utils import datetime_now + +from typing import List, Dict, Optional, Callable, Any, TypeVar, Tuple, TYPE_CHECKING + +try: + from ceph.deployment.drive_group import DriveGroupSpec +except ImportError: + pass # just for type checking + +try: + from kubernetes import client, config + from kubernetes.client.rest import ApiException + + kubernetes_imported = True + + # https://github.com/kubernetes-client/python/issues/895 + from kubernetes.client.models.v1_container_image import V1ContainerImage + def names(self: Any, names: Any) -> None: + self._names = names + V1ContainerImage.names = V1ContainerImage.names.setter(names) + +except ImportError: + kubernetes_imported = False + client = None + config = None + +from mgr_module import MgrModule, Option, NFS_POOL_NAME +import orchestrator +from orchestrator import handle_orch_error, OrchResult, raise_if_exception + +from .rook_cluster import RookCluster + +T = TypeVar('T') +FuncT = TypeVar('FuncT', bound=Callable) +ServiceSpecT = TypeVar('ServiceSpecT', bound=ServiceSpec) + + +class RookEnv(object): + def __init__(self) -> None: + # POD_NAMESPACE already exist for Rook 0.9 + self.namespace = os.environ.get('POD_NAMESPACE', 'rook-ceph') + + # ROOK_CEPH_CLUSTER_CRD_NAME is new is Rook 1.0 + self.cluster_name = os.environ.get('ROOK_CEPH_CLUSTER_CRD_NAME', self.namespace) + + self.operator_namespace = os.environ.get('ROOK_OPERATOR_NAMESPACE', self.namespace) + self.crd_version = os.environ.get('ROOK_CEPH_CLUSTER_CRD_VERSION', 'v1') + self.api_name = "ceph.rook.io/" + self.crd_version + + def api_version_match(self) -> bool: + return self.crd_version == 'v1' + + def has_namespace(self) -> bool: + return 'POD_NAMESPACE' in os.environ + + +class RookOrchestrator(MgrModule, orchestrator.Orchestrator): + """ + Writes are a two-phase thing, firstly sending + the write to the k8s API (fast) and then waiting + for the corresponding change to appear in the + Ceph cluster (slow) + + Right now, we are calling the k8s API synchronously. + """ + + MODULE_OPTIONS: List[Option] = [ + # TODO: configure k8s API addr instead of assuming local + Option( + 'storage_class', + type='str', + default='local', + desc='storage class name for LSO-discovered PVs', + ), + Option( + 'drive_group_interval', + type='float', + default=300.0, + desc='interval in seconds between re-application of applied drive_groups', + ), + ] + + @staticmethod + def can_run() -> Tuple[bool, str]: + if not kubernetes_imported: + return False, "`kubernetes` python module not found" + if not RookEnv().api_version_match(): + return False, "Rook version unsupported." + return True, '' + + def available(self) -> Tuple[bool, str, Dict[str, Any]]: + if not kubernetes_imported: + return False, "`kubernetes` python module not found", {} + elif not self._rook_env.has_namespace(): + return False, "ceph-mgr not running in Rook cluster", {} + + try: + self.k8s.list_namespaced_pod(self._rook_env.namespace) + except ApiException as e: + return False, "Cannot reach Kubernetes API: {}".format(e), {} + else: + return True, "", {} + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super(RookOrchestrator, self).__init__(*args, **kwargs) + + self._initialized = threading.Event() + self._k8s_CoreV1_api: Optional[client.CoreV1Api] = None + self._k8s_BatchV1_api: Optional[client.BatchV1Api] = None + self._k8s_CustomObjects_api: Optional[client.CustomObjectsApi] = None + self._k8s_StorageV1_api: Optional[client.StorageV1Api] = None + self._rook_cluster: Optional[RookCluster] = None + self._rook_env = RookEnv() + self._k8s_AppsV1_api: Optional[client.AppsV1Api] = None + + self.config_notify() + if TYPE_CHECKING: + self.storage_class = 'foo' + self.drive_group_interval = 10.0 + + self._load_drive_groups() + self._shutdown = threading.Event() + + def config_notify(self) -> None: + """ + This method is called whenever one of our config options is changed. + + TODO: this method should be moved into mgr_module.py + """ + for opt in self.MODULE_OPTIONS: + setattr(self, + opt['name'], # type: ignore + self.get_module_option(opt['name'])) # type: ignore + self.log.debug(' mgr option %s = %s', + opt['name'], getattr(self, opt['name'])) # type: ignore + assert isinstance(self.storage_class, str) + assert isinstance(self.drive_group_interval, float) + + if self._rook_cluster: + self._rook_cluster.storage_class_name = self.storage_class + + def shutdown(self) -> None: + self._shutdown.set() + + @property + def k8s(self): + # type: () -> client.CoreV1Api + self._initialized.wait() + assert self._k8s_CoreV1_api is not None + return self._k8s_CoreV1_api + + @property + def rook_cluster(self): + # type: () -> RookCluster + self._initialized.wait() + assert self._rook_cluster is not None + return self._rook_cluster + + def serve(self) -> None: + # For deployed clusters, we should always be running inside + # a Rook cluster. For development convenience, also support + # running outside (reading ~/.kube config) + + if self._rook_env.has_namespace(): + config.load_incluster_config() + else: + self.log.warning("DEVELOPMENT ONLY: Reading kube config from ~") + config.load_kube_config() + + # So that I can do port forwarding from my workstation - jcsp + from kubernetes.client import configuration + configuration.verify_ssl = False + + self._k8s_CoreV1_api = client.CoreV1Api() + self._k8s_BatchV1_api = client.BatchV1Api() + self._k8s_CustomObjects_api = client.CustomObjectsApi() + self._k8s_StorageV1_api = client.StorageV1Api() + self._k8s_AppsV1_api = client.AppsV1Api() + + try: + # XXX mystery hack -- I need to do an API call from + # this context, or subsequent API usage from handle_command + # fails with SSLError('bad handshake'). Suspect some kind of + # thread context setup in SSL lib? + self._k8s_CoreV1_api.list_namespaced_pod(self._rook_env.namespace) + except ApiException: + # Ignore here to make self.available() fail with a proper error message + pass + + assert isinstance(self.storage_class, str) + + self._rook_cluster = RookCluster( + self._k8s_CoreV1_api, + self._k8s_BatchV1_api, + self._k8s_CustomObjects_api, + self._k8s_StorageV1_api, + self._k8s_AppsV1_api, + self._rook_env, + self.storage_class) + + self._initialized.set() + self.config_notify() + + while not self._shutdown.is_set(): + self._apply_drivegroups(list(self._drive_group_map.values())) + self._shutdown.wait(self.drive_group_interval) + + @handle_orch_error + def get_inventory(self, host_filter: Optional[orchestrator.InventoryFilter] = None, refresh: bool = False) -> List[orchestrator.InventoryHost]: + host_list = None + if host_filter and host_filter.hosts: + # Explicit host list + host_list = host_filter.hosts + elif host_filter and host_filter.labels: + # TODO: query k8s API to resolve to host list, and pass + # it into RookCluster.get_discovered_devices + raise NotImplementedError() + + discovered_devs = self.rook_cluster.get_discovered_devices(host_list) + + result = [] + for host_name, host_devs in discovered_devs.items(): + devs = [] + for d in host_devs: + devs.append(d) + + result.append(orchestrator.InventoryHost(host_name, inventory.Devices(devs))) + + return result + + @handle_orch_error + def get_hosts(self): + # type: () -> List[orchestrator.HostSpec] + return self.rook_cluster.get_hosts() + + @handle_orch_error + def describe_service(self, + service_type: Optional[str] = None, + service_name: Optional[str] = None, + refresh: bool = False) -> List[orchestrator.ServiceDescription]: + now = datetime_now() + + # CephCluster + cl = self.rook_cluster.rook_api_get( + "cephclusters/{0}".format(self.rook_cluster.rook_env.cluster_name)) + self.log.debug('CephCluster %s' % cl) + image_name = cl['spec'].get('cephVersion', {}).get('image', None) + num_nodes = len(self.rook_cluster.get_node_names()) + + spec = {} + if service_type == 'mon' or service_type is None: + spec['mon'] = orchestrator.ServiceDescription( + spec=ServiceSpec( + 'mon', + placement=PlacementSpec( + count=cl['spec'].get('mon', {}).get('count', 1), + ), + ), + size=cl['spec'].get('mon', {}).get('count', 1), + container_image_name=image_name, + last_refresh=now, + ) + if service_type == 'mgr' or service_type is None: + spec['mgr'] = orchestrator.ServiceDescription( + spec=ServiceSpec( + 'mgr', + placement=PlacementSpec.from_string('count:1'), + ), + size=1, + container_image_name=image_name, + last_refresh=now, + ) + + if ( + service_type == 'crash' or service_type is None + and not cl['spec'].get('crashCollector', {}).get('disable', False) + ): + spec['crash'] = orchestrator.ServiceDescription( + spec=ServiceSpec( + 'crash', + placement=PlacementSpec.from_string('*'), + ), + size=num_nodes, + container_image_name=image_name, + last_refresh=now, + ) + + if service_type == 'mds' or service_type is None: + # CephFilesystems + all_fs = self.rook_cluster.get_resource("cephfilesystems") + for fs in all_fs: + svc = 'mds.' + fs['metadata']['name'] + if svc in spec: + continue + # FIXME: we are conflating active (+ standby) with count + active = fs['spec'].get('metadataServer', {}).get('activeCount', 1) + total_mds = active + if fs['spec'].get('metadataServer', {}).get('activeStandby', False): + total_mds = active * 2 + spec[svc] = orchestrator.ServiceDescription( + spec=ServiceSpec( + service_type='mds', + service_id=fs['metadata']['name'], + placement=PlacementSpec(count=active), + ), + size=total_mds, + container_image_name=image_name, + last_refresh=now, + ) + + if service_type == 'rgw' or service_type is None: + # CephObjectstores + all_zones = self.rook_cluster.get_resource("cephobjectstores") + for zone in all_zones: + svc = 'rgw.' + zone['metadata']['name'] + if svc in spec: + continue + active = zone['spec']['gateway']['instances']; + if 'securePort' in zone['spec']['gateway']: + ssl = True + port = zone['spec']['gateway']['securePort'] + else: + ssl = False + port = zone['spec']['gateway']['port'] or 80 + rgw_zone = zone['spec'].get('zone', {}).get('name') or None + spec[svc] = orchestrator.ServiceDescription( + spec=RGWSpec( + service_id=zone['metadata']['name'], + rgw_zone=rgw_zone, + ssl=ssl, + rgw_frontend_port=port, + placement=PlacementSpec(count=active), + ), + size=active, + container_image_name=image_name, + last_refresh=now, + ) + + if service_type == 'nfs' or service_type is None: + # CephNFSes + all_nfs = self.rook_cluster.get_resource("cephnfses") + nfs_pods = self.rook_cluster.describe_pods('nfs', None, None) + for nfs in all_nfs: + # Starting with V.17.2.0, the 'rados' spec part in 'cephnfs' resources does not contain the 'pool' item + if 'pool' in nfs['spec']['rados']: + if nfs['spec']['rados']['pool'] != NFS_POOL_NAME: + continue + nfs_name = nfs['metadata']['name'] + svc = 'nfs.' + nfs_name + if svc in spec: + continue + active = nfs['spec'].get('server', {}).get('active') + creation_timestamp = datetime.datetime.strptime(nfs['metadata']['creationTimestamp'], '%Y-%m-%dT%H:%M:%SZ') + spec[svc] = orchestrator.ServiceDescription( + spec=NFSServiceSpec( + service_id=nfs_name, + placement=PlacementSpec(count=active), + ), + size=active, + last_refresh=now, + running=len([1 for pod in nfs_pods if pod['labels']['ceph_nfs'] == nfs_name]), + created=creation_timestamp.astimezone(tz=datetime.timezone.utc) + ) + if service_type == 'osd' or service_type is None: + # OSDs + # FIXME: map running OSDs back to their respective services... + + # the catch-all unmanaged + all_osds = self.rook_cluster.get_osds() + svc = 'osd' + spec[svc] = orchestrator.ServiceDescription( + spec=DriveGroupSpec( + unmanaged=True, + service_type='osd', + ), + size=len(all_osds), + last_refresh=now, + running=sum(osd.status.phase == 'Running' for osd in all_osds) + ) + + # drivegroups + for name, dg in self._drive_group_map.items(): + spec[f'osd.{name}'] = orchestrator.ServiceDescription( + spec=dg, + last_refresh=now, + size=0, + running=0, + ) + + if service_type == 'rbd-mirror' or service_type is None: + # rbd-mirrors + all_mirrors = self.rook_cluster.get_resource("cephrbdmirrors") + for mirror in all_mirrors: + logging.warn(mirror) + mirror_name = mirror['metadata']['name'] + svc = 'rbd-mirror.' + mirror_name + if svc in spec: + continue + spec[svc] = orchestrator.ServiceDescription( + spec=ServiceSpec( + service_id=mirror_name, + service_type="rbd-mirror", + placement=PlacementSpec(count=1), + ), + size=1, + last_refresh=now, + ) + + for dd in self._list_daemons(): + if dd.service_name() not in spec: + continue + service = spec[dd.service_name()] + service.running += 1 + if not service.container_image_id: + service.container_image_id = dd.container_image_id + if not service.container_image_name: + service.container_image_name = dd.container_image_name + if service.last_refresh is None or not dd.last_refresh or dd.last_refresh < service.last_refresh: + service.last_refresh = dd.last_refresh + if service.created is None or dd.created is None or dd.created < service.created: + service.created = dd.created + + return [v for k, v in spec.items()] + + @handle_orch_error + def list_daemons(self, + service_name: Optional[str] = None, + daemon_type: Optional[str] = None, + daemon_id: Optional[str] = None, + host: Optional[str] = None, + refresh: bool = False) -> List[orchestrator.DaemonDescription]: + return self._list_daemons(service_name=service_name, + daemon_type=daemon_type, + daemon_id=daemon_id, + host=host, + refresh=refresh) + + def _list_daemons(self, + service_name: Optional[str] = None, + daemon_type: Optional[str] = None, + daemon_id: Optional[str] = None, + host: Optional[str] = None, + refresh: bool = False) -> List[orchestrator.DaemonDescription]: + pods = self.rook_cluster.describe_pods(daemon_type, daemon_id, host) + self.log.debug('pods %s' % pods) + result = [] + for p in pods: + sd = orchestrator.DaemonDescription() + sd.hostname = p['hostname'] + + # In Rook environments, the 'ceph-exporter' daemon is named 'exporter' whereas + # in the orchestrator interface, it is named 'ceph-exporter'. The purpose of the + # following adjustment is to ensure that the 'daemon_type' is correctly set. + # Without this adjustment, the 'service_to_daemon_types' lookup would fail, as + # it would be searching for a non-existent entry called 'exporter + if p['labels']['app'] == 'rook-ceph-exporter': + sd.daemon_type = 'ceph-exporter' + else: + sd.daemon_type = p['labels']['app'].replace('rook-ceph-', '') + + status = { + 'Pending': orchestrator.DaemonDescriptionStatus.starting, + 'Running': orchestrator.DaemonDescriptionStatus.running, + 'Succeeded': orchestrator.DaemonDescriptionStatus.stopped, + 'Failed': orchestrator.DaemonDescriptionStatus.error, + 'Unknown': orchestrator.DaemonDescriptionStatus.unknown, + }[p['phase']] + sd.status = status + + if 'ceph_daemon_id' in p['labels']: + sd.daemon_id = p['labels']['ceph_daemon_id'] + elif 'ceph-osd-id' in p['labels']: + sd.daemon_id = p['labels']['ceph-osd-id'] + else: + # Unknown type -- skip it + continue + + if service_name is not None and service_name != sd.service_name(): + continue + sd.container_image_name = p['container_image_name'] + sd.container_image_id = p['container_image_id'] + sd.created = p['created'] + sd.last_configured = p['created'] + sd.last_deployed = p['created'] + sd.started = p['started'] + sd.last_refresh = p['refreshed'] + result.append(sd) + + return result + + def _get_pool_params(self) -> Tuple[int, str]: + num_replicas = self.get_ceph_option('osd_pool_default_size') + assert type(num_replicas) is int + + leaf_type_id = self.get_ceph_option('osd_crush_chooseleaf_type') + assert type(leaf_type_id) is int + crush = self.get('osd_map_crush') + leaf_type = 'host' + for t in crush['types']: + if t['type_id'] == leaf_type_id: + leaf_type = t['name'] + break + return num_replicas, leaf_type + + @handle_orch_error + def remove_service(self, service_name: str, force: bool = False) -> str: + if service_name == 'rbd-mirror': + return self.rook_cluster.rm_service('cephrbdmirrors', 'default-rbd-mirror') + service_type, service_id = service_name.split('.', 1) + if service_type == 'mds': + return self.rook_cluster.rm_service('cephfilesystems', service_id) + elif service_type == 'rgw': + return self.rook_cluster.rm_service('cephobjectstores', service_id) + elif service_type == 'nfs': + ret, out, err = self.mon_command({ + 'prefix': 'auth ls' + }) + matches = re.findall(rf'client\.nfs-ganesha\.{service_id}\..*', out) + for match in matches: + self.check_mon_command({ + 'prefix': 'auth rm', + 'entity': match + }) + return self.rook_cluster.rm_service('cephnfses', service_id) + elif service_type == 'rbd-mirror': + return self.rook_cluster.rm_service('cephrbdmirrors', service_id) + elif service_type == 'osd': + if service_id in self._drive_group_map: + del self._drive_group_map[service_id] + self._save_drive_groups() + return f'Removed {service_name}' + elif service_type == 'ingress': + self.log.info("{0} service '{1}' does not exist".format('ingress', service_id)) + return 'The Rook orchestrator does not currently support ingress' + else: + raise orchestrator.OrchestratorError(f'Service type {service_type} not supported') + + def zap_device(self, host: str, path: str) -> OrchResult[str]: + try: + self.rook_cluster.create_zap_job(host, path) + except Exception as e: + logging.error(e) + return OrchResult(None, Exception("Unable to zap device: " + str(e.with_traceback(None)))) + return OrchResult(f'{path} on {host} zapped') + + @handle_orch_error + def apply_mon(self, spec): + # type: (ServiceSpec) -> str + if spec.placement.hosts or spec.placement.label: + raise RuntimeError("Host list or label is not supported by rook.") + + return self.rook_cluster.update_mon_count(spec.placement.count) + + def apply_rbd_mirror(self, spec: ServiceSpec) -> OrchResult[str]: + try: + self.rook_cluster.rbd_mirror(spec) + return OrchResult("Success") + except Exception as e: + return OrchResult(None, e) + + @handle_orch_error + def apply_mds(self, spec): + # type: (ServiceSpec) -> str + num_replicas, leaf_type = self._get_pool_params() + return self.rook_cluster.apply_filesystem(spec, num_replicas, leaf_type) + + @handle_orch_error + def apply_rgw(self, spec): + # type: (RGWSpec) -> str + num_replicas, leaf_type = self._get_pool_params() + return self.rook_cluster.apply_objectstore(spec, num_replicas, leaf_type) + + @handle_orch_error + def apply_nfs(self, spec): + # type: (NFSServiceSpec) -> str + try: + return self.rook_cluster.apply_nfsgw(spec, self) + except Exception as e: + logging.error(e) + return "Unable to create NFS daemon, check logs for more traceback\n" + str(e.with_traceback(None)) + + @handle_orch_error + def remove_daemons(self, names: List[str]) -> List[str]: + return self.rook_cluster.remove_pods(names) + + def apply_drivegroups(self, specs: List[DriveGroupSpec]) -> OrchResult[List[str]]: + for drive_group in specs: + self._drive_group_map[str(drive_group.service_id)] = drive_group + self._save_drive_groups() + return OrchResult(self._apply_drivegroups(specs)) + + def _apply_drivegroups(self, ls: List[DriveGroupSpec]) -> List[str]: + all_hosts = raise_if_exception(self.get_hosts()) + result_list: List[str] = [] + for drive_group in ls: + matching_hosts = drive_group.placement.filter_matching_hosts( + lambda label=None, as_hostspec=None: all_hosts + ) + + if not self.rook_cluster.node_exists(matching_hosts[0]): + raise RuntimeError("Node '{0}' is not in the Kubernetes " + "cluster".format(matching_hosts)) + + # Validate whether cluster CRD can accept individual OSD + # creations (i.e. not useAllDevices) + if not self.rook_cluster.can_create_osd(): + raise RuntimeError("Rook cluster configuration does not " + "support OSD creation.") + result_list.append(self.rook_cluster.add_osds(drive_group, matching_hosts)) + return result_list + + def _load_drive_groups(self) -> None: + stored_drive_group = self.get_store("drive_group_map") + self._drive_group_map: Dict[str, DriveGroupSpec] = {} + if stored_drive_group: + for name, dg in json.loads(stored_drive_group).items(): + try: + self._drive_group_map[name] = DriveGroupSpec.from_json(dg) + except ValueError as e: + self.log.error(f'Failed to load drive group {name} ({dg}): {e}') + + def _save_drive_groups(self) -> None: + json_drive_group_map = { + name: dg.to_json() for name, dg in self._drive_group_map.items() + } + self.set_store("drive_group_map", json.dumps(json_drive_group_map)) + + def remove_osds(self, + osd_ids: List[str], + replace: bool = False, + force: bool = False, + zap: bool = False, + no_destroy: bool = False) -> OrchResult[str]: + assert self._rook_cluster is not None + if zap: + raise RuntimeError("Rook does not support zapping devices during OSD removal.") + res = self._rook_cluster.remove_osds(osd_ids, replace, force, self.mon_command) + return OrchResult(res) + + def add_host_label(self, host: str, label: str) -> OrchResult[str]: + return self.rook_cluster.add_host_label(host, label) + + def remove_host_label(self, host: str, label: str, force: bool = False) -> OrchResult[str]: + return self.rook_cluster.remove_host_label(host, label) + """ + @handle_orch_error + def create_osds(self, drive_group): + # type: (DriveGroupSpec) -> str + # Creates OSDs from a drive group specification. + + # $: ceph orch osd create -i <dg.file> + + # The drivegroup file must only contain one spec at a time. + # + + targets = [] # type: List[str] + if drive_group.data_devices and drive_group.data_devices.paths: + targets += [d.path for d in drive_group.data_devices.paths] + if drive_group.data_directories: + targets += drive_group.data_directories + + all_hosts = raise_if_exception(self.get_hosts()) + + matching_hosts = drive_group.placement.filter_matching_hosts(lambda label=None, as_hostspec=None: all_hosts) + + assert len(matching_hosts) == 1 + + if not self.rook_cluster.node_exists(matching_hosts[0]): + raise RuntimeError("Node '{0}' is not in the Kubernetes " + "cluster".format(matching_hosts)) + + # Validate whether cluster CRD can accept individual OSD + # creations (i.e. not useAllDevices) + if not self.rook_cluster.can_create_osd(): + raise RuntimeError("Rook cluster configuration does not " + "support OSD creation.") + + return self.rook_cluster.add_osds(drive_group, matching_hosts) + + # TODO: this was the code to update the progress reference: + + @handle_orch_error + def has_osds(matching_hosts: List[str]) -> bool: + + # Find OSD pods on this host + pod_osd_ids = set() + pods = self.k8s.list_namespaced_pod(self._rook_env.namespace, + label_selector="rook_cluster={},app=rook-ceph-osd".format(self._rook_env.cluster_name), + field_selector="spec.nodeName={0}".format( + matching_hosts[0] + )).items + for p in pods: + pod_osd_ids.add(int(p.metadata.labels['ceph-osd-id'])) + + self.log.debug('pod_osd_ids={0}'.format(pod_osd_ids)) + + found = [] + osdmap = self.get("osd_map") + for osd in osdmap['osds']: + osd_id = osd['osd'] + if osd_id not in pod_osd_ids: + continue + + metadata = self.get_metadata('osd', "%s" % osd_id) + if metadata and metadata['devices'] in targets: + found.append(osd_id) + else: + self.log.info("ignoring osd {0} {1}".format( + osd_id, metadata['devices'] if metadata else 'DNE' + )) + + return found is not None + """ + + @handle_orch_error + def blink_device_light(self, ident_fault: str, on: bool, locs: List[orchestrator.DeviceLightLoc]) -> List[str]: + return self.rook_cluster.blink_light(ident_fault, on, locs) diff --git a/src/pybind/mgr/rook/requirements.txt b/src/pybind/mgr/rook/requirements.txt new file mode 100644 index 000000000..378de08e6 --- /dev/null +++ b/src/pybind/mgr/rook/requirements.txt @@ -0,0 +1,2 @@ +kubernetes +jsonpatch
\ No newline at end of file diff --git a/src/pybind/mgr/rook/rook-client-python/.github/workflows/generate.yml b/src/pybind/mgr/rook/rook-client-python/.github/workflows/generate.yml new file mode 100644 index 000000000..97ac5a222 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/.github/workflows/generate.yml @@ -0,0 +1,21 @@ +name: Python application + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: clone rook + run: | + git clone --depth 1 https://github.com/rook/rook.git + - name: Run generate.sh + run: | + ./generate.sh $PWD/rook diff --git a/src/pybind/mgr/rook/rook-client-python/.gitignore b/src/pybind/mgr/rook/rook-client-python/.gitignore new file mode 100644 index 000000000..b0eb1b49c --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/.gitignore @@ -0,0 +1,12 @@ +.coverage +.eggs/ +.idea/ +.mypy_cache/ +rook_client.egg-info/ +venv/ +downloads/ +__pycache__ +*.pyc +rook_client/tests/test_README.py +.tox +wheelhouse/ diff --git a/src/pybind/mgr/rook/rook-client-python/LICENSE b/src/pybind/mgr/rook/rook-client-python/LICENSE new file mode 100644 index 000000000..8e8487438 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2016 The Rook Authors. All rights reserved. + + 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. diff --git a/src/pybind/mgr/rook/rook-client-python/README.md b/src/pybind/mgr/rook/rook-client-python/README.md new file mode 100644 index 000000000..1ff4ba077 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/README.md @@ -0,0 +1,81 @@ +# `rook-client` Python API Classes + +The Rook CRDs are evolving over time and to verify that clients make use of the correct definitions, +this project provides generated API classes to let users write correct clients easily. + +Right now, it supports three operators: + +* Ceph +* Edgefs +* Cassandra + +It is used to type check client code against the Rook API using [mypy](mypy-lang.org). + +Inspired by [kubernetes-client/python](https://github.com/kubernetes-client/python/tree/master/kubernetes/client/models) + +Main uses case is the mgr/rook orchestrator module of the Ceph MGR + +## Code Generation + +This project contains a `generate_model_classes.py` which can generate +model classes from Kubernetes CRDs and is **independent** of Rook. + +Usage: + +``` +python generate_model_classes.py <crds.yaml> <output-folder> +``` + +## Installing `rook-client` + +To install `rook-client`, run: + +```bash +pip install -e 'git+https://github.com/ceph/rook-client-python#egg=rook-client' +``` + + +## Usage + +```python +def objectstore(api_name, name, namespace, instances): + from rook_client.ceph import cephobjectstore as cos + rook_os = cos.CephObjectStore( + apiVersion=api_name, + metadata=dict( + name=name, + namespace=namespace + ), + spec=cos.Spec( + metadataPool=cos.MetadataPool( + failureDomain='host', + replicated=cos.Replicated( + size=1 + ) + ), + dataPool=cos.DataPool( + failureDomain='osd', + replicated=cos.Replicated( + size=1 + ) + ), + gateway=cos.Gateway( + port=80, + instances=instances + ) + ) + ) + return rook_os.to_json() +``` + +## Demo + +![](rook-python-client-demo.gif) + +## Regenerate + +To re-generate the python files, run + +```bash +./generate.sh +``` diff --git a/src/pybind/mgr/rook/rook-client-python/conftest.py b/src/pybind/mgr/rook/rook-client-python/conftest.py new file mode 100644 index 000000000..77d6eb358 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/conftest.py @@ -0,0 +1,11 @@ +import pytest + +def pytest_addoption(parser): + parser.addoption( + "--crd_base", action="store", help="base path to the crd yamls" + ) + + +@pytest.fixture +def crd_base(request): + return request.config.getoption("--crd_base") diff --git a/src/pybind/mgr/rook/rook-client-python/generate.sh b/src/pybind/mgr/rook/rook-client-python/generate.sh new file mode 100755 index 000000000..f7de74aeb --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/generate.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +set -ex + +if [ -z "$1" ] ; then + rook_base="${GOPATH:-$HOME/go}/src/github.com/rook/rook" +else + rook_base="$1" +fi +crd_base="$rook_base/cluster/examples/kubernetes" + +cd "$(dirname "$0")" + +if ! [ -x "$(command -v python3)" ]; then + echo 'Error: python3 is not installed.' >&2 + exit 1 +fi + +if [ ! -d venv ] +then + python3 -m venv venv + . venv/bin/activate + pip install -r requirements.txt +else + . venv/bin/activate +fi + +python generate_model_classes.py "$crd_base/ceph/crds.yaml" "rook_client/ceph" +#python generate_model_classes.py "$crd_base/cassandra/operator.yaml" "rook_client/cassandra" + +python setup.py develop + +tox --skip-missing-interpreters=true -- --crd_base="$crd_base" + +deactivate diff --git a/src/pybind/mgr/rook/rook-client-python/generate_model_classes.py b/src/pybind/mgr/rook/rook-client-python/generate_model_classes.py new file mode 100644 index 000000000..110995bad --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/generate_model_classes.py @@ -0,0 +1,402 @@ +""" +Generate Python files containing data Python models classes for +all properties of the all CRDs in the file + +**Note**: generate_model_classes.py is independent of Rook or Ceph. It can be used for all + CRDs. + +For example: + python3 -m venv venv + pip install -r requirements.txt + python generate_model_classes.py <crds.yaml> <output-folder> + python setup.py develop + +Usage: + generate_model_classes.py <crds.yaml> <output-folder> +""" +import os +from abc import ABC, abstractmethod +from collections import OrderedDict +from typing import List, Union, Iterator, Optional, Dict, TypeVar, Callable +import copy + +import yaml +try: + from dataclasses import dataclass +except ImportError: + from attr import dataclass # type: ignore + +T = TypeVar('T') +K = TypeVar('K') + +header = '''""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +''' + +@dataclass # type: ignore +class CRDBase(ABC): + name: str + nullable: bool + required: bool + + @property + def py_name(self): + if self.name == 'exec': + return 'exec_1' + return self.name.replace('-', '_') + + @property + @abstractmethod + def py_type(self): + ... + + @property + def py_type_escaped(self): + return self.py_type + + + @abstractmethod + def flatten(self) -> Iterator[Union['CRDClass', 'CRDList', 'CRDAttribute']]: + ... + + @abstractmethod + def toplevel(self) -> str: + ... + + def py_property(self): + return f""" +@property +def {self.py_name}(self): + # type: () -> {self.py_property_return_type} + return self._property_impl('{self.py_name}') + +@{self.py_name}.setter +def {self.py_name}(self, new_val): + # type: ({self.py_param_type}) -> None + self._{self.py_name} = new_val + """.strip() + + @property + def py_param(self): + if not self.has_default: + return f'{self.py_name}, # type: {self.py_param_type}' + return f'{self.py_name}=_omit, # type: {self.py_param_type}' + + @property + def has_default(self): + return not self.required + + @property + def py_param_type(self): + return f'Optional[{self.py_type}]' if (self.nullable or not self.required) else self.py_type + + @property + def py_property_return_type(self): + return f'Optional[{self.py_type}]' if (self.nullable) else self.py_type + +@dataclass +class CRDAttribute(CRDBase): + type: str + default_value: str='_omit' + + @property + def py_param(self): + if not self.has_default: + return f'{self.py_name}, # type: {self.py_param_type}' + return f'{self.py_name}={self.default_value}, # type: {self.py_param_type}' + + @property + def has_default(self): + return not self.required or self.default_value != '_omit' + + @property + def py_type(self): + return { + 'integer': 'int', + 'boolean': 'bool', + 'string': 'str', + 'object': 'Any', + 'number': 'float', + 'x-kubernetes-int-or-string': 'Union[int, str]', + }[self.type] + + def flatten(self) -> Iterator[Union['CRDClass', 'CRDList', 'CRDAttribute']]: + yield from () + + def toplevel(self): + return '' + + def __hash__(self): + return hash(repr(self)) + + +@dataclass +class CRDList(CRDBase): + items: 'CRDClass' + + @property + def py_name(self): + return self.name + + @property + def py_type(self): + return self.name[0].upper() + self.name[1:] + 'List' + + @property + def py_type_escaped(self): + return f"'{self.py_type}'" + + @property + def py_param_type(self): + inner = f'Union[List[{self.items.py_type}], CrdObjectList]' + return f'Optional[{inner}]' if (self.nullable or not self.required) else inner + + @property + def py_property_return_type(self): + inner = f'Union[List[{self.items.py_type}], CrdObjectList]' + return f'Optional[{inner}]' if (self.nullable) else inner + + def flatten(self) -> Iterator[Union['CRDClass', 'CRDList', 'CRDAttribute']]: + yield from self.items.flatten() + yield self + + def toplevel(self): + py_type = self.items.py_type + if py_type == 'Any': + py_type = 'None' + + return f""" +class {self.py_type}(CrdObjectList): +{indent('_items_type = ' + py_type)} +""".strip() + + def __eq__(self, other): + if type(self) != type(other): + return False + return self.toplevel() == other.toplevel() + + def __hash__(self): + return hash(self.toplevel()) + + +@dataclass +class CRDClass(CRDBase): + attrs: List[Union[CRDAttribute, 'CRDClass']] + base_class: str = 'CrdObject' + + def toplevel(self) -> str: + ps = '\n\n'.join(a.py_property() for a in self.attrs) + return f"""class {self.py_type}({self.base_class}): +{indent(self.py_properties())} + +{indent(self.py_init())} + +{indent(ps)} +""".strip() + + @property + def sub_classes(self) -> List["CRDClass"]: + return [a for a in self.attrs if isinstance(a, CRDClass)] + + @property + def py_type(self): + return self.name[0].upper() + self.name[1:] + + @property + def py_type_escaped(self): + return f"'{self.py_type}'" + + + def py_properties(self): + def a_to_tuple(a): + return ', '.join((f"'{a.name}'", + f"'{a.py_name}'", + a.py_type_escaped.replace('Any', 'object'), + str(a.required), + str(a.nullable))) + + attrlist = ',\n'.join([f'({a_to_tuple(a)})' for a in self.attrs]) + return f"""_properties = [\n{indent(attrlist)}\n]""" + + def flatten(self) -> Iterator[Union['CRDClass', 'CRDList', 'CRDAttribute']]: + for sub_cls in self.attrs: + yield from sub_cls.flatten() + yield self + + def py_init(self): + sorted_attrs = sorted(self.attrs, key=lambda a: a.has_default) + params = '\n'.join(a.py_param for a in sorted_attrs) + params_set = '\n'.join(f'{a.py_name}={a.py_name},' for a in sorted_attrs) + return f""" +def __init__(self, +{indent(params, indent=4+9)} + ): + super({self.py_type}, self).__init__( +{indent(params_set, indent=8)} + ) +""".strip() + + def __eq__(self, other): + if type(self) != type(other): + return False + return self.toplevel() == other.toplevel() + + def __hash__(self): + return hash(self.toplevel()) + + +def indent(s, indent=4): + return '\n'.join(' '*indent + l for l in s.splitlines()) + + +def handle_property(elem_name, elem: dict, required: bool): + nullable = elem.get('nullable', False) + if 'properties' in elem: + ps = elem['properties'] + required_elems = elem.get('required', []) + sub_props = [handle_property(k, v, k in required_elems) for k, v in ps.items()] + return CRDClass(elem_name, nullable, required, sub_props) + elif 'items' in elem: + item = handle_property(elem_name + 'Item', elem['items'], False) + return CRDList(elem_name, nullable, required, item) + elif 'type' in elem: + return CRDAttribute(elem_name, nullable, required, elem['type']) + elif elem == {}: + return CRDAttribute(elem_name, nullable, required, 'object') + elif 'x-kubernetes-int-or-string' in elem: + return CRDAttribute(elem_name, nullable, required, 'x-kubernetes-int-or-string') + + assert False, str((elem_name, elem)) + +def spec_get_schema(c_dict: Dict) -> Dict: + try: + return c_dict['spec']['validation']['openAPIV3Schema'] + except (KeyError, TypeError): + pass + versions = c_dict['spec']['versions'] + if len(versions) != 1: + raise RuntimeError(f'todo: {[v["name"] for v in versions]}') + return c_dict['spec']['versions'][0]["schema"]['openAPIV3Schema'] + +def handle_crd(c_dict: dict) -> Optional[CRDClass]: + try: + name = c_dict['spec']['names']['kind'] + s = spec_get_schema(c_dict) + except (KeyError, TypeError): + return None + s['required'] = ['spec'] + c = handle_property(name, s, True) + if 'apiVersion' not in [a.name for a in c.attrs]: + c.attrs.append(CRDAttribute('apiVersion', False, True, 'string')) + if 'metadata' not in [a.name for a in c.attrs]: + c.attrs.append(CRDAttribute('metadata', False, True, 'object')) + if 'status' not in [a.name for a in c.attrs]: + c.attrs.append(CRDAttribute('status', False, False, 'object')) + return CRDClass(c.name, False, True, c.attrs, base_class='CrdClass') + + +def local(yaml_filename): + with open(yaml_filename) as f: + yamls = yaml.safe_load_all(f.read()) + for y in yamls: + try: + yield y + except AttributeError: + pass + + +def remove_duplicates_by(items: List[T], key: Callable[[T], K], unify: Callable[[T, T], T]) -> List[T]: + res: OrderedDict[K, T] = OrderedDict() + for i in items: + k = key(i) + if k in res: + res[k] = unify(res[k], i) + else: + res[k] = i + return list(res.values()) + + +def remove_duplicates(items: List[T]) -> List[T]: + return list(OrderedDict.fromkeys(items).keys()) + + +def unify_classes(left: CRDBase, right: CRDBase) -> CRDBase: + assert left.name == right.name + + if isinstance(left, CRDClass) and isinstance(right, CRDClass): + assert left.py_type == right.py_type + assert left.base_class == right.base_class + ret = CRDClass( + name=left.name, + nullable=left.nullable or right.nullable, + required=False, + attrs=remove_duplicates_by(right.attrs + left.attrs, lambda a: a.name, unify_classes), # type: ignore + base_class=left.base_class + ) + for a in ret.attrs: + # we have to set all required properties to False + a.required = False + return ret + + elif isinstance(left, CRDAttribute) and isinstance(right, CRDAttribute): + assert left.type == right.type + assert left.name == right.name + assert left.default_value == right.default_value + return CRDAttribute( + name=left.name, + nullable=left.nullable or right.nullable, + required=False, + type=left.type, + default_value=left.default_value + ) + elif type(left) != type(right): + # handwaving + return CRDAttribute( + name=left.name, + nullable=left.nullable or right.nullable, + required=False, + type='object' + ) + else: + assert left == right, (repr(left), repr(right)) + return left + + +def get_toplevels(crd: CRDBase) -> List[str]: + elems: List[CRDBase] = remove_duplicates(list(crd.flatten())) + res = remove_duplicates_by(elems, lambda c: c.py_type, unify_classes) + return [e.toplevel() for e in res] + + +def main(yaml_filename, outfolder): + for crd in local(yaml_filename): + valid_crd = handle_crd(crd) + if valid_crd is not None: + try: + os.mkdir(outfolder) + except FileExistsError: + pass + open(f'{outfolder}/__init__.py', 'w').close() + + with open(f'{outfolder}/{valid_crd.name.lower()}.py', 'w') as f: + f.write(header) + classes = get_toplevels(valid_crd) + f.write('\n\n\n'.join(classes)) + f.write('\n') + + +if __name__ == '__main__': + from docopt import docopt + args = docopt(__doc__) + yaml_filename = '/dev/stdin' if args["<crds.yaml>"] == '-' else args["<crds.yaml>"] + main(yaml_filename, args["<output-folder>"])
\ No newline at end of file diff --git a/src/pybind/mgr/rook/rook-client-python/mypy.ini b/src/pybind/mgr/rook/rook-client-python/mypy.ini new file mode 100644 index 000000000..cd26ff97e --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/mypy.ini @@ -0,0 +1,7 @@ +[mypy] +strict_optional = True +no_implicit_optional = True +ignore_missing_imports = True +warn_incomplete_stub = True +check_untyped_defs = True +show_error_context = True diff --git a/src/pybind/mgr/rook/rook-client-python/requirements.txt b/src/pybind/mgr/rook/rook-client-python/requirements.txt new file mode 100644 index 000000000..b94f3424c --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/requirements.txt @@ -0,0 +1,7 @@ +pytest +requests +pyyaml +markdown +-e git+https://github.com/ryneeverett/mkcodes.git@8b073b6ca0773008ca2a06ffd1c22b2c1fc1cce4#egg=mkcodes +docopt +tox diff --git a/src/pybind/mgr/rook/rook-client-python/rook-python-client-demo.gif b/src/pybind/mgr/rook/rook-client-python/rook-python-client-demo.gif Binary files differnew file mode 100644 index 000000000..0a9139a13 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook-python-client-demo.gif diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/__init__.py b/src/pybind/mgr/rook/rook-client-python/rook_client/__init__.py new file mode 100644 index 000000000..3fa2272dd --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/__init__.py @@ -0,0 +1 @@ +from ._helper import STRICT
\ No newline at end of file diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/_helper.py b/src/pybind/mgr/rook/rook-client-python/rook_client/_helper.py new file mode 100644 index 000000000..382d04c27 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/_helper.py @@ -0,0 +1,128 @@ +import logging +import sys +try: + from typing import List, Dict, Any, Optional +except ImportError: + pass + +logger = logging.getLogger(__name__) + +# Tricking mypy to think `_omit`'s type is NoneType +# To make us not add things like `Union[Optional[str], OmitType]` +NoneType = type(None) +_omit = None # type: NoneType +_omit = object() # type: ignore + + +# Don't add any additionalProperties to objects. Useful for completeness testing +STRICT = False + +def _str_to_class(cls, typ_str): + if isinstance(typ_str, str): + return getattr(sys.modules[cls.__module__], typ_str) + return typ_str + + +def _property_from_json(cls, data, breadcrumb, name, py_name, typ_str, required, nullable): + if not required and name not in data: + return _omit + try: + obj = data[name] + except KeyError as e: + raise ValueError('KeyError in {}: {}'.format(breadcrumb, e)) + if nullable and obj is None: + return obj + typ = _str_to_class(cls, typ_str) + if issubclass(typ, CrdObject) or issubclass(typ, CrdObjectList): + return typ.from_json(obj, breadcrumb + '.' + name) + return obj + + +class CrdObject(object): + _properties = [] # type: List + + def __init__(self, **kwargs): + for prop in self._properties: + setattr(self, prop[1], kwargs.pop(prop[1])) + if kwargs: + raise TypeError( + '{} got unexpected arguments {}'.format(self.__class__.__name__, kwargs.keys())) + self._additionalProperties = {} # type: Dict[str, Any] + + def _property_impl(self, name): + obj = getattr(self, '_' + name) + if obj is _omit: + raise AttributeError(name + ' not found') + return obj + + def _property_to_json(self, name, py_name, typ_str, required, nullable): + obj = getattr(self, '_' + py_name) + typ = _str_to_class(self.__class__, typ_str) + if issubclass(typ, CrdObject) or issubclass(typ, CrdObjectList): + if nullable and obj is None: + return obj + if not required and obj is _omit: + return obj + return obj.to_json() + else: + return obj + + def to_json(self): + # type: () -> Dict[str, Any] + res = {p[0]: self._property_to_json(*p) for p in self._properties} + res.update(self._additionalProperties) + return {k: v for k, v in res.items() if v is not _omit} + + @classmethod + def from_json(cls, data, breadcrumb=''): + try: + sanitized = { + p[1]: _property_from_json(cls, data, breadcrumb, *p) for p in cls._properties + } + extra = {k:v for k,v in data.items() if k not in sanitized} + ret = cls(**sanitized) + ret._additionalProperties = {} if STRICT else extra + return ret + except (TypeError, AttributeError, KeyError): + logger.exception(breadcrumb) + raise + + +class CrdClass(CrdObject): + @classmethod + def from_json(cls, data, breadcrumb=''): + kind = data['kind'] + if kind != cls.__name__: + raise ValueError("kind mismatch: {} != {}".format(kind, cls.__name__)) + return super(CrdClass, cls).from_json(data, breadcrumb) + + def to_json(self): + ret = super(CrdClass, self).to_json() + ret['kind'] = self.__class__.__name__ + return ret + + +class CrdObjectList(list): + # Py3: Replace `Any` with `TypeVar('T_CrdObject', bound='CrdObject')` + _items_type = None # type: Optional[Any] + + def to_json(self): + # type: () -> List + if self._items_type is None: + return self + if issubclass(self._items_type, CrdObject) or issubclass(self._items_type, CrdObjectList): + return [e.to_json() for e in self] + return list(self) + + + @classmethod + def from_json(cls, data, breadcrumb=''): + if cls._items_type is None: + return cls(data) + if issubclass(cls._items_type, CrdObject) or issubclass(cls._items_type, CrdObjectList): + return cls(cls._items_type.from_json(e, breadcrumb + '[{}]'.format(i)) for i, e in enumerate(data)) + return cls(data) + + def __repr__(self): + return '{}({})'.format(self.__class__.__name__, repr(list(self))) + diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/_helper.py.orig b/src/pybind/mgr/rook/rook-client-python/rook_client/_helper.py.orig new file mode 100644 index 000000000..73ea7370f --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/_helper.py.orig @@ -0,0 +1,133 @@ +import logging +import sys +try: + from typing import List, Dict, Any, Optional +except ImportError: + pass + +logger = logging.getLogger(__name__) + +# Tricking mypy to think `_omit`'s type is NoneType +# To make us not add things like `Union[Optional[str], OmitType]` +NoneType = type(None) +_omit = None # type: NoneType +_omit = object() # type: ignore + + +# Don't add any additionalProperties to objects. Useful for completeness testing +STRICT = False + +def _str_to_class(cls, typ_str): + if isinstance(typ_str, str): + return getattr(sys.modules[cls.__module__], typ_str) + return typ_str + + +def _property_from_json(cls, data, breadcrumb, name, py_name, typ_str, required, nullable): + if not required and name not in data: + return _omit + try: + obj = data[name] + except KeyError as e: + raise ValueError('KeyError in {}: {}'.format(breadcrumb, e)) + if nullable and obj is None: + return obj + typ = _str_to_class(cls, typ_str) + if issubclass(typ, CrdObject) or issubclass(typ, CrdObjectList): + return typ.from_json(obj, breadcrumb + '.' + name) + return obj + + +class CrdObject(object): + _properties = [] # type: List + + def __init__(self, **kwargs): + for prop in self._properties: + setattr(self, prop[1], kwargs.pop(prop[1])) + if kwargs: + raise TypeError( + '{} got unexpected arguments {}'.format(self.__class__.__name__, kwargs.keys())) + self._additionalProperties = {} # type: Dict[str, Any] + + def _property_impl(self, name): + obj = getattr(self, '_' + name) + if obj is _omit: + raise AttributeError(name + ' not found') + return obj + + def _property_to_json(self, name, py_name, typ_str, required, nullable): + obj = getattr(self, '_' + py_name) + typ = _str_to_class(self.__class__, typ_str) + if issubclass(typ, CrdObject) or issubclass(typ, CrdObjectList): + if nullable and obj is None: + return obj + if not required and obj is _omit: + return obj + return obj.to_json() + else: + return obj + + def to_json(self): + # type: () -> Dict[str, Any] + res = {p[0]: self._property_to_json(*p) for p in self._properties} + res.update(self._additionalProperties) + return {k: v for k, v in res.items() if v is not _omit} + + @classmethod + def from_json(cls, data, breadcrumb=''): + try: + sanitized = { + p[1]: _property_from_json(cls, data, breadcrumb, *p) for p in cls._properties + } + extra = {k:v for k,v in data.items() if k not in sanitized} + ret = cls(**sanitized) + ret._additionalProperties = {} if STRICT else extra + return ret + except (TypeError, AttributeError, KeyError): + logger.exception(breadcrumb) + raise + + +class CrdClass(CrdObject): + @classmethod + def from_json(cls, data, breadcrumb=''): + kind = data['kind'] + if kind != cls.__name__: + raise ValueError("kind mismatch: {} != {}".format(kind, cls.__name__)) + return super(CrdClass, cls).from_json(data, breadcrumb) + + def to_json(self): + ret = super(CrdClass, self).to_json() + ret['kind'] = self.__class__.__name__ + return ret + + +class CrdObjectList(list): + # Py3: Replace `Any` with `TypeVar('T_CrdObject', bound='CrdObject')` + _items_type = None # type: Optional[Any] + + def to_json(self): + # type: () -> List + if self._items_type is None: + return self + if issubclass(self._items_type, CrdObject) or issubclass(self._items_type, CrdObjectList): + return [e.to_json() for e in self] + return list(self) + + + @classmethod + def from_json(cls, data, breadcrumb=''): + if cls._items_type is None: + return cls(data) + if issubclass(cls._items_type, CrdObject) or issubclass(cls._items_type, CrdObjectList): +<<<<<<< HEAD + return cls(cls._items_type.from_json(e, breadcrumb + '[]') for e in data) + return cls(data) + + def __repr__(self): + return '{}({})'.format(self.__class__.__name__, repr(list(self))) +======= + return cls(cls._items_type.from_json(e, breadcrumb + '[{}]'.format(i)) for i, e in enumerate(data)) + return data +>>>>>>> 2e4a0b5 (Better ex message for missing required elements) + diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/cassandra/__init__.py b/src/pybind/mgr/rook/rook-client-python/rook_client/cassandra/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/cassandra/__init__.py diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/cassandra/cluster.py b/src/pybind/mgr/rook/rook-client-python/rook_client/cassandra/cluster.py new file mode 100644 index 000000000..4fa3afc61 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/cassandra/cluster.py @@ -0,0 +1,317 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class Storage(CrdObject): + _properties = [ + ('volumeClaimTemplates', 'volumeClaimTemplates', object, True, False) + ] + + def __init__(self, + volumeClaimTemplates, # type: Any + ): + super(Storage, self).__init__( + volumeClaimTemplates=volumeClaimTemplates, + ) + + @property + def volumeClaimTemplates(self): + # type: () -> Any + return self._property_impl('volumeClaimTemplates') + + @volumeClaimTemplates.setter + def volumeClaimTemplates(self, new_val): + # type: (Any) -> None + self._volumeClaimTemplates = new_val + + +class Resources(CrdObject): + _properties = [ + ('cassandra', 'cassandra', object, True, False), + ('sidecar', 'sidecar', object, True, False) + ] + + def __init__(self, + cassandra, # type: Any + sidecar, # type: Any + ): + super(Resources, self).__init__( + cassandra=cassandra, + sidecar=sidecar, + ) + + @property + def cassandra(self): + # type: () -> Any + return self._property_impl('cassandra') + + @cassandra.setter + def cassandra(self, new_val): + # type: (Any) -> None + self._cassandra = new_val + + @property + def sidecar(self): + # type: () -> Any + return self._property_impl('sidecar') + + @sidecar.setter + def sidecar(self, new_val): + # type: (Any) -> None + self._sidecar = new_val + + +class Racks(CrdObject): + _properties = [ + ('name', 'name', str, True, False), + ('members', 'members', int, True, False), + ('configMapName', 'configMapName', str, False, False), + ('jmxExporterConfigMapName', 'jmxExporterConfigMapName', str, False, False), + ('storage', 'storage', Storage, True, False), + ('placement', 'placement', object, False, False), + ('resources', 'resources', Resources, True, False), + ('sidecarImage', 'sidecarImage', object, False, False) + ] + + def __init__(self, + name, # type: str + members, # type: int + storage, # type: Storage + resources, # type: Resources + configMapName=_omit, # type: Optional[str] + jmxExporterConfigMapName=_omit, # type: Optional[str] + placement=_omit, # type: Optional[Any] + sidecarImage=_omit, # type: Optional[Any] + ): + super(Racks, self).__init__( + name=name, + members=members, + storage=storage, + resources=resources, + configMapName=configMapName, + jmxExporterConfigMapName=jmxExporterConfigMapName, + placement=placement, + sidecarImage=sidecarImage, + ) + + @property + def name(self): + # type: () -> str + return self._property_impl('name') + + @name.setter + def name(self, new_val): + # type: (str) -> None + self._name = new_val + + @property + def members(self): + # type: () -> int + return self._property_impl('members') + + @members.setter + def members(self, new_val): + # type: (int) -> None + self._members = new_val + + @property + def configMapName(self): + # type: () -> str + return self._property_impl('configMapName') + + @configMapName.setter + def configMapName(self, new_val): + # type: (Optional[str]) -> None + self._configMapName = new_val + + @property + def jmxExporterConfigMapName(self): + # type: () -> str + return self._property_impl('jmxExporterConfigMapName') + + @jmxExporterConfigMapName.setter + def jmxExporterConfigMapName(self, new_val): + # type: (Optional[str]) -> None + self._jmxExporterConfigMapName = new_val + + @property + def storage(self): + # type: () -> Storage + return self._property_impl('storage') + + @storage.setter + def storage(self, new_val): + # type: (Storage) -> None + self._storage = new_val + + @property + def placement(self): + # type: () -> Any + return self._property_impl('placement') + + @placement.setter + def placement(self, new_val): + # type: (Optional[Any]) -> None + self._placement = new_val + + @property + def resources(self): + # type: () -> Resources + return self._property_impl('resources') + + @resources.setter + def resources(self, new_val): + # type: (Resources) -> None + self._resources = new_val + + @property + def sidecarImage(self): + # type: () -> Any + return self._property_impl('sidecarImage') + + @sidecarImage.setter + def sidecarImage(self, new_val): + # type: (Optional[Any]) -> None + self._sidecarImage = new_val + + +class Datacenter(CrdObject): + _properties = [ + ('name', 'name', str, True, False), + ('racks', 'racks', Racks, False, False) + ] + + def __init__(self, + name, # type: str + racks=_omit, # type: Optional[Racks] + ): + super(Datacenter, self).__init__( + name=name, + racks=racks, + ) + + @property + def name(self): + # type: () -> str + return self._property_impl('name') + + @name.setter + def name(self, new_val): + # type: (str) -> None + self._name = new_val + + @property + def racks(self): + # type: () -> Racks + return self._property_impl('racks') + + @racks.setter + def racks(self, new_val): + # type: (Optional[Racks]) -> None + self._racks = new_val + + +class Spec(CrdObject): + _properties = [ + ('version', 'version', str, True, False), + ('datacenter', 'datacenter', Datacenter, True, False) + ] + + def __init__(self, + version, # type: str + datacenter, # type: Datacenter + ): + super(Spec, self).__init__( + version=version, + datacenter=datacenter, + ) + + @property + def version(self): + # type: () -> str + return self._property_impl('version') + + @version.setter + def version(self, new_val): + # type: (str) -> None + self._version = new_val + + @property + def datacenter(self): + # type: () -> Datacenter + return self._property_impl('datacenter') + + @datacenter.setter + def datacenter(self, new_val): + # type: (Datacenter) -> None + self._datacenter = new_val + + +class Cluster(CrdClass): + _properties = [ + ('apiVersion', 'apiVersion', str, True, False), + ('metadata', 'metadata', object, True, False), + ('status', 'status', object, False, False), + ('spec', 'spec', Spec, True, False) + ] + + def __init__(self, + apiVersion, # type: str + metadata, # type: Any + spec, # type: Spec + status=_omit, # type: Optional[Any] + ): + super(Cluster, self).__init__( + apiVersion=apiVersion, + metadata=metadata, + spec=spec, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (str) -> None + self._apiVersion = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Any) -> None + self._metadata = new_val + + @property + def status(self): + # type: () -> Any + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Any]) -> None + self._status = new_val + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Spec) -> None + self._spec = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/__init__.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/__init__.py diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephblockpool.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephblockpool.py new file mode 100644 index 000000000..34e953eac --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephblockpool.py @@ -0,0 +1,1193 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class ErasureCoded(CrdObject): + _properties = [ + ('algorithm', 'algorithm', str, False, False), + ('codingChunks', 'codingChunks', int, True, False), + ('dataChunks', 'dataChunks', int, True, False) + ] + + def __init__(self, + codingChunks, # type: int + dataChunks, # type: int + algorithm=_omit, # type: Optional[str] + ): + super(ErasureCoded, self).__init__( + codingChunks=codingChunks, + dataChunks=dataChunks, + algorithm=algorithm, + ) + + @property + def algorithm(self): + # type: () -> str + return self._property_impl('algorithm') + + @algorithm.setter + def algorithm(self, new_val): + # type: (Optional[str]) -> None + self._algorithm = new_val + + @property + def codingChunks(self): + # type: () -> int + return self._property_impl('codingChunks') + + @codingChunks.setter + def codingChunks(self, new_val): + # type: (int) -> None + self._codingChunks = new_val + + @property + def dataChunks(self): + # type: () -> int + return self._property_impl('dataChunks') + + @dataChunks.setter + def dataChunks(self, new_val): + # type: (int) -> None + self._dataChunks = new_val + + +class SnapshotSchedulesItem(CrdObject): + _properties = [ + ('image', 'image', str, False, False), + ('items', 'items', 'ItemsList', False, False), + ('namespace', 'namespace', str, False, False), + ('pool', 'pool', str, False, False), + ('interval', 'interval', str, False, False), + ('startTime', 'startTime', str, False, False) + ] + + def __init__(self, + image=_omit, # type: Optional[str] + items=_omit, # type: Optional[Union[List[ItemsItem], CrdObjectList]] + namespace=_omit, # type: Optional[str] + pool=_omit, # type: Optional[str] + interval=_omit, # type: Optional[str] + startTime=_omit, # type: Optional[str] + ): + super(SnapshotSchedulesItem, self).__init__( + image=image, + items=items, + namespace=namespace, + pool=pool, + interval=interval, + startTime=startTime, + ) + + @property + def image(self): + # type: () -> str + return self._property_impl('image') + + @image.setter + def image(self, new_val): + # type: (Optional[str]) -> None + self._image = new_val + + @property + def items(self): + # type: () -> Union[List[ItemsItem], CrdObjectList] + return self._property_impl('items') + + @items.setter + def items(self, new_val): + # type: (Optional[Union[List[ItemsItem], CrdObjectList]]) -> None + self._items = new_val + + @property + def namespace(self): + # type: () -> str + return self._property_impl('namespace') + + @namespace.setter + def namespace(self, new_val): + # type: (Optional[str]) -> None + self._namespace = new_val + + @property + def pool(self): + # type: () -> str + return self._property_impl('pool') + + @pool.setter + def pool(self, new_val): + # type: (Optional[str]) -> None + self._pool = new_val + + @property + def interval(self): + # type: () -> str + return self._property_impl('interval') + + @interval.setter + def interval(self, new_val): + # type: (Optional[str]) -> None + self._interval = new_val + + @property + def startTime(self): + # type: () -> str + return self._property_impl('startTime') + + @startTime.setter + def startTime(self, new_val): + # type: (Optional[str]) -> None + self._startTime = new_val + + +class SnapshotSchedulesList(CrdObjectList): + _items_type = SnapshotSchedulesItem + + +class Mirroring(CrdObject): + _properties = [ + ('enabled', 'enabled', bool, False, False), + ('mode', 'mode', str, False, False), + ('snapshotSchedules', 'snapshotSchedules', 'SnapshotSchedulesList', False, False) + ] + + def __init__(self, + enabled=_omit, # type: Optional[bool] + mode=_omit, # type: Optional[str] + snapshotSchedules=_omit, # type: Optional[Union[List[SnapshotSchedulesItem], CrdObjectList]] + ): + super(Mirroring, self).__init__( + enabled=enabled, + mode=mode, + snapshotSchedules=snapshotSchedules, + ) + + @property + def enabled(self): + # type: () -> bool + return self._property_impl('enabled') + + @enabled.setter + def enabled(self, new_val): + # type: (Optional[bool]) -> None + self._enabled = new_val + + @property + def mode(self): + # type: () -> str + return self._property_impl('mode') + + @mode.setter + def mode(self, new_val): + # type: (Optional[str]) -> None + self._mode = new_val + + @property + def snapshotSchedules(self): + # type: () -> Union[List[SnapshotSchedulesItem], CrdObjectList] + return self._property_impl('snapshotSchedules') + + @snapshotSchedules.setter + def snapshotSchedules(self, new_val): + # type: (Optional[Union[List[SnapshotSchedulesItem], CrdObjectList]]) -> None + self._snapshotSchedules = new_val + + +class Quotas(CrdObject): + _properties = [ + ('maxBytes', 'maxBytes', int, False, False), + ('maxObjects', 'maxObjects', int, False, False), + ('maxSize', 'maxSize', str, False, False) + ] + + def __init__(self, + maxBytes=_omit, # type: Optional[int] + maxObjects=_omit, # type: Optional[int] + maxSize=_omit, # type: Optional[str] + ): + super(Quotas, self).__init__( + maxBytes=maxBytes, + maxObjects=maxObjects, + maxSize=maxSize, + ) + + @property + def maxBytes(self): + # type: () -> int + return self._property_impl('maxBytes') + + @maxBytes.setter + def maxBytes(self, new_val): + # type: (Optional[int]) -> None + self._maxBytes = new_val + + @property + def maxObjects(self): + # type: () -> int + return self._property_impl('maxObjects') + + @maxObjects.setter + def maxObjects(self, new_val): + # type: (Optional[int]) -> None + self._maxObjects = new_val + + @property + def maxSize(self): + # type: () -> str + return self._property_impl('maxSize') + + @maxSize.setter + def maxSize(self, new_val): + # type: (Optional[str]) -> None + self._maxSize = new_val + + +class Replicated(CrdObject): + _properties = [ + ('replicasPerFailureDomain', 'replicasPerFailureDomain', int, False, False), + ('requireSafeReplicaSize', 'requireSafeReplicaSize', bool, False, False), + ('size', 'size', int, True, False), + ('subFailureDomain', 'subFailureDomain', str, False, False), + ('targetSizeRatio', 'targetSizeRatio', float, False, False) + ] + + def __init__(self, + size, # type: int + replicasPerFailureDomain=_omit, # type: Optional[int] + requireSafeReplicaSize=_omit, # type: Optional[bool] + subFailureDomain=_omit, # type: Optional[str] + targetSizeRatio=_omit, # type: Optional[float] + ): + super(Replicated, self).__init__( + size=size, + replicasPerFailureDomain=replicasPerFailureDomain, + requireSafeReplicaSize=requireSafeReplicaSize, + subFailureDomain=subFailureDomain, + targetSizeRatio=targetSizeRatio, + ) + + @property + def replicasPerFailureDomain(self): + # type: () -> int + return self._property_impl('replicasPerFailureDomain') + + @replicasPerFailureDomain.setter + def replicasPerFailureDomain(self, new_val): + # type: (Optional[int]) -> None + self._replicasPerFailureDomain = new_val + + @property + def requireSafeReplicaSize(self): + # type: () -> bool + return self._property_impl('requireSafeReplicaSize') + + @requireSafeReplicaSize.setter + def requireSafeReplicaSize(self, new_val): + # type: (Optional[bool]) -> None + self._requireSafeReplicaSize = new_val + + @property + def size(self): + # type: () -> int + return self._property_impl('size') + + @size.setter + def size(self, new_val): + # type: (int) -> None + self._size = new_val + + @property + def subFailureDomain(self): + # type: () -> str + return self._property_impl('subFailureDomain') + + @subFailureDomain.setter + def subFailureDomain(self, new_val): + # type: (Optional[str]) -> None + self._subFailureDomain = new_val + + @property + def targetSizeRatio(self): + # type: () -> float + return self._property_impl('targetSizeRatio') + + @targetSizeRatio.setter + def targetSizeRatio(self, new_val): + # type: (Optional[float]) -> None + self._targetSizeRatio = new_val + + +class Mirror(CrdObject): + _properties = [ + ('disabled', 'disabled', bool, False, False), + ('interval', 'interval', str, False, False), + ('timeout', 'timeout', str, False, False) + ] + + def __init__(self, + disabled=_omit, # type: Optional[bool] + interval=_omit, # type: Optional[str] + timeout=_omit, # type: Optional[str] + ): + super(Mirror, self).__init__( + disabled=disabled, + interval=interval, + timeout=timeout, + ) + + @property + def disabled(self): + # type: () -> bool + return self._property_impl('disabled') + + @disabled.setter + def disabled(self, new_val): + # type: (Optional[bool]) -> None + self._disabled = new_val + + @property + def interval(self): + # type: () -> str + return self._property_impl('interval') + + @interval.setter + def interval(self, new_val): + # type: (Optional[str]) -> None + self._interval = new_val + + @property + def timeout(self): + # type: () -> str + return self._property_impl('timeout') + + @timeout.setter + def timeout(self, new_val): + # type: (Optional[str]) -> None + self._timeout = new_val + + +class StatusCheck(CrdObject): + _properties = [ + ('mirror', 'mirror', 'Mirror', False, True) + ] + + def __init__(self, + mirror=_omit, # type: Optional[Mirror] + ): + super(StatusCheck, self).__init__( + mirror=mirror, + ) + + @property + def mirror(self): + # type: () -> Optional[Mirror] + return self._property_impl('mirror') + + @mirror.setter + def mirror(self, new_val): + # type: (Optional[Mirror]) -> None + self._mirror = new_val + + +class Spec(CrdObject): + _properties = [ + ('compressionMode', 'compressionMode', str, False, True), + ('crushRoot', 'crushRoot', str, False, True), + ('deviceClass', 'deviceClass', str, False, True), + ('enableRBDStats', 'enableRBDStats', bool, False, False), + ('erasureCoded', 'erasureCoded', 'ErasureCoded', False, False), + ('failureDomain', 'failureDomain', str, False, False), + ('mirroring', 'mirroring', 'Mirroring', False, False), + ('parameters', 'parameters', object, False, True), + ('quotas', 'quotas', 'Quotas', False, True), + ('replicated', 'replicated', 'Replicated', False, False), + ('statusCheck', 'statusCheck', 'StatusCheck', False, False) + ] + + def __init__(self, + compressionMode=_omit, # type: Optional[str] + crushRoot=_omit, # type: Optional[str] + deviceClass=_omit, # type: Optional[str] + enableRBDStats=_omit, # type: Optional[bool] + erasureCoded=_omit, # type: Optional[ErasureCoded] + failureDomain=_omit, # type: Optional[str] + mirroring=_omit, # type: Optional[Mirroring] + parameters=_omit, # type: Optional[Any] + quotas=_omit, # type: Optional[Quotas] + replicated=_omit, # type: Optional[Replicated] + statusCheck=_omit, # type: Optional[StatusCheck] + ): + super(Spec, self).__init__( + compressionMode=compressionMode, + crushRoot=crushRoot, + deviceClass=deviceClass, + enableRBDStats=enableRBDStats, + erasureCoded=erasureCoded, + failureDomain=failureDomain, + mirroring=mirroring, + parameters=parameters, + quotas=quotas, + replicated=replicated, + statusCheck=statusCheck, + ) + + @property + def compressionMode(self): + # type: () -> Optional[str] + return self._property_impl('compressionMode') + + @compressionMode.setter + def compressionMode(self, new_val): + # type: (Optional[str]) -> None + self._compressionMode = new_val + + @property + def crushRoot(self): + # type: () -> Optional[str] + return self._property_impl('crushRoot') + + @crushRoot.setter + def crushRoot(self, new_val): + # type: (Optional[str]) -> None + self._crushRoot = new_val + + @property + def deviceClass(self): + # type: () -> Optional[str] + return self._property_impl('deviceClass') + + @deviceClass.setter + def deviceClass(self, new_val): + # type: (Optional[str]) -> None + self._deviceClass = new_val + + @property + def enableRBDStats(self): + # type: () -> bool + return self._property_impl('enableRBDStats') + + @enableRBDStats.setter + def enableRBDStats(self, new_val): + # type: (Optional[bool]) -> None + self._enableRBDStats = new_val + + @property + def erasureCoded(self): + # type: () -> ErasureCoded + return self._property_impl('erasureCoded') + + @erasureCoded.setter + def erasureCoded(self, new_val): + # type: (Optional[ErasureCoded]) -> None + self._erasureCoded = new_val + + @property + def failureDomain(self): + # type: () -> str + return self._property_impl('failureDomain') + + @failureDomain.setter + def failureDomain(self, new_val): + # type: (Optional[str]) -> None + self._failureDomain = new_val + + @property + def mirroring(self): + # type: () -> Mirroring + return self._property_impl('mirroring') + + @mirroring.setter + def mirroring(self, new_val): + # type: (Optional[Mirroring]) -> None + self._mirroring = new_val + + @property + def parameters(self): + # type: () -> Optional[Any] + return self._property_impl('parameters') + + @parameters.setter + def parameters(self, new_val): + # type: (Optional[Any]) -> None + self._parameters = new_val + + @property + def quotas(self): + # type: () -> Optional[Quotas] + return self._property_impl('quotas') + + @quotas.setter + def quotas(self, new_val): + # type: (Optional[Quotas]) -> None + self._quotas = new_val + + @property + def replicated(self): + # type: () -> Replicated + return self._property_impl('replicated') + + @replicated.setter + def replicated(self, new_val): + # type: (Optional[Replicated]) -> None + self._replicated = new_val + + @property + def statusCheck(self): + # type: () -> StatusCheck + return self._property_impl('statusCheck') + + @statusCheck.setter + def statusCheck(self, new_val): + # type: (Optional[StatusCheck]) -> None + self._statusCheck = new_val + + +class PeersItem(CrdObject): + _properties = [ + ('client_name', 'client_name', str, False, False), + ('direction', 'direction', str, False, False), + ('mirror_uuid', 'mirror_uuid', str, False, False), + ('site_name', 'site_name', str, False, False), + ('uuid', 'uuid', str, False, False) + ] + + def __init__(self, + client_name=_omit, # type: Optional[str] + direction=_omit, # type: Optional[str] + mirror_uuid=_omit, # type: Optional[str] + site_name=_omit, # type: Optional[str] + uuid=_omit, # type: Optional[str] + ): + super(PeersItem, self).__init__( + client_name=client_name, + direction=direction, + mirror_uuid=mirror_uuid, + site_name=site_name, + uuid=uuid, + ) + + @property + def client_name(self): + # type: () -> str + return self._property_impl('client_name') + + @client_name.setter + def client_name(self, new_val): + # type: (Optional[str]) -> None + self._client_name = new_val + + @property + def direction(self): + # type: () -> str + return self._property_impl('direction') + + @direction.setter + def direction(self, new_val): + # type: (Optional[str]) -> None + self._direction = new_val + + @property + def mirror_uuid(self): + # type: () -> str + return self._property_impl('mirror_uuid') + + @mirror_uuid.setter + def mirror_uuid(self, new_val): + # type: (Optional[str]) -> None + self._mirror_uuid = new_val + + @property + def site_name(self): + # type: () -> str + return self._property_impl('site_name') + + @site_name.setter + def site_name(self, new_val): + # type: (Optional[str]) -> None + self._site_name = new_val + + @property + def uuid(self): + # type: () -> str + return self._property_impl('uuid') + + @uuid.setter + def uuid(self, new_val): + # type: (Optional[str]) -> None + self._uuid = new_val + + +class PeersList(CrdObjectList): + _items_type = PeersItem + + +class MirroringInfo(CrdObject): + _properties = [ + ('details', 'details', str, False, False), + ('lastChanged', 'lastChanged', str, False, False), + ('lastChecked', 'lastChecked', str, False, False), + ('mode', 'mode', str, False, False), + ('peers', 'peers', 'PeersList', False, False), + ('site_name', 'site_name', str, False, False) + ] + + def __init__(self, + details=_omit, # type: Optional[str] + lastChanged=_omit, # type: Optional[str] + lastChecked=_omit, # type: Optional[str] + mode=_omit, # type: Optional[str] + peers=_omit, # type: Optional[Union[List[PeersItem], CrdObjectList]] + site_name=_omit, # type: Optional[str] + ): + super(MirroringInfo, self).__init__( + details=details, + lastChanged=lastChanged, + lastChecked=lastChecked, + mode=mode, + peers=peers, + site_name=site_name, + ) + + @property + def details(self): + # type: () -> str + return self._property_impl('details') + + @details.setter + def details(self, new_val): + # type: (Optional[str]) -> None + self._details = new_val + + @property + def lastChanged(self): + # type: () -> str + return self._property_impl('lastChanged') + + @lastChanged.setter + def lastChanged(self, new_val): + # type: (Optional[str]) -> None + self._lastChanged = new_val + + @property + def lastChecked(self): + # type: () -> str + return self._property_impl('lastChecked') + + @lastChecked.setter + def lastChecked(self, new_val): + # type: (Optional[str]) -> None + self._lastChecked = new_val + + @property + def mode(self): + # type: () -> str + return self._property_impl('mode') + + @mode.setter + def mode(self, new_val): + # type: (Optional[str]) -> None + self._mode = new_val + + @property + def peers(self): + # type: () -> Union[List[PeersItem], CrdObjectList] + return self._property_impl('peers') + + @peers.setter + def peers(self, new_val): + # type: (Optional[Union[List[PeersItem], CrdObjectList]]) -> None + self._peers = new_val + + @property + def site_name(self): + # type: () -> str + return self._property_impl('site_name') + + @site_name.setter + def site_name(self, new_val): + # type: (Optional[str]) -> None + self._site_name = new_val + + +class States(CrdObject): + _properties = [ + ('error', 'error', int, False, False), + ('replaying', 'replaying', int, False, False), + ('starting_replay', 'starting_replay', int, False, False), + ('stopped', 'stopped', int, False, False), + ('stopping_replay', 'stopping_replay', int, False, False), + ('syncing', 'syncing', int, False, False), + ('unknown', 'unknown', int, False, False) + ] + + def __init__(self, + error=_omit, # type: Optional[int] + replaying=_omit, # type: Optional[int] + starting_replay=_omit, # type: Optional[int] + stopped=_omit, # type: Optional[int] + stopping_replay=_omit, # type: Optional[int] + syncing=_omit, # type: Optional[int] + unknown=_omit, # type: Optional[int] + ): + super(States, self).__init__( + error=error, + replaying=replaying, + starting_replay=starting_replay, + stopped=stopped, + stopping_replay=stopping_replay, + syncing=syncing, + unknown=unknown, + ) + + @property + def error(self): + # type: () -> int + return self._property_impl('error') + + @error.setter + def error(self, new_val): + # type: (Optional[int]) -> None + self._error = new_val + + @property + def replaying(self): + # type: () -> int + return self._property_impl('replaying') + + @replaying.setter + def replaying(self, new_val): + # type: (Optional[int]) -> None + self._replaying = new_val + + @property + def starting_replay(self): + # type: () -> int + return self._property_impl('starting_replay') + + @starting_replay.setter + def starting_replay(self, new_val): + # type: (Optional[int]) -> None + self._starting_replay = new_val + + @property + def stopped(self): + # type: () -> int + return self._property_impl('stopped') + + @stopped.setter + def stopped(self, new_val): + # type: (Optional[int]) -> None + self._stopped = new_val + + @property + def stopping_replay(self): + # type: () -> int + return self._property_impl('stopping_replay') + + @stopping_replay.setter + def stopping_replay(self, new_val): + # type: (Optional[int]) -> None + self._stopping_replay = new_val + + @property + def syncing(self): + # type: () -> int + return self._property_impl('syncing') + + @syncing.setter + def syncing(self, new_val): + # type: (Optional[int]) -> None + self._syncing = new_val + + @property + def unknown(self): + # type: () -> int + return self._property_impl('unknown') + + @unknown.setter + def unknown(self, new_val): + # type: (Optional[int]) -> None + self._unknown = new_val + + +class Summary(CrdObject): + _properties = [ + ('daemon_health', 'daemon_health', str, False, False), + ('health', 'health', str, False, False), + ('image_health', 'image_health', str, False, False), + ('states', 'states', 'States', False, True) + ] + + def __init__(self, + daemon_health=_omit, # type: Optional[str] + health=_omit, # type: Optional[str] + image_health=_omit, # type: Optional[str] + states=_omit, # type: Optional[States] + ): + super(Summary, self).__init__( + daemon_health=daemon_health, + health=health, + image_health=image_health, + states=states, + ) + + @property + def daemon_health(self): + # type: () -> str + return self._property_impl('daemon_health') + + @daemon_health.setter + def daemon_health(self, new_val): + # type: (Optional[str]) -> None + self._daemon_health = new_val + + @property + def health(self): + # type: () -> str + return self._property_impl('health') + + @health.setter + def health(self, new_val): + # type: (Optional[str]) -> None + self._health = new_val + + @property + def image_health(self): + # type: () -> str + return self._property_impl('image_health') + + @image_health.setter + def image_health(self, new_val): + # type: (Optional[str]) -> None + self._image_health = new_val + + @property + def states(self): + # type: () -> Optional[States] + return self._property_impl('states') + + @states.setter + def states(self, new_val): + # type: (Optional[States]) -> None + self._states = new_val + + +class MirroringStatus(CrdObject): + _properties = [ + ('details', 'details', str, False, False), + ('lastChanged', 'lastChanged', str, False, False), + ('lastChecked', 'lastChecked', str, False, False), + ('summary', 'summary', 'Summary', False, False) + ] + + def __init__(self, + details=_omit, # type: Optional[str] + lastChanged=_omit, # type: Optional[str] + lastChecked=_omit, # type: Optional[str] + summary=_omit, # type: Optional[Summary] + ): + super(MirroringStatus, self).__init__( + details=details, + lastChanged=lastChanged, + lastChecked=lastChecked, + summary=summary, + ) + + @property + def details(self): + # type: () -> str + return self._property_impl('details') + + @details.setter + def details(self, new_val): + # type: (Optional[str]) -> None + self._details = new_val + + @property + def lastChanged(self): + # type: () -> str + return self._property_impl('lastChanged') + + @lastChanged.setter + def lastChanged(self, new_val): + # type: (Optional[str]) -> None + self._lastChanged = new_val + + @property + def lastChecked(self): + # type: () -> str + return self._property_impl('lastChecked') + + @lastChecked.setter + def lastChecked(self, new_val): + # type: (Optional[str]) -> None + self._lastChecked = new_val + + @property + def summary(self): + # type: () -> Summary + return self._property_impl('summary') + + @summary.setter + def summary(self, new_val): + # type: (Optional[Summary]) -> None + self._summary = new_val + + +class ItemsItem(CrdObject): + _properties = [ + ('interval', 'interval', str, False, False), + ('start_time', 'start_time', str, False, False) + ] + + def __init__(self, + interval=_omit, # type: Optional[str] + start_time=_omit, # type: Optional[str] + ): + super(ItemsItem, self).__init__( + interval=interval, + start_time=start_time, + ) + + @property + def interval(self): + # type: () -> str + return self._property_impl('interval') + + @interval.setter + def interval(self, new_val): + # type: (Optional[str]) -> None + self._interval = new_val + + @property + def start_time(self): + # type: () -> str + return self._property_impl('start_time') + + @start_time.setter + def start_time(self, new_val): + # type: (Optional[str]) -> None + self._start_time = new_val + + +class ItemsList(CrdObjectList): + _items_type = ItemsItem + + +class SnapshotScheduleStatus(CrdObject): + _properties = [ + ('details', 'details', str, False, False), + ('lastChanged', 'lastChanged', str, False, False), + ('lastChecked', 'lastChecked', str, False, False), + ('snapshotSchedules', 'snapshotSchedules', 'SnapshotSchedulesList', False, True) + ] + + def __init__(self, + details=_omit, # type: Optional[str] + lastChanged=_omit, # type: Optional[str] + lastChecked=_omit, # type: Optional[str] + snapshotSchedules=_omit, # type: Optional[Union[List[SnapshotSchedulesItem], CrdObjectList]] + ): + super(SnapshotScheduleStatus, self).__init__( + details=details, + lastChanged=lastChanged, + lastChecked=lastChecked, + snapshotSchedules=snapshotSchedules, + ) + + @property + def details(self): + # type: () -> str + return self._property_impl('details') + + @details.setter + def details(self, new_val): + # type: (Optional[str]) -> None + self._details = new_val + + @property + def lastChanged(self): + # type: () -> str + return self._property_impl('lastChanged') + + @lastChanged.setter + def lastChanged(self, new_val): + # type: (Optional[str]) -> None + self._lastChanged = new_val + + @property + def lastChecked(self): + # type: () -> str + return self._property_impl('lastChecked') + + @lastChecked.setter + def lastChecked(self, new_val): + # type: (Optional[str]) -> None + self._lastChecked = new_val + + @property + def snapshotSchedules(self): + # type: () -> Optional[Union[List[SnapshotSchedulesItem], CrdObjectList]] + return self._property_impl('snapshotSchedules') + + @snapshotSchedules.setter + def snapshotSchedules(self, new_val): + # type: (Optional[Union[List[SnapshotSchedulesItem], CrdObjectList]]) -> None + self._snapshotSchedules = new_val + + +class Status(CrdObject): + _properties = [ + ('info', 'info', object, False, True), + ('mirroringInfo', 'mirroringInfo', 'MirroringInfo', False, False), + ('mirroringStatus', 'mirroringStatus', 'MirroringStatus', False, False), + ('phase', 'phase', str, False, False), + ('snapshotScheduleStatus', 'snapshotScheduleStatus', 'SnapshotScheduleStatus', False, False) + ] + + def __init__(self, + info=_omit, # type: Optional[Any] + mirroringInfo=_omit, # type: Optional[MirroringInfo] + mirroringStatus=_omit, # type: Optional[MirroringStatus] + phase=_omit, # type: Optional[str] + snapshotScheduleStatus=_omit, # type: Optional[SnapshotScheduleStatus] + ): + super(Status, self).__init__( + info=info, + mirroringInfo=mirroringInfo, + mirroringStatus=mirroringStatus, + phase=phase, + snapshotScheduleStatus=snapshotScheduleStatus, + ) + + @property + def info(self): + # type: () -> Optional[Any] + return self._property_impl('info') + + @info.setter + def info(self, new_val): + # type: (Optional[Any]) -> None + self._info = new_val + + @property + def mirroringInfo(self): + # type: () -> MirroringInfo + return self._property_impl('mirroringInfo') + + @mirroringInfo.setter + def mirroringInfo(self, new_val): + # type: (Optional[MirroringInfo]) -> None + self._mirroringInfo = new_val + + @property + def mirroringStatus(self): + # type: () -> MirroringStatus + return self._property_impl('mirroringStatus') + + @mirroringStatus.setter + def mirroringStatus(self, new_val): + # type: (Optional[MirroringStatus]) -> None + self._mirroringStatus = new_val + + @property + def phase(self): + # type: () -> str + return self._property_impl('phase') + + @phase.setter + def phase(self, new_val): + # type: (Optional[str]) -> None + self._phase = new_val + + @property + def snapshotScheduleStatus(self): + # type: () -> SnapshotScheduleStatus + return self._property_impl('snapshotScheduleStatus') + + @snapshotScheduleStatus.setter + def snapshotScheduleStatus(self, new_val): + # type: (Optional[SnapshotScheduleStatus]) -> None + self._snapshotScheduleStatus = new_val + + +class CephBlockPool(CrdClass): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', object, False, False), + ('spec', 'spec', 'Spec', True, False), + ('status', 'status', 'Status', False, False) + ] + + def __init__(self, + spec, # type: Spec + apiVersion=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Any] + status=_omit, # type: Optional[Status] + ): + super(CephBlockPool, self).__init__( + spec=spec, + apiVersion=apiVersion, + kind=kind, + metadata=metadata, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Any]) -> None + self._metadata = new_val + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Spec) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Status + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Status]) -> None + self._status = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephclient.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephclient.py new file mode 100644 index 000000000..c7f8c7863 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephclient.py @@ -0,0 +1,157 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class Spec(CrdObject): + _properties = [ + ('caps', 'caps', object, True, False), + ('name', 'name', str, False, False) + ] + + def __init__(self, + caps, # type: Any + name=_omit, # type: Optional[str] + ): + super(Spec, self).__init__( + caps=caps, + name=name, + ) + + @property + def caps(self): + # type: () -> Any + return self._property_impl('caps') + + @caps.setter + def caps(self, new_val): + # type: (Any) -> None + self._caps = new_val + + @property + def name(self): + # type: () -> str + return self._property_impl('name') + + @name.setter + def name(self, new_val): + # type: (Optional[str]) -> None + self._name = new_val + + +class Status(CrdObject): + _properties = [ + ('info', 'info', object, False, True), + ('phase', 'phase', str, False, False) + ] + + def __init__(self, + info=_omit, # type: Optional[Any] + phase=_omit, # type: Optional[str] + ): + super(Status, self).__init__( + info=info, + phase=phase, + ) + + @property + def info(self): + # type: () -> Optional[Any] + return self._property_impl('info') + + @info.setter + def info(self, new_val): + # type: (Optional[Any]) -> None + self._info = new_val + + @property + def phase(self): + # type: () -> str + return self._property_impl('phase') + + @phase.setter + def phase(self, new_val): + # type: (Optional[str]) -> None + self._phase = new_val + + +class CephClient(CrdClass): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', object, False, False), + ('spec', 'spec', 'Spec', True, False), + ('status', 'status', 'Status', False, False) + ] + + def __init__(self, + spec, # type: Spec + apiVersion=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Any] + status=_omit, # type: Optional[Status] + ): + super(CephClient, self).__init__( + spec=spec, + apiVersion=apiVersion, + kind=kind, + metadata=metadata, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Any]) -> None + self._metadata = new_val + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Spec) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Status + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Status]) -> None + self._status = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephcluster.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephcluster.py new file mode 100644 index 000000000..00cdbc817 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephcluster.py @@ -0,0 +1,3959 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class CephVersion(CrdObject): + _properties = [ + ('allowUnsupported', 'allowUnsupported', bool, False, False), + ('image', 'image', str, False, False) + ] + + def __init__(self, + allowUnsupported=_omit, # type: Optional[bool] + image=_omit, # type: Optional[str] + ): + super(CephVersion, self).__init__( + allowUnsupported=allowUnsupported, + image=image, + ) + + @property + def allowUnsupported(self): + # type: () -> bool + return self._property_impl('allowUnsupported') + + @allowUnsupported.setter + def allowUnsupported(self, new_val): + # type: (Optional[bool]) -> None + self._allowUnsupported = new_val + + @property + def image(self): + # type: () -> str + return self._property_impl('image') + + @image.setter + def image(self, new_val): + # type: (Optional[str]) -> None + self._image = new_val + + +class SanitizeDisks(CrdObject): + _properties = [ + ('dataSource', 'dataSource', str, False, False), + ('iteration', 'iteration', int, False, False), + ('method', 'method', str, False, False) + ] + + def __init__(self, + dataSource=_omit, # type: Optional[str] + iteration=_omit, # type: Optional[int] + method=_omit, # type: Optional[str] + ): + super(SanitizeDisks, self).__init__( + dataSource=dataSource, + iteration=iteration, + method=method, + ) + + @property + def dataSource(self): + # type: () -> str + return self._property_impl('dataSource') + + @dataSource.setter + def dataSource(self, new_val): + # type: (Optional[str]) -> None + self._dataSource = new_val + + @property + def iteration(self): + # type: () -> int + return self._property_impl('iteration') + + @iteration.setter + def iteration(self, new_val): + # type: (Optional[int]) -> None + self._iteration = new_val + + @property + def method(self): + # type: () -> str + return self._property_impl('method') + + @method.setter + def method(self, new_val): + # type: (Optional[str]) -> None + self._method = new_val + + +class CleanupPolicy(CrdObject): + _properties = [ + ('allowUninstallWithVolumes', 'allowUninstallWithVolumes', bool, False, False), + ('confirmation', 'confirmation', str, False, True), + ('sanitizeDisks', 'sanitizeDisks', 'SanitizeDisks', False, True) + ] + + def __init__(self, + allowUninstallWithVolumes=_omit, # type: Optional[bool] + confirmation=_omit, # type: Optional[str] + sanitizeDisks=_omit, # type: Optional[SanitizeDisks] + ): + super(CleanupPolicy, self).__init__( + allowUninstallWithVolumes=allowUninstallWithVolumes, + confirmation=confirmation, + sanitizeDisks=sanitizeDisks, + ) + + @property + def allowUninstallWithVolumes(self): + # type: () -> bool + return self._property_impl('allowUninstallWithVolumes') + + @allowUninstallWithVolumes.setter + def allowUninstallWithVolumes(self, new_val): + # type: (Optional[bool]) -> None + self._allowUninstallWithVolumes = new_val + + @property + def confirmation(self): + # type: () -> Optional[str] + return self._property_impl('confirmation') + + @confirmation.setter + def confirmation(self, new_val): + # type: (Optional[str]) -> None + self._confirmation = new_val + + @property + def sanitizeDisks(self): + # type: () -> Optional[SanitizeDisks] + return self._property_impl('sanitizeDisks') + + @sanitizeDisks.setter + def sanitizeDisks(self, new_val): + # type: (Optional[SanitizeDisks]) -> None + self._sanitizeDisks = new_val + + +class CrashCollector(CrdObject): + _properties = [ + ('daysToRetain', 'daysToRetain', int, False, False), + ('disable', 'disable', bool, False, False) + ] + + def __init__(self, + daysToRetain=_omit, # type: Optional[int] + disable=_omit, # type: Optional[bool] + ): + super(CrashCollector, self).__init__( + daysToRetain=daysToRetain, + disable=disable, + ) + + @property + def daysToRetain(self): + # type: () -> int + return self._property_impl('daysToRetain') + + @daysToRetain.setter + def daysToRetain(self, new_val): + # type: (Optional[int]) -> None + self._daysToRetain = new_val + + @property + def disable(self): + # type: () -> bool + return self._property_impl('disable') + + @disable.setter + def disable(self, new_val): + # type: (Optional[bool]) -> None + self._disable = new_val + + +class Dashboard(CrdObject): + _properties = [ + ('enabled', 'enabled', bool, False, False), + ('port', 'port', int, False, False), + ('ssl', 'ssl', bool, False, False), + ('urlPrefix', 'urlPrefix', str, False, False) + ] + + def __init__(self, + enabled=_omit, # type: Optional[bool] + port=_omit, # type: Optional[int] + ssl=_omit, # type: Optional[bool] + urlPrefix=_omit, # type: Optional[str] + ): + super(Dashboard, self).__init__( + enabled=enabled, + port=port, + ssl=ssl, + urlPrefix=urlPrefix, + ) + + @property + def enabled(self): + # type: () -> bool + return self._property_impl('enabled') + + @enabled.setter + def enabled(self, new_val): + # type: (Optional[bool]) -> None + self._enabled = new_val + + @property + def port(self): + # type: () -> int + return self._property_impl('port') + + @port.setter + def port(self, new_val): + # type: (Optional[int]) -> None + self._port = new_val + + @property + def ssl(self): + # type: () -> bool + return self._property_impl('ssl') + + @ssl.setter + def ssl(self, new_val): + # type: (Optional[bool]) -> None + self._ssl = new_val + + @property + def urlPrefix(self): + # type: () -> str + return self._property_impl('urlPrefix') + + @urlPrefix.setter + def urlPrefix(self, new_val): + # type: (Optional[str]) -> None + self._urlPrefix = new_val + + +class DisruptionManagement(CrdObject): + _properties = [ + ('machineDisruptionBudgetNamespace', 'machineDisruptionBudgetNamespace', str, False, False), + ('manageMachineDisruptionBudgets', 'manageMachineDisruptionBudgets', bool, False, False), + ('managePodBudgets', 'managePodBudgets', bool, False, False), + ('osdMaintenanceTimeout', 'osdMaintenanceTimeout', int, False, False), + ('pgHealthCheckTimeout', 'pgHealthCheckTimeout', int, False, False) + ] + + def __init__(self, + machineDisruptionBudgetNamespace=_omit, # type: Optional[str] + manageMachineDisruptionBudgets=_omit, # type: Optional[bool] + managePodBudgets=_omit, # type: Optional[bool] + osdMaintenanceTimeout=_omit, # type: Optional[int] + pgHealthCheckTimeout=_omit, # type: Optional[int] + ): + super(DisruptionManagement, self).__init__( + machineDisruptionBudgetNamespace=machineDisruptionBudgetNamespace, + manageMachineDisruptionBudgets=manageMachineDisruptionBudgets, + managePodBudgets=managePodBudgets, + osdMaintenanceTimeout=osdMaintenanceTimeout, + pgHealthCheckTimeout=pgHealthCheckTimeout, + ) + + @property + def machineDisruptionBudgetNamespace(self): + # type: () -> str + return self._property_impl('machineDisruptionBudgetNamespace') + + @machineDisruptionBudgetNamespace.setter + def machineDisruptionBudgetNamespace(self, new_val): + # type: (Optional[str]) -> None + self._machineDisruptionBudgetNamespace = new_val + + @property + def manageMachineDisruptionBudgets(self): + # type: () -> bool + return self._property_impl('manageMachineDisruptionBudgets') + + @manageMachineDisruptionBudgets.setter + def manageMachineDisruptionBudgets(self, new_val): + # type: (Optional[bool]) -> None + self._manageMachineDisruptionBudgets = new_val + + @property + def managePodBudgets(self): + # type: () -> bool + return self._property_impl('managePodBudgets') + + @managePodBudgets.setter + def managePodBudgets(self, new_val): + # type: (Optional[bool]) -> None + self._managePodBudgets = new_val + + @property + def osdMaintenanceTimeout(self): + # type: () -> int + return self._property_impl('osdMaintenanceTimeout') + + @osdMaintenanceTimeout.setter + def osdMaintenanceTimeout(self, new_val): + # type: (Optional[int]) -> None + self._osdMaintenanceTimeout = new_val + + @property + def pgHealthCheckTimeout(self): + # type: () -> int + return self._property_impl('pgHealthCheckTimeout') + + @pgHealthCheckTimeout.setter + def pgHealthCheckTimeout(self, new_val): + # type: (Optional[int]) -> None + self._pgHealthCheckTimeout = new_val + + +class External(CrdObject): + _properties = [ + ('enable', 'enable', bool, False, False) + ] + + def __init__(self, + enable=_omit, # type: Optional[bool] + ): + super(External, self).__init__( + enable=enable, + ) + + @property + def enable(self): + # type: () -> bool + return self._property_impl('enable') + + @enable.setter + def enable(self, new_val): + # type: (Optional[bool]) -> None + self._enable = new_val + + +class Mon(CrdObject): + _properties = [ + ('allowMultiplePerNode', 'allowMultiplePerNode', bool, False, False), + ('count', 'count', int, False, False), + ('stretchCluster', 'stretchCluster', 'StretchCluster', False, False), + ('volumeClaimTemplate', 'volumeClaimTemplate', 'VolumeClaimTemplate', False, False), + ('disabled', 'disabled', bool, False, False), + ('interval', 'interval', str, False, False), + ('timeout', 'timeout', str, False, False) + ] + + def __init__(self, + allowMultiplePerNode=_omit, # type: Optional[bool] + count=_omit, # type: Optional[int] + stretchCluster=_omit, # type: Optional[StretchCluster] + volumeClaimTemplate=_omit, # type: Optional[VolumeClaimTemplate] + disabled=_omit, # type: Optional[bool] + interval=_omit, # type: Optional[str] + timeout=_omit, # type: Optional[str] + ): + super(Mon, self).__init__( + allowMultiplePerNode=allowMultiplePerNode, + count=count, + stretchCluster=stretchCluster, + volumeClaimTemplate=volumeClaimTemplate, + disabled=disabled, + interval=interval, + timeout=timeout, + ) + + @property + def allowMultiplePerNode(self): + # type: () -> bool + return self._property_impl('allowMultiplePerNode') + + @allowMultiplePerNode.setter + def allowMultiplePerNode(self, new_val): + # type: (Optional[bool]) -> None + self._allowMultiplePerNode = new_val + + @property + def count(self): + # type: () -> int + return self._property_impl('count') + + @count.setter + def count(self, new_val): + # type: (Optional[int]) -> None + self._count = new_val + + @property + def stretchCluster(self): + # type: () -> StretchCluster + return self._property_impl('stretchCluster') + + @stretchCluster.setter + def stretchCluster(self, new_val): + # type: (Optional[StretchCluster]) -> None + self._stretchCluster = new_val + + @property + def volumeClaimTemplate(self): + # type: () -> VolumeClaimTemplate + return self._property_impl('volumeClaimTemplate') + + @volumeClaimTemplate.setter + def volumeClaimTemplate(self, new_val): + # type: (Optional[VolumeClaimTemplate]) -> None + self._volumeClaimTemplate = new_val + + @property + def disabled(self): + # type: () -> bool + return self._property_impl('disabled') + + @disabled.setter + def disabled(self, new_val): + # type: (Optional[bool]) -> None + self._disabled = new_val + + @property + def interval(self): + # type: () -> str + return self._property_impl('interval') + + @interval.setter + def interval(self, new_val): + # type: (Optional[str]) -> None + self._interval = new_val + + @property + def timeout(self): + # type: () -> str + return self._property_impl('timeout') + + @timeout.setter + def timeout(self, new_val): + # type: (Optional[str]) -> None + self._timeout = new_val + + +class Osd(CrdObject): + _properties = [ + ('disabled', 'disabled', bool, False, False), + ('interval', 'interval', str, False, False), + ('timeout', 'timeout', str, False, False) + ] + + def __init__(self, + disabled=_omit, # type: Optional[bool] + interval=_omit, # type: Optional[str] + timeout=_omit, # type: Optional[str] + ): + super(Osd, self).__init__( + disabled=disabled, + interval=interval, + timeout=timeout, + ) + + @property + def disabled(self): + # type: () -> bool + return self._property_impl('disabled') + + @disabled.setter + def disabled(self, new_val): + # type: (Optional[bool]) -> None + self._disabled = new_val + + @property + def interval(self): + # type: () -> str + return self._property_impl('interval') + + @interval.setter + def interval(self, new_val): + # type: (Optional[str]) -> None + self._interval = new_val + + @property + def timeout(self): + # type: () -> str + return self._property_impl('timeout') + + @timeout.setter + def timeout(self, new_val): + # type: (Optional[str]) -> None + self._timeout = new_val + + +class Status(CrdObject): + _properties = [ + ('ceph', 'ceph', 'Ceph', False, False), + ('conditions', 'conditions', 'ConditionsList', False, False), + ('message', 'message', str, False, False), + ('phase', 'phase', str, False, False), + ('state', 'state', str, False, False), + ('storage', 'storage', 'Storage', False, False), + ('version', 'version', 'Version', False, False), + ('accessModes', 'accessModes', 'AccessModesList', False, False), + ('capacity', 'capacity', object, False, False), + ('disabled', 'disabled', bool, False, False), + ('interval', 'interval', str, False, False), + ('timeout', 'timeout', str, False, False) + ] + + def __init__(self, + ceph=_omit, # type: Optional[Ceph] + conditions=_omit, # type: Optional[Union[List[ConditionsItem], CrdObjectList]] + message=_omit, # type: Optional[str] + phase=_omit, # type: Optional[str] + state=_omit, # type: Optional[str] + storage=_omit, # type: Optional[Storage] + version=_omit, # type: Optional[Version] + accessModes=_omit, # type: Optional[Union[List[str], CrdObjectList]] + capacity=_omit, # type: Optional[Any] + disabled=_omit, # type: Optional[bool] + interval=_omit, # type: Optional[str] + timeout=_omit, # type: Optional[str] + ): + super(Status, self).__init__( + ceph=ceph, + conditions=conditions, + message=message, + phase=phase, + state=state, + storage=storage, + version=version, + accessModes=accessModes, + capacity=capacity, + disabled=disabled, + interval=interval, + timeout=timeout, + ) + + @property + def ceph(self): + # type: () -> Ceph + return self._property_impl('ceph') + + @ceph.setter + def ceph(self, new_val): + # type: (Optional[Ceph]) -> None + self._ceph = new_val + + @property + def conditions(self): + # type: () -> Union[List[ConditionsItem], CrdObjectList] + return self._property_impl('conditions') + + @conditions.setter + def conditions(self, new_val): + # type: (Optional[Union[List[ConditionsItem], CrdObjectList]]) -> None + self._conditions = new_val + + @property + def message(self): + # type: () -> str + return self._property_impl('message') + + @message.setter + def message(self, new_val): + # type: (Optional[str]) -> None + self._message = new_val + + @property + def phase(self): + # type: () -> str + return self._property_impl('phase') + + @phase.setter + def phase(self, new_val): + # type: (Optional[str]) -> None + self._phase = new_val + + @property + def state(self): + # type: () -> str + return self._property_impl('state') + + @state.setter + def state(self, new_val): + # type: (Optional[str]) -> None + self._state = new_val + + @property + def storage(self): + # type: () -> Storage + return self._property_impl('storage') + + @storage.setter + def storage(self, new_val): + # type: (Optional[Storage]) -> None + self._storage = new_val + + @property + def version(self): + # type: () -> Version + return self._property_impl('version') + + @version.setter + def version(self, new_val): + # type: (Optional[Version]) -> None + self._version = new_val + + @property + def accessModes(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('accessModes') + + @accessModes.setter + def accessModes(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._accessModes = new_val + + @property + def capacity(self): + # type: () -> Any + return self._property_impl('capacity') + + @capacity.setter + def capacity(self, new_val): + # type: (Optional[Any]) -> None + self._capacity = new_val + + @property + def disabled(self): + # type: () -> bool + return self._property_impl('disabled') + + @disabled.setter + def disabled(self, new_val): + # type: (Optional[bool]) -> None + self._disabled = new_val + + @property + def interval(self): + # type: () -> str + return self._property_impl('interval') + + @interval.setter + def interval(self, new_val): + # type: (Optional[str]) -> None + self._interval = new_val + + @property + def timeout(self): + # type: () -> str + return self._property_impl('timeout') + + @timeout.setter + def timeout(self, new_val): + # type: (Optional[str]) -> None + self._timeout = new_val + + +class DaemonHealth(CrdObject): + _properties = [ + ('mon', 'mon', 'Mon', False, True), + ('osd', 'osd', 'Osd', False, True), + ('status', 'status', 'Status', False, True) + ] + + def __init__(self, + mon=_omit, # type: Optional[Mon] + osd=_omit, # type: Optional[Osd] + status=_omit, # type: Optional[Status] + ): + super(DaemonHealth, self).__init__( + mon=mon, + osd=osd, + status=status, + ) + + @property + def mon(self): + # type: () -> Optional[Mon] + return self._property_impl('mon') + + @mon.setter + def mon(self, new_val): + # type: (Optional[Mon]) -> None + self._mon = new_val + + @property + def osd(self): + # type: () -> Optional[Osd] + return self._property_impl('osd') + + @osd.setter + def osd(self, new_val): + # type: (Optional[Osd]) -> None + self._osd = new_val + + @property + def status(self): + # type: () -> Optional[Status] + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Status]) -> None + self._status = new_val + + +class HealthCheck(CrdObject): + _properties = [ + ('daemonHealth', 'daemonHealth', 'DaemonHealth', False, True), + ('livenessProbe', 'livenessProbe', object, False, False) + ] + + def __init__(self, + daemonHealth=_omit, # type: Optional[DaemonHealth] + livenessProbe=_omit, # type: Optional[Any] + ): + super(HealthCheck, self).__init__( + daemonHealth=daemonHealth, + livenessProbe=livenessProbe, + ) + + @property + def daemonHealth(self): + # type: () -> Optional[DaemonHealth] + return self._property_impl('daemonHealth') + + @daemonHealth.setter + def daemonHealth(self, new_val): + # type: (Optional[DaemonHealth]) -> None + self._daemonHealth = new_val + + @property + def livenessProbe(self): + # type: () -> Any + return self._property_impl('livenessProbe') + + @livenessProbe.setter + def livenessProbe(self, new_val): + # type: (Optional[Any]) -> None + self._livenessProbe = new_val + + +class LogCollector(CrdObject): + _properties = [ + ('enabled', 'enabled', bool, False, False), + ('periodicity', 'periodicity', str, False, False) + ] + + def __init__(self, + enabled=_omit, # type: Optional[bool] + periodicity=_omit, # type: Optional[str] + ): + super(LogCollector, self).__init__( + enabled=enabled, + periodicity=periodicity, + ) + + @property + def enabled(self): + # type: () -> bool + return self._property_impl('enabled') + + @enabled.setter + def enabled(self, new_val): + # type: (Optional[bool]) -> None + self._enabled = new_val + + @property + def periodicity(self): + # type: () -> str + return self._property_impl('periodicity') + + @periodicity.setter + def periodicity(self, new_val): + # type: (Optional[str]) -> None + self._periodicity = new_val + + +class ModulesItem(CrdObject): + _properties = [ + ('enabled', 'enabled', bool, False, False), + ('name', 'name', str, False, False) + ] + + def __init__(self, + enabled=_omit, # type: Optional[bool] + name=_omit, # type: Optional[str] + ): + super(ModulesItem, self).__init__( + enabled=enabled, + name=name, + ) + + @property + def enabled(self): + # type: () -> bool + return self._property_impl('enabled') + + @enabled.setter + def enabled(self, new_val): + # type: (Optional[bool]) -> None + self._enabled = new_val + + @property + def name(self): + # type: () -> str + return self._property_impl('name') + + @name.setter + def name(self, new_val): + # type: (Optional[str]) -> None + self._name = new_val + + +class ModulesList(CrdObjectList): + _items_type = ModulesItem + + +class Mgr(CrdObject): + _properties = [ + ('allowMultiplePerNode', 'allowMultiplePerNode', bool, False, False), + ('count', 'count', int, False, False), + ('modules', 'modules', 'ModulesList', False, True) + ] + + def __init__(self, + allowMultiplePerNode=_omit, # type: Optional[bool] + count=_omit, # type: Optional[int] + modules=_omit, # type: Optional[Union[List[ModulesItem], CrdObjectList]] + ): + super(Mgr, self).__init__( + allowMultiplePerNode=allowMultiplePerNode, + count=count, + modules=modules, + ) + + @property + def allowMultiplePerNode(self): + # type: () -> bool + return self._property_impl('allowMultiplePerNode') + + @allowMultiplePerNode.setter + def allowMultiplePerNode(self, new_val): + # type: (Optional[bool]) -> None + self._allowMultiplePerNode = new_val + + @property + def count(self): + # type: () -> int + return self._property_impl('count') + + @count.setter + def count(self, new_val): + # type: (Optional[int]) -> None + self._count = new_val + + @property + def modules(self): + # type: () -> Optional[Union[List[ModulesItem], CrdObjectList]] + return self._property_impl('modules') + + @modules.setter + def modules(self, new_val): + # type: (Optional[Union[List[ModulesItem], CrdObjectList]]) -> None + self._modules = new_val + + +class FinalizersList(CrdObjectList): + _items_type = str + + +class Metadata(CrdObject): + _properties = [ + ('annotations', 'annotations', object, False, False), + ('finalizers', 'finalizers', 'FinalizersList', False, False), + ('labels', 'labels', object, False, False), + ('name', 'name', str, False, False), + ('namespace', 'namespace', str, False, False) + ] + + def __init__(self, + annotations=_omit, # type: Optional[Any] + finalizers=_omit, # type: Optional[Union[List[str], CrdObjectList]] + labels=_omit, # type: Optional[Any] + name=_omit, # type: Optional[str] + namespace=_omit, # type: Optional[str] + ): + super(Metadata, self).__init__( + annotations=annotations, + finalizers=finalizers, + labels=labels, + name=name, + namespace=namespace, + ) + + @property + def annotations(self): + # type: () -> Any + return self._property_impl('annotations') + + @annotations.setter + def annotations(self, new_val): + # type: (Optional[Any]) -> None + self._annotations = new_val + + @property + def finalizers(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('finalizers') + + @finalizers.setter + def finalizers(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._finalizers = new_val + + @property + def labels(self): + # type: () -> Any + return self._property_impl('labels') + + @labels.setter + def labels(self, new_val): + # type: (Optional[Any]) -> None + self._labels = new_val + + @property + def name(self): + # type: () -> str + return self._property_impl('name') + + @name.setter + def name(self, new_val): + # type: (Optional[str]) -> None + self._name = new_val + + @property + def namespace(self): + # type: () -> str + return self._property_impl('namespace') + + @namespace.setter + def namespace(self, new_val): + # type: (Optional[str]) -> None + self._namespace = new_val + + +class AccessModesList(CrdObjectList): + _items_type = str + + +class DataSource(CrdObject): + _properties = [ + ('apiGroup', 'apiGroup', str, False, False), + ('kind', 'kind', str, True, False), + ('name', 'name', str, True, False) + ] + + def __init__(self, + kind, # type: str + name, # type: str + apiGroup=_omit, # type: Optional[str] + ): + super(DataSource, self).__init__( + kind=kind, + name=name, + apiGroup=apiGroup, + ) + + @property + def apiGroup(self): + # type: () -> str + return self._property_impl('apiGroup') + + @apiGroup.setter + def apiGroup(self, new_val): + # type: (Optional[str]) -> None + self._apiGroup = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (str) -> None + self._kind = new_val + + @property + def name(self): + # type: () -> str + return self._property_impl('name') + + @name.setter + def name(self, new_val): + # type: (str) -> None + self._name = new_val + + +class Resources(CrdObject): + _properties = [ + ('limits', 'limits', object, False, False), + ('requests', 'requests', object, False, False) + ] + + def __init__(self, + limits=_omit, # type: Optional[Any] + requests=_omit, # type: Optional[Any] + ): + super(Resources, self).__init__( + limits=limits, + requests=requests, + ) + + @property + def limits(self): + # type: () -> Any + return self._property_impl('limits') + + @limits.setter + def limits(self, new_val): + # type: (Optional[Any]) -> None + self._limits = new_val + + @property + def requests(self): + # type: () -> Any + return self._property_impl('requests') + + @requests.setter + def requests(self, new_val): + # type: (Optional[Any]) -> None + self._requests = new_val + + +class ValuesList(CrdObjectList): + _items_type = str + + +class MatchExpressionsItem(CrdObject): + _properties = [ + ('key', 'key', str, True, False), + ('operator', 'operator', str, True, False), + ('values', 'values', 'ValuesList', False, False) + ] + + def __init__(self, + key, # type: str + operator, # type: str + values=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(MatchExpressionsItem, self).__init__( + key=key, + operator=operator, + values=values, + ) + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (str) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (str) -> None + self._operator = new_val + + @property + def values(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('values') + + @values.setter + def values(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._values = new_val + + +class MatchExpressionsList(CrdObjectList): + _items_type = MatchExpressionsItem + + +class Selector(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchLabels', 'matchLabels', object, False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchLabels=_omit, # type: Optional[Any] + ): + super(Selector, self).__init__( + matchExpressions=matchExpressions, + matchLabels=matchLabels, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchLabels(self): + # type: () -> Any + return self._property_impl('matchLabels') + + @matchLabels.setter + def matchLabels(self, new_val): + # type: (Optional[Any]) -> None + self._matchLabels = new_val + + +class Spec(CrdObject): + _properties = [ + ('annotations', 'annotations', object, False, True), + ('cephVersion', 'cephVersion', 'CephVersion', False, True), + ('cleanupPolicy', 'cleanupPolicy', 'CleanupPolicy', False, True), + ('continueUpgradeAfterChecksEvenIfNotHealthy', 'continueUpgradeAfterChecksEvenIfNotHealthy', bool, False, False), + ('crashCollector', 'crashCollector', 'CrashCollector', False, True), + ('dashboard', 'dashboard', 'Dashboard', False, True), + ('dataDirHostPath', 'dataDirHostPath', str, False, False), + ('disruptionManagement', 'disruptionManagement', 'DisruptionManagement', False, True), + ('external', 'external', 'External', False, True), + ('healthCheck', 'healthCheck', 'HealthCheck', False, True), + ('labels', 'labels', object, False, True), + ('logCollector', 'logCollector', 'LogCollector', False, True), + ('mgr', 'mgr', 'Mgr', False, True), + ('mon', 'mon', 'Mon', False, True), + ('monitoring', 'monitoring', 'Monitoring', False, True), + ('network', 'network', 'Network', False, True), + ('placement', 'placement', object, False, True), + ('priorityClassNames', 'priorityClassNames', object, False, True), + ('removeOSDsIfOutAndSafeToRemove', 'removeOSDsIfOutAndSafeToRemove', bool, False, False), + ('resources', 'resources', object, False, True), + ('security', 'security', 'Security', False, True), + ('skipUpgradeChecks', 'skipUpgradeChecks', bool, False, False), + ('storage', 'storage', 'Storage', False, True), + ('waitTimeoutForHealthyOSDInMinutes', 'waitTimeoutForHealthyOSDInMinutes', int, False, False), + ('accessModes', 'accessModes', 'AccessModesList', False, False), + ('dataSource', 'dataSource', 'DataSource', False, False), + ('selector', 'selector', 'Selector', False, False), + ('storageClassName', 'storageClassName', str, False, False), + ('volumeMode', 'volumeMode', str, False, False), + ('volumeName', 'volumeName', str, False, False) + ] + + def __init__(self, + annotations=_omit, # type: Optional[Any] + cephVersion=_omit, # type: Optional[CephVersion] + cleanupPolicy=_omit, # type: Optional[CleanupPolicy] + continueUpgradeAfterChecksEvenIfNotHealthy=_omit, # type: Optional[bool] + crashCollector=_omit, # type: Optional[CrashCollector] + dashboard=_omit, # type: Optional[Dashboard] + dataDirHostPath=_omit, # type: Optional[str] + disruptionManagement=_omit, # type: Optional[DisruptionManagement] + external=_omit, # type: Optional[External] + healthCheck=_omit, # type: Optional[HealthCheck] + labels=_omit, # type: Optional[Any] + logCollector=_omit, # type: Optional[LogCollector] + mgr=_omit, # type: Optional[Mgr] + mon=_omit, # type: Optional[Mon] + monitoring=_omit, # type: Optional[Monitoring] + network=_omit, # type: Optional[Network] + placement=_omit, # type: Optional[Any] + priorityClassNames=_omit, # type: Optional[Any] + removeOSDsIfOutAndSafeToRemove=_omit, # type: Optional[bool] + resources=_omit, # type: Optional[Any] + security=_omit, # type: Optional[Security] + skipUpgradeChecks=_omit, # type: Optional[bool] + storage=_omit, # type: Optional[Storage] + waitTimeoutForHealthyOSDInMinutes=_omit, # type: Optional[int] + accessModes=_omit, # type: Optional[Union[List[str], CrdObjectList]] + dataSource=_omit, # type: Optional[DataSource] + selector=_omit, # type: Optional[Selector] + storageClassName=_omit, # type: Optional[str] + volumeMode=_omit, # type: Optional[str] + volumeName=_omit, # type: Optional[str] + ): + super(Spec, self).__init__( + annotations=annotations, + cephVersion=cephVersion, + cleanupPolicy=cleanupPolicy, + continueUpgradeAfterChecksEvenIfNotHealthy=continueUpgradeAfterChecksEvenIfNotHealthy, + crashCollector=crashCollector, + dashboard=dashboard, + dataDirHostPath=dataDirHostPath, + disruptionManagement=disruptionManagement, + external=external, + healthCheck=healthCheck, + labels=labels, + logCollector=logCollector, + mgr=mgr, + mon=mon, + monitoring=monitoring, + network=network, + placement=placement, + priorityClassNames=priorityClassNames, + removeOSDsIfOutAndSafeToRemove=removeOSDsIfOutAndSafeToRemove, + resources=resources, + security=security, + skipUpgradeChecks=skipUpgradeChecks, + storage=storage, + waitTimeoutForHealthyOSDInMinutes=waitTimeoutForHealthyOSDInMinutes, + accessModes=accessModes, + dataSource=dataSource, + selector=selector, + storageClassName=storageClassName, + volumeMode=volumeMode, + volumeName=volumeName, + ) + + @property + def annotations(self): + # type: () -> Optional[Any] + return self._property_impl('annotations') + + @annotations.setter + def annotations(self, new_val): + # type: (Optional[Any]) -> None + self._annotations = new_val + + @property + def cephVersion(self): + # type: () -> Optional[CephVersion] + return self._property_impl('cephVersion') + + @cephVersion.setter + def cephVersion(self, new_val): + # type: (Optional[CephVersion]) -> None + self._cephVersion = new_val + + @property + def cleanupPolicy(self): + # type: () -> Optional[CleanupPolicy] + return self._property_impl('cleanupPolicy') + + @cleanupPolicy.setter + def cleanupPolicy(self, new_val): + # type: (Optional[CleanupPolicy]) -> None + self._cleanupPolicy = new_val + + @property + def continueUpgradeAfterChecksEvenIfNotHealthy(self): + # type: () -> bool + return self._property_impl('continueUpgradeAfterChecksEvenIfNotHealthy') + + @continueUpgradeAfterChecksEvenIfNotHealthy.setter + def continueUpgradeAfterChecksEvenIfNotHealthy(self, new_val): + # type: (Optional[bool]) -> None + self._continueUpgradeAfterChecksEvenIfNotHealthy = new_val + + @property + def crashCollector(self): + # type: () -> Optional[CrashCollector] + return self._property_impl('crashCollector') + + @crashCollector.setter + def crashCollector(self, new_val): + # type: (Optional[CrashCollector]) -> None + self._crashCollector = new_val + + @property + def dashboard(self): + # type: () -> Optional[Dashboard] + return self._property_impl('dashboard') + + @dashboard.setter + def dashboard(self, new_val): + # type: (Optional[Dashboard]) -> None + self._dashboard = new_val + + @property + def dataDirHostPath(self): + # type: () -> str + return self._property_impl('dataDirHostPath') + + @dataDirHostPath.setter + def dataDirHostPath(self, new_val): + # type: (Optional[str]) -> None + self._dataDirHostPath = new_val + + @property + def disruptionManagement(self): + # type: () -> Optional[DisruptionManagement] + return self._property_impl('disruptionManagement') + + @disruptionManagement.setter + def disruptionManagement(self, new_val): + # type: (Optional[DisruptionManagement]) -> None + self._disruptionManagement = new_val + + @property + def external(self): + # type: () -> Optional[External] + return self._property_impl('external') + + @external.setter + def external(self, new_val): + # type: (Optional[External]) -> None + self._external = new_val + + @property + def healthCheck(self): + # type: () -> Optional[HealthCheck] + return self._property_impl('healthCheck') + + @healthCheck.setter + def healthCheck(self, new_val): + # type: (Optional[HealthCheck]) -> None + self._healthCheck = new_val + + @property + def labels(self): + # type: () -> Optional[Any] + return self._property_impl('labels') + + @labels.setter + def labels(self, new_val): + # type: (Optional[Any]) -> None + self._labels = new_val + + @property + def logCollector(self): + # type: () -> Optional[LogCollector] + return self._property_impl('logCollector') + + @logCollector.setter + def logCollector(self, new_val): + # type: (Optional[LogCollector]) -> None + self._logCollector = new_val + + @property + def mgr(self): + # type: () -> Optional[Mgr] + return self._property_impl('mgr') + + @mgr.setter + def mgr(self, new_val): + # type: (Optional[Mgr]) -> None + self._mgr = new_val + + @property + def mon(self): + # type: () -> Optional[Mon] + return self._property_impl('mon') + + @mon.setter + def mon(self, new_val): + # type: (Optional[Mon]) -> None + self._mon = new_val + + @property + def monitoring(self): + # type: () -> Optional[Monitoring] + return self._property_impl('monitoring') + + @monitoring.setter + def monitoring(self, new_val): + # type: (Optional[Monitoring]) -> None + self._monitoring = new_val + + @property + def network(self): + # type: () -> Optional[Network] + return self._property_impl('network') + + @network.setter + def network(self, new_val): + # type: (Optional[Network]) -> None + self._network = new_val + + @property + def placement(self): + # type: () -> Optional[Any] + return self._property_impl('placement') + + @placement.setter + def placement(self, new_val): + # type: (Optional[Any]) -> None + self._placement = new_val + + @property + def priorityClassNames(self): + # type: () -> Optional[Any] + return self._property_impl('priorityClassNames') + + @priorityClassNames.setter + def priorityClassNames(self, new_val): + # type: (Optional[Any]) -> None + self._priorityClassNames = new_val + + @property + def removeOSDsIfOutAndSafeToRemove(self): + # type: () -> bool + return self._property_impl('removeOSDsIfOutAndSafeToRemove') + + @removeOSDsIfOutAndSafeToRemove.setter + def removeOSDsIfOutAndSafeToRemove(self, new_val): + # type: (Optional[bool]) -> None + self._removeOSDsIfOutAndSafeToRemove = new_val + + @property + def resources(self): + # type: () -> Optional[Any] + return self._property_impl('resources') + + @resources.setter + def resources(self, new_val): + # type: (Optional[Any]) -> None + self._resources = new_val + + @property + def security(self): + # type: () -> Optional[Security] + return self._property_impl('security') + + @security.setter + def security(self, new_val): + # type: (Optional[Security]) -> None + self._security = new_val + + @property + def skipUpgradeChecks(self): + # type: () -> bool + return self._property_impl('skipUpgradeChecks') + + @skipUpgradeChecks.setter + def skipUpgradeChecks(self, new_val): + # type: (Optional[bool]) -> None + self._skipUpgradeChecks = new_val + + @property + def storage(self): + # type: () -> Optional[Storage] + return self._property_impl('storage') + + @storage.setter + def storage(self, new_val): + # type: (Optional[Storage]) -> None + self._storage = new_val + + @property + def waitTimeoutForHealthyOSDInMinutes(self): + # type: () -> int + return self._property_impl('waitTimeoutForHealthyOSDInMinutes') + + @waitTimeoutForHealthyOSDInMinutes.setter + def waitTimeoutForHealthyOSDInMinutes(self, new_val): + # type: (Optional[int]) -> None + self._waitTimeoutForHealthyOSDInMinutes = new_val + + @property + def accessModes(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('accessModes') + + @accessModes.setter + def accessModes(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._accessModes = new_val + + @property + def dataSource(self): + # type: () -> DataSource + return self._property_impl('dataSource') + + @dataSource.setter + def dataSource(self, new_val): + # type: (Optional[DataSource]) -> None + self._dataSource = new_val + + @property + def selector(self): + # type: () -> Selector + return self._property_impl('selector') + + @selector.setter + def selector(self, new_val): + # type: (Optional[Selector]) -> None + self._selector = new_val + + @property + def storageClassName(self): + # type: () -> str + return self._property_impl('storageClassName') + + @storageClassName.setter + def storageClassName(self, new_val): + # type: (Optional[str]) -> None + self._storageClassName = new_val + + @property + def volumeMode(self): + # type: () -> str + return self._property_impl('volumeMode') + + @volumeMode.setter + def volumeMode(self, new_val): + # type: (Optional[str]) -> None + self._volumeMode = new_val + + @property + def volumeName(self): + # type: () -> str + return self._property_impl('volumeName') + + @volumeName.setter + def volumeName(self, new_val): + # type: (Optional[str]) -> None + self._volumeName = new_val + + +class ConditionsItem(CrdObject): + _properties = [ + ('lastHeartbeatTime', 'lastHeartbeatTime', str, False, False), + ('lastTransitionTime', 'lastTransitionTime', str, False, False), + ('message', 'message', str, False, False), + ('reason', 'reason', str, False, False), + ('status', 'status', str, False, False), + ('type', 'type', str, False, False), + ('lastProbeTime', 'lastProbeTime', str, False, False) + ] + + def __init__(self, + lastHeartbeatTime=_omit, # type: Optional[str] + lastTransitionTime=_omit, # type: Optional[str] + message=_omit, # type: Optional[str] + reason=_omit, # type: Optional[str] + status=_omit, # type: Optional[str] + type=_omit, # type: Optional[str] + lastProbeTime=_omit, # type: Optional[str] + ): + super(ConditionsItem, self).__init__( + lastHeartbeatTime=lastHeartbeatTime, + lastTransitionTime=lastTransitionTime, + message=message, + reason=reason, + status=status, + type=type, + lastProbeTime=lastProbeTime, + ) + + @property + def lastHeartbeatTime(self): + # type: () -> str + return self._property_impl('lastHeartbeatTime') + + @lastHeartbeatTime.setter + def lastHeartbeatTime(self, new_val): + # type: (Optional[str]) -> None + self._lastHeartbeatTime = new_val + + @property + def lastTransitionTime(self): + # type: () -> str + return self._property_impl('lastTransitionTime') + + @lastTransitionTime.setter + def lastTransitionTime(self, new_val): + # type: (Optional[str]) -> None + self._lastTransitionTime = new_val + + @property + def message(self): + # type: () -> str + return self._property_impl('message') + + @message.setter + def message(self, new_val): + # type: (Optional[str]) -> None + self._message = new_val + + @property + def reason(self): + # type: () -> str + return self._property_impl('reason') + + @reason.setter + def reason(self, new_val): + # type: (Optional[str]) -> None + self._reason = new_val + + @property + def status(self): + # type: () -> str + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[str]) -> None + self._status = new_val + + @property + def type(self): + # type: () -> str + return self._property_impl('type') + + @type.setter + def type(self, new_val): + # type: (Optional[str]) -> None + self._type = new_val + + @property + def lastProbeTime(self): + # type: () -> str + return self._property_impl('lastProbeTime') + + @lastProbeTime.setter + def lastProbeTime(self, new_val): + # type: (Optional[str]) -> None + self._lastProbeTime = new_val + + +class ConditionsList(CrdObjectList): + _items_type = ConditionsItem + + +class VolumeClaimTemplate(CrdObject): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', 'Metadata', False, False), + ('spec', 'spec', 'Spec', False, False), + ('status', 'status', 'Status', False, False) + ] + + def __init__(self, + apiVersion=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Metadata] + spec=_omit, # type: Optional[Spec] + status=_omit, # type: Optional[Status] + ): + super(VolumeClaimTemplate, self).__init__( + apiVersion=apiVersion, + kind=kind, + metadata=metadata, + spec=spec, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Metadata + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Metadata]) -> None + self._metadata = new_val + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Optional[Spec]) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Status + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Status]) -> None + self._status = new_val + + +class ZonesItem(CrdObject): + _properties = [ + ('arbiter', 'arbiter', bool, False, False), + ('name', 'name', str, False, False), + ('volumeClaimTemplate', 'volumeClaimTemplate', 'VolumeClaimTemplate', False, False) + ] + + def __init__(self, + arbiter=_omit, # type: Optional[bool] + name=_omit, # type: Optional[str] + volumeClaimTemplate=_omit, # type: Optional[VolumeClaimTemplate] + ): + super(ZonesItem, self).__init__( + arbiter=arbiter, + name=name, + volumeClaimTemplate=volumeClaimTemplate, + ) + + @property + def arbiter(self): + # type: () -> bool + return self._property_impl('arbiter') + + @arbiter.setter + def arbiter(self, new_val): + # type: (Optional[bool]) -> None + self._arbiter = new_val + + @property + def name(self): + # type: () -> str + return self._property_impl('name') + + @name.setter + def name(self, new_val): + # type: (Optional[str]) -> None + self._name = new_val + + @property + def volumeClaimTemplate(self): + # type: () -> VolumeClaimTemplate + return self._property_impl('volumeClaimTemplate') + + @volumeClaimTemplate.setter + def volumeClaimTemplate(self, new_val): + # type: (Optional[VolumeClaimTemplate]) -> None + self._volumeClaimTemplate = new_val + + +class ZonesList(CrdObjectList): + _items_type = ZonesItem + + +class StretchCluster(CrdObject): + _properties = [ + ('failureDomainLabel', 'failureDomainLabel', str, False, False), + ('subFailureDomain', 'subFailureDomain', str, False, False), + ('zones', 'zones', 'ZonesList', False, True) + ] + + def __init__(self, + failureDomainLabel=_omit, # type: Optional[str] + subFailureDomain=_omit, # type: Optional[str] + zones=_omit, # type: Optional[Union[List[ZonesItem], CrdObjectList]] + ): + super(StretchCluster, self).__init__( + failureDomainLabel=failureDomainLabel, + subFailureDomain=subFailureDomain, + zones=zones, + ) + + @property + def failureDomainLabel(self): + # type: () -> str + return self._property_impl('failureDomainLabel') + + @failureDomainLabel.setter + def failureDomainLabel(self, new_val): + # type: (Optional[str]) -> None + self._failureDomainLabel = new_val + + @property + def subFailureDomain(self): + # type: () -> str + return self._property_impl('subFailureDomain') + + @subFailureDomain.setter + def subFailureDomain(self, new_val): + # type: (Optional[str]) -> None + self._subFailureDomain = new_val + + @property + def zones(self): + # type: () -> Optional[Union[List[ZonesItem], CrdObjectList]] + return self._property_impl('zones') + + @zones.setter + def zones(self, new_val): + # type: (Optional[Union[List[ZonesItem], CrdObjectList]]) -> None + self._zones = new_val + + +class TargetRef(CrdObject): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('fieldPath', 'fieldPath', str, False, False), + ('kind', 'kind', str, False, False), + ('name', 'name', str, False, False), + ('namespace', 'namespace', str, False, False), + ('resourceVersion', 'resourceVersion', str, False, False), + ('uid', 'uid', str, False, False) + ] + + def __init__(self, + apiVersion=_omit, # type: Optional[str] + fieldPath=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + name=_omit, # type: Optional[str] + namespace=_omit, # type: Optional[str] + resourceVersion=_omit, # type: Optional[str] + uid=_omit, # type: Optional[str] + ): + super(TargetRef, self).__init__( + apiVersion=apiVersion, + fieldPath=fieldPath, + kind=kind, + name=name, + namespace=namespace, + resourceVersion=resourceVersion, + uid=uid, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def fieldPath(self): + # type: () -> str + return self._property_impl('fieldPath') + + @fieldPath.setter + def fieldPath(self, new_val): + # type: (Optional[str]) -> None + self._fieldPath = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def name(self): + # type: () -> str + return self._property_impl('name') + + @name.setter + def name(self, new_val): + # type: (Optional[str]) -> None + self._name = new_val + + @property + def namespace(self): + # type: () -> str + return self._property_impl('namespace') + + @namespace.setter + def namespace(self, new_val): + # type: (Optional[str]) -> None + self._namespace = new_val + + @property + def resourceVersion(self): + # type: () -> str + return self._property_impl('resourceVersion') + + @resourceVersion.setter + def resourceVersion(self, new_val): + # type: (Optional[str]) -> None + self._resourceVersion = new_val + + @property + def uid(self): + # type: () -> str + return self._property_impl('uid') + + @uid.setter + def uid(self, new_val): + # type: (Optional[str]) -> None + self._uid = new_val + + +class ExternalMgrEndpointsItem(CrdObject): + _properties = [ + ('hostname', 'hostname', str, False, False), + ('ip', 'ip', str, True, False), + ('nodeName', 'nodeName', str, False, False), + ('targetRef', 'targetRef', 'TargetRef', False, False) + ] + + def __init__(self, + ip, # type: str + hostname=_omit, # type: Optional[str] + nodeName=_omit, # type: Optional[str] + targetRef=_omit, # type: Optional[TargetRef] + ): + super(ExternalMgrEndpointsItem, self).__init__( + ip=ip, + hostname=hostname, + nodeName=nodeName, + targetRef=targetRef, + ) + + @property + def hostname(self): + # type: () -> str + return self._property_impl('hostname') + + @hostname.setter + def hostname(self, new_val): + # type: (Optional[str]) -> None + self._hostname = new_val + + @property + def ip(self): + # type: () -> str + return self._property_impl('ip') + + @ip.setter + def ip(self, new_val): + # type: (str) -> None + self._ip = new_val + + @property + def nodeName(self): + # type: () -> str + return self._property_impl('nodeName') + + @nodeName.setter + def nodeName(self, new_val): + # type: (Optional[str]) -> None + self._nodeName = new_val + + @property + def targetRef(self): + # type: () -> TargetRef + return self._property_impl('targetRef') + + @targetRef.setter + def targetRef(self, new_val): + # type: (Optional[TargetRef]) -> None + self._targetRef = new_val + + +class ExternalMgrEndpointsList(CrdObjectList): + _items_type = ExternalMgrEndpointsItem + + +class Monitoring(CrdObject): + _properties = [ + ('enabled', 'enabled', bool, False, False), + ('externalMgrEndpoints', 'externalMgrEndpoints', 'ExternalMgrEndpointsList', False, True), + ('externalMgrPrometheusPort', 'externalMgrPrometheusPort', int, False, False), + ('rulesNamespace', 'rulesNamespace', str, False, False) + ] + + def __init__(self, + enabled=_omit, # type: Optional[bool] + externalMgrEndpoints=_omit, # type: Optional[Union[List[ExternalMgrEndpointsItem], CrdObjectList]] + externalMgrPrometheusPort=_omit, # type: Optional[int] + rulesNamespace=_omit, # type: Optional[str] + ): + super(Monitoring, self).__init__( + enabled=enabled, + externalMgrEndpoints=externalMgrEndpoints, + externalMgrPrometheusPort=externalMgrPrometheusPort, + rulesNamespace=rulesNamespace, + ) + + @property + def enabled(self): + # type: () -> bool + return self._property_impl('enabled') + + @enabled.setter + def enabled(self, new_val): + # type: (Optional[bool]) -> None + self._enabled = new_val + + @property + def externalMgrEndpoints(self): + # type: () -> Optional[Union[List[ExternalMgrEndpointsItem], CrdObjectList]] + return self._property_impl('externalMgrEndpoints') + + @externalMgrEndpoints.setter + def externalMgrEndpoints(self, new_val): + # type: (Optional[Union[List[ExternalMgrEndpointsItem], CrdObjectList]]) -> None + self._externalMgrEndpoints = new_val + + @property + def externalMgrPrometheusPort(self): + # type: () -> int + return self._property_impl('externalMgrPrometheusPort') + + @externalMgrPrometheusPort.setter + def externalMgrPrometheusPort(self, new_val): + # type: (Optional[int]) -> None + self._externalMgrPrometheusPort = new_val + + @property + def rulesNamespace(self): + # type: () -> str + return self._property_impl('rulesNamespace') + + @rulesNamespace.setter + def rulesNamespace(self, new_val): + # type: (Optional[str]) -> None + self._rulesNamespace = new_val + + +class Network(CrdObject): + _properties = [ + ('dualStack', 'dualStack', bool, False, False), + ('hostNetwork', 'hostNetwork', bool, False, False), + ('ipFamily', 'ipFamily', str, False, True), + ('provider', 'provider', str, False, True), + ('selectors', 'selectors', object, False, True) + ] + + def __init__(self, + dualStack=_omit, # type: Optional[bool] + hostNetwork=_omit, # type: Optional[bool] + ipFamily=_omit, # type: Optional[str] + provider=_omit, # type: Optional[str] + selectors=_omit, # type: Optional[Any] + ): + super(Network, self).__init__( + dualStack=dualStack, + hostNetwork=hostNetwork, + ipFamily=ipFamily, + provider=provider, + selectors=selectors, + ) + + @property + def dualStack(self): + # type: () -> bool + return self._property_impl('dualStack') + + @dualStack.setter + def dualStack(self, new_val): + # type: (Optional[bool]) -> None + self._dualStack = new_val + + @property + def hostNetwork(self): + # type: () -> bool + return self._property_impl('hostNetwork') + + @hostNetwork.setter + def hostNetwork(self, new_val): + # type: (Optional[bool]) -> None + self._hostNetwork = new_val + + @property + def ipFamily(self): + # type: () -> Optional[str] + return self._property_impl('ipFamily') + + @ipFamily.setter + def ipFamily(self, new_val): + # type: (Optional[str]) -> None + self._ipFamily = new_val + + @property + def provider(self): + # type: () -> Optional[str] + return self._property_impl('provider') + + @provider.setter + def provider(self, new_val): + # type: (Optional[str]) -> None + self._provider = new_val + + @property + def selectors(self): + # type: () -> Optional[Any] + return self._property_impl('selectors') + + @selectors.setter + def selectors(self, new_val): + # type: (Optional[Any]) -> None + self._selectors = new_val + + +class Kms(CrdObject): + _properties = [ + ('connectionDetails', 'connectionDetails', object, False, True), + ('tokenSecretName', 'tokenSecretName', str, False, False) + ] + + def __init__(self, + connectionDetails=_omit, # type: Optional[Any] + tokenSecretName=_omit, # type: Optional[str] + ): + super(Kms, self).__init__( + connectionDetails=connectionDetails, + tokenSecretName=tokenSecretName, + ) + + @property + def connectionDetails(self): + # type: () -> Optional[Any] + return self._property_impl('connectionDetails') + + @connectionDetails.setter + def connectionDetails(self, new_val): + # type: (Optional[Any]) -> None + self._connectionDetails = new_val + + @property + def tokenSecretName(self): + # type: () -> str + return self._property_impl('tokenSecretName') + + @tokenSecretName.setter + def tokenSecretName(self, new_val): + # type: (Optional[str]) -> None + self._tokenSecretName = new_val + + +class Security(CrdObject): + _properties = [ + ('kms', 'kms', 'Kms', False, True) + ] + + def __init__(self, + kms=_omit, # type: Optional[Kms] + ): + super(Security, self).__init__( + kms=kms, + ) + + @property + def kms(self): + # type: () -> Optional[Kms] + return self._property_impl('kms') + + @kms.setter + def kms(self, new_val): + # type: (Optional[Kms]) -> None + self._kms = new_val + + +class DevicesItem(CrdObject): + _properties = [ + ('config', 'config', object, False, False), + ('fullpath', 'fullpath', str, False, False), + ('name', 'name', str, False, False) + ] + + def __init__(self, + config=_omit, # type: Optional[Any] + fullpath=_omit, # type: Optional[str] + name=_omit, # type: Optional[str] + ): + super(DevicesItem, self).__init__( + config=config, + fullpath=fullpath, + name=name, + ) + + @property + def config(self): + # type: () -> Any + return self._property_impl('config') + + @config.setter + def config(self, new_val): + # type: (Optional[Any]) -> None + self._config = new_val + + @property + def fullpath(self): + # type: () -> str + return self._property_impl('fullpath') + + @fullpath.setter + def fullpath(self, new_val): + # type: (Optional[str]) -> None + self._fullpath = new_val + + @property + def name(self): + # type: () -> str + return self._property_impl('name') + + @name.setter + def name(self, new_val): + # type: (Optional[str]) -> None + self._name = new_val + + +class DevicesList(CrdObjectList): + _items_type = DevicesItem + + +class VolumeClaimTemplatesItem(CrdObject): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', 'Metadata', False, False), + ('spec', 'spec', 'Spec', False, False), + ('status', 'status', 'Status', False, False) + ] + + def __init__(self, + apiVersion=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Metadata] + spec=_omit, # type: Optional[Spec] + status=_omit, # type: Optional[Status] + ): + super(VolumeClaimTemplatesItem, self).__init__( + apiVersion=apiVersion, + kind=kind, + metadata=metadata, + spec=spec, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Metadata + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Metadata]) -> None + self._metadata = new_val + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Optional[Spec]) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Status + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Status]) -> None + self._status = new_val + + +class VolumeClaimTemplatesList(CrdObjectList): + _items_type = VolumeClaimTemplatesItem + + +class NodesItem(CrdObject): + _properties = [ + ('config', 'config', object, False, True), + ('deviceFilter', 'deviceFilter', str, False, False), + ('devicePathFilter', 'devicePathFilter', str, False, False), + ('devices', 'devices', 'DevicesList', False, True), + ('name', 'name', str, False, False), + ('resources', 'resources', 'Resources', False, True), + ('useAllDevices', 'useAllDevices', bool, False, False), + ('volumeClaimTemplates', 'volumeClaimTemplates', 'VolumeClaimTemplatesList', False, False) + ] + + def __init__(self, + config=_omit, # type: Optional[Any] + deviceFilter=_omit, # type: Optional[str] + devicePathFilter=_omit, # type: Optional[str] + devices=_omit, # type: Optional[Union[List[DevicesItem], CrdObjectList]] + name=_omit, # type: Optional[str] + resources=_omit, # type: Optional[Resources] + useAllDevices=_omit, # type: Optional[bool] + volumeClaimTemplates=_omit, # type: Optional[Union[List[VolumeClaimTemplatesItem], CrdObjectList]] + ): + super(NodesItem, self).__init__( + config=config, + deviceFilter=deviceFilter, + devicePathFilter=devicePathFilter, + devices=devices, + name=name, + resources=resources, + useAllDevices=useAllDevices, + volumeClaimTemplates=volumeClaimTemplates, + ) + + @property + def config(self): + # type: () -> Optional[Any] + return self._property_impl('config') + + @config.setter + def config(self, new_val): + # type: (Optional[Any]) -> None + self._config = new_val + + @property + def deviceFilter(self): + # type: () -> str + return self._property_impl('deviceFilter') + + @deviceFilter.setter + def deviceFilter(self, new_val): + # type: (Optional[str]) -> None + self._deviceFilter = new_val + + @property + def devicePathFilter(self): + # type: () -> str + return self._property_impl('devicePathFilter') + + @devicePathFilter.setter + def devicePathFilter(self, new_val): + # type: (Optional[str]) -> None + self._devicePathFilter = new_val + + @property + def devices(self): + # type: () -> Optional[Union[List[DevicesItem], CrdObjectList]] + return self._property_impl('devices') + + @devices.setter + def devices(self, new_val): + # type: (Optional[Union[List[DevicesItem], CrdObjectList]]) -> None + self._devices = new_val + + @property + def name(self): + # type: () -> str + return self._property_impl('name') + + @name.setter + def name(self, new_val): + # type: (Optional[str]) -> None + self._name = new_val + + @property + def resources(self): + # type: () -> Optional[Resources] + return self._property_impl('resources') + + @resources.setter + def resources(self, new_val): + # type: (Optional[Resources]) -> None + self._resources = new_val + + @property + def useAllDevices(self): + # type: () -> bool + return self._property_impl('useAllDevices') + + @useAllDevices.setter + def useAllDevices(self, new_val): + # type: (Optional[bool]) -> None + self._useAllDevices = new_val + + @property + def volumeClaimTemplates(self): + # type: () -> Union[List[VolumeClaimTemplatesItem], CrdObjectList] + return self._property_impl('volumeClaimTemplates') + + @volumeClaimTemplates.setter + def volumeClaimTemplates(self, new_val): + # type: (Optional[Union[List[VolumeClaimTemplatesItem], CrdObjectList]]) -> None + self._volumeClaimTemplates = new_val + + +class NodesList(CrdObjectList): + _items_type = NodesItem + + +class MatchFieldsItem(CrdObject): + _properties = [ + ('key', 'key', str, True, False), + ('operator', 'operator', str, True, False), + ('values', 'values', 'ValuesList', False, False) + ] + + def __init__(self, + key, # type: str + operator, # type: str + values=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(MatchFieldsItem, self).__init__( + key=key, + operator=operator, + values=values, + ) + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (str) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (str) -> None + self._operator = new_val + + @property + def values(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('values') + + @values.setter + def values(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._values = new_val + + +class MatchFieldsList(CrdObjectList): + _items_type = MatchFieldsItem + + +class Preference(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchFields', 'matchFields', 'MatchFieldsList', False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchFields=_omit, # type: Optional[Union[List[MatchFieldsItem], CrdObjectList]] + ): + super(Preference, self).__init__( + matchExpressions=matchExpressions, + matchFields=matchFields, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchFields(self): + # type: () -> Union[List[MatchFieldsItem], CrdObjectList] + return self._property_impl('matchFields') + + @matchFields.setter + def matchFields(self, new_val): + # type: (Optional[Union[List[MatchFieldsItem], CrdObjectList]]) -> None + self._matchFields = new_val + + +class PreferredDuringSchedulingIgnoredDuringExecutionItem(CrdObject): + _properties = [ + ('podAffinityTerm', 'podAffinityTerm', 'PodAffinityTerm', False, False), + ('weight', 'weight', int, False, False), + ('preference', 'preference', 'Preference', False, False) + ] + + def __init__(self, + podAffinityTerm=_omit, # type: Optional[PodAffinityTerm] + weight=_omit, # type: Optional[int] + preference=_omit, # type: Optional[Preference] + ): + super(PreferredDuringSchedulingIgnoredDuringExecutionItem, self).__init__( + podAffinityTerm=podAffinityTerm, + weight=weight, + preference=preference, + ) + + @property + def podAffinityTerm(self): + # type: () -> PodAffinityTerm + return self._property_impl('podAffinityTerm') + + @podAffinityTerm.setter + def podAffinityTerm(self, new_val): + # type: (Optional[PodAffinityTerm]) -> None + self._podAffinityTerm = new_val + + @property + def weight(self): + # type: () -> int + return self._property_impl('weight') + + @weight.setter + def weight(self, new_val): + # type: (Optional[int]) -> None + self._weight = new_val + + @property + def preference(self): + # type: () -> Preference + return self._property_impl('preference') + + @preference.setter + def preference(self, new_val): + # type: (Optional[Preference]) -> None + self._preference = new_val + + +class PreferredDuringSchedulingIgnoredDuringExecutionList(CrdObjectList): + _items_type = PreferredDuringSchedulingIgnoredDuringExecutionItem + + +class NodeSelectorTermsItem(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchFields', 'matchFields', 'MatchFieldsList', False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchFields=_omit, # type: Optional[Union[List[MatchFieldsItem], CrdObjectList]] + ): + super(NodeSelectorTermsItem, self).__init__( + matchExpressions=matchExpressions, + matchFields=matchFields, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchFields(self): + # type: () -> Union[List[MatchFieldsItem], CrdObjectList] + return self._property_impl('matchFields') + + @matchFields.setter + def matchFields(self, new_val): + # type: (Optional[Union[List[MatchFieldsItem], CrdObjectList]]) -> None + self._matchFields = new_val + + +class NodeSelectorTermsList(CrdObjectList): + _items_type = NodeSelectorTermsItem + + +class RequiredDuringSchedulingIgnoredDuringExecution(CrdObject): + _properties = [ + ('nodeSelectorTerms', 'nodeSelectorTerms', 'NodeSelectorTermsList', True, False) + ] + + def __init__(self, + nodeSelectorTerms, # type: Union[List[NodeSelectorTermsItem], CrdObjectList] + ): + super(RequiredDuringSchedulingIgnoredDuringExecution, self).__init__( + nodeSelectorTerms=nodeSelectorTerms, + ) + + @property + def nodeSelectorTerms(self): + # type: () -> Union[List[NodeSelectorTermsItem], CrdObjectList] + return self._property_impl('nodeSelectorTerms') + + @nodeSelectorTerms.setter + def nodeSelectorTerms(self, new_val): + # type: (Union[List[NodeSelectorTermsItem], CrdObjectList]) -> None + self._nodeSelectorTerms = new_val + + +class NodeAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecution', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[RequiredDuringSchedulingIgnoredDuringExecution] + ): + super(NodeAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> RequiredDuringSchedulingIgnoredDuringExecution + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[RequiredDuringSchedulingIgnoredDuringExecution]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class LabelSelector(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchLabels', 'matchLabels', object, False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchLabels=_omit, # type: Optional[Any] + ): + super(LabelSelector, self).__init__( + matchExpressions=matchExpressions, + matchLabels=matchLabels, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchLabels(self): + # type: () -> Any + return self._property_impl('matchLabels') + + @matchLabels.setter + def matchLabels(self, new_val): + # type: (Optional[Any]) -> None + self._matchLabels = new_val + + +class NamespaceSelector(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchLabels', 'matchLabels', object, False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchLabels=_omit, # type: Optional[Any] + ): + super(NamespaceSelector, self).__init__( + matchExpressions=matchExpressions, + matchLabels=matchLabels, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchLabels(self): + # type: () -> Any + return self._property_impl('matchLabels') + + @matchLabels.setter + def matchLabels(self, new_val): + # type: (Optional[Any]) -> None + self._matchLabels = new_val + + +class NamespacesList(CrdObjectList): + _items_type = str + + +class PodAffinityTerm(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('namespaceSelector', 'namespaceSelector', 'NamespaceSelector', False, False), + ('namespaces', 'namespaces', 'NamespacesList', False, False), + ('topologyKey', 'topologyKey', str, True, False) + ] + + def __init__(self, + topologyKey, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + namespaceSelector=_omit, # type: Optional[NamespaceSelector] + namespaces=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(PodAffinityTerm, self).__init__( + topologyKey=topologyKey, + labelSelector=labelSelector, + namespaceSelector=namespaceSelector, + namespaces=namespaces, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def namespaceSelector(self): + # type: () -> NamespaceSelector + return self._property_impl('namespaceSelector') + + @namespaceSelector.setter + def namespaceSelector(self, new_val): + # type: (Optional[NamespaceSelector]) -> None + self._namespaceSelector = new_val + + @property + def namespaces(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('namespaces') + + @namespaces.setter + def namespaces(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._namespaces = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + +class RequiredDuringSchedulingIgnoredDuringExecutionItem(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('namespaceSelector', 'namespaceSelector', 'NamespaceSelector', False, False), + ('namespaces', 'namespaces', 'NamespacesList', False, False), + ('topologyKey', 'topologyKey', str, True, False) + ] + + def __init__(self, + topologyKey, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + namespaceSelector=_omit, # type: Optional[NamespaceSelector] + namespaces=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(RequiredDuringSchedulingIgnoredDuringExecutionItem, self).__init__( + topologyKey=topologyKey, + labelSelector=labelSelector, + namespaceSelector=namespaceSelector, + namespaces=namespaces, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def namespaceSelector(self): + # type: () -> NamespaceSelector + return self._property_impl('namespaceSelector') + + @namespaceSelector.setter + def namespaceSelector(self, new_val): + # type: (Optional[NamespaceSelector]) -> None + self._namespaceSelector = new_val + + @property + def namespaces(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('namespaces') + + @namespaces.setter + def namespaces(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._namespaces = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + +class RequiredDuringSchedulingIgnoredDuringExecutionList(CrdObjectList): + _items_type = RequiredDuringSchedulingIgnoredDuringExecutionItem + + +class PodAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecutionList', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + ): + super(PodAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class PodAntiAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecutionList', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + ): + super(PodAntiAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class TolerationsItem(CrdObject): + _properties = [ + ('effect', 'effect', str, False, False), + ('key', 'key', str, False, False), + ('operator', 'operator', str, False, False), + ('tolerationSeconds', 'tolerationSeconds', int, False, False), + ('value', 'value', str, False, False) + ] + + def __init__(self, + effect=_omit, # type: Optional[str] + key=_omit, # type: Optional[str] + operator=_omit, # type: Optional[str] + tolerationSeconds=_omit, # type: Optional[int] + value=_omit, # type: Optional[str] + ): + super(TolerationsItem, self).__init__( + effect=effect, + key=key, + operator=operator, + tolerationSeconds=tolerationSeconds, + value=value, + ) + + @property + def effect(self): + # type: () -> str + return self._property_impl('effect') + + @effect.setter + def effect(self, new_val): + # type: (Optional[str]) -> None + self._effect = new_val + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (Optional[str]) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (Optional[str]) -> None + self._operator = new_val + + @property + def tolerationSeconds(self): + # type: () -> int + return self._property_impl('tolerationSeconds') + + @tolerationSeconds.setter + def tolerationSeconds(self, new_val): + # type: (Optional[int]) -> None + self._tolerationSeconds = new_val + + @property + def value(self): + # type: () -> str + return self._property_impl('value') + + @value.setter + def value(self, new_val): + # type: (Optional[str]) -> None + self._value = new_val + + +class TolerationsList(CrdObjectList): + _items_type = TolerationsItem + + +class TopologySpreadConstraintsItem(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('maxSkew', 'maxSkew', int, True, False), + ('topologyKey', 'topologyKey', str, True, False), + ('whenUnsatisfiable', 'whenUnsatisfiable', str, True, False) + ] + + def __init__(self, + maxSkew, # type: int + topologyKey, # type: str + whenUnsatisfiable, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + ): + super(TopologySpreadConstraintsItem, self).__init__( + maxSkew=maxSkew, + topologyKey=topologyKey, + whenUnsatisfiable=whenUnsatisfiable, + labelSelector=labelSelector, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def maxSkew(self): + # type: () -> int + return self._property_impl('maxSkew') + + @maxSkew.setter + def maxSkew(self, new_val): + # type: (int) -> None + self._maxSkew = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + @property + def whenUnsatisfiable(self): + # type: () -> str + return self._property_impl('whenUnsatisfiable') + + @whenUnsatisfiable.setter + def whenUnsatisfiable(self, new_val): + # type: (str) -> None + self._whenUnsatisfiable = new_val + + +class TopologySpreadConstraintsList(CrdObjectList): + _items_type = TopologySpreadConstraintsItem + + +class Placement(CrdObject): + _properties = [ + ('nodeAffinity', 'nodeAffinity', 'NodeAffinity', False, False), + ('podAffinity', 'podAffinity', 'PodAffinity', False, False), + ('podAntiAffinity', 'podAntiAffinity', 'PodAntiAffinity', False, False), + ('tolerations', 'tolerations', 'TolerationsList', False, False), + ('topologySpreadConstraints', 'topologySpreadConstraints', 'TopologySpreadConstraintsList', False, False) + ] + + def __init__(self, + nodeAffinity=_omit, # type: Optional[NodeAffinity] + podAffinity=_omit, # type: Optional[PodAffinity] + podAntiAffinity=_omit, # type: Optional[PodAntiAffinity] + tolerations=_omit, # type: Optional[Union[List[TolerationsItem], CrdObjectList]] + topologySpreadConstraints=_omit, # type: Optional[Union[List[TopologySpreadConstraintsItem], CrdObjectList]] + ): + super(Placement, self).__init__( + nodeAffinity=nodeAffinity, + podAffinity=podAffinity, + podAntiAffinity=podAntiAffinity, + tolerations=tolerations, + topologySpreadConstraints=topologySpreadConstraints, + ) + + @property + def nodeAffinity(self): + # type: () -> NodeAffinity + return self._property_impl('nodeAffinity') + + @nodeAffinity.setter + def nodeAffinity(self, new_val): + # type: (Optional[NodeAffinity]) -> None + self._nodeAffinity = new_val + + @property + def podAffinity(self): + # type: () -> PodAffinity + return self._property_impl('podAffinity') + + @podAffinity.setter + def podAffinity(self, new_val): + # type: (Optional[PodAffinity]) -> None + self._podAffinity = new_val + + @property + def podAntiAffinity(self): + # type: () -> PodAntiAffinity + return self._property_impl('podAntiAffinity') + + @podAntiAffinity.setter + def podAntiAffinity(self, new_val): + # type: (Optional[PodAntiAffinity]) -> None + self._podAntiAffinity = new_val + + @property + def tolerations(self): + # type: () -> Union[List[TolerationsItem], CrdObjectList] + return self._property_impl('tolerations') + + @tolerations.setter + def tolerations(self, new_val): + # type: (Optional[Union[List[TolerationsItem], CrdObjectList]]) -> None + self._tolerations = new_val + + @property + def topologySpreadConstraints(self): + # type: () -> Union[List[TopologySpreadConstraintsItem], CrdObjectList] + return self._property_impl('topologySpreadConstraints') + + @topologySpreadConstraints.setter + def topologySpreadConstraints(self, new_val): + # type: (Optional[Union[List[TopologySpreadConstraintsItem], CrdObjectList]]) -> None + self._topologySpreadConstraints = new_val + + +class PreparePlacement(CrdObject): + _properties = [ + ('nodeAffinity', 'nodeAffinity', 'NodeAffinity', False, False), + ('podAffinity', 'podAffinity', 'PodAffinity', False, False), + ('podAntiAffinity', 'podAntiAffinity', 'PodAntiAffinity', False, False), + ('tolerations', 'tolerations', 'TolerationsList', False, False), + ('topologySpreadConstraints', 'topologySpreadConstraints', 'TopologySpreadConstraintsList', False, False) + ] + + def __init__(self, + nodeAffinity=_omit, # type: Optional[NodeAffinity] + podAffinity=_omit, # type: Optional[PodAffinity] + podAntiAffinity=_omit, # type: Optional[PodAntiAffinity] + tolerations=_omit, # type: Optional[Union[List[TolerationsItem], CrdObjectList]] + topologySpreadConstraints=_omit, # type: Optional[Union[List[TopologySpreadConstraintsItem], CrdObjectList]] + ): + super(PreparePlacement, self).__init__( + nodeAffinity=nodeAffinity, + podAffinity=podAffinity, + podAntiAffinity=podAntiAffinity, + tolerations=tolerations, + topologySpreadConstraints=topologySpreadConstraints, + ) + + @property + def nodeAffinity(self): + # type: () -> NodeAffinity + return self._property_impl('nodeAffinity') + + @nodeAffinity.setter + def nodeAffinity(self, new_val): + # type: (Optional[NodeAffinity]) -> None + self._nodeAffinity = new_val + + @property + def podAffinity(self): + # type: () -> PodAffinity + return self._property_impl('podAffinity') + + @podAffinity.setter + def podAffinity(self, new_val): + # type: (Optional[PodAffinity]) -> None + self._podAffinity = new_val + + @property + def podAntiAffinity(self): + # type: () -> PodAntiAffinity + return self._property_impl('podAntiAffinity') + + @podAntiAffinity.setter + def podAntiAffinity(self, new_val): + # type: (Optional[PodAntiAffinity]) -> None + self._podAntiAffinity = new_val + + @property + def tolerations(self): + # type: () -> Union[List[TolerationsItem], CrdObjectList] + return self._property_impl('tolerations') + + @tolerations.setter + def tolerations(self, new_val): + # type: (Optional[Union[List[TolerationsItem], CrdObjectList]]) -> None + self._tolerations = new_val + + @property + def topologySpreadConstraints(self): + # type: () -> Union[List[TopologySpreadConstraintsItem], CrdObjectList] + return self._property_impl('topologySpreadConstraints') + + @topologySpreadConstraints.setter + def topologySpreadConstraints(self, new_val): + # type: (Optional[Union[List[TopologySpreadConstraintsItem], CrdObjectList]]) -> None + self._topologySpreadConstraints = new_val + + +class StorageClassDeviceSetsItem(CrdObject): + _properties = [ + ('config', 'config', object, False, True), + ('count', 'count', int, True, False), + ('encrypted', 'encrypted', bool, False, False), + ('name', 'name', str, True, False), + ('placement', 'placement', 'Placement', False, True), + ('portable', 'portable', bool, False, False), + ('preparePlacement', 'preparePlacement', 'PreparePlacement', False, True), + ('resources', 'resources', 'Resources', False, True), + ('schedulerName', 'schedulerName', str, False, False), + ('tuneDeviceClass', 'tuneDeviceClass', bool, False, False), + ('tuneFastDeviceClass', 'tuneFastDeviceClass', bool, False, False), + ('volumeClaimTemplates', 'volumeClaimTemplates', 'VolumeClaimTemplatesList', True, False) + ] + + def __init__(self, + count, # type: int + name, # type: str + volumeClaimTemplates, # type: Union[List[VolumeClaimTemplatesItem], CrdObjectList] + config=_omit, # type: Optional[Any] + encrypted=_omit, # type: Optional[bool] + placement=_omit, # type: Optional[Placement] + portable=_omit, # type: Optional[bool] + preparePlacement=_omit, # type: Optional[PreparePlacement] + resources=_omit, # type: Optional[Resources] + schedulerName=_omit, # type: Optional[str] + tuneDeviceClass=_omit, # type: Optional[bool] + tuneFastDeviceClass=_omit, # type: Optional[bool] + ): + super(StorageClassDeviceSetsItem, self).__init__( + count=count, + name=name, + volumeClaimTemplates=volumeClaimTemplates, + config=config, + encrypted=encrypted, + placement=placement, + portable=portable, + preparePlacement=preparePlacement, + resources=resources, + schedulerName=schedulerName, + tuneDeviceClass=tuneDeviceClass, + tuneFastDeviceClass=tuneFastDeviceClass, + ) + + @property + def config(self): + # type: () -> Optional[Any] + return self._property_impl('config') + + @config.setter + def config(self, new_val): + # type: (Optional[Any]) -> None + self._config = new_val + + @property + def count(self): + # type: () -> int + return self._property_impl('count') + + @count.setter + def count(self, new_val): + # type: (int) -> None + self._count = new_val + + @property + def encrypted(self): + # type: () -> bool + return self._property_impl('encrypted') + + @encrypted.setter + def encrypted(self, new_val): + # type: (Optional[bool]) -> None + self._encrypted = new_val + + @property + def name(self): + # type: () -> str + return self._property_impl('name') + + @name.setter + def name(self, new_val): + # type: (str) -> None + self._name = new_val + + @property + def placement(self): + # type: () -> Optional[Placement] + return self._property_impl('placement') + + @placement.setter + def placement(self, new_val): + # type: (Optional[Placement]) -> None + self._placement = new_val + + @property + def portable(self): + # type: () -> bool + return self._property_impl('portable') + + @portable.setter + def portable(self, new_val): + # type: (Optional[bool]) -> None + self._portable = new_val + + @property + def preparePlacement(self): + # type: () -> Optional[PreparePlacement] + return self._property_impl('preparePlacement') + + @preparePlacement.setter + def preparePlacement(self, new_val): + # type: (Optional[PreparePlacement]) -> None + self._preparePlacement = new_val + + @property + def resources(self): + # type: () -> Optional[Resources] + return self._property_impl('resources') + + @resources.setter + def resources(self, new_val): + # type: (Optional[Resources]) -> None + self._resources = new_val + + @property + def schedulerName(self): + # type: () -> str + return self._property_impl('schedulerName') + + @schedulerName.setter + def schedulerName(self, new_val): + # type: (Optional[str]) -> None + self._schedulerName = new_val + + @property + def tuneDeviceClass(self): + # type: () -> bool + return self._property_impl('tuneDeviceClass') + + @tuneDeviceClass.setter + def tuneDeviceClass(self, new_val): + # type: (Optional[bool]) -> None + self._tuneDeviceClass = new_val + + @property + def tuneFastDeviceClass(self): + # type: () -> bool + return self._property_impl('tuneFastDeviceClass') + + @tuneFastDeviceClass.setter + def tuneFastDeviceClass(self, new_val): + # type: (Optional[bool]) -> None + self._tuneFastDeviceClass = new_val + + @property + def volumeClaimTemplates(self): + # type: () -> Union[List[VolumeClaimTemplatesItem], CrdObjectList] + return self._property_impl('volumeClaimTemplates') + + @volumeClaimTemplates.setter + def volumeClaimTemplates(self, new_val): + # type: (Union[List[VolumeClaimTemplatesItem], CrdObjectList]) -> None + self._volumeClaimTemplates = new_val + + +class StorageClassDeviceSetsList(CrdObjectList): + _items_type = StorageClassDeviceSetsItem + + +class Storage(CrdObject): + _properties = [ + ('deviceClasses', 'deviceClasses', 'DeviceClassesList', False, False), + ('config', 'config', object, False, True), + ('deviceFilter', 'deviceFilter', str, False, False), + ('devicePathFilter', 'devicePathFilter', str, False, False), + ('devices', 'devices', 'DevicesList', False, True), + ('nodes', 'nodes', 'NodesList', False, True), + ('storageClassDeviceSets', 'storageClassDeviceSets', 'StorageClassDeviceSetsList', False, True), + ('useAllDevices', 'useAllDevices', bool, False, False), + ('useAllNodes', 'useAllNodes', bool, False, False), + ('volumeClaimTemplates', 'volumeClaimTemplates', 'VolumeClaimTemplatesList', False, False) + ] + + def __init__(self, + deviceClasses=_omit, # type: Optional[Union[List[DeviceClassesItem], CrdObjectList]] + config=_omit, # type: Optional[Any] + deviceFilter=_omit, # type: Optional[str] + devicePathFilter=_omit, # type: Optional[str] + devices=_omit, # type: Optional[Union[List[DevicesItem], CrdObjectList]] + nodes=_omit, # type: Optional[Union[List[NodesItem], CrdObjectList]] + storageClassDeviceSets=_omit, # type: Optional[Union[List[StorageClassDeviceSetsItem], CrdObjectList]] + useAllDevices=_omit, # type: Optional[bool] + useAllNodes=_omit, # type: Optional[bool] + volumeClaimTemplates=_omit, # type: Optional[Union[List[VolumeClaimTemplatesItem], CrdObjectList]] + ): + super(Storage, self).__init__( + deviceClasses=deviceClasses, + config=config, + deviceFilter=deviceFilter, + devicePathFilter=devicePathFilter, + devices=devices, + nodes=nodes, + storageClassDeviceSets=storageClassDeviceSets, + useAllDevices=useAllDevices, + useAllNodes=useAllNodes, + volumeClaimTemplates=volumeClaimTemplates, + ) + + @property + def deviceClasses(self): + # type: () -> Union[List[DeviceClassesItem], CrdObjectList] + return self._property_impl('deviceClasses') + + @deviceClasses.setter + def deviceClasses(self, new_val): + # type: (Optional[Union[List[DeviceClassesItem], CrdObjectList]]) -> None + self._deviceClasses = new_val + + @property + def config(self): + # type: () -> Optional[Any] + return self._property_impl('config') + + @config.setter + def config(self, new_val): + # type: (Optional[Any]) -> None + self._config = new_val + + @property + def deviceFilter(self): + # type: () -> str + return self._property_impl('deviceFilter') + + @deviceFilter.setter + def deviceFilter(self, new_val): + # type: (Optional[str]) -> None + self._deviceFilter = new_val + + @property + def devicePathFilter(self): + # type: () -> str + return self._property_impl('devicePathFilter') + + @devicePathFilter.setter + def devicePathFilter(self, new_val): + # type: (Optional[str]) -> None + self._devicePathFilter = new_val + + @property + def devices(self): + # type: () -> Optional[Union[List[DevicesItem], CrdObjectList]] + return self._property_impl('devices') + + @devices.setter + def devices(self, new_val): + # type: (Optional[Union[List[DevicesItem], CrdObjectList]]) -> None + self._devices = new_val + + @property + def nodes(self): + # type: () -> Optional[Union[List[NodesItem], CrdObjectList]] + return self._property_impl('nodes') + + @nodes.setter + def nodes(self, new_val): + # type: (Optional[Union[List[NodesItem], CrdObjectList]]) -> None + self._nodes = new_val + + @property + def storageClassDeviceSets(self): + # type: () -> Optional[Union[List[StorageClassDeviceSetsItem], CrdObjectList]] + return self._property_impl('storageClassDeviceSets') + + @storageClassDeviceSets.setter + def storageClassDeviceSets(self, new_val): + # type: (Optional[Union[List[StorageClassDeviceSetsItem], CrdObjectList]]) -> None + self._storageClassDeviceSets = new_val + + @property + def useAllDevices(self): + # type: () -> bool + return self._property_impl('useAllDevices') + + @useAllDevices.setter + def useAllDevices(self, new_val): + # type: (Optional[bool]) -> None + self._useAllDevices = new_val + + @property + def useAllNodes(self): + # type: () -> bool + return self._property_impl('useAllNodes') + + @useAllNodes.setter + def useAllNodes(self, new_val): + # type: (Optional[bool]) -> None + self._useAllNodes = new_val + + @property + def volumeClaimTemplates(self): + # type: () -> Union[List[VolumeClaimTemplatesItem], CrdObjectList] + return self._property_impl('volumeClaimTemplates') + + @volumeClaimTemplates.setter + def volumeClaimTemplates(self, new_val): + # type: (Optional[Union[List[VolumeClaimTemplatesItem], CrdObjectList]]) -> None + self._volumeClaimTemplates = new_val + + +class Capacity(CrdObject): + _properties = [ + ('bytesAvailable', 'bytesAvailable', int, False, False), + ('bytesTotal', 'bytesTotal', int, False, False), + ('bytesUsed', 'bytesUsed', int, False, False), + ('lastUpdated', 'lastUpdated', str, False, False) + ] + + def __init__(self, + bytesAvailable=_omit, # type: Optional[int] + bytesTotal=_omit, # type: Optional[int] + bytesUsed=_omit, # type: Optional[int] + lastUpdated=_omit, # type: Optional[str] + ): + super(Capacity, self).__init__( + bytesAvailable=bytesAvailable, + bytesTotal=bytesTotal, + bytesUsed=bytesUsed, + lastUpdated=lastUpdated, + ) + + @property + def bytesAvailable(self): + # type: () -> int + return self._property_impl('bytesAvailable') + + @bytesAvailable.setter + def bytesAvailable(self, new_val): + # type: (Optional[int]) -> None + self._bytesAvailable = new_val + + @property + def bytesTotal(self): + # type: () -> int + return self._property_impl('bytesTotal') + + @bytesTotal.setter + def bytesTotal(self, new_val): + # type: (Optional[int]) -> None + self._bytesTotal = new_val + + @property + def bytesUsed(self): + # type: () -> int + return self._property_impl('bytesUsed') + + @bytesUsed.setter + def bytesUsed(self, new_val): + # type: (Optional[int]) -> None + self._bytesUsed = new_val + + @property + def lastUpdated(self): + # type: () -> str + return self._property_impl('lastUpdated') + + @lastUpdated.setter + def lastUpdated(self, new_val): + # type: (Optional[str]) -> None + self._lastUpdated = new_val + + +class Versions(CrdObject): + _properties = [ + ('cephfs-mirror', 'cephfs_mirror', object, False, False), + ('mds', 'mds', object, False, False), + ('mgr', 'mgr', object, False, False), + ('mon', 'mon', object, False, False), + ('osd', 'osd', object, False, False), + ('overall', 'overall', object, False, False), + ('rbd-mirror', 'rbd_mirror', object, False, False), + ('rgw', 'rgw', object, False, False) + ] + + def __init__(self, + cephfs_mirror=_omit, # type: Optional[Any] + mds=_omit, # type: Optional[Any] + mgr=_omit, # type: Optional[Any] + mon=_omit, # type: Optional[Any] + osd=_omit, # type: Optional[Any] + overall=_omit, # type: Optional[Any] + rbd_mirror=_omit, # type: Optional[Any] + rgw=_omit, # type: Optional[Any] + ): + super(Versions, self).__init__( + cephfs_mirror=cephfs_mirror, + mds=mds, + mgr=mgr, + mon=mon, + osd=osd, + overall=overall, + rbd_mirror=rbd_mirror, + rgw=rgw, + ) + + @property + def cephfs_mirror(self): + # type: () -> Any + return self._property_impl('cephfs_mirror') + + @cephfs_mirror.setter + def cephfs_mirror(self, new_val): + # type: (Optional[Any]) -> None + self._cephfs_mirror = new_val + + @property + def mds(self): + # type: () -> Any + return self._property_impl('mds') + + @mds.setter + def mds(self, new_val): + # type: (Optional[Any]) -> None + self._mds = new_val + + @property + def mgr(self): + # type: () -> Any + return self._property_impl('mgr') + + @mgr.setter + def mgr(self, new_val): + # type: (Optional[Any]) -> None + self._mgr = new_val + + @property + def mon(self): + # type: () -> Any + return self._property_impl('mon') + + @mon.setter + def mon(self, new_val): + # type: (Optional[Any]) -> None + self._mon = new_val + + @property + def osd(self): + # type: () -> Any + return self._property_impl('osd') + + @osd.setter + def osd(self, new_val): + # type: (Optional[Any]) -> None + self._osd = new_val + + @property + def overall(self): + # type: () -> Any + return self._property_impl('overall') + + @overall.setter + def overall(self, new_val): + # type: (Optional[Any]) -> None + self._overall = new_val + + @property + def rbd_mirror(self): + # type: () -> Any + return self._property_impl('rbd_mirror') + + @rbd_mirror.setter + def rbd_mirror(self, new_val): + # type: (Optional[Any]) -> None + self._rbd_mirror = new_val + + @property + def rgw(self): + # type: () -> Any + return self._property_impl('rgw') + + @rgw.setter + def rgw(self, new_val): + # type: (Optional[Any]) -> None + self._rgw = new_val + + +class Ceph(CrdObject): + _properties = [ + ('capacity', 'capacity', 'Capacity', False, False), + ('details', 'details', object, False, False), + ('health', 'health', str, False, False), + ('lastChanged', 'lastChanged', str, False, False), + ('lastChecked', 'lastChecked', str, False, False), + ('previousHealth', 'previousHealth', str, False, False), + ('versions', 'versions', 'Versions', False, False) + ] + + def __init__(self, + capacity=_omit, # type: Optional[Capacity] + details=_omit, # type: Optional[Any] + health=_omit, # type: Optional[str] + lastChanged=_omit, # type: Optional[str] + lastChecked=_omit, # type: Optional[str] + previousHealth=_omit, # type: Optional[str] + versions=_omit, # type: Optional[Versions] + ): + super(Ceph, self).__init__( + capacity=capacity, + details=details, + health=health, + lastChanged=lastChanged, + lastChecked=lastChecked, + previousHealth=previousHealth, + versions=versions, + ) + + @property + def capacity(self): + # type: () -> Capacity + return self._property_impl('capacity') + + @capacity.setter + def capacity(self, new_val): + # type: (Optional[Capacity]) -> None + self._capacity = new_val + + @property + def details(self): + # type: () -> Any + return self._property_impl('details') + + @details.setter + def details(self, new_val): + # type: (Optional[Any]) -> None + self._details = new_val + + @property + def health(self): + # type: () -> str + return self._property_impl('health') + + @health.setter + def health(self, new_val): + # type: (Optional[str]) -> None + self._health = new_val + + @property + def lastChanged(self): + # type: () -> str + return self._property_impl('lastChanged') + + @lastChanged.setter + def lastChanged(self, new_val): + # type: (Optional[str]) -> None + self._lastChanged = new_val + + @property + def lastChecked(self): + # type: () -> str + return self._property_impl('lastChecked') + + @lastChecked.setter + def lastChecked(self, new_val): + # type: (Optional[str]) -> None + self._lastChecked = new_val + + @property + def previousHealth(self): + # type: () -> str + return self._property_impl('previousHealth') + + @previousHealth.setter + def previousHealth(self, new_val): + # type: (Optional[str]) -> None + self._previousHealth = new_val + + @property + def versions(self): + # type: () -> Versions + return self._property_impl('versions') + + @versions.setter + def versions(self, new_val): + # type: (Optional[Versions]) -> None + self._versions = new_val + + +class DeviceClassesItem(CrdObject): + _properties = [ + ('name', 'name', str, False, False) + ] + + def __init__(self, + name=_omit, # type: Optional[str] + ): + super(DeviceClassesItem, self).__init__( + name=name, + ) + + @property + def name(self): + # type: () -> str + return self._property_impl('name') + + @name.setter + def name(self, new_val): + # type: (Optional[str]) -> None + self._name = new_val + + +class DeviceClassesList(CrdObjectList): + _items_type = DeviceClassesItem + + +class Version(CrdObject): + _properties = [ + ('image', 'image', str, False, False), + ('version', 'version', str, False, False) + ] + + def __init__(self, + image=_omit, # type: Optional[str] + version=_omit, # type: Optional[str] + ): + super(Version, self).__init__( + image=image, + version=version, + ) + + @property + def image(self): + # type: () -> str + return self._property_impl('image') + + @image.setter + def image(self, new_val): + # type: (Optional[str]) -> None + self._image = new_val + + @property + def version(self): + # type: () -> str + return self._property_impl('version') + + @version.setter + def version(self, new_val): + # type: (Optional[str]) -> None + self._version = new_val + + +class CephCluster(CrdClass): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', object, False, False), + ('spec', 'spec', 'Spec', True, False), + ('status', 'status', 'Status', False, True) + ] + + def __init__(self, + spec, # type: Spec + apiVersion=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Any] + status=_omit, # type: Optional[Status] + ): + super(CephCluster, self).__init__( + spec=spec, + apiVersion=apiVersion, + kind=kind, + metadata=metadata, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Any]) -> None + self._metadata = new_val + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Spec) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Optional[Status] + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Status]) -> None + self._status = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephfilesystem.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephfilesystem.py new file mode 100644 index 000000000..c1eaa6dbc --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephfilesystem.py @@ -0,0 +1,1771 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class ErasureCoded(CrdObject): + _properties = [ + ('algorithm', 'algorithm', str, False, False), + ('codingChunks', 'codingChunks', int, True, False), + ('dataChunks', 'dataChunks', int, True, False) + ] + + def __init__(self, + codingChunks, # type: int + dataChunks, # type: int + algorithm=_omit, # type: Optional[str] + ): + super(ErasureCoded, self).__init__( + codingChunks=codingChunks, + dataChunks=dataChunks, + algorithm=algorithm, + ) + + @property + def algorithm(self): + # type: () -> str + return self._property_impl('algorithm') + + @algorithm.setter + def algorithm(self, new_val): + # type: (Optional[str]) -> None + self._algorithm = new_val + + @property + def codingChunks(self): + # type: () -> int + return self._property_impl('codingChunks') + + @codingChunks.setter + def codingChunks(self, new_val): + # type: (int) -> None + self._codingChunks = new_val + + @property + def dataChunks(self): + # type: () -> int + return self._property_impl('dataChunks') + + @dataChunks.setter + def dataChunks(self, new_val): + # type: (int) -> None + self._dataChunks = new_val + + +class SnapshotSchedulesItem(CrdObject): + _properties = [ + ('interval', 'interval', str, False, False), + ('startTime', 'startTime', str, False, False) + ] + + def __init__(self, + interval=_omit, # type: Optional[str] + startTime=_omit, # type: Optional[str] + ): + super(SnapshotSchedulesItem, self).__init__( + interval=interval, + startTime=startTime, + ) + + @property + def interval(self): + # type: () -> str + return self._property_impl('interval') + + @interval.setter + def interval(self, new_val): + # type: (Optional[str]) -> None + self._interval = new_val + + @property + def startTime(self): + # type: () -> str + return self._property_impl('startTime') + + @startTime.setter + def startTime(self, new_val): + # type: (Optional[str]) -> None + self._startTime = new_val + + +class SnapshotSchedulesList(CrdObjectList): + _items_type = SnapshotSchedulesItem + + +class Mirroring(CrdObject): + _properties = [ + ('enabled', 'enabled', bool, False, False), + ('mode', 'mode', str, False, False), + ('snapshotSchedules', 'snapshotSchedules', 'SnapshotSchedulesList', False, False) + ] + + def __init__(self, + enabled=_omit, # type: Optional[bool] + mode=_omit, # type: Optional[str] + snapshotSchedules=_omit, # type: Optional[Union[List[SnapshotSchedulesItem], CrdObjectList]] + ): + super(Mirroring, self).__init__( + enabled=enabled, + mode=mode, + snapshotSchedules=snapshotSchedules, + ) + + @property + def enabled(self): + # type: () -> bool + return self._property_impl('enabled') + + @enabled.setter + def enabled(self, new_val): + # type: (Optional[bool]) -> None + self._enabled = new_val + + @property + def mode(self): + # type: () -> str + return self._property_impl('mode') + + @mode.setter + def mode(self, new_val): + # type: (Optional[str]) -> None + self._mode = new_val + + @property + def snapshotSchedules(self): + # type: () -> Union[List[SnapshotSchedulesItem], CrdObjectList] + return self._property_impl('snapshotSchedules') + + @snapshotSchedules.setter + def snapshotSchedules(self, new_val): + # type: (Optional[Union[List[SnapshotSchedulesItem], CrdObjectList]]) -> None + self._snapshotSchedules = new_val + + +class Quotas(CrdObject): + _properties = [ + ('maxBytes', 'maxBytes', int, False, False), + ('maxObjects', 'maxObjects', int, False, False), + ('maxSize', 'maxSize', str, False, False) + ] + + def __init__(self, + maxBytes=_omit, # type: Optional[int] + maxObjects=_omit, # type: Optional[int] + maxSize=_omit, # type: Optional[str] + ): + super(Quotas, self).__init__( + maxBytes=maxBytes, + maxObjects=maxObjects, + maxSize=maxSize, + ) + + @property + def maxBytes(self): + # type: () -> int + return self._property_impl('maxBytes') + + @maxBytes.setter + def maxBytes(self, new_val): + # type: (Optional[int]) -> None + self._maxBytes = new_val + + @property + def maxObjects(self): + # type: () -> int + return self._property_impl('maxObjects') + + @maxObjects.setter + def maxObjects(self, new_val): + # type: (Optional[int]) -> None + self._maxObjects = new_val + + @property + def maxSize(self): + # type: () -> str + return self._property_impl('maxSize') + + @maxSize.setter + def maxSize(self, new_val): + # type: (Optional[str]) -> None + self._maxSize = new_val + + +class Replicated(CrdObject): + _properties = [ + ('replicasPerFailureDomain', 'replicasPerFailureDomain', int, False, False), + ('requireSafeReplicaSize', 'requireSafeReplicaSize', bool, False, False), + ('size', 'size', int, True, False), + ('subFailureDomain', 'subFailureDomain', str, False, False), + ('targetSizeRatio', 'targetSizeRatio', float, False, False) + ] + + def __init__(self, + size, # type: int + replicasPerFailureDomain=_omit, # type: Optional[int] + requireSafeReplicaSize=_omit, # type: Optional[bool] + subFailureDomain=_omit, # type: Optional[str] + targetSizeRatio=_omit, # type: Optional[float] + ): + super(Replicated, self).__init__( + size=size, + replicasPerFailureDomain=replicasPerFailureDomain, + requireSafeReplicaSize=requireSafeReplicaSize, + subFailureDomain=subFailureDomain, + targetSizeRatio=targetSizeRatio, + ) + + @property + def replicasPerFailureDomain(self): + # type: () -> int + return self._property_impl('replicasPerFailureDomain') + + @replicasPerFailureDomain.setter + def replicasPerFailureDomain(self, new_val): + # type: (Optional[int]) -> None + self._replicasPerFailureDomain = new_val + + @property + def requireSafeReplicaSize(self): + # type: () -> bool + return self._property_impl('requireSafeReplicaSize') + + @requireSafeReplicaSize.setter + def requireSafeReplicaSize(self, new_val): + # type: (Optional[bool]) -> None + self._requireSafeReplicaSize = new_val + + @property + def size(self): + # type: () -> int + return self._property_impl('size') + + @size.setter + def size(self, new_val): + # type: (int) -> None + self._size = new_val + + @property + def subFailureDomain(self): + # type: () -> str + return self._property_impl('subFailureDomain') + + @subFailureDomain.setter + def subFailureDomain(self, new_val): + # type: (Optional[str]) -> None + self._subFailureDomain = new_val + + @property + def targetSizeRatio(self): + # type: () -> float + return self._property_impl('targetSizeRatio') + + @targetSizeRatio.setter + def targetSizeRatio(self, new_val): + # type: (Optional[float]) -> None + self._targetSizeRatio = new_val + + +class Mirror(CrdObject): + _properties = [ + ('disabled', 'disabled', bool, False, False), + ('interval', 'interval', str, False, False), + ('timeout', 'timeout', str, False, False) + ] + + def __init__(self, + disabled=_omit, # type: Optional[bool] + interval=_omit, # type: Optional[str] + timeout=_omit, # type: Optional[str] + ): + super(Mirror, self).__init__( + disabled=disabled, + interval=interval, + timeout=timeout, + ) + + @property + def disabled(self): + # type: () -> bool + return self._property_impl('disabled') + + @disabled.setter + def disabled(self, new_val): + # type: (Optional[bool]) -> None + self._disabled = new_val + + @property + def interval(self): + # type: () -> str + return self._property_impl('interval') + + @interval.setter + def interval(self, new_val): + # type: (Optional[str]) -> None + self._interval = new_val + + @property + def timeout(self): + # type: () -> str + return self._property_impl('timeout') + + @timeout.setter + def timeout(self, new_val): + # type: (Optional[str]) -> None + self._timeout = new_val + + +class StatusCheck(CrdObject): + _properties = [ + ('mirror', 'mirror', 'Mirror', False, True) + ] + + def __init__(self, + mirror=_omit, # type: Optional[Mirror] + ): + super(StatusCheck, self).__init__( + mirror=mirror, + ) + + @property + def mirror(self): + # type: () -> Optional[Mirror] + return self._property_impl('mirror') + + @mirror.setter + def mirror(self, new_val): + # type: (Optional[Mirror]) -> None + self._mirror = new_val + + +class DataPoolsItem(CrdObject): + _properties = [ + ('compressionMode', 'compressionMode', str, False, True), + ('crushRoot', 'crushRoot', str, False, True), + ('deviceClass', 'deviceClass', str, False, True), + ('enableRBDStats', 'enableRBDStats', bool, False, False), + ('erasureCoded', 'erasureCoded', 'ErasureCoded', False, False), + ('failureDomain', 'failureDomain', str, False, False), + ('mirroring', 'mirroring', 'Mirroring', False, False), + ('parameters', 'parameters', object, False, True), + ('quotas', 'quotas', 'Quotas', False, True), + ('replicated', 'replicated', 'Replicated', False, False), + ('statusCheck', 'statusCheck', 'StatusCheck', False, False) + ] + + def __init__(self, + compressionMode=_omit, # type: Optional[str] + crushRoot=_omit, # type: Optional[str] + deviceClass=_omit, # type: Optional[str] + enableRBDStats=_omit, # type: Optional[bool] + erasureCoded=_omit, # type: Optional[ErasureCoded] + failureDomain=_omit, # type: Optional[str] + mirroring=_omit, # type: Optional[Mirroring] + parameters=_omit, # type: Optional[Any] + quotas=_omit, # type: Optional[Quotas] + replicated=_omit, # type: Optional[Replicated] + statusCheck=_omit, # type: Optional[StatusCheck] + ): + super(DataPoolsItem, self).__init__( + compressionMode=compressionMode, + crushRoot=crushRoot, + deviceClass=deviceClass, + enableRBDStats=enableRBDStats, + erasureCoded=erasureCoded, + failureDomain=failureDomain, + mirroring=mirroring, + parameters=parameters, + quotas=quotas, + replicated=replicated, + statusCheck=statusCheck, + ) + + @property + def compressionMode(self): + # type: () -> Optional[str] + return self._property_impl('compressionMode') + + @compressionMode.setter + def compressionMode(self, new_val): + # type: (Optional[str]) -> None + self._compressionMode = new_val + + @property + def crushRoot(self): + # type: () -> Optional[str] + return self._property_impl('crushRoot') + + @crushRoot.setter + def crushRoot(self, new_val): + # type: (Optional[str]) -> None + self._crushRoot = new_val + + @property + def deviceClass(self): + # type: () -> Optional[str] + return self._property_impl('deviceClass') + + @deviceClass.setter + def deviceClass(self, new_val): + # type: (Optional[str]) -> None + self._deviceClass = new_val + + @property + def enableRBDStats(self): + # type: () -> bool + return self._property_impl('enableRBDStats') + + @enableRBDStats.setter + def enableRBDStats(self, new_val): + # type: (Optional[bool]) -> None + self._enableRBDStats = new_val + + @property + def erasureCoded(self): + # type: () -> ErasureCoded + return self._property_impl('erasureCoded') + + @erasureCoded.setter + def erasureCoded(self, new_val): + # type: (Optional[ErasureCoded]) -> None + self._erasureCoded = new_val + + @property + def failureDomain(self): + # type: () -> str + return self._property_impl('failureDomain') + + @failureDomain.setter + def failureDomain(self, new_val): + # type: (Optional[str]) -> None + self._failureDomain = new_val + + @property + def mirroring(self): + # type: () -> Mirroring + return self._property_impl('mirroring') + + @mirroring.setter + def mirroring(self, new_val): + # type: (Optional[Mirroring]) -> None + self._mirroring = new_val + + @property + def parameters(self): + # type: () -> Optional[Any] + return self._property_impl('parameters') + + @parameters.setter + def parameters(self, new_val): + # type: (Optional[Any]) -> None + self._parameters = new_val + + @property + def quotas(self): + # type: () -> Optional[Quotas] + return self._property_impl('quotas') + + @quotas.setter + def quotas(self, new_val): + # type: (Optional[Quotas]) -> None + self._quotas = new_val + + @property + def replicated(self): + # type: () -> Replicated + return self._property_impl('replicated') + + @replicated.setter + def replicated(self, new_val): + # type: (Optional[Replicated]) -> None + self._replicated = new_val + + @property + def statusCheck(self): + # type: () -> StatusCheck + return self._property_impl('statusCheck') + + @statusCheck.setter + def statusCheck(self, new_val): + # type: (Optional[StatusCheck]) -> None + self._statusCheck = new_val + + +class DataPoolsList(CrdObjectList): + _items_type = DataPoolsItem + + +class MetadataPool(CrdObject): + _properties = [ + ('compressionMode', 'compressionMode', str, False, True), + ('crushRoot', 'crushRoot', str, False, True), + ('deviceClass', 'deviceClass', str, False, True), + ('enableRBDStats', 'enableRBDStats', bool, False, False), + ('erasureCoded', 'erasureCoded', 'ErasureCoded', False, False), + ('failureDomain', 'failureDomain', str, False, False), + ('mirroring', 'mirroring', 'Mirroring', False, False), + ('parameters', 'parameters', object, False, True), + ('quotas', 'quotas', 'Quotas', False, True), + ('replicated', 'replicated', 'Replicated', False, False), + ('statusCheck', 'statusCheck', 'StatusCheck', False, False) + ] + + def __init__(self, + compressionMode=_omit, # type: Optional[str] + crushRoot=_omit, # type: Optional[str] + deviceClass=_omit, # type: Optional[str] + enableRBDStats=_omit, # type: Optional[bool] + erasureCoded=_omit, # type: Optional[ErasureCoded] + failureDomain=_omit, # type: Optional[str] + mirroring=_omit, # type: Optional[Mirroring] + parameters=_omit, # type: Optional[Any] + quotas=_omit, # type: Optional[Quotas] + replicated=_omit, # type: Optional[Replicated] + statusCheck=_omit, # type: Optional[StatusCheck] + ): + super(MetadataPool, self).__init__( + compressionMode=compressionMode, + crushRoot=crushRoot, + deviceClass=deviceClass, + enableRBDStats=enableRBDStats, + erasureCoded=erasureCoded, + failureDomain=failureDomain, + mirroring=mirroring, + parameters=parameters, + quotas=quotas, + replicated=replicated, + statusCheck=statusCheck, + ) + + @property + def compressionMode(self): + # type: () -> Optional[str] + return self._property_impl('compressionMode') + + @compressionMode.setter + def compressionMode(self, new_val): + # type: (Optional[str]) -> None + self._compressionMode = new_val + + @property + def crushRoot(self): + # type: () -> Optional[str] + return self._property_impl('crushRoot') + + @crushRoot.setter + def crushRoot(self, new_val): + # type: (Optional[str]) -> None + self._crushRoot = new_val + + @property + def deviceClass(self): + # type: () -> Optional[str] + return self._property_impl('deviceClass') + + @deviceClass.setter + def deviceClass(self, new_val): + # type: (Optional[str]) -> None + self._deviceClass = new_val + + @property + def enableRBDStats(self): + # type: () -> bool + return self._property_impl('enableRBDStats') + + @enableRBDStats.setter + def enableRBDStats(self, new_val): + # type: (Optional[bool]) -> None + self._enableRBDStats = new_val + + @property + def erasureCoded(self): + # type: () -> ErasureCoded + return self._property_impl('erasureCoded') + + @erasureCoded.setter + def erasureCoded(self, new_val): + # type: (Optional[ErasureCoded]) -> None + self._erasureCoded = new_val + + @property + def failureDomain(self): + # type: () -> str + return self._property_impl('failureDomain') + + @failureDomain.setter + def failureDomain(self, new_val): + # type: (Optional[str]) -> None + self._failureDomain = new_val + + @property + def mirroring(self): + # type: () -> Mirroring + return self._property_impl('mirroring') + + @mirroring.setter + def mirroring(self, new_val): + # type: (Optional[Mirroring]) -> None + self._mirroring = new_val + + @property + def parameters(self): + # type: () -> Optional[Any] + return self._property_impl('parameters') + + @parameters.setter + def parameters(self, new_val): + # type: (Optional[Any]) -> None + self._parameters = new_val + + @property + def quotas(self): + # type: () -> Optional[Quotas] + return self._property_impl('quotas') + + @quotas.setter + def quotas(self, new_val): + # type: (Optional[Quotas]) -> None + self._quotas = new_val + + @property + def replicated(self): + # type: () -> Replicated + return self._property_impl('replicated') + + @replicated.setter + def replicated(self, new_val): + # type: (Optional[Replicated]) -> None + self._replicated = new_val + + @property + def statusCheck(self): + # type: () -> StatusCheck + return self._property_impl('statusCheck') + + @statusCheck.setter + def statusCheck(self, new_val): + # type: (Optional[StatusCheck]) -> None + self._statusCheck = new_val + + +class ValuesList(CrdObjectList): + _items_type = str + + +class MatchExpressionsItem(CrdObject): + _properties = [ + ('key', 'key', str, True, False), + ('operator', 'operator', str, True, False), + ('values', 'values', 'ValuesList', False, False) + ] + + def __init__(self, + key, # type: str + operator, # type: str + values=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(MatchExpressionsItem, self).__init__( + key=key, + operator=operator, + values=values, + ) + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (str) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (str) -> None + self._operator = new_val + + @property + def values(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('values') + + @values.setter + def values(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._values = new_val + + +class MatchExpressionsList(CrdObjectList): + _items_type = MatchExpressionsItem + + +class MatchFieldsItem(CrdObject): + _properties = [ + ('key', 'key', str, True, False), + ('operator', 'operator', str, True, False), + ('values', 'values', 'ValuesList', False, False) + ] + + def __init__(self, + key, # type: str + operator, # type: str + values=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(MatchFieldsItem, self).__init__( + key=key, + operator=operator, + values=values, + ) + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (str) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (str) -> None + self._operator = new_val + + @property + def values(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('values') + + @values.setter + def values(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._values = new_val + + +class MatchFieldsList(CrdObjectList): + _items_type = MatchFieldsItem + + +class Preference(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchFields', 'matchFields', 'MatchFieldsList', False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchFields=_omit, # type: Optional[Union[List[MatchFieldsItem], CrdObjectList]] + ): + super(Preference, self).__init__( + matchExpressions=matchExpressions, + matchFields=matchFields, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchFields(self): + # type: () -> Union[List[MatchFieldsItem], CrdObjectList] + return self._property_impl('matchFields') + + @matchFields.setter + def matchFields(self, new_val): + # type: (Optional[Union[List[MatchFieldsItem], CrdObjectList]]) -> None + self._matchFields = new_val + + +class PreferredDuringSchedulingIgnoredDuringExecutionItem(CrdObject): + _properties = [ + ('podAffinityTerm', 'podAffinityTerm', 'PodAffinityTerm', False, False), + ('weight', 'weight', int, False, False), + ('preference', 'preference', 'Preference', False, False) + ] + + def __init__(self, + podAffinityTerm=_omit, # type: Optional[PodAffinityTerm] + weight=_omit, # type: Optional[int] + preference=_omit, # type: Optional[Preference] + ): + super(PreferredDuringSchedulingIgnoredDuringExecutionItem, self).__init__( + podAffinityTerm=podAffinityTerm, + weight=weight, + preference=preference, + ) + + @property + def podAffinityTerm(self): + # type: () -> PodAffinityTerm + return self._property_impl('podAffinityTerm') + + @podAffinityTerm.setter + def podAffinityTerm(self, new_val): + # type: (Optional[PodAffinityTerm]) -> None + self._podAffinityTerm = new_val + + @property + def weight(self): + # type: () -> int + return self._property_impl('weight') + + @weight.setter + def weight(self, new_val): + # type: (Optional[int]) -> None + self._weight = new_val + + @property + def preference(self): + # type: () -> Preference + return self._property_impl('preference') + + @preference.setter + def preference(self, new_val): + # type: (Optional[Preference]) -> None + self._preference = new_val + + +class PreferredDuringSchedulingIgnoredDuringExecutionList(CrdObjectList): + _items_type = PreferredDuringSchedulingIgnoredDuringExecutionItem + + +class NodeSelectorTermsItem(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchFields', 'matchFields', 'MatchFieldsList', False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchFields=_omit, # type: Optional[Union[List[MatchFieldsItem], CrdObjectList]] + ): + super(NodeSelectorTermsItem, self).__init__( + matchExpressions=matchExpressions, + matchFields=matchFields, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchFields(self): + # type: () -> Union[List[MatchFieldsItem], CrdObjectList] + return self._property_impl('matchFields') + + @matchFields.setter + def matchFields(self, new_val): + # type: (Optional[Union[List[MatchFieldsItem], CrdObjectList]]) -> None + self._matchFields = new_val + + +class NodeSelectorTermsList(CrdObjectList): + _items_type = NodeSelectorTermsItem + + +class RequiredDuringSchedulingIgnoredDuringExecution(CrdObject): + _properties = [ + ('nodeSelectorTerms', 'nodeSelectorTerms', 'NodeSelectorTermsList', True, False) + ] + + def __init__(self, + nodeSelectorTerms, # type: Union[List[NodeSelectorTermsItem], CrdObjectList] + ): + super(RequiredDuringSchedulingIgnoredDuringExecution, self).__init__( + nodeSelectorTerms=nodeSelectorTerms, + ) + + @property + def nodeSelectorTerms(self): + # type: () -> Union[List[NodeSelectorTermsItem], CrdObjectList] + return self._property_impl('nodeSelectorTerms') + + @nodeSelectorTerms.setter + def nodeSelectorTerms(self, new_val): + # type: (Union[List[NodeSelectorTermsItem], CrdObjectList]) -> None + self._nodeSelectorTerms = new_val + + +class NodeAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecution', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[RequiredDuringSchedulingIgnoredDuringExecution] + ): + super(NodeAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> RequiredDuringSchedulingIgnoredDuringExecution + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[RequiredDuringSchedulingIgnoredDuringExecution]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class LabelSelector(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchLabels', 'matchLabels', object, False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchLabels=_omit, # type: Optional[Any] + ): + super(LabelSelector, self).__init__( + matchExpressions=matchExpressions, + matchLabels=matchLabels, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchLabels(self): + # type: () -> Any + return self._property_impl('matchLabels') + + @matchLabels.setter + def matchLabels(self, new_val): + # type: (Optional[Any]) -> None + self._matchLabels = new_val + + +class NamespaceSelector(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchLabels', 'matchLabels', object, False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchLabels=_omit, # type: Optional[Any] + ): + super(NamespaceSelector, self).__init__( + matchExpressions=matchExpressions, + matchLabels=matchLabels, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchLabels(self): + # type: () -> Any + return self._property_impl('matchLabels') + + @matchLabels.setter + def matchLabels(self, new_val): + # type: (Optional[Any]) -> None + self._matchLabels = new_val + + +class NamespacesList(CrdObjectList): + _items_type = str + + +class PodAffinityTerm(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('namespaceSelector', 'namespaceSelector', 'NamespaceSelector', False, False), + ('namespaces', 'namespaces', 'NamespacesList', False, False), + ('topologyKey', 'topologyKey', str, True, False) + ] + + def __init__(self, + topologyKey, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + namespaceSelector=_omit, # type: Optional[NamespaceSelector] + namespaces=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(PodAffinityTerm, self).__init__( + topologyKey=topologyKey, + labelSelector=labelSelector, + namespaceSelector=namespaceSelector, + namespaces=namespaces, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def namespaceSelector(self): + # type: () -> NamespaceSelector + return self._property_impl('namespaceSelector') + + @namespaceSelector.setter + def namespaceSelector(self, new_val): + # type: (Optional[NamespaceSelector]) -> None + self._namespaceSelector = new_val + + @property + def namespaces(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('namespaces') + + @namespaces.setter + def namespaces(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._namespaces = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + +class RequiredDuringSchedulingIgnoredDuringExecutionItem(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('namespaceSelector', 'namespaceSelector', 'NamespaceSelector', False, False), + ('namespaces', 'namespaces', 'NamespacesList', False, False), + ('topologyKey', 'topologyKey', str, True, False) + ] + + def __init__(self, + topologyKey, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + namespaceSelector=_omit, # type: Optional[NamespaceSelector] + namespaces=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(RequiredDuringSchedulingIgnoredDuringExecutionItem, self).__init__( + topologyKey=topologyKey, + labelSelector=labelSelector, + namespaceSelector=namespaceSelector, + namespaces=namespaces, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def namespaceSelector(self): + # type: () -> NamespaceSelector + return self._property_impl('namespaceSelector') + + @namespaceSelector.setter + def namespaceSelector(self, new_val): + # type: (Optional[NamespaceSelector]) -> None + self._namespaceSelector = new_val + + @property + def namespaces(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('namespaces') + + @namespaces.setter + def namespaces(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._namespaces = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + +class RequiredDuringSchedulingIgnoredDuringExecutionList(CrdObjectList): + _items_type = RequiredDuringSchedulingIgnoredDuringExecutionItem + + +class PodAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecutionList', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + ): + super(PodAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class PodAntiAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecutionList', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + ): + super(PodAntiAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class TolerationsItem(CrdObject): + _properties = [ + ('effect', 'effect', str, False, False), + ('key', 'key', str, False, False), + ('operator', 'operator', str, False, False), + ('tolerationSeconds', 'tolerationSeconds', int, False, False), + ('value', 'value', str, False, False) + ] + + def __init__(self, + effect=_omit, # type: Optional[str] + key=_omit, # type: Optional[str] + operator=_omit, # type: Optional[str] + tolerationSeconds=_omit, # type: Optional[int] + value=_omit, # type: Optional[str] + ): + super(TolerationsItem, self).__init__( + effect=effect, + key=key, + operator=operator, + tolerationSeconds=tolerationSeconds, + value=value, + ) + + @property + def effect(self): + # type: () -> str + return self._property_impl('effect') + + @effect.setter + def effect(self, new_val): + # type: (Optional[str]) -> None + self._effect = new_val + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (Optional[str]) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (Optional[str]) -> None + self._operator = new_val + + @property + def tolerationSeconds(self): + # type: () -> int + return self._property_impl('tolerationSeconds') + + @tolerationSeconds.setter + def tolerationSeconds(self, new_val): + # type: (Optional[int]) -> None + self._tolerationSeconds = new_val + + @property + def value(self): + # type: () -> str + return self._property_impl('value') + + @value.setter + def value(self, new_val): + # type: (Optional[str]) -> None + self._value = new_val + + +class TolerationsList(CrdObjectList): + _items_type = TolerationsItem + + +class TopologySpreadConstraintsItem(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('maxSkew', 'maxSkew', int, True, False), + ('topologyKey', 'topologyKey', str, True, False), + ('whenUnsatisfiable', 'whenUnsatisfiable', str, True, False) + ] + + def __init__(self, + maxSkew, # type: int + topologyKey, # type: str + whenUnsatisfiable, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + ): + super(TopologySpreadConstraintsItem, self).__init__( + maxSkew=maxSkew, + topologyKey=topologyKey, + whenUnsatisfiable=whenUnsatisfiable, + labelSelector=labelSelector, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def maxSkew(self): + # type: () -> int + return self._property_impl('maxSkew') + + @maxSkew.setter + def maxSkew(self, new_val): + # type: (int) -> None + self._maxSkew = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + @property + def whenUnsatisfiable(self): + # type: () -> str + return self._property_impl('whenUnsatisfiable') + + @whenUnsatisfiable.setter + def whenUnsatisfiable(self, new_val): + # type: (str) -> None + self._whenUnsatisfiable = new_val + + +class TopologySpreadConstraintsList(CrdObjectList): + _items_type = TopologySpreadConstraintsItem + + +class Placement(CrdObject): + _properties = [ + ('nodeAffinity', 'nodeAffinity', 'NodeAffinity', False, False), + ('podAffinity', 'podAffinity', 'PodAffinity', False, False), + ('podAntiAffinity', 'podAntiAffinity', 'PodAntiAffinity', False, False), + ('tolerations', 'tolerations', 'TolerationsList', False, False), + ('topologySpreadConstraints', 'topologySpreadConstraints', 'TopologySpreadConstraintsList', False, False) + ] + + def __init__(self, + nodeAffinity=_omit, # type: Optional[NodeAffinity] + podAffinity=_omit, # type: Optional[PodAffinity] + podAntiAffinity=_omit, # type: Optional[PodAntiAffinity] + tolerations=_omit, # type: Optional[Union[List[TolerationsItem], CrdObjectList]] + topologySpreadConstraints=_omit, # type: Optional[Union[List[TopologySpreadConstraintsItem], CrdObjectList]] + ): + super(Placement, self).__init__( + nodeAffinity=nodeAffinity, + podAffinity=podAffinity, + podAntiAffinity=podAntiAffinity, + tolerations=tolerations, + topologySpreadConstraints=topologySpreadConstraints, + ) + + @property + def nodeAffinity(self): + # type: () -> NodeAffinity + return self._property_impl('nodeAffinity') + + @nodeAffinity.setter + def nodeAffinity(self, new_val): + # type: (Optional[NodeAffinity]) -> None + self._nodeAffinity = new_val + + @property + def podAffinity(self): + # type: () -> PodAffinity + return self._property_impl('podAffinity') + + @podAffinity.setter + def podAffinity(self, new_val): + # type: (Optional[PodAffinity]) -> None + self._podAffinity = new_val + + @property + def podAntiAffinity(self): + # type: () -> PodAntiAffinity + return self._property_impl('podAntiAffinity') + + @podAntiAffinity.setter + def podAntiAffinity(self, new_val): + # type: (Optional[PodAntiAffinity]) -> None + self._podAntiAffinity = new_val + + @property + def tolerations(self): + # type: () -> Union[List[TolerationsItem], CrdObjectList] + return self._property_impl('tolerations') + + @tolerations.setter + def tolerations(self, new_val): + # type: (Optional[Union[List[TolerationsItem], CrdObjectList]]) -> None + self._tolerations = new_val + + @property + def topologySpreadConstraints(self): + # type: () -> Union[List[TopologySpreadConstraintsItem], CrdObjectList] + return self._property_impl('topologySpreadConstraints') + + @topologySpreadConstraints.setter + def topologySpreadConstraints(self, new_val): + # type: (Optional[Union[List[TopologySpreadConstraintsItem], CrdObjectList]]) -> None + self._topologySpreadConstraints = new_val + + +class Resources(CrdObject): + _properties = [ + ('limits', 'limits', object, False, False), + ('requests', 'requests', object, False, False) + ] + + def __init__(self, + limits=_omit, # type: Optional[Any] + requests=_omit, # type: Optional[Any] + ): + super(Resources, self).__init__( + limits=limits, + requests=requests, + ) + + @property + def limits(self): + # type: () -> Any + return self._property_impl('limits') + + @limits.setter + def limits(self, new_val): + # type: (Optional[Any]) -> None + self._limits = new_val + + @property + def requests(self): + # type: () -> Any + return self._property_impl('requests') + + @requests.setter + def requests(self, new_val): + # type: (Optional[Any]) -> None + self._requests = new_val + + +class MetadataServer(CrdObject): + _properties = [ + ('activeCount', 'activeCount', int, True, False), + ('activeStandby', 'activeStandby', bool, False, False), + ('annotations', 'annotations', object, False, True), + ('labels', 'labels', object, False, True), + ('placement', 'placement', 'Placement', False, True), + ('priorityClassName', 'priorityClassName', str, False, False), + ('resources', 'resources', 'Resources', False, True) + ] + + def __init__(self, + activeCount, # type: int + activeStandby=_omit, # type: Optional[bool] + annotations=_omit, # type: Optional[Any] + labels=_omit, # type: Optional[Any] + placement=_omit, # type: Optional[Placement] + priorityClassName=_omit, # type: Optional[str] + resources=_omit, # type: Optional[Resources] + ): + super(MetadataServer, self).__init__( + activeCount=activeCount, + activeStandby=activeStandby, + annotations=annotations, + labels=labels, + placement=placement, + priorityClassName=priorityClassName, + resources=resources, + ) + + @property + def activeCount(self): + # type: () -> int + return self._property_impl('activeCount') + + @activeCount.setter + def activeCount(self, new_val): + # type: (int) -> None + self._activeCount = new_val + + @property + def activeStandby(self): + # type: () -> bool + return self._property_impl('activeStandby') + + @activeStandby.setter + def activeStandby(self, new_val): + # type: (Optional[bool]) -> None + self._activeStandby = new_val + + @property + def annotations(self): + # type: () -> Optional[Any] + return self._property_impl('annotations') + + @annotations.setter + def annotations(self, new_val): + # type: (Optional[Any]) -> None + self._annotations = new_val + + @property + def labels(self): + # type: () -> Optional[Any] + return self._property_impl('labels') + + @labels.setter + def labels(self, new_val): + # type: (Optional[Any]) -> None + self._labels = new_val + + @property + def placement(self): + # type: () -> Optional[Placement] + return self._property_impl('placement') + + @placement.setter + def placement(self, new_val): + # type: (Optional[Placement]) -> None + self._placement = new_val + + @property + def priorityClassName(self): + # type: () -> str + return self._property_impl('priorityClassName') + + @priorityClassName.setter + def priorityClassName(self, new_val): + # type: (Optional[str]) -> None + self._priorityClassName = new_val + + @property + def resources(self): + # type: () -> Optional[Resources] + return self._property_impl('resources') + + @resources.setter + def resources(self, new_val): + # type: (Optional[Resources]) -> None + self._resources = new_val + + +class Spec(CrdObject): + _properties = [ + ('dataPools', 'dataPools', 'DataPoolsList', True, True), + ('metadataPool', 'metadataPool', 'MetadataPool', True, True), + ('metadataServer', 'metadataServer', 'MetadataServer', True, False), + ('mirroring', 'mirroring', 'Mirroring', False, True), + ('preserveFilesystemOnDelete', 'preserveFilesystemOnDelete', bool, False, False), + ('preservePoolsOnDelete', 'preservePoolsOnDelete', bool, False, False) + ] + + def __init__(self, + dataPools, # type: Optional[Union[List[DataPoolsItem], CrdObjectList]] + metadataPool, # type: Optional[MetadataPool] + metadataServer, # type: MetadataServer + mirroring=_omit, # type: Optional[Mirroring] + preserveFilesystemOnDelete=_omit, # type: Optional[bool] + preservePoolsOnDelete=_omit, # type: Optional[bool] + ): + super(Spec, self).__init__( + dataPools=dataPools, + metadataPool=metadataPool, + metadataServer=metadataServer, + mirroring=mirroring, + preserveFilesystemOnDelete=preserveFilesystemOnDelete, + preservePoolsOnDelete=preservePoolsOnDelete, + ) + + @property + def dataPools(self): + # type: () -> Optional[Union[List[DataPoolsItem], CrdObjectList]] + return self._property_impl('dataPools') + + @dataPools.setter + def dataPools(self, new_val): + # type: (Optional[Union[List[DataPoolsItem], CrdObjectList]]) -> None + self._dataPools = new_val + + @property + def metadataPool(self): + # type: () -> Optional[MetadataPool] + return self._property_impl('metadataPool') + + @metadataPool.setter + def metadataPool(self, new_val): + # type: (Optional[MetadataPool]) -> None + self._metadataPool = new_val + + @property + def metadataServer(self): + # type: () -> MetadataServer + return self._property_impl('metadataServer') + + @metadataServer.setter + def metadataServer(self, new_val): + # type: (MetadataServer) -> None + self._metadataServer = new_val + + @property + def mirroring(self): + # type: () -> Optional[Mirroring] + return self._property_impl('mirroring') + + @mirroring.setter + def mirroring(self, new_val): + # type: (Optional[Mirroring]) -> None + self._mirroring = new_val + + @property + def preserveFilesystemOnDelete(self): + # type: () -> bool + return self._property_impl('preserveFilesystemOnDelete') + + @preserveFilesystemOnDelete.setter + def preserveFilesystemOnDelete(self, new_val): + # type: (Optional[bool]) -> None + self._preserveFilesystemOnDelete = new_val + + @property + def preservePoolsOnDelete(self): + # type: () -> bool + return self._property_impl('preservePoolsOnDelete') + + @preservePoolsOnDelete.setter + def preservePoolsOnDelete(self, new_val): + # type: (Optional[bool]) -> None + self._preservePoolsOnDelete = new_val + + +class Status(CrdObject): + _properties = [ + ('phase', 'phase', str, False, False) + ] + + def __init__(self, + phase=_omit, # type: Optional[str] + ): + super(Status, self).__init__( + phase=phase, + ) + + @property + def phase(self): + # type: () -> str + return self._property_impl('phase') + + @phase.setter + def phase(self, new_val): + # type: (Optional[str]) -> None + self._phase = new_val + + +class CephFilesystem(CrdClass): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', object, False, False), + ('spec', 'spec', 'Spec', True, False), + ('status', 'status', 'Status', False, False) + ] + + def __init__(self, + spec, # type: Spec + apiVersion=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Any] + status=_omit, # type: Optional[Status] + ): + super(CephFilesystem, self).__init__( + spec=spec, + apiVersion=apiVersion, + kind=kind, + metadata=metadata, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Any]) -> None + self._metadata = new_val + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Spec) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Status + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Status]) -> None + self._status = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephfilesystemmirror.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephfilesystemmirror.py new file mode 100644 index 000000000..a57fde263 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephfilesystemmirror.py @@ -0,0 +1,1013 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class ValuesList(CrdObjectList): + _items_type = str + + +class MatchExpressionsItem(CrdObject): + _properties = [ + ('key', 'key', str, True, False), + ('operator', 'operator', str, True, False), + ('values', 'values', 'ValuesList', False, False) + ] + + def __init__(self, + key, # type: str + operator, # type: str + values=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(MatchExpressionsItem, self).__init__( + key=key, + operator=operator, + values=values, + ) + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (str) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (str) -> None + self._operator = new_val + + @property + def values(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('values') + + @values.setter + def values(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._values = new_val + + +class MatchExpressionsList(CrdObjectList): + _items_type = MatchExpressionsItem + + +class MatchFieldsItem(CrdObject): + _properties = [ + ('key', 'key', str, True, False), + ('operator', 'operator', str, True, False), + ('values', 'values', 'ValuesList', False, False) + ] + + def __init__(self, + key, # type: str + operator, # type: str + values=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(MatchFieldsItem, self).__init__( + key=key, + operator=operator, + values=values, + ) + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (str) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (str) -> None + self._operator = new_val + + @property + def values(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('values') + + @values.setter + def values(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._values = new_val + + +class MatchFieldsList(CrdObjectList): + _items_type = MatchFieldsItem + + +class Preference(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchFields', 'matchFields', 'MatchFieldsList', False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchFields=_omit, # type: Optional[Union[List[MatchFieldsItem], CrdObjectList]] + ): + super(Preference, self).__init__( + matchExpressions=matchExpressions, + matchFields=matchFields, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchFields(self): + # type: () -> Union[List[MatchFieldsItem], CrdObjectList] + return self._property_impl('matchFields') + + @matchFields.setter + def matchFields(self, new_val): + # type: (Optional[Union[List[MatchFieldsItem], CrdObjectList]]) -> None + self._matchFields = new_val + + +class PreferredDuringSchedulingIgnoredDuringExecutionItem(CrdObject): + _properties = [ + ('podAffinityTerm', 'podAffinityTerm', 'PodAffinityTerm', False, False), + ('weight', 'weight', int, False, False), + ('preference', 'preference', 'Preference', False, False) + ] + + def __init__(self, + podAffinityTerm=_omit, # type: Optional[PodAffinityTerm] + weight=_omit, # type: Optional[int] + preference=_omit, # type: Optional[Preference] + ): + super(PreferredDuringSchedulingIgnoredDuringExecutionItem, self).__init__( + podAffinityTerm=podAffinityTerm, + weight=weight, + preference=preference, + ) + + @property + def podAffinityTerm(self): + # type: () -> PodAffinityTerm + return self._property_impl('podAffinityTerm') + + @podAffinityTerm.setter + def podAffinityTerm(self, new_val): + # type: (Optional[PodAffinityTerm]) -> None + self._podAffinityTerm = new_val + + @property + def weight(self): + # type: () -> int + return self._property_impl('weight') + + @weight.setter + def weight(self, new_val): + # type: (Optional[int]) -> None + self._weight = new_val + + @property + def preference(self): + # type: () -> Preference + return self._property_impl('preference') + + @preference.setter + def preference(self, new_val): + # type: (Optional[Preference]) -> None + self._preference = new_val + + +class PreferredDuringSchedulingIgnoredDuringExecutionList(CrdObjectList): + _items_type = PreferredDuringSchedulingIgnoredDuringExecutionItem + + +class NodeSelectorTermsItem(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchFields', 'matchFields', 'MatchFieldsList', False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchFields=_omit, # type: Optional[Union[List[MatchFieldsItem], CrdObjectList]] + ): + super(NodeSelectorTermsItem, self).__init__( + matchExpressions=matchExpressions, + matchFields=matchFields, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchFields(self): + # type: () -> Union[List[MatchFieldsItem], CrdObjectList] + return self._property_impl('matchFields') + + @matchFields.setter + def matchFields(self, new_val): + # type: (Optional[Union[List[MatchFieldsItem], CrdObjectList]]) -> None + self._matchFields = new_val + + +class NodeSelectorTermsList(CrdObjectList): + _items_type = NodeSelectorTermsItem + + +class RequiredDuringSchedulingIgnoredDuringExecution(CrdObject): + _properties = [ + ('nodeSelectorTerms', 'nodeSelectorTerms', 'NodeSelectorTermsList', True, False) + ] + + def __init__(self, + nodeSelectorTerms, # type: Union[List[NodeSelectorTermsItem], CrdObjectList] + ): + super(RequiredDuringSchedulingIgnoredDuringExecution, self).__init__( + nodeSelectorTerms=nodeSelectorTerms, + ) + + @property + def nodeSelectorTerms(self): + # type: () -> Union[List[NodeSelectorTermsItem], CrdObjectList] + return self._property_impl('nodeSelectorTerms') + + @nodeSelectorTerms.setter + def nodeSelectorTerms(self, new_val): + # type: (Union[List[NodeSelectorTermsItem], CrdObjectList]) -> None + self._nodeSelectorTerms = new_val + + +class NodeAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecution', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[RequiredDuringSchedulingIgnoredDuringExecution] + ): + super(NodeAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> RequiredDuringSchedulingIgnoredDuringExecution + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[RequiredDuringSchedulingIgnoredDuringExecution]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class LabelSelector(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchLabels', 'matchLabels', object, False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchLabels=_omit, # type: Optional[Any] + ): + super(LabelSelector, self).__init__( + matchExpressions=matchExpressions, + matchLabels=matchLabels, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchLabels(self): + # type: () -> Any + return self._property_impl('matchLabels') + + @matchLabels.setter + def matchLabels(self, new_val): + # type: (Optional[Any]) -> None + self._matchLabels = new_val + + +class NamespaceSelector(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchLabels', 'matchLabels', object, False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchLabels=_omit, # type: Optional[Any] + ): + super(NamespaceSelector, self).__init__( + matchExpressions=matchExpressions, + matchLabels=matchLabels, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchLabels(self): + # type: () -> Any + return self._property_impl('matchLabels') + + @matchLabels.setter + def matchLabels(self, new_val): + # type: (Optional[Any]) -> None + self._matchLabels = new_val + + +class NamespacesList(CrdObjectList): + _items_type = str + + +class PodAffinityTerm(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('namespaceSelector', 'namespaceSelector', 'NamespaceSelector', False, False), + ('namespaces', 'namespaces', 'NamespacesList', False, False), + ('topologyKey', 'topologyKey', str, True, False) + ] + + def __init__(self, + topologyKey, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + namespaceSelector=_omit, # type: Optional[NamespaceSelector] + namespaces=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(PodAffinityTerm, self).__init__( + topologyKey=topologyKey, + labelSelector=labelSelector, + namespaceSelector=namespaceSelector, + namespaces=namespaces, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def namespaceSelector(self): + # type: () -> NamespaceSelector + return self._property_impl('namespaceSelector') + + @namespaceSelector.setter + def namespaceSelector(self, new_val): + # type: (Optional[NamespaceSelector]) -> None + self._namespaceSelector = new_val + + @property + def namespaces(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('namespaces') + + @namespaces.setter + def namespaces(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._namespaces = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + +class RequiredDuringSchedulingIgnoredDuringExecutionItem(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('namespaceSelector', 'namespaceSelector', 'NamespaceSelector', False, False), + ('namespaces', 'namespaces', 'NamespacesList', False, False), + ('topologyKey', 'topologyKey', str, True, False) + ] + + def __init__(self, + topologyKey, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + namespaceSelector=_omit, # type: Optional[NamespaceSelector] + namespaces=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(RequiredDuringSchedulingIgnoredDuringExecutionItem, self).__init__( + topologyKey=topologyKey, + labelSelector=labelSelector, + namespaceSelector=namespaceSelector, + namespaces=namespaces, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def namespaceSelector(self): + # type: () -> NamespaceSelector + return self._property_impl('namespaceSelector') + + @namespaceSelector.setter + def namespaceSelector(self, new_val): + # type: (Optional[NamespaceSelector]) -> None + self._namespaceSelector = new_val + + @property + def namespaces(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('namespaces') + + @namespaces.setter + def namespaces(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._namespaces = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + +class RequiredDuringSchedulingIgnoredDuringExecutionList(CrdObjectList): + _items_type = RequiredDuringSchedulingIgnoredDuringExecutionItem + + +class PodAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecutionList', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + ): + super(PodAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class PodAntiAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecutionList', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + ): + super(PodAntiAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class TolerationsItem(CrdObject): + _properties = [ + ('effect', 'effect', str, False, False), + ('key', 'key', str, False, False), + ('operator', 'operator', str, False, False), + ('tolerationSeconds', 'tolerationSeconds', int, False, False), + ('value', 'value', str, False, False) + ] + + def __init__(self, + effect=_omit, # type: Optional[str] + key=_omit, # type: Optional[str] + operator=_omit, # type: Optional[str] + tolerationSeconds=_omit, # type: Optional[int] + value=_omit, # type: Optional[str] + ): + super(TolerationsItem, self).__init__( + effect=effect, + key=key, + operator=operator, + tolerationSeconds=tolerationSeconds, + value=value, + ) + + @property + def effect(self): + # type: () -> str + return self._property_impl('effect') + + @effect.setter + def effect(self, new_val): + # type: (Optional[str]) -> None + self._effect = new_val + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (Optional[str]) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (Optional[str]) -> None + self._operator = new_val + + @property + def tolerationSeconds(self): + # type: () -> int + return self._property_impl('tolerationSeconds') + + @tolerationSeconds.setter + def tolerationSeconds(self, new_val): + # type: (Optional[int]) -> None + self._tolerationSeconds = new_val + + @property + def value(self): + # type: () -> str + return self._property_impl('value') + + @value.setter + def value(self, new_val): + # type: (Optional[str]) -> None + self._value = new_val + + +class TolerationsList(CrdObjectList): + _items_type = TolerationsItem + + +class TopologySpreadConstraintsItem(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('maxSkew', 'maxSkew', int, True, False), + ('topologyKey', 'topologyKey', str, True, False), + ('whenUnsatisfiable', 'whenUnsatisfiable', str, True, False) + ] + + def __init__(self, + maxSkew, # type: int + topologyKey, # type: str + whenUnsatisfiable, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + ): + super(TopologySpreadConstraintsItem, self).__init__( + maxSkew=maxSkew, + topologyKey=topologyKey, + whenUnsatisfiable=whenUnsatisfiable, + labelSelector=labelSelector, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def maxSkew(self): + # type: () -> int + return self._property_impl('maxSkew') + + @maxSkew.setter + def maxSkew(self, new_val): + # type: (int) -> None + self._maxSkew = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + @property + def whenUnsatisfiable(self): + # type: () -> str + return self._property_impl('whenUnsatisfiable') + + @whenUnsatisfiable.setter + def whenUnsatisfiable(self, new_val): + # type: (str) -> None + self._whenUnsatisfiable = new_val + + +class TopologySpreadConstraintsList(CrdObjectList): + _items_type = TopologySpreadConstraintsItem + + +class Placement(CrdObject): + _properties = [ + ('nodeAffinity', 'nodeAffinity', 'NodeAffinity', False, False), + ('podAffinity', 'podAffinity', 'PodAffinity', False, False), + ('podAntiAffinity', 'podAntiAffinity', 'PodAntiAffinity', False, False), + ('tolerations', 'tolerations', 'TolerationsList', False, False), + ('topologySpreadConstraints', 'topologySpreadConstraints', 'TopologySpreadConstraintsList', False, False) + ] + + def __init__(self, + nodeAffinity=_omit, # type: Optional[NodeAffinity] + podAffinity=_omit, # type: Optional[PodAffinity] + podAntiAffinity=_omit, # type: Optional[PodAntiAffinity] + tolerations=_omit, # type: Optional[Union[List[TolerationsItem], CrdObjectList]] + topologySpreadConstraints=_omit, # type: Optional[Union[List[TopologySpreadConstraintsItem], CrdObjectList]] + ): + super(Placement, self).__init__( + nodeAffinity=nodeAffinity, + podAffinity=podAffinity, + podAntiAffinity=podAntiAffinity, + tolerations=tolerations, + topologySpreadConstraints=topologySpreadConstraints, + ) + + @property + def nodeAffinity(self): + # type: () -> NodeAffinity + return self._property_impl('nodeAffinity') + + @nodeAffinity.setter + def nodeAffinity(self, new_val): + # type: (Optional[NodeAffinity]) -> None + self._nodeAffinity = new_val + + @property + def podAffinity(self): + # type: () -> PodAffinity + return self._property_impl('podAffinity') + + @podAffinity.setter + def podAffinity(self, new_val): + # type: (Optional[PodAffinity]) -> None + self._podAffinity = new_val + + @property + def podAntiAffinity(self): + # type: () -> PodAntiAffinity + return self._property_impl('podAntiAffinity') + + @podAntiAffinity.setter + def podAntiAffinity(self, new_val): + # type: (Optional[PodAntiAffinity]) -> None + self._podAntiAffinity = new_val + + @property + def tolerations(self): + # type: () -> Union[List[TolerationsItem], CrdObjectList] + return self._property_impl('tolerations') + + @tolerations.setter + def tolerations(self, new_val): + # type: (Optional[Union[List[TolerationsItem], CrdObjectList]]) -> None + self._tolerations = new_val + + @property + def topologySpreadConstraints(self): + # type: () -> Union[List[TopologySpreadConstraintsItem], CrdObjectList] + return self._property_impl('topologySpreadConstraints') + + @topologySpreadConstraints.setter + def topologySpreadConstraints(self, new_val): + # type: (Optional[Union[List[TopologySpreadConstraintsItem], CrdObjectList]]) -> None + self._topologySpreadConstraints = new_val + + +class Resources(CrdObject): + _properties = [ + ('limits', 'limits', object, False, False), + ('requests', 'requests', object, False, False) + ] + + def __init__(self, + limits=_omit, # type: Optional[Any] + requests=_omit, # type: Optional[Any] + ): + super(Resources, self).__init__( + limits=limits, + requests=requests, + ) + + @property + def limits(self): + # type: () -> Any + return self._property_impl('limits') + + @limits.setter + def limits(self, new_val): + # type: (Optional[Any]) -> None + self._limits = new_val + + @property + def requests(self): + # type: () -> Any + return self._property_impl('requests') + + @requests.setter + def requests(self, new_val): + # type: (Optional[Any]) -> None + self._requests = new_val + + +class Spec(CrdObject): + _properties = [ + ('annotations', 'annotations', object, False, True), + ('labels', 'labels', object, False, True), + ('placement', 'placement', 'Placement', False, True), + ('priorityClassName', 'priorityClassName', str, False, False), + ('resources', 'resources', 'Resources', False, True) + ] + + def __init__(self, + annotations=_omit, # type: Optional[Any] + labels=_omit, # type: Optional[Any] + placement=_omit, # type: Optional[Placement] + priorityClassName=_omit, # type: Optional[str] + resources=_omit, # type: Optional[Resources] + ): + super(Spec, self).__init__( + annotations=annotations, + labels=labels, + placement=placement, + priorityClassName=priorityClassName, + resources=resources, + ) + + @property + def annotations(self): + # type: () -> Optional[Any] + return self._property_impl('annotations') + + @annotations.setter + def annotations(self, new_val): + # type: (Optional[Any]) -> None + self._annotations = new_val + + @property + def labels(self): + # type: () -> Optional[Any] + return self._property_impl('labels') + + @labels.setter + def labels(self, new_val): + # type: (Optional[Any]) -> None + self._labels = new_val + + @property + def placement(self): + # type: () -> Optional[Placement] + return self._property_impl('placement') + + @placement.setter + def placement(self, new_val): + # type: (Optional[Placement]) -> None + self._placement = new_val + + @property + def priorityClassName(self): + # type: () -> str + return self._property_impl('priorityClassName') + + @priorityClassName.setter + def priorityClassName(self, new_val): + # type: (Optional[str]) -> None + self._priorityClassName = new_val + + @property + def resources(self): + # type: () -> Optional[Resources] + return self._property_impl('resources') + + @resources.setter + def resources(self, new_val): + # type: (Optional[Resources]) -> None + self._resources = new_val + + +class Status(CrdObject): + _properties = [ + ('phase', 'phase', str, False, False) + ] + + def __init__(self, + phase=_omit, # type: Optional[str] + ): + super(Status, self).__init__( + phase=phase, + ) + + @property + def phase(self): + # type: () -> str + return self._property_impl('phase') + + @phase.setter + def phase(self, new_val): + # type: (Optional[str]) -> None + self._phase = new_val + + +class CephFilesystemMirror(CrdClass): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', object, False, False), + ('spec', 'spec', 'Spec', True, False), + ('status', 'status', 'Status', False, False) + ] + + def __init__(self, + spec, # type: Spec + apiVersion=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Any] + status=_omit, # type: Optional[Status] + ): + super(CephFilesystemMirror, self).__init__( + spec=spec, + apiVersion=apiVersion, + kind=kind, + metadata=metadata, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Any]) -> None + self._metadata = new_val + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Spec) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Status + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Status]) -> None + self._status = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephnfs.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephnfs.py new file mode 100644 index 000000000..af069f303 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephnfs.py @@ -0,0 +1,1111 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class Rados(CrdObject): + _properties = [ + ('namespace', 'namespace', str, True, False), + ('pool', 'pool', str, True, False) + ] + + def __init__(self, + namespace, # type: str + pool, # type: str + ): + super(Rados, self).__init__( + namespace=namespace, + pool=pool, + ) + + @property + def namespace(self): + # type: () -> str + return self._property_impl('namespace') + + @namespace.setter + def namespace(self, new_val): + # type: (str) -> None + self._namespace = new_val + + @property + def pool(self): + # type: () -> str + return self._property_impl('pool') + + @pool.setter + def pool(self, new_val): + # type: (str) -> None + self._pool = new_val + + +class ValuesList(CrdObjectList): + _items_type = str + + +class MatchExpressionsItem(CrdObject): + _properties = [ + ('key', 'key', str, True, False), + ('operator', 'operator', str, True, False), + ('values', 'values', 'ValuesList', False, False) + ] + + def __init__(self, + key, # type: str + operator, # type: str + values=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(MatchExpressionsItem, self).__init__( + key=key, + operator=operator, + values=values, + ) + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (str) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (str) -> None + self._operator = new_val + + @property + def values(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('values') + + @values.setter + def values(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._values = new_val + + +class MatchExpressionsList(CrdObjectList): + _items_type = MatchExpressionsItem + + +class MatchFieldsItem(CrdObject): + _properties = [ + ('key', 'key', str, True, False), + ('operator', 'operator', str, True, False), + ('values', 'values', 'ValuesList', False, False) + ] + + def __init__(self, + key, # type: str + operator, # type: str + values=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(MatchFieldsItem, self).__init__( + key=key, + operator=operator, + values=values, + ) + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (str) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (str) -> None + self._operator = new_val + + @property + def values(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('values') + + @values.setter + def values(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._values = new_val + + +class MatchFieldsList(CrdObjectList): + _items_type = MatchFieldsItem + + +class Preference(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchFields', 'matchFields', 'MatchFieldsList', False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchFields=_omit, # type: Optional[Union[List[MatchFieldsItem], CrdObjectList]] + ): + super(Preference, self).__init__( + matchExpressions=matchExpressions, + matchFields=matchFields, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchFields(self): + # type: () -> Union[List[MatchFieldsItem], CrdObjectList] + return self._property_impl('matchFields') + + @matchFields.setter + def matchFields(self, new_val): + # type: (Optional[Union[List[MatchFieldsItem], CrdObjectList]]) -> None + self._matchFields = new_val + + +class PreferredDuringSchedulingIgnoredDuringExecutionItem(CrdObject): + _properties = [ + ('podAffinityTerm', 'podAffinityTerm', 'PodAffinityTerm', False, False), + ('weight', 'weight', int, False, False), + ('preference', 'preference', 'Preference', False, False) + ] + + def __init__(self, + podAffinityTerm=_omit, # type: Optional[PodAffinityTerm] + weight=_omit, # type: Optional[int] + preference=_omit, # type: Optional[Preference] + ): + super(PreferredDuringSchedulingIgnoredDuringExecutionItem, self).__init__( + podAffinityTerm=podAffinityTerm, + weight=weight, + preference=preference, + ) + + @property + def podAffinityTerm(self): + # type: () -> PodAffinityTerm + return self._property_impl('podAffinityTerm') + + @podAffinityTerm.setter + def podAffinityTerm(self, new_val): + # type: (Optional[PodAffinityTerm]) -> None + self._podAffinityTerm = new_val + + @property + def weight(self): + # type: () -> int + return self._property_impl('weight') + + @weight.setter + def weight(self, new_val): + # type: (Optional[int]) -> None + self._weight = new_val + + @property + def preference(self): + # type: () -> Preference + return self._property_impl('preference') + + @preference.setter + def preference(self, new_val): + # type: (Optional[Preference]) -> None + self._preference = new_val + + +class PreferredDuringSchedulingIgnoredDuringExecutionList(CrdObjectList): + _items_type = PreferredDuringSchedulingIgnoredDuringExecutionItem + + +class NodeSelectorTermsItem(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchFields', 'matchFields', 'MatchFieldsList', False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchFields=_omit, # type: Optional[Union[List[MatchFieldsItem], CrdObjectList]] + ): + super(NodeSelectorTermsItem, self).__init__( + matchExpressions=matchExpressions, + matchFields=matchFields, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchFields(self): + # type: () -> Union[List[MatchFieldsItem], CrdObjectList] + return self._property_impl('matchFields') + + @matchFields.setter + def matchFields(self, new_val): + # type: (Optional[Union[List[MatchFieldsItem], CrdObjectList]]) -> None + self._matchFields = new_val + + +class NodeSelectorTermsList(CrdObjectList): + _items_type = NodeSelectorTermsItem + + +class RequiredDuringSchedulingIgnoredDuringExecution(CrdObject): + _properties = [ + ('nodeSelectorTerms', 'nodeSelectorTerms', 'NodeSelectorTermsList', True, False) + ] + + def __init__(self, + nodeSelectorTerms, # type: Union[List[NodeSelectorTermsItem], CrdObjectList] + ): + super(RequiredDuringSchedulingIgnoredDuringExecution, self).__init__( + nodeSelectorTerms=nodeSelectorTerms, + ) + + @property + def nodeSelectorTerms(self): + # type: () -> Union[List[NodeSelectorTermsItem], CrdObjectList] + return self._property_impl('nodeSelectorTerms') + + @nodeSelectorTerms.setter + def nodeSelectorTerms(self, new_val): + # type: (Union[List[NodeSelectorTermsItem], CrdObjectList]) -> None + self._nodeSelectorTerms = new_val + + +class NodeAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecution', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[RequiredDuringSchedulingIgnoredDuringExecution] + ): + super(NodeAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> RequiredDuringSchedulingIgnoredDuringExecution + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[RequiredDuringSchedulingIgnoredDuringExecution]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class LabelSelector(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchLabels', 'matchLabels', object, False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchLabels=_omit, # type: Optional[Any] + ): + super(LabelSelector, self).__init__( + matchExpressions=matchExpressions, + matchLabels=matchLabels, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchLabels(self): + # type: () -> Any + return self._property_impl('matchLabels') + + @matchLabels.setter + def matchLabels(self, new_val): + # type: (Optional[Any]) -> None + self._matchLabels = new_val + + +class NamespaceSelector(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchLabels', 'matchLabels', object, False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchLabels=_omit, # type: Optional[Any] + ): + super(NamespaceSelector, self).__init__( + matchExpressions=matchExpressions, + matchLabels=matchLabels, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchLabels(self): + # type: () -> Any + return self._property_impl('matchLabels') + + @matchLabels.setter + def matchLabels(self, new_val): + # type: (Optional[Any]) -> None + self._matchLabels = new_val + + +class NamespacesList(CrdObjectList): + _items_type = str + + +class PodAffinityTerm(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('namespaceSelector', 'namespaceSelector', 'NamespaceSelector', False, False), + ('namespaces', 'namespaces', 'NamespacesList', False, False), + ('topologyKey', 'topologyKey', str, True, False) + ] + + def __init__(self, + topologyKey, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + namespaceSelector=_omit, # type: Optional[NamespaceSelector] + namespaces=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(PodAffinityTerm, self).__init__( + topologyKey=topologyKey, + labelSelector=labelSelector, + namespaceSelector=namespaceSelector, + namespaces=namespaces, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def namespaceSelector(self): + # type: () -> NamespaceSelector + return self._property_impl('namespaceSelector') + + @namespaceSelector.setter + def namespaceSelector(self, new_val): + # type: (Optional[NamespaceSelector]) -> None + self._namespaceSelector = new_val + + @property + def namespaces(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('namespaces') + + @namespaces.setter + def namespaces(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._namespaces = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + +class RequiredDuringSchedulingIgnoredDuringExecutionItem(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('namespaceSelector', 'namespaceSelector', 'NamespaceSelector', False, False), + ('namespaces', 'namespaces', 'NamespacesList', False, False), + ('topologyKey', 'topologyKey', str, True, False) + ] + + def __init__(self, + topologyKey, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + namespaceSelector=_omit, # type: Optional[NamespaceSelector] + namespaces=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(RequiredDuringSchedulingIgnoredDuringExecutionItem, self).__init__( + topologyKey=topologyKey, + labelSelector=labelSelector, + namespaceSelector=namespaceSelector, + namespaces=namespaces, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def namespaceSelector(self): + # type: () -> NamespaceSelector + return self._property_impl('namespaceSelector') + + @namespaceSelector.setter + def namespaceSelector(self, new_val): + # type: (Optional[NamespaceSelector]) -> None + self._namespaceSelector = new_val + + @property + def namespaces(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('namespaces') + + @namespaces.setter + def namespaces(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._namespaces = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + +class RequiredDuringSchedulingIgnoredDuringExecutionList(CrdObjectList): + _items_type = RequiredDuringSchedulingIgnoredDuringExecutionItem + + +class PodAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecutionList', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + ): + super(PodAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class PodAntiAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecutionList', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + ): + super(PodAntiAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class TolerationsItem(CrdObject): + _properties = [ + ('effect', 'effect', str, False, False), + ('key', 'key', str, False, False), + ('operator', 'operator', str, False, False), + ('tolerationSeconds', 'tolerationSeconds', int, False, False), + ('value', 'value', str, False, False) + ] + + def __init__(self, + effect=_omit, # type: Optional[str] + key=_omit, # type: Optional[str] + operator=_omit, # type: Optional[str] + tolerationSeconds=_omit, # type: Optional[int] + value=_omit, # type: Optional[str] + ): + super(TolerationsItem, self).__init__( + effect=effect, + key=key, + operator=operator, + tolerationSeconds=tolerationSeconds, + value=value, + ) + + @property + def effect(self): + # type: () -> str + return self._property_impl('effect') + + @effect.setter + def effect(self, new_val): + # type: (Optional[str]) -> None + self._effect = new_val + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (Optional[str]) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (Optional[str]) -> None + self._operator = new_val + + @property + def tolerationSeconds(self): + # type: () -> int + return self._property_impl('tolerationSeconds') + + @tolerationSeconds.setter + def tolerationSeconds(self, new_val): + # type: (Optional[int]) -> None + self._tolerationSeconds = new_val + + @property + def value(self): + # type: () -> str + return self._property_impl('value') + + @value.setter + def value(self, new_val): + # type: (Optional[str]) -> None + self._value = new_val + + +class TolerationsList(CrdObjectList): + _items_type = TolerationsItem + + +class TopologySpreadConstraintsItem(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('maxSkew', 'maxSkew', int, True, False), + ('topologyKey', 'topologyKey', str, True, False), + ('whenUnsatisfiable', 'whenUnsatisfiable', str, True, False) + ] + + def __init__(self, + maxSkew, # type: int + topologyKey, # type: str + whenUnsatisfiable, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + ): + super(TopologySpreadConstraintsItem, self).__init__( + maxSkew=maxSkew, + topologyKey=topologyKey, + whenUnsatisfiable=whenUnsatisfiable, + labelSelector=labelSelector, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def maxSkew(self): + # type: () -> int + return self._property_impl('maxSkew') + + @maxSkew.setter + def maxSkew(self, new_val): + # type: (int) -> None + self._maxSkew = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + @property + def whenUnsatisfiable(self): + # type: () -> str + return self._property_impl('whenUnsatisfiable') + + @whenUnsatisfiable.setter + def whenUnsatisfiable(self, new_val): + # type: (str) -> None + self._whenUnsatisfiable = new_val + + +class TopologySpreadConstraintsList(CrdObjectList): + _items_type = TopologySpreadConstraintsItem + + +class Placement(CrdObject): + _properties = [ + ('nodeAffinity', 'nodeAffinity', 'NodeAffinity', False, False), + ('podAffinity', 'podAffinity', 'PodAffinity', False, False), + ('podAntiAffinity', 'podAntiAffinity', 'PodAntiAffinity', False, False), + ('tolerations', 'tolerations', 'TolerationsList', False, False), + ('topologySpreadConstraints', 'topologySpreadConstraints', 'TopologySpreadConstraintsList', False, False) + ] + + def __init__(self, + nodeAffinity=_omit, # type: Optional[NodeAffinity] + podAffinity=_omit, # type: Optional[PodAffinity] + podAntiAffinity=_omit, # type: Optional[PodAntiAffinity] + tolerations=_omit, # type: Optional[Union[List[TolerationsItem], CrdObjectList]] + topologySpreadConstraints=_omit, # type: Optional[Union[List[TopologySpreadConstraintsItem], CrdObjectList]] + ): + super(Placement, self).__init__( + nodeAffinity=nodeAffinity, + podAffinity=podAffinity, + podAntiAffinity=podAntiAffinity, + tolerations=tolerations, + topologySpreadConstraints=topologySpreadConstraints, + ) + + @property + def nodeAffinity(self): + # type: () -> NodeAffinity + return self._property_impl('nodeAffinity') + + @nodeAffinity.setter + def nodeAffinity(self, new_val): + # type: (Optional[NodeAffinity]) -> None + self._nodeAffinity = new_val + + @property + def podAffinity(self): + # type: () -> PodAffinity + return self._property_impl('podAffinity') + + @podAffinity.setter + def podAffinity(self, new_val): + # type: (Optional[PodAffinity]) -> None + self._podAffinity = new_val + + @property + def podAntiAffinity(self): + # type: () -> PodAntiAffinity + return self._property_impl('podAntiAffinity') + + @podAntiAffinity.setter + def podAntiAffinity(self, new_val): + # type: (Optional[PodAntiAffinity]) -> None + self._podAntiAffinity = new_val + + @property + def tolerations(self): + # type: () -> Union[List[TolerationsItem], CrdObjectList] + return self._property_impl('tolerations') + + @tolerations.setter + def tolerations(self, new_val): + # type: (Optional[Union[List[TolerationsItem], CrdObjectList]]) -> None + self._tolerations = new_val + + @property + def topologySpreadConstraints(self): + # type: () -> Union[List[TopologySpreadConstraintsItem], CrdObjectList] + return self._property_impl('topologySpreadConstraints') + + @topologySpreadConstraints.setter + def topologySpreadConstraints(self, new_val): + # type: (Optional[Union[List[TopologySpreadConstraintsItem], CrdObjectList]]) -> None + self._topologySpreadConstraints = new_val + + +class Resources(CrdObject): + _properties = [ + ('limits', 'limits', object, False, False), + ('requests', 'requests', object, False, False) + ] + + def __init__(self, + limits=_omit, # type: Optional[Any] + requests=_omit, # type: Optional[Any] + ): + super(Resources, self).__init__( + limits=limits, + requests=requests, + ) + + @property + def limits(self): + # type: () -> Any + return self._property_impl('limits') + + @limits.setter + def limits(self, new_val): + # type: (Optional[Any]) -> None + self._limits = new_val + + @property + def requests(self): + # type: () -> Any + return self._property_impl('requests') + + @requests.setter + def requests(self, new_val): + # type: (Optional[Any]) -> None + self._requests = new_val + + +class Server(CrdObject): + _properties = [ + ('active', 'active', int, True, False), + ('annotations', 'annotations', object, False, True), + ('labels', 'labels', object, False, True), + ('logLevel', 'logLevel', str, False, False), + ('placement', 'placement', 'Placement', False, True), + ('priorityClassName', 'priorityClassName', str, False, False), + ('resources', 'resources', 'Resources', False, True) + ] + + def __init__(self, + active, # type: int + annotations=_omit, # type: Optional[Any] + labels=_omit, # type: Optional[Any] + logLevel=_omit, # type: Optional[str] + placement=_omit, # type: Optional[Placement] + priorityClassName=_omit, # type: Optional[str] + resources=_omit, # type: Optional[Resources] + ): + super(Server, self).__init__( + active=active, + annotations=annotations, + labels=labels, + logLevel=logLevel, + placement=placement, + priorityClassName=priorityClassName, + resources=resources, + ) + + @property + def active(self): + # type: () -> int + return self._property_impl('active') + + @active.setter + def active(self, new_val): + # type: (int) -> None + self._active = new_val + + @property + def annotations(self): + # type: () -> Optional[Any] + return self._property_impl('annotations') + + @annotations.setter + def annotations(self, new_val): + # type: (Optional[Any]) -> None + self._annotations = new_val + + @property + def labels(self): + # type: () -> Optional[Any] + return self._property_impl('labels') + + @labels.setter + def labels(self, new_val): + # type: (Optional[Any]) -> None + self._labels = new_val + + @property + def logLevel(self): + # type: () -> str + return self._property_impl('logLevel') + + @logLevel.setter + def logLevel(self, new_val): + # type: (Optional[str]) -> None + self._logLevel = new_val + + @property + def placement(self): + # type: () -> Optional[Placement] + return self._property_impl('placement') + + @placement.setter + def placement(self, new_val): + # type: (Optional[Placement]) -> None + self._placement = new_val + + @property + def priorityClassName(self): + # type: () -> str + return self._property_impl('priorityClassName') + + @priorityClassName.setter + def priorityClassName(self, new_val): + # type: (Optional[str]) -> None + self._priorityClassName = new_val + + @property + def resources(self): + # type: () -> Optional[Resources] + return self._property_impl('resources') + + @resources.setter + def resources(self, new_val): + # type: (Optional[Resources]) -> None + self._resources = new_val + + +class Spec(CrdObject): + _properties = [ + ('rados', 'rados', 'Rados', True, False), + ('server', 'server', 'Server', True, False) + ] + + def __init__(self, + rados, # type: Rados + server, # type: Server + ): + super(Spec, self).__init__( + rados=rados, + server=server, + ) + + @property + def rados(self): + # type: () -> Rados + return self._property_impl('rados') + + @rados.setter + def rados(self, new_val): + # type: (Rados) -> None + self._rados = new_val + + @property + def server(self): + # type: () -> Server + return self._property_impl('server') + + @server.setter + def server(self, new_val): + # type: (Server) -> None + self._server = new_val + + +class Status(CrdObject): + _properties = [ + ('phase', 'phase', str, False, False) + ] + + def __init__(self, + phase=_omit, # type: Optional[str] + ): + super(Status, self).__init__( + phase=phase, + ) + + @property + def phase(self): + # type: () -> str + return self._property_impl('phase') + + @phase.setter + def phase(self, new_val): + # type: (Optional[str]) -> None + self._phase = new_val + + +class CephNFS(CrdClass): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', object, False, False), + ('spec', 'spec', 'Spec', True, False), + ('status', 'status', 'Status', False, False) + ] + + def __init__(self, + spec, # type: Spec + apiVersion=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Any] + status=_omit, # type: Optional[Status] + ): + super(CephNFS, self).__init__( + spec=spec, + apiVersion=apiVersion, + kind=kind, + metadata=metadata, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Any]) -> None + self._metadata = new_val + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Spec) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Status + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Status]) -> None + self._status = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephobjectrealm.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephobjectrealm.py new file mode 100644 index 000000000..eeac3f3f5 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephobjectrealm.py @@ -0,0 +1,154 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class Pull(CrdObject): + _properties = [ + ('endpoint', 'endpoint', str, True, False) + ] + + def __init__(self, + endpoint, # type: str + ): + super(Pull, self).__init__( + endpoint=endpoint, + ) + + @property + def endpoint(self): + # type: () -> str + return self._property_impl('endpoint') + + @endpoint.setter + def endpoint(self, new_val): + # type: (str) -> None + self._endpoint = new_val + + +class Spec(CrdObject): + _properties = [ + ('pull', 'pull', 'Pull', True, False) + ] + + def __init__(self, + pull, # type: Pull + ): + super(Spec, self).__init__( + pull=pull, + ) + + @property + def pull(self): + # type: () -> Pull + return self._property_impl('pull') + + @pull.setter + def pull(self, new_val): + # type: (Pull) -> None + self._pull = new_val + + +class Status(CrdObject): + _properties = [ + ('phase', 'phase', str, False, False) + ] + + def __init__(self, + phase=_omit, # type: Optional[str] + ): + super(Status, self).__init__( + phase=phase, + ) + + @property + def phase(self): + # type: () -> str + return self._property_impl('phase') + + @phase.setter + def phase(self, new_val): + # type: (Optional[str]) -> None + self._phase = new_val + + +class CephObjectRealm(CrdClass): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', object, False, False), + ('spec', 'spec', 'Spec', True, True), + ('status', 'status', 'Status', False, False) + ] + + def __init__(self, + spec, # type: Optional[Spec] + apiVersion=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Any] + status=_omit, # type: Optional[Status] + ): + super(CephObjectRealm, self).__init__( + spec=spec, + apiVersion=apiVersion, + kind=kind, + metadata=metadata, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Any]) -> None + self._metadata = new_val + + @property + def spec(self): + # type: () -> Optional[Spec] + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Optional[Spec]) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Status + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Status]) -> None + self._status = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephobjectstore.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephobjectstore.py new file mode 100644 index 000000000..2c7d7cb74 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephobjectstore.py @@ -0,0 +1,2631 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class ErasureCoded(CrdObject): + _properties = [ + ('algorithm', 'algorithm', str, False, False), + ('codingChunks', 'codingChunks', int, True, False), + ('dataChunks', 'dataChunks', int, True, False) + ] + + def __init__(self, + codingChunks, # type: int + dataChunks, # type: int + algorithm=_omit, # type: Optional[str] + ): + super(ErasureCoded, self).__init__( + codingChunks=codingChunks, + dataChunks=dataChunks, + algorithm=algorithm, + ) + + @property + def algorithm(self): + # type: () -> str + return self._property_impl('algorithm') + + @algorithm.setter + def algorithm(self, new_val): + # type: (Optional[str]) -> None + self._algorithm = new_val + + @property + def codingChunks(self): + # type: () -> int + return self._property_impl('codingChunks') + + @codingChunks.setter + def codingChunks(self, new_val): + # type: (int) -> None + self._codingChunks = new_val + + @property + def dataChunks(self): + # type: () -> int + return self._property_impl('dataChunks') + + @dataChunks.setter + def dataChunks(self, new_val): + # type: (int) -> None + self._dataChunks = new_val + + +class SnapshotSchedulesItem(CrdObject): + _properties = [ + ('interval', 'interval', str, False, False), + ('startTime', 'startTime', str, False, False) + ] + + def __init__(self, + interval=_omit, # type: Optional[str] + startTime=_omit, # type: Optional[str] + ): + super(SnapshotSchedulesItem, self).__init__( + interval=interval, + startTime=startTime, + ) + + @property + def interval(self): + # type: () -> str + return self._property_impl('interval') + + @interval.setter + def interval(self, new_val): + # type: (Optional[str]) -> None + self._interval = new_val + + @property + def startTime(self): + # type: () -> str + return self._property_impl('startTime') + + @startTime.setter + def startTime(self, new_val): + # type: (Optional[str]) -> None + self._startTime = new_val + + +class SnapshotSchedulesList(CrdObjectList): + _items_type = SnapshotSchedulesItem + + +class Mirroring(CrdObject): + _properties = [ + ('enabled', 'enabled', bool, False, False), + ('mode', 'mode', str, False, False), + ('snapshotSchedules', 'snapshotSchedules', 'SnapshotSchedulesList', False, False) + ] + + def __init__(self, + enabled=_omit, # type: Optional[bool] + mode=_omit, # type: Optional[str] + snapshotSchedules=_omit, # type: Optional[Union[List[SnapshotSchedulesItem], CrdObjectList]] + ): + super(Mirroring, self).__init__( + enabled=enabled, + mode=mode, + snapshotSchedules=snapshotSchedules, + ) + + @property + def enabled(self): + # type: () -> bool + return self._property_impl('enabled') + + @enabled.setter + def enabled(self, new_val): + # type: (Optional[bool]) -> None + self._enabled = new_val + + @property + def mode(self): + # type: () -> str + return self._property_impl('mode') + + @mode.setter + def mode(self, new_val): + # type: (Optional[str]) -> None + self._mode = new_val + + @property + def snapshotSchedules(self): + # type: () -> Union[List[SnapshotSchedulesItem], CrdObjectList] + return self._property_impl('snapshotSchedules') + + @snapshotSchedules.setter + def snapshotSchedules(self, new_val): + # type: (Optional[Union[List[SnapshotSchedulesItem], CrdObjectList]]) -> None + self._snapshotSchedules = new_val + + +class Quotas(CrdObject): + _properties = [ + ('maxBytes', 'maxBytes', int, False, False), + ('maxObjects', 'maxObjects', int, False, False), + ('maxSize', 'maxSize', str, False, False) + ] + + def __init__(self, + maxBytes=_omit, # type: Optional[int] + maxObjects=_omit, # type: Optional[int] + maxSize=_omit, # type: Optional[str] + ): + super(Quotas, self).__init__( + maxBytes=maxBytes, + maxObjects=maxObjects, + maxSize=maxSize, + ) + + @property + def maxBytes(self): + # type: () -> int + return self._property_impl('maxBytes') + + @maxBytes.setter + def maxBytes(self, new_val): + # type: (Optional[int]) -> None + self._maxBytes = new_val + + @property + def maxObjects(self): + # type: () -> int + return self._property_impl('maxObjects') + + @maxObjects.setter + def maxObjects(self, new_val): + # type: (Optional[int]) -> None + self._maxObjects = new_val + + @property + def maxSize(self): + # type: () -> str + return self._property_impl('maxSize') + + @maxSize.setter + def maxSize(self, new_val): + # type: (Optional[str]) -> None + self._maxSize = new_val + + +class Replicated(CrdObject): + _properties = [ + ('replicasPerFailureDomain', 'replicasPerFailureDomain', int, False, False), + ('requireSafeReplicaSize', 'requireSafeReplicaSize', bool, False, False), + ('size', 'size', int, True, False), + ('subFailureDomain', 'subFailureDomain', str, False, False), + ('targetSizeRatio', 'targetSizeRatio', float, False, False) + ] + + def __init__(self, + size, # type: int + replicasPerFailureDomain=_omit, # type: Optional[int] + requireSafeReplicaSize=_omit, # type: Optional[bool] + subFailureDomain=_omit, # type: Optional[str] + targetSizeRatio=_omit, # type: Optional[float] + ): + super(Replicated, self).__init__( + size=size, + replicasPerFailureDomain=replicasPerFailureDomain, + requireSafeReplicaSize=requireSafeReplicaSize, + subFailureDomain=subFailureDomain, + targetSizeRatio=targetSizeRatio, + ) + + @property + def replicasPerFailureDomain(self): + # type: () -> int + return self._property_impl('replicasPerFailureDomain') + + @replicasPerFailureDomain.setter + def replicasPerFailureDomain(self, new_val): + # type: (Optional[int]) -> None + self._replicasPerFailureDomain = new_val + + @property + def requireSafeReplicaSize(self): + # type: () -> bool + return self._property_impl('requireSafeReplicaSize') + + @requireSafeReplicaSize.setter + def requireSafeReplicaSize(self, new_val): + # type: (Optional[bool]) -> None + self._requireSafeReplicaSize = new_val + + @property + def size(self): + # type: () -> int + return self._property_impl('size') + + @size.setter + def size(self, new_val): + # type: (int) -> None + self._size = new_val + + @property + def subFailureDomain(self): + # type: () -> str + return self._property_impl('subFailureDomain') + + @subFailureDomain.setter + def subFailureDomain(self, new_val): + # type: (Optional[str]) -> None + self._subFailureDomain = new_val + + @property + def targetSizeRatio(self): + # type: () -> float + return self._property_impl('targetSizeRatio') + + @targetSizeRatio.setter + def targetSizeRatio(self, new_val): + # type: (Optional[float]) -> None + self._targetSizeRatio = new_val + + +class Mirror(CrdObject): + _properties = [ + ('disabled', 'disabled', bool, False, False), + ('interval', 'interval', str, False, False), + ('timeout', 'timeout', str, False, False) + ] + + def __init__(self, + disabled=_omit, # type: Optional[bool] + interval=_omit, # type: Optional[str] + timeout=_omit, # type: Optional[str] + ): + super(Mirror, self).__init__( + disabled=disabled, + interval=interval, + timeout=timeout, + ) + + @property + def disabled(self): + # type: () -> bool + return self._property_impl('disabled') + + @disabled.setter + def disabled(self, new_val): + # type: (Optional[bool]) -> None + self._disabled = new_val + + @property + def interval(self): + # type: () -> str + return self._property_impl('interval') + + @interval.setter + def interval(self, new_val): + # type: (Optional[str]) -> None + self._interval = new_val + + @property + def timeout(self): + # type: () -> str + return self._property_impl('timeout') + + @timeout.setter + def timeout(self, new_val): + # type: (Optional[str]) -> None + self._timeout = new_val + + +class StatusCheck(CrdObject): + _properties = [ + ('mirror', 'mirror', 'Mirror', False, True) + ] + + def __init__(self, + mirror=_omit, # type: Optional[Mirror] + ): + super(StatusCheck, self).__init__( + mirror=mirror, + ) + + @property + def mirror(self): + # type: () -> Optional[Mirror] + return self._property_impl('mirror') + + @mirror.setter + def mirror(self, new_val): + # type: (Optional[Mirror]) -> None + self._mirror = new_val + + +class DataPool(CrdObject): + _properties = [ + ('compressionMode', 'compressionMode', str, False, True), + ('crushRoot', 'crushRoot', str, False, True), + ('deviceClass', 'deviceClass', str, False, True), + ('enableRBDStats', 'enableRBDStats', bool, False, False), + ('erasureCoded', 'erasureCoded', 'ErasureCoded', False, False), + ('failureDomain', 'failureDomain', str, False, False), + ('mirroring', 'mirroring', 'Mirroring', False, False), + ('parameters', 'parameters', object, False, True), + ('quotas', 'quotas', 'Quotas', False, True), + ('replicated', 'replicated', 'Replicated', False, False), + ('statusCheck', 'statusCheck', 'StatusCheck', False, False) + ] + + def __init__(self, + compressionMode=_omit, # type: Optional[str] + crushRoot=_omit, # type: Optional[str] + deviceClass=_omit, # type: Optional[str] + enableRBDStats=_omit, # type: Optional[bool] + erasureCoded=_omit, # type: Optional[ErasureCoded] + failureDomain=_omit, # type: Optional[str] + mirroring=_omit, # type: Optional[Mirroring] + parameters=_omit, # type: Optional[Any] + quotas=_omit, # type: Optional[Quotas] + replicated=_omit, # type: Optional[Replicated] + statusCheck=_omit, # type: Optional[StatusCheck] + ): + super(DataPool, self).__init__( + compressionMode=compressionMode, + crushRoot=crushRoot, + deviceClass=deviceClass, + enableRBDStats=enableRBDStats, + erasureCoded=erasureCoded, + failureDomain=failureDomain, + mirroring=mirroring, + parameters=parameters, + quotas=quotas, + replicated=replicated, + statusCheck=statusCheck, + ) + + @property + def compressionMode(self): + # type: () -> Optional[str] + return self._property_impl('compressionMode') + + @compressionMode.setter + def compressionMode(self, new_val): + # type: (Optional[str]) -> None + self._compressionMode = new_val + + @property + def crushRoot(self): + # type: () -> Optional[str] + return self._property_impl('crushRoot') + + @crushRoot.setter + def crushRoot(self, new_val): + # type: (Optional[str]) -> None + self._crushRoot = new_val + + @property + def deviceClass(self): + # type: () -> Optional[str] + return self._property_impl('deviceClass') + + @deviceClass.setter + def deviceClass(self, new_val): + # type: (Optional[str]) -> None + self._deviceClass = new_val + + @property + def enableRBDStats(self): + # type: () -> bool + return self._property_impl('enableRBDStats') + + @enableRBDStats.setter + def enableRBDStats(self, new_val): + # type: (Optional[bool]) -> None + self._enableRBDStats = new_val + + @property + def erasureCoded(self): + # type: () -> ErasureCoded + return self._property_impl('erasureCoded') + + @erasureCoded.setter + def erasureCoded(self, new_val): + # type: (Optional[ErasureCoded]) -> None + self._erasureCoded = new_val + + @property + def failureDomain(self): + # type: () -> str + return self._property_impl('failureDomain') + + @failureDomain.setter + def failureDomain(self, new_val): + # type: (Optional[str]) -> None + self._failureDomain = new_val + + @property + def mirroring(self): + # type: () -> Mirroring + return self._property_impl('mirroring') + + @mirroring.setter + def mirroring(self, new_val): + # type: (Optional[Mirroring]) -> None + self._mirroring = new_val + + @property + def parameters(self): + # type: () -> Optional[Any] + return self._property_impl('parameters') + + @parameters.setter + def parameters(self, new_val): + # type: (Optional[Any]) -> None + self._parameters = new_val + + @property + def quotas(self): + # type: () -> Optional[Quotas] + return self._property_impl('quotas') + + @quotas.setter + def quotas(self, new_val): + # type: (Optional[Quotas]) -> None + self._quotas = new_val + + @property + def replicated(self): + # type: () -> Replicated + return self._property_impl('replicated') + + @replicated.setter + def replicated(self, new_val): + # type: (Optional[Replicated]) -> None + self._replicated = new_val + + @property + def statusCheck(self): + # type: () -> StatusCheck + return self._property_impl('statusCheck') + + @statusCheck.setter + def statusCheck(self, new_val): + # type: (Optional[StatusCheck]) -> None + self._statusCheck = new_val + + +class TargetRef(CrdObject): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('fieldPath', 'fieldPath', str, False, False), + ('kind', 'kind', str, False, False), + ('name', 'name', str, False, False), + ('namespace', 'namespace', str, False, False), + ('resourceVersion', 'resourceVersion', str, False, False), + ('uid', 'uid', str, False, False) + ] + + def __init__(self, + apiVersion=_omit, # type: Optional[str] + fieldPath=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + name=_omit, # type: Optional[str] + namespace=_omit, # type: Optional[str] + resourceVersion=_omit, # type: Optional[str] + uid=_omit, # type: Optional[str] + ): + super(TargetRef, self).__init__( + apiVersion=apiVersion, + fieldPath=fieldPath, + kind=kind, + name=name, + namespace=namespace, + resourceVersion=resourceVersion, + uid=uid, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def fieldPath(self): + # type: () -> str + return self._property_impl('fieldPath') + + @fieldPath.setter + def fieldPath(self, new_val): + # type: (Optional[str]) -> None + self._fieldPath = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def name(self): + # type: () -> str + return self._property_impl('name') + + @name.setter + def name(self, new_val): + # type: (Optional[str]) -> None + self._name = new_val + + @property + def namespace(self): + # type: () -> str + return self._property_impl('namespace') + + @namespace.setter + def namespace(self, new_val): + # type: (Optional[str]) -> None + self._namespace = new_val + + @property + def resourceVersion(self): + # type: () -> str + return self._property_impl('resourceVersion') + + @resourceVersion.setter + def resourceVersion(self, new_val): + # type: (Optional[str]) -> None + self._resourceVersion = new_val + + @property + def uid(self): + # type: () -> str + return self._property_impl('uid') + + @uid.setter + def uid(self, new_val): + # type: (Optional[str]) -> None + self._uid = new_val + + +class ExternalRgwEndpointsItem(CrdObject): + _properties = [ + ('hostname', 'hostname', str, False, False), + ('ip', 'ip', str, True, False), + ('nodeName', 'nodeName', str, False, False), + ('targetRef', 'targetRef', 'TargetRef', False, False) + ] + + def __init__(self, + ip, # type: str + hostname=_omit, # type: Optional[str] + nodeName=_omit, # type: Optional[str] + targetRef=_omit, # type: Optional[TargetRef] + ): + super(ExternalRgwEndpointsItem, self).__init__( + ip=ip, + hostname=hostname, + nodeName=nodeName, + targetRef=targetRef, + ) + + @property + def hostname(self): + # type: () -> str + return self._property_impl('hostname') + + @hostname.setter + def hostname(self, new_val): + # type: (Optional[str]) -> None + self._hostname = new_val + + @property + def ip(self): + # type: () -> str + return self._property_impl('ip') + + @ip.setter + def ip(self, new_val): + # type: (str) -> None + self._ip = new_val + + @property + def nodeName(self): + # type: () -> str + return self._property_impl('nodeName') + + @nodeName.setter + def nodeName(self, new_val): + # type: (Optional[str]) -> None + self._nodeName = new_val + + @property + def targetRef(self): + # type: () -> TargetRef + return self._property_impl('targetRef') + + @targetRef.setter + def targetRef(self, new_val): + # type: (Optional[TargetRef]) -> None + self._targetRef = new_val + + +class ExternalRgwEndpointsList(CrdObjectList): + _items_type = ExternalRgwEndpointsItem + + +class ValuesList(CrdObjectList): + _items_type = str + + +class MatchExpressionsItem(CrdObject): + _properties = [ + ('key', 'key', str, True, False), + ('operator', 'operator', str, True, False), + ('values', 'values', 'ValuesList', False, False) + ] + + def __init__(self, + key, # type: str + operator, # type: str + values=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(MatchExpressionsItem, self).__init__( + key=key, + operator=operator, + values=values, + ) + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (str) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (str) -> None + self._operator = new_val + + @property + def values(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('values') + + @values.setter + def values(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._values = new_val + + +class MatchExpressionsList(CrdObjectList): + _items_type = MatchExpressionsItem + + +class MatchFieldsItem(CrdObject): + _properties = [ + ('key', 'key', str, True, False), + ('operator', 'operator', str, True, False), + ('values', 'values', 'ValuesList', False, False) + ] + + def __init__(self, + key, # type: str + operator, # type: str + values=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(MatchFieldsItem, self).__init__( + key=key, + operator=operator, + values=values, + ) + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (str) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (str) -> None + self._operator = new_val + + @property + def values(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('values') + + @values.setter + def values(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._values = new_val + + +class MatchFieldsList(CrdObjectList): + _items_type = MatchFieldsItem + + +class Preference(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchFields', 'matchFields', 'MatchFieldsList', False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchFields=_omit, # type: Optional[Union[List[MatchFieldsItem], CrdObjectList]] + ): + super(Preference, self).__init__( + matchExpressions=matchExpressions, + matchFields=matchFields, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchFields(self): + # type: () -> Union[List[MatchFieldsItem], CrdObjectList] + return self._property_impl('matchFields') + + @matchFields.setter + def matchFields(self, new_val): + # type: (Optional[Union[List[MatchFieldsItem], CrdObjectList]]) -> None + self._matchFields = new_val + + +class PreferredDuringSchedulingIgnoredDuringExecutionItem(CrdObject): + _properties = [ + ('podAffinityTerm', 'podAffinityTerm', 'PodAffinityTerm', False, False), + ('weight', 'weight', int, False, False), + ('preference', 'preference', 'Preference', False, False) + ] + + def __init__(self, + podAffinityTerm=_omit, # type: Optional[PodAffinityTerm] + weight=_omit, # type: Optional[int] + preference=_omit, # type: Optional[Preference] + ): + super(PreferredDuringSchedulingIgnoredDuringExecutionItem, self).__init__( + podAffinityTerm=podAffinityTerm, + weight=weight, + preference=preference, + ) + + @property + def podAffinityTerm(self): + # type: () -> PodAffinityTerm + return self._property_impl('podAffinityTerm') + + @podAffinityTerm.setter + def podAffinityTerm(self, new_val): + # type: (Optional[PodAffinityTerm]) -> None + self._podAffinityTerm = new_val + + @property + def weight(self): + # type: () -> int + return self._property_impl('weight') + + @weight.setter + def weight(self, new_val): + # type: (Optional[int]) -> None + self._weight = new_val + + @property + def preference(self): + # type: () -> Preference + return self._property_impl('preference') + + @preference.setter + def preference(self, new_val): + # type: (Optional[Preference]) -> None + self._preference = new_val + + +class PreferredDuringSchedulingIgnoredDuringExecutionList(CrdObjectList): + _items_type = PreferredDuringSchedulingIgnoredDuringExecutionItem + + +class NodeSelectorTermsItem(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchFields', 'matchFields', 'MatchFieldsList', False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchFields=_omit, # type: Optional[Union[List[MatchFieldsItem], CrdObjectList]] + ): + super(NodeSelectorTermsItem, self).__init__( + matchExpressions=matchExpressions, + matchFields=matchFields, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchFields(self): + # type: () -> Union[List[MatchFieldsItem], CrdObjectList] + return self._property_impl('matchFields') + + @matchFields.setter + def matchFields(self, new_val): + # type: (Optional[Union[List[MatchFieldsItem], CrdObjectList]]) -> None + self._matchFields = new_val + + +class NodeSelectorTermsList(CrdObjectList): + _items_type = NodeSelectorTermsItem + + +class RequiredDuringSchedulingIgnoredDuringExecution(CrdObject): + _properties = [ + ('nodeSelectorTerms', 'nodeSelectorTerms', 'NodeSelectorTermsList', True, False) + ] + + def __init__(self, + nodeSelectorTerms, # type: Union[List[NodeSelectorTermsItem], CrdObjectList] + ): + super(RequiredDuringSchedulingIgnoredDuringExecution, self).__init__( + nodeSelectorTerms=nodeSelectorTerms, + ) + + @property + def nodeSelectorTerms(self): + # type: () -> Union[List[NodeSelectorTermsItem], CrdObjectList] + return self._property_impl('nodeSelectorTerms') + + @nodeSelectorTerms.setter + def nodeSelectorTerms(self, new_val): + # type: (Union[List[NodeSelectorTermsItem], CrdObjectList]) -> None + self._nodeSelectorTerms = new_val + + +class NodeAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecution', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[RequiredDuringSchedulingIgnoredDuringExecution] + ): + super(NodeAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> RequiredDuringSchedulingIgnoredDuringExecution + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[RequiredDuringSchedulingIgnoredDuringExecution]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class LabelSelector(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchLabels', 'matchLabels', object, False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchLabels=_omit, # type: Optional[Any] + ): + super(LabelSelector, self).__init__( + matchExpressions=matchExpressions, + matchLabels=matchLabels, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchLabels(self): + # type: () -> Any + return self._property_impl('matchLabels') + + @matchLabels.setter + def matchLabels(self, new_val): + # type: (Optional[Any]) -> None + self._matchLabels = new_val + + +class NamespaceSelector(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchLabels', 'matchLabels', object, False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchLabels=_omit, # type: Optional[Any] + ): + super(NamespaceSelector, self).__init__( + matchExpressions=matchExpressions, + matchLabels=matchLabels, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchLabels(self): + # type: () -> Any + return self._property_impl('matchLabels') + + @matchLabels.setter + def matchLabels(self, new_val): + # type: (Optional[Any]) -> None + self._matchLabels = new_val + + +class NamespacesList(CrdObjectList): + _items_type = str + + +class PodAffinityTerm(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('namespaceSelector', 'namespaceSelector', 'NamespaceSelector', False, False), + ('namespaces', 'namespaces', 'NamespacesList', False, False), + ('topologyKey', 'topologyKey', str, True, False) + ] + + def __init__(self, + topologyKey, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + namespaceSelector=_omit, # type: Optional[NamespaceSelector] + namespaces=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(PodAffinityTerm, self).__init__( + topologyKey=topologyKey, + labelSelector=labelSelector, + namespaceSelector=namespaceSelector, + namespaces=namespaces, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def namespaceSelector(self): + # type: () -> NamespaceSelector + return self._property_impl('namespaceSelector') + + @namespaceSelector.setter + def namespaceSelector(self, new_val): + # type: (Optional[NamespaceSelector]) -> None + self._namespaceSelector = new_val + + @property + def namespaces(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('namespaces') + + @namespaces.setter + def namespaces(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._namespaces = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + +class RequiredDuringSchedulingIgnoredDuringExecutionItem(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('namespaceSelector', 'namespaceSelector', 'NamespaceSelector', False, False), + ('namespaces', 'namespaces', 'NamespacesList', False, False), + ('topologyKey', 'topologyKey', str, True, False) + ] + + def __init__(self, + topologyKey, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + namespaceSelector=_omit, # type: Optional[NamespaceSelector] + namespaces=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(RequiredDuringSchedulingIgnoredDuringExecutionItem, self).__init__( + topologyKey=topologyKey, + labelSelector=labelSelector, + namespaceSelector=namespaceSelector, + namespaces=namespaces, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def namespaceSelector(self): + # type: () -> NamespaceSelector + return self._property_impl('namespaceSelector') + + @namespaceSelector.setter + def namespaceSelector(self, new_val): + # type: (Optional[NamespaceSelector]) -> None + self._namespaceSelector = new_val + + @property + def namespaces(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('namespaces') + + @namespaces.setter + def namespaces(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._namespaces = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + +class RequiredDuringSchedulingIgnoredDuringExecutionList(CrdObjectList): + _items_type = RequiredDuringSchedulingIgnoredDuringExecutionItem + + +class PodAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecutionList', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + ): + super(PodAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class PodAntiAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecutionList', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + ): + super(PodAntiAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class TolerationsItem(CrdObject): + _properties = [ + ('effect', 'effect', str, False, False), + ('key', 'key', str, False, False), + ('operator', 'operator', str, False, False), + ('tolerationSeconds', 'tolerationSeconds', int, False, False), + ('value', 'value', str, False, False) + ] + + def __init__(self, + effect=_omit, # type: Optional[str] + key=_omit, # type: Optional[str] + operator=_omit, # type: Optional[str] + tolerationSeconds=_omit, # type: Optional[int] + value=_omit, # type: Optional[str] + ): + super(TolerationsItem, self).__init__( + effect=effect, + key=key, + operator=operator, + tolerationSeconds=tolerationSeconds, + value=value, + ) + + @property + def effect(self): + # type: () -> str + return self._property_impl('effect') + + @effect.setter + def effect(self, new_val): + # type: (Optional[str]) -> None + self._effect = new_val + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (Optional[str]) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (Optional[str]) -> None + self._operator = new_val + + @property + def tolerationSeconds(self): + # type: () -> int + return self._property_impl('tolerationSeconds') + + @tolerationSeconds.setter + def tolerationSeconds(self, new_val): + # type: (Optional[int]) -> None + self._tolerationSeconds = new_val + + @property + def value(self): + # type: () -> str + return self._property_impl('value') + + @value.setter + def value(self, new_val): + # type: (Optional[str]) -> None + self._value = new_val + + +class TolerationsList(CrdObjectList): + _items_type = TolerationsItem + + +class TopologySpreadConstraintsItem(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('maxSkew', 'maxSkew', int, True, False), + ('topologyKey', 'topologyKey', str, True, False), + ('whenUnsatisfiable', 'whenUnsatisfiable', str, True, False) + ] + + def __init__(self, + maxSkew, # type: int + topologyKey, # type: str + whenUnsatisfiable, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + ): + super(TopologySpreadConstraintsItem, self).__init__( + maxSkew=maxSkew, + topologyKey=topologyKey, + whenUnsatisfiable=whenUnsatisfiable, + labelSelector=labelSelector, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def maxSkew(self): + # type: () -> int + return self._property_impl('maxSkew') + + @maxSkew.setter + def maxSkew(self, new_val): + # type: (int) -> None + self._maxSkew = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + @property + def whenUnsatisfiable(self): + # type: () -> str + return self._property_impl('whenUnsatisfiable') + + @whenUnsatisfiable.setter + def whenUnsatisfiable(self, new_val): + # type: (str) -> None + self._whenUnsatisfiable = new_val + + +class TopologySpreadConstraintsList(CrdObjectList): + _items_type = TopologySpreadConstraintsItem + + +class Placement(CrdObject): + _properties = [ + ('nodeAffinity', 'nodeAffinity', 'NodeAffinity', False, False), + ('podAffinity', 'podAffinity', 'PodAffinity', False, False), + ('podAntiAffinity', 'podAntiAffinity', 'PodAntiAffinity', False, False), + ('tolerations', 'tolerations', 'TolerationsList', False, False), + ('topologySpreadConstraints', 'topologySpreadConstraints', 'TopologySpreadConstraintsList', False, False) + ] + + def __init__(self, + nodeAffinity=_omit, # type: Optional[NodeAffinity] + podAffinity=_omit, # type: Optional[PodAffinity] + podAntiAffinity=_omit, # type: Optional[PodAntiAffinity] + tolerations=_omit, # type: Optional[Union[List[TolerationsItem], CrdObjectList]] + topologySpreadConstraints=_omit, # type: Optional[Union[List[TopologySpreadConstraintsItem], CrdObjectList]] + ): + super(Placement, self).__init__( + nodeAffinity=nodeAffinity, + podAffinity=podAffinity, + podAntiAffinity=podAntiAffinity, + tolerations=tolerations, + topologySpreadConstraints=topologySpreadConstraints, + ) + + @property + def nodeAffinity(self): + # type: () -> NodeAffinity + return self._property_impl('nodeAffinity') + + @nodeAffinity.setter + def nodeAffinity(self, new_val): + # type: (Optional[NodeAffinity]) -> None + self._nodeAffinity = new_val + + @property + def podAffinity(self): + # type: () -> PodAffinity + return self._property_impl('podAffinity') + + @podAffinity.setter + def podAffinity(self, new_val): + # type: (Optional[PodAffinity]) -> None + self._podAffinity = new_val + + @property + def podAntiAffinity(self): + # type: () -> PodAntiAffinity + return self._property_impl('podAntiAffinity') + + @podAntiAffinity.setter + def podAntiAffinity(self, new_val): + # type: (Optional[PodAntiAffinity]) -> None + self._podAntiAffinity = new_val + + @property + def tolerations(self): + # type: () -> Union[List[TolerationsItem], CrdObjectList] + return self._property_impl('tolerations') + + @tolerations.setter + def tolerations(self, new_val): + # type: (Optional[Union[List[TolerationsItem], CrdObjectList]]) -> None + self._tolerations = new_val + + @property + def topologySpreadConstraints(self): + # type: () -> Union[List[TopologySpreadConstraintsItem], CrdObjectList] + return self._property_impl('topologySpreadConstraints') + + @topologySpreadConstraints.setter + def topologySpreadConstraints(self, new_val): + # type: (Optional[Union[List[TopologySpreadConstraintsItem], CrdObjectList]]) -> None + self._topologySpreadConstraints = new_val + + +class Resources(CrdObject): + _properties = [ + ('limits', 'limits', object, False, False), + ('requests', 'requests', object, False, False) + ] + + def __init__(self, + limits=_omit, # type: Optional[Any] + requests=_omit, # type: Optional[Any] + ): + super(Resources, self).__init__( + limits=limits, + requests=requests, + ) + + @property + def limits(self): + # type: () -> Any + return self._property_impl('limits') + + @limits.setter + def limits(self, new_val): + # type: (Optional[Any]) -> None + self._limits = new_val + + @property + def requests(self): + # type: () -> Any + return self._property_impl('requests') + + @requests.setter + def requests(self, new_val): + # type: (Optional[Any]) -> None + self._requests = new_val + + +class Service(CrdObject): + _properties = [ + ('annotations', 'annotations', object, False, False) + ] + + def __init__(self, + annotations=_omit, # type: Optional[Any] + ): + super(Service, self).__init__( + annotations=annotations, + ) + + @property + def annotations(self): + # type: () -> Any + return self._property_impl('annotations') + + @annotations.setter + def annotations(self, new_val): + # type: (Optional[Any]) -> None + self._annotations = new_val + + +class Gateway(CrdObject): + _properties = [ + ('annotations', 'annotations', object, False, True), + ('externalRgwEndpoints', 'externalRgwEndpoints', 'ExternalRgwEndpointsList', False, True), + ('instances', 'instances', int, True, False), + ('labels', 'labels', object, False, True), + ('placement', 'placement', 'Placement', False, True), + ('port', 'port', int, False, False), + ('priorityClassName', 'priorityClassName', str, False, False), + ('resources', 'resources', 'Resources', False, True), + ('securePort', 'securePort', int, False, True), + ('service', 'service', 'Service', False, True), + ('sslCertificateRef', 'sslCertificateRef', str, False, True) + ] + + def __init__(self, + instances, # type: int + annotations=_omit, # type: Optional[Any] + externalRgwEndpoints=_omit, # type: Optional[Union[List[ExternalRgwEndpointsItem], CrdObjectList]] + labels=_omit, # type: Optional[Any] + placement=_omit, # type: Optional[Placement] + port=_omit, # type: Optional[int] + priorityClassName=_omit, # type: Optional[str] + resources=_omit, # type: Optional[Resources] + securePort=_omit, # type: Optional[int] + service=_omit, # type: Optional[Service] + sslCertificateRef=_omit, # type: Optional[str] + ): + super(Gateway, self).__init__( + instances=instances, + annotations=annotations, + externalRgwEndpoints=externalRgwEndpoints, + labels=labels, + placement=placement, + port=port, + priorityClassName=priorityClassName, + resources=resources, + securePort=securePort, + service=service, + sslCertificateRef=sslCertificateRef, + ) + + @property + def annotations(self): + # type: () -> Optional[Any] + return self._property_impl('annotations') + + @annotations.setter + def annotations(self, new_val): + # type: (Optional[Any]) -> None + self._annotations = new_val + + @property + def externalRgwEndpoints(self): + # type: () -> Optional[Union[List[ExternalRgwEndpointsItem], CrdObjectList]] + return self._property_impl('externalRgwEndpoints') + + @externalRgwEndpoints.setter + def externalRgwEndpoints(self, new_val): + # type: (Optional[Union[List[ExternalRgwEndpointsItem], CrdObjectList]]) -> None + self._externalRgwEndpoints = new_val + + @property + def instances(self): + # type: () -> int + return self._property_impl('instances') + + @instances.setter + def instances(self, new_val): + # type: (int) -> None + self._instances = new_val + + @property + def labels(self): + # type: () -> Optional[Any] + return self._property_impl('labels') + + @labels.setter + def labels(self, new_val): + # type: (Optional[Any]) -> None + self._labels = new_val + + @property + def placement(self): + # type: () -> Optional[Placement] + return self._property_impl('placement') + + @placement.setter + def placement(self, new_val): + # type: (Optional[Placement]) -> None + self._placement = new_val + + @property + def port(self): + # type: () -> int + return self._property_impl('port') + + @port.setter + def port(self, new_val): + # type: (Optional[int]) -> None + self._port = new_val + + @property + def priorityClassName(self): + # type: () -> str + return self._property_impl('priorityClassName') + + @priorityClassName.setter + def priorityClassName(self, new_val): + # type: (Optional[str]) -> None + self._priorityClassName = new_val + + @property + def resources(self): + # type: () -> Optional[Resources] + return self._property_impl('resources') + + @resources.setter + def resources(self, new_val): + # type: (Optional[Resources]) -> None + self._resources = new_val + + @property + def securePort(self): + # type: () -> Optional[int] + return self._property_impl('securePort') + + @securePort.setter + def securePort(self, new_val): + # type: (Optional[int]) -> None + self._securePort = new_val + + @property + def service(self): + # type: () -> Optional[Service] + return self._property_impl('service') + + @service.setter + def service(self, new_val): + # type: (Optional[Service]) -> None + self._service = new_val + + @property + def sslCertificateRef(self): + # type: () -> Optional[str] + return self._property_impl('sslCertificateRef') + + @sslCertificateRef.setter + def sslCertificateRef(self, new_val): + # type: (Optional[str]) -> None + self._sslCertificateRef = new_val + + +class Bucket(CrdObject): + _properties = [ + ('disabled', 'disabled', bool, False, False), + ('interval', 'interval', str, False, False), + ('timeout', 'timeout', str, False, False) + ] + + def __init__(self, + disabled=_omit, # type: Optional[bool] + interval=_omit, # type: Optional[str] + timeout=_omit, # type: Optional[str] + ): + super(Bucket, self).__init__( + disabled=disabled, + interval=interval, + timeout=timeout, + ) + + @property + def disabled(self): + # type: () -> bool + return self._property_impl('disabled') + + @disabled.setter + def disabled(self, new_val): + # type: (Optional[bool]) -> None + self._disabled = new_val + + @property + def interval(self): + # type: () -> str + return self._property_impl('interval') + + @interval.setter + def interval(self, new_val): + # type: (Optional[str]) -> None + self._interval = new_val + + @property + def timeout(self): + # type: () -> str + return self._property_impl('timeout') + + @timeout.setter + def timeout(self, new_val): + # type: (Optional[str]) -> None + self._timeout = new_val + + +class CommandList(CrdObjectList): + _items_type = str + + +class Exec(CrdObject): + _properties = [ + ('command', 'command', 'CommandList', False, False) + ] + + def __init__(self, + command=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(Exec, self).__init__( + command=command, + ) + + @property + def command(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('command') + + @command.setter + def command(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._command = new_val + + +class HttpHeadersItem(CrdObject): + _properties = [ + ('name', 'name', str, True, False), + ('value', 'value', str, True, False) + ] + + def __init__(self, + name, # type: str + value, # type: str + ): + super(HttpHeadersItem, self).__init__( + name=name, + value=value, + ) + + @property + def name(self): + # type: () -> str + return self._property_impl('name') + + @name.setter + def name(self, new_val): + # type: (str) -> None + self._name = new_val + + @property + def value(self): + # type: () -> str + return self._property_impl('value') + + @value.setter + def value(self, new_val): + # type: (str) -> None + self._value = new_val + + +class HttpHeadersList(CrdObjectList): + _items_type = HttpHeadersItem + + +class HttpGet(CrdObject): + _properties = [ + ('host', 'host', str, False, False), + ('httpHeaders', 'httpHeaders', 'HttpHeadersList', False, False), + ('path', 'path', str, False, False), + ('port', 'port', Union[int, str], True, False), + ('scheme', 'scheme', str, False, False) + ] + + def __init__(self, + port, # type: Union[int, str] + host=_omit, # type: Optional[str] + httpHeaders=_omit, # type: Optional[Union[List[HttpHeadersItem], CrdObjectList]] + path=_omit, # type: Optional[str] + scheme=_omit, # type: Optional[str] + ): + super(HttpGet, self).__init__( + port=port, + host=host, + httpHeaders=httpHeaders, + path=path, + scheme=scheme, + ) + + @property + def host(self): + # type: () -> str + return self._property_impl('host') + + @host.setter + def host(self, new_val): + # type: (Optional[str]) -> None + self._host = new_val + + @property + def httpHeaders(self): + # type: () -> Union[List[HttpHeadersItem], CrdObjectList] + return self._property_impl('httpHeaders') + + @httpHeaders.setter + def httpHeaders(self, new_val): + # type: (Optional[Union[List[HttpHeadersItem], CrdObjectList]]) -> None + self._httpHeaders = new_val + + @property + def path(self): + # type: () -> str + return self._property_impl('path') + + @path.setter + def path(self, new_val): + # type: (Optional[str]) -> None + self._path = new_val + + @property + def port(self): + # type: () -> Union[int, str] + return self._property_impl('port') + + @port.setter + def port(self, new_val): + # type: (Union[int, str]) -> None + self._port = new_val + + @property + def scheme(self): + # type: () -> str + return self._property_impl('scheme') + + @scheme.setter + def scheme(self, new_val): + # type: (Optional[str]) -> None + self._scheme = new_val + + +class TcpSocket(CrdObject): + _properties = [ + ('host', 'host', str, False, False), + ('port', 'port', Union[int, str], True, False) + ] + + def __init__(self, + port, # type: Union[int, str] + host=_omit, # type: Optional[str] + ): + super(TcpSocket, self).__init__( + port=port, + host=host, + ) + + @property + def host(self): + # type: () -> str + return self._property_impl('host') + + @host.setter + def host(self, new_val): + # type: (Optional[str]) -> None + self._host = new_val + + @property + def port(self): + # type: () -> Union[int, str] + return self._property_impl('port') + + @port.setter + def port(self, new_val): + # type: (Union[int, str]) -> None + self._port = new_val + + +class Probe(CrdObject): + _properties = [ + ('exec', 'exec_1', 'Exec', False, False), + ('failureThreshold', 'failureThreshold', int, False, False), + ('httpGet', 'httpGet', 'HttpGet', False, False), + ('initialDelaySeconds', 'initialDelaySeconds', int, False, False), + ('periodSeconds', 'periodSeconds', int, False, False), + ('successThreshold', 'successThreshold', int, False, False), + ('tcpSocket', 'tcpSocket', 'TcpSocket', False, False), + ('terminationGracePeriodSeconds', 'terminationGracePeriodSeconds', int, False, False), + ('timeoutSeconds', 'timeoutSeconds', int, False, False) + ] + + def __init__(self, + exec_1=_omit, # type: Optional[Exec] + failureThreshold=_omit, # type: Optional[int] + httpGet=_omit, # type: Optional[HttpGet] + initialDelaySeconds=_omit, # type: Optional[int] + periodSeconds=_omit, # type: Optional[int] + successThreshold=_omit, # type: Optional[int] + tcpSocket=_omit, # type: Optional[TcpSocket] + terminationGracePeriodSeconds=_omit, # type: Optional[int] + timeoutSeconds=_omit, # type: Optional[int] + ): + super(Probe, self).__init__( + exec_1=exec_1, + failureThreshold=failureThreshold, + httpGet=httpGet, + initialDelaySeconds=initialDelaySeconds, + periodSeconds=periodSeconds, + successThreshold=successThreshold, + tcpSocket=tcpSocket, + terminationGracePeriodSeconds=terminationGracePeriodSeconds, + timeoutSeconds=timeoutSeconds, + ) + + @property + def exec_1(self): + # type: () -> Exec + return self._property_impl('exec_1') + + @exec_1.setter + def exec_1(self, new_val): + # type: (Optional[Exec]) -> None + self._exec_1 = new_val + + @property + def failureThreshold(self): + # type: () -> int + return self._property_impl('failureThreshold') + + @failureThreshold.setter + def failureThreshold(self, new_val): + # type: (Optional[int]) -> None + self._failureThreshold = new_val + + @property + def httpGet(self): + # type: () -> HttpGet + return self._property_impl('httpGet') + + @httpGet.setter + def httpGet(self, new_val): + # type: (Optional[HttpGet]) -> None + self._httpGet = new_val + + @property + def initialDelaySeconds(self): + # type: () -> int + return self._property_impl('initialDelaySeconds') + + @initialDelaySeconds.setter + def initialDelaySeconds(self, new_val): + # type: (Optional[int]) -> None + self._initialDelaySeconds = new_val + + @property + def periodSeconds(self): + # type: () -> int + return self._property_impl('periodSeconds') + + @periodSeconds.setter + def periodSeconds(self, new_val): + # type: (Optional[int]) -> None + self._periodSeconds = new_val + + @property + def successThreshold(self): + # type: () -> int + return self._property_impl('successThreshold') + + @successThreshold.setter + def successThreshold(self, new_val): + # type: (Optional[int]) -> None + self._successThreshold = new_val + + @property + def tcpSocket(self): + # type: () -> TcpSocket + return self._property_impl('tcpSocket') + + @tcpSocket.setter + def tcpSocket(self, new_val): + # type: (Optional[TcpSocket]) -> None + self._tcpSocket = new_val + + @property + def terminationGracePeriodSeconds(self): + # type: () -> int + return self._property_impl('terminationGracePeriodSeconds') + + @terminationGracePeriodSeconds.setter + def terminationGracePeriodSeconds(self, new_val): + # type: (Optional[int]) -> None + self._terminationGracePeriodSeconds = new_val + + @property + def timeoutSeconds(self): + # type: () -> int + return self._property_impl('timeoutSeconds') + + @timeoutSeconds.setter + def timeoutSeconds(self, new_val): + # type: (Optional[int]) -> None + self._timeoutSeconds = new_val + + +class LivenessProbe(CrdObject): + _properties = [ + ('disabled', 'disabled', bool, False, False), + ('probe', 'probe', 'Probe', False, False) + ] + + def __init__(self, + disabled=_omit, # type: Optional[bool] + probe=_omit, # type: Optional[Probe] + ): + super(LivenessProbe, self).__init__( + disabled=disabled, + probe=probe, + ) + + @property + def disabled(self): + # type: () -> bool + return self._property_impl('disabled') + + @disabled.setter + def disabled(self, new_val): + # type: (Optional[bool]) -> None + self._disabled = new_val + + @property + def probe(self): + # type: () -> Probe + return self._property_impl('probe') + + @probe.setter + def probe(self, new_val): + # type: (Optional[Probe]) -> None + self._probe = new_val + + +class HealthCheck(CrdObject): + _properties = [ + ('bucket', 'bucket', 'Bucket', False, False), + ('livenessProbe', 'livenessProbe', 'LivenessProbe', False, False) + ] + + def __init__(self, + bucket=_omit, # type: Optional[Bucket] + livenessProbe=_omit, # type: Optional[LivenessProbe] + ): + super(HealthCheck, self).__init__( + bucket=bucket, + livenessProbe=livenessProbe, + ) + + @property + def bucket(self): + # type: () -> Bucket + return self._property_impl('bucket') + + @bucket.setter + def bucket(self, new_val): + # type: (Optional[Bucket]) -> None + self._bucket = new_val + + @property + def livenessProbe(self): + # type: () -> LivenessProbe + return self._property_impl('livenessProbe') + + @livenessProbe.setter + def livenessProbe(self, new_val): + # type: (Optional[LivenessProbe]) -> None + self._livenessProbe = new_val + + +class MetadataPool(CrdObject): + _properties = [ + ('compressionMode', 'compressionMode', str, False, True), + ('crushRoot', 'crushRoot', str, False, True), + ('deviceClass', 'deviceClass', str, False, True), + ('enableRBDStats', 'enableRBDStats', bool, False, False), + ('erasureCoded', 'erasureCoded', 'ErasureCoded', False, False), + ('failureDomain', 'failureDomain', str, False, False), + ('mirroring', 'mirroring', 'Mirroring', False, False), + ('parameters', 'parameters', object, False, True), + ('quotas', 'quotas', 'Quotas', False, True), + ('replicated', 'replicated', 'Replicated', False, False), + ('statusCheck', 'statusCheck', 'StatusCheck', False, False) + ] + + def __init__(self, + compressionMode=_omit, # type: Optional[str] + crushRoot=_omit, # type: Optional[str] + deviceClass=_omit, # type: Optional[str] + enableRBDStats=_omit, # type: Optional[bool] + erasureCoded=_omit, # type: Optional[ErasureCoded] + failureDomain=_omit, # type: Optional[str] + mirroring=_omit, # type: Optional[Mirroring] + parameters=_omit, # type: Optional[Any] + quotas=_omit, # type: Optional[Quotas] + replicated=_omit, # type: Optional[Replicated] + statusCheck=_omit, # type: Optional[StatusCheck] + ): + super(MetadataPool, self).__init__( + compressionMode=compressionMode, + crushRoot=crushRoot, + deviceClass=deviceClass, + enableRBDStats=enableRBDStats, + erasureCoded=erasureCoded, + failureDomain=failureDomain, + mirroring=mirroring, + parameters=parameters, + quotas=quotas, + replicated=replicated, + statusCheck=statusCheck, + ) + + @property + def compressionMode(self): + # type: () -> Optional[str] + return self._property_impl('compressionMode') + + @compressionMode.setter + def compressionMode(self, new_val): + # type: (Optional[str]) -> None + self._compressionMode = new_val + + @property + def crushRoot(self): + # type: () -> Optional[str] + return self._property_impl('crushRoot') + + @crushRoot.setter + def crushRoot(self, new_val): + # type: (Optional[str]) -> None + self._crushRoot = new_val + + @property + def deviceClass(self): + # type: () -> Optional[str] + return self._property_impl('deviceClass') + + @deviceClass.setter + def deviceClass(self, new_val): + # type: (Optional[str]) -> None + self._deviceClass = new_val + + @property + def enableRBDStats(self): + # type: () -> bool + return self._property_impl('enableRBDStats') + + @enableRBDStats.setter + def enableRBDStats(self, new_val): + # type: (Optional[bool]) -> None + self._enableRBDStats = new_val + + @property + def erasureCoded(self): + # type: () -> ErasureCoded + return self._property_impl('erasureCoded') + + @erasureCoded.setter + def erasureCoded(self, new_val): + # type: (Optional[ErasureCoded]) -> None + self._erasureCoded = new_val + + @property + def failureDomain(self): + # type: () -> str + return self._property_impl('failureDomain') + + @failureDomain.setter + def failureDomain(self, new_val): + # type: (Optional[str]) -> None + self._failureDomain = new_val + + @property + def mirroring(self): + # type: () -> Mirroring + return self._property_impl('mirroring') + + @mirroring.setter + def mirroring(self, new_val): + # type: (Optional[Mirroring]) -> None + self._mirroring = new_val + + @property + def parameters(self): + # type: () -> Optional[Any] + return self._property_impl('parameters') + + @parameters.setter + def parameters(self, new_val): + # type: (Optional[Any]) -> None + self._parameters = new_val + + @property + def quotas(self): + # type: () -> Optional[Quotas] + return self._property_impl('quotas') + + @quotas.setter + def quotas(self, new_val): + # type: (Optional[Quotas]) -> None + self._quotas = new_val + + @property + def replicated(self): + # type: () -> Replicated + return self._property_impl('replicated') + + @replicated.setter + def replicated(self, new_val): + # type: (Optional[Replicated]) -> None + self._replicated = new_val + + @property + def statusCheck(self): + # type: () -> StatusCheck + return self._property_impl('statusCheck') + + @statusCheck.setter + def statusCheck(self, new_val): + # type: (Optional[StatusCheck]) -> None + self._statusCheck = new_val + + +class Kms(CrdObject): + _properties = [ + ('connectionDetails', 'connectionDetails', object, False, True), + ('tokenSecretName', 'tokenSecretName', str, False, False) + ] + + def __init__(self, + connectionDetails=_omit, # type: Optional[Any] + tokenSecretName=_omit, # type: Optional[str] + ): + super(Kms, self).__init__( + connectionDetails=connectionDetails, + tokenSecretName=tokenSecretName, + ) + + @property + def connectionDetails(self): + # type: () -> Optional[Any] + return self._property_impl('connectionDetails') + + @connectionDetails.setter + def connectionDetails(self, new_val): + # type: (Optional[Any]) -> None + self._connectionDetails = new_val + + @property + def tokenSecretName(self): + # type: () -> str + return self._property_impl('tokenSecretName') + + @tokenSecretName.setter + def tokenSecretName(self, new_val): + # type: (Optional[str]) -> None + self._tokenSecretName = new_val + + +class Security(CrdObject): + _properties = [ + ('kms', 'kms', 'Kms', False, True) + ] + + def __init__(self, + kms=_omit, # type: Optional[Kms] + ): + super(Security, self).__init__( + kms=kms, + ) + + @property + def kms(self): + # type: () -> Optional[Kms] + return self._property_impl('kms') + + @kms.setter + def kms(self, new_val): + # type: (Optional[Kms]) -> None + self._kms = new_val + + +class Zone(CrdObject): + _properties = [ + ('name', 'name', str, True, False) + ] + + def __init__(self, + name, # type: str + ): + super(Zone, self).__init__( + name=name, + ) + + @property + def name(self): + # type: () -> str + return self._property_impl('name') + + @name.setter + def name(self, new_val): + # type: (str) -> None + self._name = new_val + + +class Spec(CrdObject): + _properties = [ + ('dataPool', 'dataPool', 'DataPool', False, True), + ('gateway', 'gateway', 'Gateway', False, True), + ('healthCheck', 'healthCheck', 'HealthCheck', False, True), + ('metadataPool', 'metadataPool', 'MetadataPool', False, True), + ('preservePoolsOnDelete', 'preservePoolsOnDelete', bool, False, False), + ('security', 'security', 'Security', False, True), + ('zone', 'zone', 'Zone', False, True) + ] + + def __init__(self, + dataPool=_omit, # type: Optional[DataPool] + gateway=_omit, # type: Optional[Gateway] + healthCheck=_omit, # type: Optional[HealthCheck] + metadataPool=_omit, # type: Optional[MetadataPool] + preservePoolsOnDelete=_omit, # type: Optional[bool] + security=_omit, # type: Optional[Security] + zone=_omit, # type: Optional[Zone] + ): + super(Spec, self).__init__( + dataPool=dataPool, + gateway=gateway, + healthCheck=healthCheck, + metadataPool=metadataPool, + preservePoolsOnDelete=preservePoolsOnDelete, + security=security, + zone=zone, + ) + + @property + def dataPool(self): + # type: () -> Optional[DataPool] + return self._property_impl('dataPool') + + @dataPool.setter + def dataPool(self, new_val): + # type: (Optional[DataPool]) -> None + self._dataPool = new_val + + @property + def gateway(self): + # type: () -> Optional[Gateway] + return self._property_impl('gateway') + + @gateway.setter + def gateway(self, new_val): + # type: (Optional[Gateway]) -> None + self._gateway = new_val + + @property + def healthCheck(self): + # type: () -> Optional[HealthCheck] + return self._property_impl('healthCheck') + + @healthCheck.setter + def healthCheck(self, new_val): + # type: (Optional[HealthCheck]) -> None + self._healthCheck = new_val + + @property + def metadataPool(self): + # type: () -> Optional[MetadataPool] + return self._property_impl('metadataPool') + + @metadataPool.setter + def metadataPool(self, new_val): + # type: (Optional[MetadataPool]) -> None + self._metadataPool = new_val + + @property + def preservePoolsOnDelete(self): + # type: () -> bool + return self._property_impl('preservePoolsOnDelete') + + @preservePoolsOnDelete.setter + def preservePoolsOnDelete(self, new_val): + # type: (Optional[bool]) -> None + self._preservePoolsOnDelete = new_val + + @property + def security(self): + # type: () -> Optional[Security] + return self._property_impl('security') + + @security.setter + def security(self, new_val): + # type: (Optional[Security]) -> None + self._security = new_val + + @property + def zone(self): + # type: () -> Optional[Zone] + return self._property_impl('zone') + + @zone.setter + def zone(self, new_val): + # type: (Optional[Zone]) -> None + self._zone = new_val + + +class BucketStatus(CrdObject): + _properties = [ + ('details', 'details', str, False, False), + ('health', 'health', str, False, False), + ('lastChanged', 'lastChanged', str, False, False), + ('lastChecked', 'lastChecked', str, False, False) + ] + + def __init__(self, + details=_omit, # type: Optional[str] + health=_omit, # type: Optional[str] + lastChanged=_omit, # type: Optional[str] + lastChecked=_omit, # type: Optional[str] + ): + super(BucketStatus, self).__init__( + details=details, + health=health, + lastChanged=lastChanged, + lastChecked=lastChecked, + ) + + @property + def details(self): + # type: () -> str + return self._property_impl('details') + + @details.setter + def details(self, new_val): + # type: (Optional[str]) -> None + self._details = new_val + + @property + def health(self): + # type: () -> str + return self._property_impl('health') + + @health.setter + def health(self, new_val): + # type: (Optional[str]) -> None + self._health = new_val + + @property + def lastChanged(self): + # type: () -> str + return self._property_impl('lastChanged') + + @lastChanged.setter + def lastChanged(self, new_val): + # type: (Optional[str]) -> None + self._lastChanged = new_val + + @property + def lastChecked(self): + # type: () -> str + return self._property_impl('lastChecked') + + @lastChecked.setter + def lastChecked(self, new_val): + # type: (Optional[str]) -> None + self._lastChecked = new_val + + +class Status(CrdObject): + _properties = [ + ('bucketStatus', 'bucketStatus', 'BucketStatus', False, False), + ('info', 'info', object, False, True), + ('message', 'message', str, False, False), + ('phase', 'phase', str, False, False) + ] + + def __init__(self, + bucketStatus=_omit, # type: Optional[BucketStatus] + info=_omit, # type: Optional[Any] + message=_omit, # type: Optional[str] + phase=_omit, # type: Optional[str] + ): + super(Status, self).__init__( + bucketStatus=bucketStatus, + info=info, + message=message, + phase=phase, + ) + + @property + def bucketStatus(self): + # type: () -> BucketStatus + return self._property_impl('bucketStatus') + + @bucketStatus.setter + def bucketStatus(self, new_val): + # type: (Optional[BucketStatus]) -> None + self._bucketStatus = new_val + + @property + def info(self): + # type: () -> Optional[Any] + return self._property_impl('info') + + @info.setter + def info(self, new_val): + # type: (Optional[Any]) -> None + self._info = new_val + + @property + def message(self): + # type: () -> str + return self._property_impl('message') + + @message.setter + def message(self, new_val): + # type: (Optional[str]) -> None + self._message = new_val + + @property + def phase(self): + # type: () -> str + return self._property_impl('phase') + + @phase.setter + def phase(self, new_val): + # type: (Optional[str]) -> None + self._phase = new_val + + +class CephObjectStore(CrdClass): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', object, False, False), + ('spec', 'spec', 'Spec', True, False), + ('status', 'status', 'Status', False, False) + ] + + def __init__(self, + spec, # type: Spec + apiVersion=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Any] + status=_omit, # type: Optional[Status] + ): + super(CephObjectStore, self).__init__( + spec=spec, + apiVersion=apiVersion, + kind=kind, + metadata=metadata, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Any]) -> None + self._metadata = new_val + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Spec) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Status + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Status]) -> None + self._status = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephobjectstoreuser.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephobjectstoreuser.py new file mode 100644 index 000000000..5947aaa4f --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephobjectstoreuser.py @@ -0,0 +1,157 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class Spec(CrdObject): + _properties = [ + ('displayName', 'displayName', str, False, False), + ('store', 'store', str, False, False) + ] + + def __init__(self, + displayName=_omit, # type: Optional[str] + store=_omit, # type: Optional[str] + ): + super(Spec, self).__init__( + displayName=displayName, + store=store, + ) + + @property + def displayName(self): + # type: () -> str + return self._property_impl('displayName') + + @displayName.setter + def displayName(self, new_val): + # type: (Optional[str]) -> None + self._displayName = new_val + + @property + def store(self): + # type: () -> str + return self._property_impl('store') + + @store.setter + def store(self, new_val): + # type: (Optional[str]) -> None + self._store = new_val + + +class Status(CrdObject): + _properties = [ + ('info', 'info', object, False, True), + ('phase', 'phase', str, False, False) + ] + + def __init__(self, + info=_omit, # type: Optional[Any] + phase=_omit, # type: Optional[str] + ): + super(Status, self).__init__( + info=info, + phase=phase, + ) + + @property + def info(self): + # type: () -> Optional[Any] + return self._property_impl('info') + + @info.setter + def info(self, new_val): + # type: (Optional[Any]) -> None + self._info = new_val + + @property + def phase(self): + # type: () -> str + return self._property_impl('phase') + + @phase.setter + def phase(self, new_val): + # type: (Optional[str]) -> None + self._phase = new_val + + +class CephObjectStoreUser(CrdClass): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', object, False, False), + ('spec', 'spec', 'Spec', True, False), + ('status', 'status', 'Status', False, False) + ] + + def __init__(self, + spec, # type: Spec + apiVersion=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Any] + status=_omit, # type: Optional[Status] + ): + super(CephObjectStoreUser, self).__init__( + spec=spec, + apiVersion=apiVersion, + kind=kind, + metadata=metadata, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Any]) -> None + self._metadata = new_val + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Spec) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Status + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Status]) -> None + self._status = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephobjectzone.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephobjectzone.py new file mode 100644 index 000000000..7ba5f510f --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephobjectzone.py @@ -0,0 +1,797 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class ErasureCoded(CrdObject): + _properties = [ + ('algorithm', 'algorithm', str, False, False), + ('codingChunks', 'codingChunks', int, True, False), + ('dataChunks', 'dataChunks', int, True, False) + ] + + def __init__(self, + codingChunks, # type: int + dataChunks, # type: int + algorithm=_omit, # type: Optional[str] + ): + super(ErasureCoded, self).__init__( + codingChunks=codingChunks, + dataChunks=dataChunks, + algorithm=algorithm, + ) + + @property + def algorithm(self): + # type: () -> str + return self._property_impl('algorithm') + + @algorithm.setter + def algorithm(self, new_val): + # type: (Optional[str]) -> None + self._algorithm = new_val + + @property + def codingChunks(self): + # type: () -> int + return self._property_impl('codingChunks') + + @codingChunks.setter + def codingChunks(self, new_val): + # type: (int) -> None + self._codingChunks = new_val + + @property + def dataChunks(self): + # type: () -> int + return self._property_impl('dataChunks') + + @dataChunks.setter + def dataChunks(self, new_val): + # type: (int) -> None + self._dataChunks = new_val + + +class SnapshotSchedulesItem(CrdObject): + _properties = [ + ('interval', 'interval', str, False, False), + ('startTime', 'startTime', str, False, False) + ] + + def __init__(self, + interval=_omit, # type: Optional[str] + startTime=_omit, # type: Optional[str] + ): + super(SnapshotSchedulesItem, self).__init__( + interval=interval, + startTime=startTime, + ) + + @property + def interval(self): + # type: () -> str + return self._property_impl('interval') + + @interval.setter + def interval(self, new_val): + # type: (Optional[str]) -> None + self._interval = new_val + + @property + def startTime(self): + # type: () -> str + return self._property_impl('startTime') + + @startTime.setter + def startTime(self, new_val): + # type: (Optional[str]) -> None + self._startTime = new_val + + +class SnapshotSchedulesList(CrdObjectList): + _items_type = SnapshotSchedulesItem + + +class Mirroring(CrdObject): + _properties = [ + ('enabled', 'enabled', bool, False, False), + ('mode', 'mode', str, False, False), + ('snapshotSchedules', 'snapshotSchedules', 'SnapshotSchedulesList', False, False) + ] + + def __init__(self, + enabled=_omit, # type: Optional[bool] + mode=_omit, # type: Optional[str] + snapshotSchedules=_omit, # type: Optional[Union[List[SnapshotSchedulesItem], CrdObjectList]] + ): + super(Mirroring, self).__init__( + enabled=enabled, + mode=mode, + snapshotSchedules=snapshotSchedules, + ) + + @property + def enabled(self): + # type: () -> bool + return self._property_impl('enabled') + + @enabled.setter + def enabled(self, new_val): + # type: (Optional[bool]) -> None + self._enabled = new_val + + @property + def mode(self): + # type: () -> str + return self._property_impl('mode') + + @mode.setter + def mode(self, new_val): + # type: (Optional[str]) -> None + self._mode = new_val + + @property + def snapshotSchedules(self): + # type: () -> Union[List[SnapshotSchedulesItem], CrdObjectList] + return self._property_impl('snapshotSchedules') + + @snapshotSchedules.setter + def snapshotSchedules(self, new_val): + # type: (Optional[Union[List[SnapshotSchedulesItem], CrdObjectList]]) -> None + self._snapshotSchedules = new_val + + +class Quotas(CrdObject): + _properties = [ + ('maxBytes', 'maxBytes', int, False, False), + ('maxObjects', 'maxObjects', int, False, False), + ('maxSize', 'maxSize', str, False, False) + ] + + def __init__(self, + maxBytes=_omit, # type: Optional[int] + maxObjects=_omit, # type: Optional[int] + maxSize=_omit, # type: Optional[str] + ): + super(Quotas, self).__init__( + maxBytes=maxBytes, + maxObjects=maxObjects, + maxSize=maxSize, + ) + + @property + def maxBytes(self): + # type: () -> int + return self._property_impl('maxBytes') + + @maxBytes.setter + def maxBytes(self, new_val): + # type: (Optional[int]) -> None + self._maxBytes = new_val + + @property + def maxObjects(self): + # type: () -> int + return self._property_impl('maxObjects') + + @maxObjects.setter + def maxObjects(self, new_val): + # type: (Optional[int]) -> None + self._maxObjects = new_val + + @property + def maxSize(self): + # type: () -> str + return self._property_impl('maxSize') + + @maxSize.setter + def maxSize(self, new_val): + # type: (Optional[str]) -> None + self._maxSize = new_val + + +class Replicated(CrdObject): + _properties = [ + ('replicasPerFailureDomain', 'replicasPerFailureDomain', int, False, False), + ('requireSafeReplicaSize', 'requireSafeReplicaSize', bool, False, False), + ('size', 'size', int, True, False), + ('subFailureDomain', 'subFailureDomain', str, False, False), + ('targetSizeRatio', 'targetSizeRatio', float, False, False) + ] + + def __init__(self, + size, # type: int + replicasPerFailureDomain=_omit, # type: Optional[int] + requireSafeReplicaSize=_omit, # type: Optional[bool] + subFailureDomain=_omit, # type: Optional[str] + targetSizeRatio=_omit, # type: Optional[float] + ): + super(Replicated, self).__init__( + size=size, + replicasPerFailureDomain=replicasPerFailureDomain, + requireSafeReplicaSize=requireSafeReplicaSize, + subFailureDomain=subFailureDomain, + targetSizeRatio=targetSizeRatio, + ) + + @property + def replicasPerFailureDomain(self): + # type: () -> int + return self._property_impl('replicasPerFailureDomain') + + @replicasPerFailureDomain.setter + def replicasPerFailureDomain(self, new_val): + # type: (Optional[int]) -> None + self._replicasPerFailureDomain = new_val + + @property + def requireSafeReplicaSize(self): + # type: () -> bool + return self._property_impl('requireSafeReplicaSize') + + @requireSafeReplicaSize.setter + def requireSafeReplicaSize(self, new_val): + # type: (Optional[bool]) -> None + self._requireSafeReplicaSize = new_val + + @property + def size(self): + # type: () -> int + return self._property_impl('size') + + @size.setter + def size(self, new_val): + # type: (int) -> None + self._size = new_val + + @property + def subFailureDomain(self): + # type: () -> str + return self._property_impl('subFailureDomain') + + @subFailureDomain.setter + def subFailureDomain(self, new_val): + # type: (Optional[str]) -> None + self._subFailureDomain = new_val + + @property + def targetSizeRatio(self): + # type: () -> float + return self._property_impl('targetSizeRatio') + + @targetSizeRatio.setter + def targetSizeRatio(self, new_val): + # type: (Optional[float]) -> None + self._targetSizeRatio = new_val + + +class Mirror(CrdObject): + _properties = [ + ('disabled', 'disabled', bool, False, False), + ('interval', 'interval', str, False, False), + ('timeout', 'timeout', str, False, False) + ] + + def __init__(self, + disabled=_omit, # type: Optional[bool] + interval=_omit, # type: Optional[str] + timeout=_omit, # type: Optional[str] + ): + super(Mirror, self).__init__( + disabled=disabled, + interval=interval, + timeout=timeout, + ) + + @property + def disabled(self): + # type: () -> bool + return self._property_impl('disabled') + + @disabled.setter + def disabled(self, new_val): + # type: (Optional[bool]) -> None + self._disabled = new_val + + @property + def interval(self): + # type: () -> str + return self._property_impl('interval') + + @interval.setter + def interval(self, new_val): + # type: (Optional[str]) -> None + self._interval = new_val + + @property + def timeout(self): + # type: () -> str + return self._property_impl('timeout') + + @timeout.setter + def timeout(self, new_val): + # type: (Optional[str]) -> None + self._timeout = new_val + + +class StatusCheck(CrdObject): + _properties = [ + ('mirror', 'mirror', 'Mirror', False, True) + ] + + def __init__(self, + mirror=_omit, # type: Optional[Mirror] + ): + super(StatusCheck, self).__init__( + mirror=mirror, + ) + + @property + def mirror(self): + # type: () -> Optional[Mirror] + return self._property_impl('mirror') + + @mirror.setter + def mirror(self, new_val): + # type: (Optional[Mirror]) -> None + self._mirror = new_val + + +class DataPool(CrdObject): + _properties = [ + ('compressionMode', 'compressionMode', str, False, True), + ('crushRoot', 'crushRoot', str, False, True), + ('deviceClass', 'deviceClass', str, False, True), + ('enableRBDStats', 'enableRBDStats', bool, False, False), + ('erasureCoded', 'erasureCoded', 'ErasureCoded', False, False), + ('failureDomain', 'failureDomain', str, False, False), + ('mirroring', 'mirroring', 'Mirroring', False, False), + ('parameters', 'parameters', object, False, True), + ('quotas', 'quotas', 'Quotas', False, True), + ('replicated', 'replicated', 'Replicated', False, False), + ('statusCheck', 'statusCheck', 'StatusCheck', False, False) + ] + + def __init__(self, + compressionMode=_omit, # type: Optional[str] + crushRoot=_omit, # type: Optional[str] + deviceClass=_omit, # type: Optional[str] + enableRBDStats=_omit, # type: Optional[bool] + erasureCoded=_omit, # type: Optional[ErasureCoded] + failureDomain=_omit, # type: Optional[str] + mirroring=_omit, # type: Optional[Mirroring] + parameters=_omit, # type: Optional[Any] + quotas=_omit, # type: Optional[Quotas] + replicated=_omit, # type: Optional[Replicated] + statusCheck=_omit, # type: Optional[StatusCheck] + ): + super(DataPool, self).__init__( + compressionMode=compressionMode, + crushRoot=crushRoot, + deviceClass=deviceClass, + enableRBDStats=enableRBDStats, + erasureCoded=erasureCoded, + failureDomain=failureDomain, + mirroring=mirroring, + parameters=parameters, + quotas=quotas, + replicated=replicated, + statusCheck=statusCheck, + ) + + @property + def compressionMode(self): + # type: () -> Optional[str] + return self._property_impl('compressionMode') + + @compressionMode.setter + def compressionMode(self, new_val): + # type: (Optional[str]) -> None + self._compressionMode = new_val + + @property + def crushRoot(self): + # type: () -> Optional[str] + return self._property_impl('crushRoot') + + @crushRoot.setter + def crushRoot(self, new_val): + # type: (Optional[str]) -> None + self._crushRoot = new_val + + @property + def deviceClass(self): + # type: () -> Optional[str] + return self._property_impl('deviceClass') + + @deviceClass.setter + def deviceClass(self, new_val): + # type: (Optional[str]) -> None + self._deviceClass = new_val + + @property + def enableRBDStats(self): + # type: () -> bool + return self._property_impl('enableRBDStats') + + @enableRBDStats.setter + def enableRBDStats(self, new_val): + # type: (Optional[bool]) -> None + self._enableRBDStats = new_val + + @property + def erasureCoded(self): + # type: () -> ErasureCoded + return self._property_impl('erasureCoded') + + @erasureCoded.setter + def erasureCoded(self, new_val): + # type: (Optional[ErasureCoded]) -> None + self._erasureCoded = new_val + + @property + def failureDomain(self): + # type: () -> str + return self._property_impl('failureDomain') + + @failureDomain.setter + def failureDomain(self, new_val): + # type: (Optional[str]) -> None + self._failureDomain = new_val + + @property + def mirroring(self): + # type: () -> Mirroring + return self._property_impl('mirroring') + + @mirroring.setter + def mirroring(self, new_val): + # type: (Optional[Mirroring]) -> None + self._mirroring = new_val + + @property + def parameters(self): + # type: () -> Optional[Any] + return self._property_impl('parameters') + + @parameters.setter + def parameters(self, new_val): + # type: (Optional[Any]) -> None + self._parameters = new_val + + @property + def quotas(self): + # type: () -> Optional[Quotas] + return self._property_impl('quotas') + + @quotas.setter + def quotas(self, new_val): + # type: (Optional[Quotas]) -> None + self._quotas = new_val + + @property + def replicated(self): + # type: () -> Replicated + return self._property_impl('replicated') + + @replicated.setter + def replicated(self, new_val): + # type: (Optional[Replicated]) -> None + self._replicated = new_val + + @property + def statusCheck(self): + # type: () -> StatusCheck + return self._property_impl('statusCheck') + + @statusCheck.setter + def statusCheck(self, new_val): + # type: (Optional[StatusCheck]) -> None + self._statusCheck = new_val + + +class MetadataPool(CrdObject): + _properties = [ + ('compressionMode', 'compressionMode', str, False, True), + ('crushRoot', 'crushRoot', str, False, True), + ('deviceClass', 'deviceClass', str, False, True), + ('enableRBDStats', 'enableRBDStats', bool, False, False), + ('erasureCoded', 'erasureCoded', 'ErasureCoded', False, False), + ('failureDomain', 'failureDomain', str, False, False), + ('mirroring', 'mirroring', 'Mirroring', False, False), + ('parameters', 'parameters', object, False, True), + ('quotas', 'quotas', 'Quotas', False, True), + ('replicated', 'replicated', 'Replicated', False, False), + ('statusCheck', 'statusCheck', 'StatusCheck', False, False) + ] + + def __init__(self, + compressionMode=_omit, # type: Optional[str] + crushRoot=_omit, # type: Optional[str] + deviceClass=_omit, # type: Optional[str] + enableRBDStats=_omit, # type: Optional[bool] + erasureCoded=_omit, # type: Optional[ErasureCoded] + failureDomain=_omit, # type: Optional[str] + mirroring=_omit, # type: Optional[Mirroring] + parameters=_omit, # type: Optional[Any] + quotas=_omit, # type: Optional[Quotas] + replicated=_omit, # type: Optional[Replicated] + statusCheck=_omit, # type: Optional[StatusCheck] + ): + super(MetadataPool, self).__init__( + compressionMode=compressionMode, + crushRoot=crushRoot, + deviceClass=deviceClass, + enableRBDStats=enableRBDStats, + erasureCoded=erasureCoded, + failureDomain=failureDomain, + mirroring=mirroring, + parameters=parameters, + quotas=quotas, + replicated=replicated, + statusCheck=statusCheck, + ) + + @property + def compressionMode(self): + # type: () -> Optional[str] + return self._property_impl('compressionMode') + + @compressionMode.setter + def compressionMode(self, new_val): + # type: (Optional[str]) -> None + self._compressionMode = new_val + + @property + def crushRoot(self): + # type: () -> Optional[str] + return self._property_impl('crushRoot') + + @crushRoot.setter + def crushRoot(self, new_val): + # type: (Optional[str]) -> None + self._crushRoot = new_val + + @property + def deviceClass(self): + # type: () -> Optional[str] + return self._property_impl('deviceClass') + + @deviceClass.setter + def deviceClass(self, new_val): + # type: (Optional[str]) -> None + self._deviceClass = new_val + + @property + def enableRBDStats(self): + # type: () -> bool + return self._property_impl('enableRBDStats') + + @enableRBDStats.setter + def enableRBDStats(self, new_val): + # type: (Optional[bool]) -> None + self._enableRBDStats = new_val + + @property + def erasureCoded(self): + # type: () -> ErasureCoded + return self._property_impl('erasureCoded') + + @erasureCoded.setter + def erasureCoded(self, new_val): + # type: (Optional[ErasureCoded]) -> None + self._erasureCoded = new_val + + @property + def failureDomain(self): + # type: () -> str + return self._property_impl('failureDomain') + + @failureDomain.setter + def failureDomain(self, new_val): + # type: (Optional[str]) -> None + self._failureDomain = new_val + + @property + def mirroring(self): + # type: () -> Mirroring + return self._property_impl('mirroring') + + @mirroring.setter + def mirroring(self, new_val): + # type: (Optional[Mirroring]) -> None + self._mirroring = new_val + + @property + def parameters(self): + # type: () -> Optional[Any] + return self._property_impl('parameters') + + @parameters.setter + def parameters(self, new_val): + # type: (Optional[Any]) -> None + self._parameters = new_val + + @property + def quotas(self): + # type: () -> Optional[Quotas] + return self._property_impl('quotas') + + @quotas.setter + def quotas(self, new_val): + # type: (Optional[Quotas]) -> None + self._quotas = new_val + + @property + def replicated(self): + # type: () -> Replicated + return self._property_impl('replicated') + + @replicated.setter + def replicated(self, new_val): + # type: (Optional[Replicated]) -> None + self._replicated = new_val + + @property + def statusCheck(self): + # type: () -> StatusCheck + return self._property_impl('statusCheck') + + @statusCheck.setter + def statusCheck(self, new_val): + # type: (Optional[StatusCheck]) -> None + self._statusCheck = new_val + + +class Spec(CrdObject): + _properties = [ + ('dataPool', 'dataPool', 'DataPool', True, True), + ('metadataPool', 'metadataPool', 'MetadataPool', True, True), + ('zoneGroup', 'zoneGroup', str, True, False) + ] + + def __init__(self, + dataPool, # type: Optional[DataPool] + metadataPool, # type: Optional[MetadataPool] + zoneGroup, # type: str + ): + super(Spec, self).__init__( + dataPool=dataPool, + metadataPool=metadataPool, + zoneGroup=zoneGroup, + ) + + @property + def dataPool(self): + # type: () -> Optional[DataPool] + return self._property_impl('dataPool') + + @dataPool.setter + def dataPool(self, new_val): + # type: (Optional[DataPool]) -> None + self._dataPool = new_val + + @property + def metadataPool(self): + # type: () -> Optional[MetadataPool] + return self._property_impl('metadataPool') + + @metadataPool.setter + def metadataPool(self, new_val): + # type: (Optional[MetadataPool]) -> None + self._metadataPool = new_val + + @property + def zoneGroup(self): + # type: () -> str + return self._property_impl('zoneGroup') + + @zoneGroup.setter + def zoneGroup(self, new_val): + # type: (str) -> None + self._zoneGroup = new_val + + +class Status(CrdObject): + _properties = [ + ('phase', 'phase', str, False, False) + ] + + def __init__(self, + phase=_omit, # type: Optional[str] + ): + super(Status, self).__init__( + phase=phase, + ) + + @property + def phase(self): + # type: () -> str + return self._property_impl('phase') + + @phase.setter + def phase(self, new_val): + # type: (Optional[str]) -> None + self._phase = new_val + + +class CephObjectZone(CrdClass): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', object, False, False), + ('spec', 'spec', 'Spec', True, False), + ('status', 'status', 'Status', False, False) + ] + + def __init__(self, + spec, # type: Spec + apiVersion=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Any] + status=_omit, # type: Optional[Status] + ): + super(CephObjectZone, self).__init__( + spec=spec, + apiVersion=apiVersion, + kind=kind, + metadata=metadata, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Any]) -> None + self._metadata = new_val + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Spec) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Status + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Status]) -> None + self._status = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephobjectzonegroup.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephobjectzonegroup.py new file mode 100644 index 000000000..d535a1b7a --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephobjectzonegroup.py @@ -0,0 +1,131 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class Spec(CrdObject): + _properties = [ + ('realm', 'realm', str, True, False) + ] + + def __init__(self, + realm, # type: str + ): + super(Spec, self).__init__( + realm=realm, + ) + + @property + def realm(self): + # type: () -> str + return self._property_impl('realm') + + @realm.setter + def realm(self, new_val): + # type: (str) -> None + self._realm = new_val + + +class Status(CrdObject): + _properties = [ + ('phase', 'phase', str, False, False) + ] + + def __init__(self, + phase=_omit, # type: Optional[str] + ): + super(Status, self).__init__( + phase=phase, + ) + + @property + def phase(self): + # type: () -> str + return self._property_impl('phase') + + @phase.setter + def phase(self, new_val): + # type: (Optional[str]) -> None + self._phase = new_val + + +class CephObjectZoneGroup(CrdClass): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', object, False, False), + ('spec', 'spec', 'Spec', True, False), + ('status', 'status', 'Status', False, False) + ] + + def __init__(self, + spec, # type: Spec + apiVersion=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Any] + status=_omit, # type: Optional[Status] + ): + super(CephObjectZoneGroup, self).__init__( + spec=spec, + apiVersion=apiVersion, + kind=kind, + metadata=metadata, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Any]) -> None + self._metadata = new_val + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Spec) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Status + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Status]) -> None + self._status = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephrbdmirror.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephrbdmirror.py new file mode 100644 index 000000000..4d121377f --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/cephrbdmirror.py @@ -0,0 +1,1066 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class SecretNamesList(CrdObjectList): + _items_type = str + + +class Peers(CrdObject): + _properties = [ + ('secretNames', 'secretNames', 'SecretNamesList', False, False) + ] + + def __init__(self, + secretNames=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(Peers, self).__init__( + secretNames=secretNames, + ) + + @property + def secretNames(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('secretNames') + + @secretNames.setter + def secretNames(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._secretNames = new_val + + +class ValuesList(CrdObjectList): + _items_type = str + + +class MatchExpressionsItem(CrdObject): + _properties = [ + ('key', 'key', str, True, False), + ('operator', 'operator', str, True, False), + ('values', 'values', 'ValuesList', False, False) + ] + + def __init__(self, + key, # type: str + operator, # type: str + values=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(MatchExpressionsItem, self).__init__( + key=key, + operator=operator, + values=values, + ) + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (str) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (str) -> None + self._operator = new_val + + @property + def values(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('values') + + @values.setter + def values(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._values = new_val + + +class MatchExpressionsList(CrdObjectList): + _items_type = MatchExpressionsItem + + +class MatchFieldsItem(CrdObject): + _properties = [ + ('key', 'key', str, True, False), + ('operator', 'operator', str, True, False), + ('values', 'values', 'ValuesList', False, False) + ] + + def __init__(self, + key, # type: str + operator, # type: str + values=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(MatchFieldsItem, self).__init__( + key=key, + operator=operator, + values=values, + ) + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (str) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (str) -> None + self._operator = new_val + + @property + def values(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('values') + + @values.setter + def values(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._values = new_val + + +class MatchFieldsList(CrdObjectList): + _items_type = MatchFieldsItem + + +class Preference(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchFields', 'matchFields', 'MatchFieldsList', False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchFields=_omit, # type: Optional[Union[List[MatchFieldsItem], CrdObjectList]] + ): + super(Preference, self).__init__( + matchExpressions=matchExpressions, + matchFields=matchFields, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchFields(self): + # type: () -> Union[List[MatchFieldsItem], CrdObjectList] + return self._property_impl('matchFields') + + @matchFields.setter + def matchFields(self, new_val): + # type: (Optional[Union[List[MatchFieldsItem], CrdObjectList]]) -> None + self._matchFields = new_val + + +class PreferredDuringSchedulingIgnoredDuringExecutionItem(CrdObject): + _properties = [ + ('podAffinityTerm', 'podAffinityTerm', 'PodAffinityTerm', False, False), + ('weight', 'weight', int, False, False), + ('preference', 'preference', 'Preference', False, False) + ] + + def __init__(self, + podAffinityTerm=_omit, # type: Optional[PodAffinityTerm] + weight=_omit, # type: Optional[int] + preference=_omit, # type: Optional[Preference] + ): + super(PreferredDuringSchedulingIgnoredDuringExecutionItem, self).__init__( + podAffinityTerm=podAffinityTerm, + weight=weight, + preference=preference, + ) + + @property + def podAffinityTerm(self): + # type: () -> PodAffinityTerm + return self._property_impl('podAffinityTerm') + + @podAffinityTerm.setter + def podAffinityTerm(self, new_val): + # type: (Optional[PodAffinityTerm]) -> None + self._podAffinityTerm = new_val + + @property + def weight(self): + # type: () -> int + return self._property_impl('weight') + + @weight.setter + def weight(self, new_val): + # type: (Optional[int]) -> None + self._weight = new_val + + @property + def preference(self): + # type: () -> Preference + return self._property_impl('preference') + + @preference.setter + def preference(self, new_val): + # type: (Optional[Preference]) -> None + self._preference = new_val + + +class PreferredDuringSchedulingIgnoredDuringExecutionList(CrdObjectList): + _items_type = PreferredDuringSchedulingIgnoredDuringExecutionItem + + +class NodeSelectorTermsItem(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchFields', 'matchFields', 'MatchFieldsList', False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchFields=_omit, # type: Optional[Union[List[MatchFieldsItem], CrdObjectList]] + ): + super(NodeSelectorTermsItem, self).__init__( + matchExpressions=matchExpressions, + matchFields=matchFields, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchFields(self): + # type: () -> Union[List[MatchFieldsItem], CrdObjectList] + return self._property_impl('matchFields') + + @matchFields.setter + def matchFields(self, new_val): + # type: (Optional[Union[List[MatchFieldsItem], CrdObjectList]]) -> None + self._matchFields = new_val + + +class NodeSelectorTermsList(CrdObjectList): + _items_type = NodeSelectorTermsItem + + +class RequiredDuringSchedulingIgnoredDuringExecution(CrdObject): + _properties = [ + ('nodeSelectorTerms', 'nodeSelectorTerms', 'NodeSelectorTermsList', True, False) + ] + + def __init__(self, + nodeSelectorTerms, # type: Union[List[NodeSelectorTermsItem], CrdObjectList] + ): + super(RequiredDuringSchedulingIgnoredDuringExecution, self).__init__( + nodeSelectorTerms=nodeSelectorTerms, + ) + + @property + def nodeSelectorTerms(self): + # type: () -> Union[List[NodeSelectorTermsItem], CrdObjectList] + return self._property_impl('nodeSelectorTerms') + + @nodeSelectorTerms.setter + def nodeSelectorTerms(self, new_val): + # type: (Union[List[NodeSelectorTermsItem], CrdObjectList]) -> None + self._nodeSelectorTerms = new_val + + +class NodeAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecution', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[RequiredDuringSchedulingIgnoredDuringExecution] + ): + super(NodeAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> RequiredDuringSchedulingIgnoredDuringExecution + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[RequiredDuringSchedulingIgnoredDuringExecution]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class LabelSelector(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchLabels', 'matchLabels', object, False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchLabels=_omit, # type: Optional[Any] + ): + super(LabelSelector, self).__init__( + matchExpressions=matchExpressions, + matchLabels=matchLabels, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchLabels(self): + # type: () -> Any + return self._property_impl('matchLabels') + + @matchLabels.setter + def matchLabels(self, new_val): + # type: (Optional[Any]) -> None + self._matchLabels = new_val + + +class NamespaceSelector(CrdObject): + _properties = [ + ('matchExpressions', 'matchExpressions', 'MatchExpressionsList', False, False), + ('matchLabels', 'matchLabels', object, False, False) + ] + + def __init__(self, + matchExpressions=_omit, # type: Optional[Union[List[MatchExpressionsItem], CrdObjectList]] + matchLabels=_omit, # type: Optional[Any] + ): + super(NamespaceSelector, self).__init__( + matchExpressions=matchExpressions, + matchLabels=matchLabels, + ) + + @property + def matchExpressions(self): + # type: () -> Union[List[MatchExpressionsItem], CrdObjectList] + return self._property_impl('matchExpressions') + + @matchExpressions.setter + def matchExpressions(self, new_val): + # type: (Optional[Union[List[MatchExpressionsItem], CrdObjectList]]) -> None + self._matchExpressions = new_val + + @property + def matchLabels(self): + # type: () -> Any + return self._property_impl('matchLabels') + + @matchLabels.setter + def matchLabels(self, new_val): + # type: (Optional[Any]) -> None + self._matchLabels = new_val + + +class NamespacesList(CrdObjectList): + _items_type = str + + +class PodAffinityTerm(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('namespaceSelector', 'namespaceSelector', 'NamespaceSelector', False, False), + ('namespaces', 'namespaces', 'NamespacesList', False, False), + ('topologyKey', 'topologyKey', str, True, False) + ] + + def __init__(self, + topologyKey, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + namespaceSelector=_omit, # type: Optional[NamespaceSelector] + namespaces=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(PodAffinityTerm, self).__init__( + topologyKey=topologyKey, + labelSelector=labelSelector, + namespaceSelector=namespaceSelector, + namespaces=namespaces, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def namespaceSelector(self): + # type: () -> NamespaceSelector + return self._property_impl('namespaceSelector') + + @namespaceSelector.setter + def namespaceSelector(self, new_val): + # type: (Optional[NamespaceSelector]) -> None + self._namespaceSelector = new_val + + @property + def namespaces(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('namespaces') + + @namespaces.setter + def namespaces(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._namespaces = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + +class RequiredDuringSchedulingIgnoredDuringExecutionItem(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('namespaceSelector', 'namespaceSelector', 'NamespaceSelector', False, False), + ('namespaces', 'namespaces', 'NamespacesList', False, False), + ('topologyKey', 'topologyKey', str, True, False) + ] + + def __init__(self, + topologyKey, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + namespaceSelector=_omit, # type: Optional[NamespaceSelector] + namespaces=_omit, # type: Optional[Union[List[str], CrdObjectList]] + ): + super(RequiredDuringSchedulingIgnoredDuringExecutionItem, self).__init__( + topologyKey=topologyKey, + labelSelector=labelSelector, + namespaceSelector=namespaceSelector, + namespaces=namespaces, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def namespaceSelector(self): + # type: () -> NamespaceSelector + return self._property_impl('namespaceSelector') + + @namespaceSelector.setter + def namespaceSelector(self, new_val): + # type: (Optional[NamespaceSelector]) -> None + self._namespaceSelector = new_val + + @property + def namespaces(self): + # type: () -> Union[List[str], CrdObjectList] + return self._property_impl('namespaces') + + @namespaces.setter + def namespaces(self, new_val): + # type: (Optional[Union[List[str], CrdObjectList]]) -> None + self._namespaces = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + +class RequiredDuringSchedulingIgnoredDuringExecutionList(CrdObjectList): + _items_type = RequiredDuringSchedulingIgnoredDuringExecutionItem + + +class PodAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecutionList', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + ): + super(PodAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class PodAntiAffinity(CrdObject): + _properties = [ + ('preferredDuringSchedulingIgnoredDuringExecution', 'preferredDuringSchedulingIgnoredDuringExecution', 'PreferredDuringSchedulingIgnoredDuringExecutionList', False, False), + ('requiredDuringSchedulingIgnoredDuringExecution', 'requiredDuringSchedulingIgnoredDuringExecution', 'RequiredDuringSchedulingIgnoredDuringExecutionList', False, False) + ] + + def __init__(self, + preferredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + requiredDuringSchedulingIgnoredDuringExecution=_omit, # type: Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]] + ): + super(PodAntiAffinity, self).__init__( + preferredDuringSchedulingIgnoredDuringExecution=preferredDuringSchedulingIgnoredDuringExecution, + requiredDuringSchedulingIgnoredDuringExecution=requiredDuringSchedulingIgnoredDuringExecution, + ) + + @property + def preferredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('preferredDuringSchedulingIgnoredDuringExecution') + + @preferredDuringSchedulingIgnoredDuringExecution.setter + def preferredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[PreferredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._preferredDuringSchedulingIgnoredDuringExecution = new_val + + @property + def requiredDuringSchedulingIgnoredDuringExecution(self): + # type: () -> Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList] + return self._property_impl('requiredDuringSchedulingIgnoredDuringExecution') + + @requiredDuringSchedulingIgnoredDuringExecution.setter + def requiredDuringSchedulingIgnoredDuringExecution(self, new_val): + # type: (Optional[Union[List[RequiredDuringSchedulingIgnoredDuringExecutionItem], CrdObjectList]]) -> None + self._requiredDuringSchedulingIgnoredDuringExecution = new_val + + +class TolerationsItem(CrdObject): + _properties = [ + ('effect', 'effect', str, False, False), + ('key', 'key', str, False, False), + ('operator', 'operator', str, False, False), + ('tolerationSeconds', 'tolerationSeconds', int, False, False), + ('value', 'value', str, False, False) + ] + + def __init__(self, + effect=_omit, # type: Optional[str] + key=_omit, # type: Optional[str] + operator=_omit, # type: Optional[str] + tolerationSeconds=_omit, # type: Optional[int] + value=_omit, # type: Optional[str] + ): + super(TolerationsItem, self).__init__( + effect=effect, + key=key, + operator=operator, + tolerationSeconds=tolerationSeconds, + value=value, + ) + + @property + def effect(self): + # type: () -> str + return self._property_impl('effect') + + @effect.setter + def effect(self, new_val): + # type: (Optional[str]) -> None + self._effect = new_val + + @property + def key(self): + # type: () -> str + return self._property_impl('key') + + @key.setter + def key(self, new_val): + # type: (Optional[str]) -> None + self._key = new_val + + @property + def operator(self): + # type: () -> str + return self._property_impl('operator') + + @operator.setter + def operator(self, new_val): + # type: (Optional[str]) -> None + self._operator = new_val + + @property + def tolerationSeconds(self): + # type: () -> int + return self._property_impl('tolerationSeconds') + + @tolerationSeconds.setter + def tolerationSeconds(self, new_val): + # type: (Optional[int]) -> None + self._tolerationSeconds = new_val + + @property + def value(self): + # type: () -> str + return self._property_impl('value') + + @value.setter + def value(self, new_val): + # type: (Optional[str]) -> None + self._value = new_val + + +class TolerationsList(CrdObjectList): + _items_type = TolerationsItem + + +class TopologySpreadConstraintsItem(CrdObject): + _properties = [ + ('labelSelector', 'labelSelector', 'LabelSelector', False, False), + ('maxSkew', 'maxSkew', int, True, False), + ('topologyKey', 'topologyKey', str, True, False), + ('whenUnsatisfiable', 'whenUnsatisfiable', str, True, False) + ] + + def __init__(self, + maxSkew, # type: int + topologyKey, # type: str + whenUnsatisfiable, # type: str + labelSelector=_omit, # type: Optional[LabelSelector] + ): + super(TopologySpreadConstraintsItem, self).__init__( + maxSkew=maxSkew, + topologyKey=topologyKey, + whenUnsatisfiable=whenUnsatisfiable, + labelSelector=labelSelector, + ) + + @property + def labelSelector(self): + # type: () -> LabelSelector + return self._property_impl('labelSelector') + + @labelSelector.setter + def labelSelector(self, new_val): + # type: (Optional[LabelSelector]) -> None + self._labelSelector = new_val + + @property + def maxSkew(self): + # type: () -> int + return self._property_impl('maxSkew') + + @maxSkew.setter + def maxSkew(self, new_val): + # type: (int) -> None + self._maxSkew = new_val + + @property + def topologyKey(self): + # type: () -> str + return self._property_impl('topologyKey') + + @topologyKey.setter + def topologyKey(self, new_val): + # type: (str) -> None + self._topologyKey = new_val + + @property + def whenUnsatisfiable(self): + # type: () -> str + return self._property_impl('whenUnsatisfiable') + + @whenUnsatisfiable.setter + def whenUnsatisfiable(self, new_val): + # type: (str) -> None + self._whenUnsatisfiable = new_val + + +class TopologySpreadConstraintsList(CrdObjectList): + _items_type = TopologySpreadConstraintsItem + + +class Placement(CrdObject): + _properties = [ + ('nodeAffinity', 'nodeAffinity', 'NodeAffinity', False, False), + ('podAffinity', 'podAffinity', 'PodAffinity', False, False), + ('podAntiAffinity', 'podAntiAffinity', 'PodAntiAffinity', False, False), + ('tolerations', 'tolerations', 'TolerationsList', False, False), + ('topologySpreadConstraints', 'topologySpreadConstraints', 'TopologySpreadConstraintsList', False, False) + ] + + def __init__(self, + nodeAffinity=_omit, # type: Optional[NodeAffinity] + podAffinity=_omit, # type: Optional[PodAffinity] + podAntiAffinity=_omit, # type: Optional[PodAntiAffinity] + tolerations=_omit, # type: Optional[Union[List[TolerationsItem], CrdObjectList]] + topologySpreadConstraints=_omit, # type: Optional[Union[List[TopologySpreadConstraintsItem], CrdObjectList]] + ): + super(Placement, self).__init__( + nodeAffinity=nodeAffinity, + podAffinity=podAffinity, + podAntiAffinity=podAntiAffinity, + tolerations=tolerations, + topologySpreadConstraints=topologySpreadConstraints, + ) + + @property + def nodeAffinity(self): + # type: () -> NodeAffinity + return self._property_impl('nodeAffinity') + + @nodeAffinity.setter + def nodeAffinity(self, new_val): + # type: (Optional[NodeAffinity]) -> None + self._nodeAffinity = new_val + + @property + def podAffinity(self): + # type: () -> PodAffinity + return self._property_impl('podAffinity') + + @podAffinity.setter + def podAffinity(self, new_val): + # type: (Optional[PodAffinity]) -> None + self._podAffinity = new_val + + @property + def podAntiAffinity(self): + # type: () -> PodAntiAffinity + return self._property_impl('podAntiAffinity') + + @podAntiAffinity.setter + def podAntiAffinity(self, new_val): + # type: (Optional[PodAntiAffinity]) -> None + self._podAntiAffinity = new_val + + @property + def tolerations(self): + # type: () -> Union[List[TolerationsItem], CrdObjectList] + return self._property_impl('tolerations') + + @tolerations.setter + def tolerations(self, new_val): + # type: (Optional[Union[List[TolerationsItem], CrdObjectList]]) -> None + self._tolerations = new_val + + @property + def topologySpreadConstraints(self): + # type: () -> Union[List[TopologySpreadConstraintsItem], CrdObjectList] + return self._property_impl('topologySpreadConstraints') + + @topologySpreadConstraints.setter + def topologySpreadConstraints(self, new_val): + # type: (Optional[Union[List[TopologySpreadConstraintsItem], CrdObjectList]]) -> None + self._topologySpreadConstraints = new_val + + +class Resources(CrdObject): + _properties = [ + ('limits', 'limits', object, False, False), + ('requests', 'requests', object, False, False) + ] + + def __init__(self, + limits=_omit, # type: Optional[Any] + requests=_omit, # type: Optional[Any] + ): + super(Resources, self).__init__( + limits=limits, + requests=requests, + ) + + @property + def limits(self): + # type: () -> Any + return self._property_impl('limits') + + @limits.setter + def limits(self, new_val): + # type: (Optional[Any]) -> None + self._limits = new_val + + @property + def requests(self): + # type: () -> Any + return self._property_impl('requests') + + @requests.setter + def requests(self, new_val): + # type: (Optional[Any]) -> None + self._requests = new_val + + +class Spec(CrdObject): + _properties = [ + ('annotations', 'annotations', object, False, True), + ('count', 'count', int, True, False), + ('labels', 'labels', object, False, True), + ('peers', 'peers', 'Peers', False, True), + ('placement', 'placement', 'Placement', False, True), + ('priorityClassName', 'priorityClassName', str, False, False), + ('resources', 'resources', 'Resources', False, True) + ] + + def __init__(self, + count, # type: int + annotations=_omit, # type: Optional[Any] + labels=_omit, # type: Optional[Any] + peers=_omit, # type: Optional[Peers] + placement=_omit, # type: Optional[Placement] + priorityClassName=_omit, # type: Optional[str] + resources=_omit, # type: Optional[Resources] + ): + super(Spec, self).__init__( + count=count, + annotations=annotations, + labels=labels, + peers=peers, + placement=placement, + priorityClassName=priorityClassName, + resources=resources, + ) + + @property + def annotations(self): + # type: () -> Optional[Any] + return self._property_impl('annotations') + + @annotations.setter + def annotations(self, new_val): + # type: (Optional[Any]) -> None + self._annotations = new_val + + @property + def count(self): + # type: () -> int + return self._property_impl('count') + + @count.setter + def count(self, new_val): + # type: (int) -> None + self._count = new_val + + @property + def labels(self): + # type: () -> Optional[Any] + return self._property_impl('labels') + + @labels.setter + def labels(self, new_val): + # type: (Optional[Any]) -> None + self._labels = new_val + + @property + def peers(self): + # type: () -> Optional[Peers] + return self._property_impl('peers') + + @peers.setter + def peers(self, new_val): + # type: (Optional[Peers]) -> None + self._peers = new_val + + @property + def placement(self): + # type: () -> Optional[Placement] + return self._property_impl('placement') + + @placement.setter + def placement(self, new_val): + # type: (Optional[Placement]) -> None + self._placement = new_val + + @property + def priorityClassName(self): + # type: () -> str + return self._property_impl('priorityClassName') + + @priorityClassName.setter + def priorityClassName(self, new_val): + # type: (Optional[str]) -> None + self._priorityClassName = new_val + + @property + def resources(self): + # type: () -> Optional[Resources] + return self._property_impl('resources') + + @resources.setter + def resources(self, new_val): + # type: (Optional[Resources]) -> None + self._resources = new_val + + +class Status(CrdObject): + _properties = [ + ('phase', 'phase', str, False, False) + ] + + def __init__(self, + phase=_omit, # type: Optional[str] + ): + super(Status, self).__init__( + phase=phase, + ) + + @property + def phase(self): + # type: () -> str + return self._property_impl('phase') + + @phase.setter + def phase(self, new_val): + # type: (Optional[str]) -> None + self._phase = new_val + + +class CephRBDMirror(CrdClass): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', object, False, False), + ('spec', 'spec', 'Spec', True, False), + ('status', 'status', 'Status', False, False) + ] + + def __init__(self, + spec, # type: Spec + apiVersion=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Any] + status=_omit, # type: Optional[Status] + ): + super(CephRBDMirror, self).__init__( + spec=spec, + apiVersion=apiVersion, + kind=kind, + metadata=metadata, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Any]) -> None + self._metadata = new_val + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Spec) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Status + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Status]) -> None + self._status = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/objectbucket.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/objectbucket.py new file mode 100644 index 000000000..7d4158a47 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/objectbucket.py @@ -0,0 +1,252 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class Endpoint(CrdObject): + _properties = [ + ('bucketHost', 'bucketHost', str, False, False), + ('bucketPort', 'bucketPort', int, False, False), + ('bucketName', 'bucketName', str, False, False), + ('region', 'region', str, False, False), + ('subRegion', 'subRegion', str, False, False), + ('additionalConfig', 'additionalConfig', object, False, True) + ] + + def __init__(self, + bucketHost=_omit, # type: Optional[str] + bucketPort=_omit, # type: Optional[int] + bucketName=_omit, # type: Optional[str] + region=_omit, # type: Optional[str] + subRegion=_omit, # type: Optional[str] + additionalConfig=_omit, # type: Optional[Any] + ): + super(Endpoint, self).__init__( + bucketHost=bucketHost, + bucketPort=bucketPort, + bucketName=bucketName, + region=region, + subRegion=subRegion, + additionalConfig=additionalConfig, + ) + + @property + def bucketHost(self): + # type: () -> str + return self._property_impl('bucketHost') + + @bucketHost.setter + def bucketHost(self, new_val): + # type: (Optional[str]) -> None + self._bucketHost = new_val + + @property + def bucketPort(self): + # type: () -> int + return self._property_impl('bucketPort') + + @bucketPort.setter + def bucketPort(self, new_val): + # type: (Optional[int]) -> None + self._bucketPort = new_val + + @property + def bucketName(self): + # type: () -> str + return self._property_impl('bucketName') + + @bucketName.setter + def bucketName(self, new_val): + # type: (Optional[str]) -> None + self._bucketName = new_val + + @property + def region(self): + # type: () -> str + return self._property_impl('region') + + @region.setter + def region(self, new_val): + # type: (Optional[str]) -> None + self._region = new_val + + @property + def subRegion(self): + # type: () -> str + return self._property_impl('subRegion') + + @subRegion.setter + def subRegion(self, new_val): + # type: (Optional[str]) -> None + self._subRegion = new_val + + @property + def additionalConfig(self): + # type: () -> Optional[Any] + return self._property_impl('additionalConfig') + + @additionalConfig.setter + def additionalConfig(self, new_val): + # type: (Optional[Any]) -> None + self._additionalConfig = new_val + + +class AuthenticationList(CrdObjectList): + _items_type = None + + +class Spec(CrdObject): + _properties = [ + ('storageClassName', 'storageClassName', str, False, False), + ('endpoint', 'endpoint', 'Endpoint', False, True), + ('authentication', 'authentication', 'AuthenticationList', False, True), + ('additionalState', 'additionalState', object, False, True), + ('reclaimPolicy', 'reclaimPolicy', str, False, False), + ('claimRef', 'claimRef', object, False, True) + ] + + def __init__(self, + storageClassName=_omit, # type: Optional[str] + endpoint=_omit, # type: Optional[Endpoint] + authentication=_omit, # type: Optional[Union[List[Any], CrdObjectList]] + additionalState=_omit, # type: Optional[Any] + reclaimPolicy=_omit, # type: Optional[str] + claimRef=_omit, # type: Optional[Any] + ): + super(Spec, self).__init__( + storageClassName=storageClassName, + endpoint=endpoint, + authentication=authentication, + additionalState=additionalState, + reclaimPolicy=reclaimPolicy, + claimRef=claimRef, + ) + + @property + def storageClassName(self): + # type: () -> str + return self._property_impl('storageClassName') + + @storageClassName.setter + def storageClassName(self, new_val): + # type: (Optional[str]) -> None + self._storageClassName = new_val + + @property + def endpoint(self): + # type: () -> Optional[Endpoint] + return self._property_impl('endpoint') + + @endpoint.setter + def endpoint(self, new_val): + # type: (Optional[Endpoint]) -> None + self._endpoint = new_val + + @property + def authentication(self): + # type: () -> Optional[Union[List[Any], CrdObjectList]] + return self._property_impl('authentication') + + @authentication.setter + def authentication(self, new_val): + # type: (Optional[Union[List[Any], CrdObjectList]]) -> None + self._authentication = new_val + + @property + def additionalState(self): + # type: () -> Optional[Any] + return self._property_impl('additionalState') + + @additionalState.setter + def additionalState(self, new_val): + # type: (Optional[Any]) -> None + self._additionalState = new_val + + @property + def reclaimPolicy(self): + # type: () -> str + return self._property_impl('reclaimPolicy') + + @reclaimPolicy.setter + def reclaimPolicy(self, new_val): + # type: (Optional[str]) -> None + self._reclaimPolicy = new_val + + @property + def claimRef(self): + # type: () -> Optional[Any] + return self._property_impl('claimRef') + + @claimRef.setter + def claimRef(self, new_val): + # type: (Optional[Any]) -> None + self._claimRef = new_val + + +class ObjectBucket(CrdClass): + _properties = [ + ('spec', 'spec', 'Spec', True, False), + ('status', 'status', object, False, False), + ('apiVersion', 'apiVersion', str, True, False), + ('metadata', 'metadata', object, True, False) + ] + + def __init__(self, + spec, # type: Spec + apiVersion, # type: str + metadata, # type: Any + status=_omit, # type: Optional[Any] + ): + super(ObjectBucket, self).__init__( + spec=spec, + apiVersion=apiVersion, + metadata=metadata, + status=status, + ) + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Spec) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Any + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Any]) -> None + self._status = new_val + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (str) -> None + self._apiVersion = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Any) -> None + self._metadata = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/objectbucketclaim.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/objectbucketclaim.py new file mode 100644 index 000000000..3a976a167 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/objectbucketclaim.py @@ -0,0 +1,147 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class Spec(CrdObject): + _properties = [ + ('storageClassName', 'storageClassName', str, False, False), + ('bucketName', 'bucketName', str, False, False), + ('generateBucketName', 'generateBucketName', str, False, False), + ('additionalConfig', 'additionalConfig', object, False, True), + ('objectBucketName', 'objectBucketName', str, False, False) + ] + + def __init__(self, + storageClassName=_omit, # type: Optional[str] + bucketName=_omit, # type: Optional[str] + generateBucketName=_omit, # type: Optional[str] + additionalConfig=_omit, # type: Optional[Any] + objectBucketName=_omit, # type: Optional[str] + ): + super(Spec, self).__init__( + storageClassName=storageClassName, + bucketName=bucketName, + generateBucketName=generateBucketName, + additionalConfig=additionalConfig, + objectBucketName=objectBucketName, + ) + + @property + def storageClassName(self): + # type: () -> str + return self._property_impl('storageClassName') + + @storageClassName.setter + def storageClassName(self, new_val): + # type: (Optional[str]) -> None + self._storageClassName = new_val + + @property + def bucketName(self): + # type: () -> str + return self._property_impl('bucketName') + + @bucketName.setter + def bucketName(self, new_val): + # type: (Optional[str]) -> None + self._bucketName = new_val + + @property + def generateBucketName(self): + # type: () -> str + return self._property_impl('generateBucketName') + + @generateBucketName.setter + def generateBucketName(self, new_val): + # type: (Optional[str]) -> None + self._generateBucketName = new_val + + @property + def additionalConfig(self): + # type: () -> Optional[Any] + return self._property_impl('additionalConfig') + + @additionalConfig.setter + def additionalConfig(self, new_val): + # type: (Optional[Any]) -> None + self._additionalConfig = new_val + + @property + def objectBucketName(self): + # type: () -> str + return self._property_impl('objectBucketName') + + @objectBucketName.setter + def objectBucketName(self, new_val): + # type: (Optional[str]) -> None + self._objectBucketName = new_val + + +class ObjectBucketClaim(CrdClass): + _properties = [ + ('spec', 'spec', 'Spec', True, False), + ('status', 'status', object, False, False), + ('apiVersion', 'apiVersion', str, True, False), + ('metadata', 'metadata', object, True, False) + ] + + def __init__(self, + spec, # type: Spec + apiVersion, # type: str + metadata, # type: Any + status=_omit, # type: Optional[Any] + ): + super(ObjectBucketClaim, self).__init__( + spec=spec, + apiVersion=apiVersion, + metadata=metadata, + status=status, + ) + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Spec) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Any + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Any]) -> None + self._status = new_val + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (str) -> None + self._apiVersion = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Any) -> None + self._metadata = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/volume.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/volume.py new file mode 100644 index 000000000..8b7c2703c --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/volume.py @@ -0,0 +1,177 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class AttachmentsItem(CrdObject): + _properties = [ + ('clusterName', 'clusterName', str, True, False), + ('mountDir', 'mountDir', str, True, False), + ('node', 'node', str, True, False), + ('podName', 'podName', str, True, False), + ('podNamespace', 'podNamespace', str, True, False), + ('readOnly', 'readOnly', bool, True, False) + ] + + def __init__(self, + clusterName, # type: str + mountDir, # type: str + node, # type: str + podName, # type: str + podNamespace, # type: str + readOnly, # type: bool + ): + super(AttachmentsItem, self).__init__( + clusterName=clusterName, + mountDir=mountDir, + node=node, + podName=podName, + podNamespace=podNamespace, + readOnly=readOnly, + ) + + @property + def clusterName(self): + # type: () -> str + return self._property_impl('clusterName') + + @clusterName.setter + def clusterName(self, new_val): + # type: (str) -> None + self._clusterName = new_val + + @property + def mountDir(self): + # type: () -> str + return self._property_impl('mountDir') + + @mountDir.setter + def mountDir(self, new_val): + # type: (str) -> None + self._mountDir = new_val + + @property + def node(self): + # type: () -> str + return self._property_impl('node') + + @node.setter + def node(self, new_val): + # type: (str) -> None + self._node = new_val + + @property + def podName(self): + # type: () -> str + return self._property_impl('podName') + + @podName.setter + def podName(self, new_val): + # type: (str) -> None + self._podName = new_val + + @property + def podNamespace(self): + # type: () -> str + return self._property_impl('podNamespace') + + @podNamespace.setter + def podNamespace(self, new_val): + # type: (str) -> None + self._podNamespace = new_val + + @property + def readOnly(self): + # type: () -> bool + return self._property_impl('readOnly') + + @readOnly.setter + def readOnly(self, new_val): + # type: (bool) -> None + self._readOnly = new_val + + +class AttachmentsList(CrdObjectList): + _items_type = AttachmentsItem + + +class Volume(CrdClass): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('attachments', 'attachments', 'AttachmentsList', False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', object, False, False), + ('status', 'status', object, False, False) + ] + + def __init__(self, + apiVersion=_omit, # type: Optional[str] + attachments=_omit, # type: Optional[Union[List[AttachmentsItem], CrdObjectList]] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Any] + status=_omit, # type: Optional[Any] + ): + super(Volume, self).__init__( + apiVersion=apiVersion, + attachments=attachments, + kind=kind, + metadata=metadata, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def attachments(self): + # type: () -> Union[List[AttachmentsItem], CrdObjectList] + return self._property_impl('attachments') + + @attachments.setter + def attachments(self, new_val): + # type: (Optional[Union[List[AttachmentsItem], CrdObjectList]]) -> None + self._attachments = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Any]) -> None + self._metadata = new_val + + @property + def status(self): + # type: () -> Any + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Any]) -> None + self._status = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/volumereplication.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/volumereplication.py new file mode 100644 index 000000000..1b9252729 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/volumereplication.py @@ -0,0 +1,363 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class DataSource(CrdObject): + _properties = [ + ('apiGroup', 'apiGroup', str, False, False), + ('kind', 'kind', str, True, False), + ('name', 'name', str, True, False) + ] + + def __init__(self, + kind, # type: str + name, # type: str + apiGroup=_omit, # type: Optional[str] + ): + super(DataSource, self).__init__( + kind=kind, + name=name, + apiGroup=apiGroup, + ) + + @property + def apiGroup(self): + # type: () -> str + return self._property_impl('apiGroup') + + @apiGroup.setter + def apiGroup(self, new_val): + # type: (Optional[str]) -> None + self._apiGroup = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (str) -> None + self._kind = new_val + + @property + def name(self): + # type: () -> str + return self._property_impl('name') + + @name.setter + def name(self, new_val): + # type: (str) -> None + self._name = new_val + + +class Spec(CrdObject): + _properties = [ + ('dataSource', 'dataSource', 'DataSource', True, False), + ('replicationState', 'replicationState', str, True, False), + ('volumeReplicationClass', 'volumeReplicationClass', str, True, False) + ] + + def __init__(self, + dataSource, # type: DataSource + replicationState, # type: str + volumeReplicationClass, # type: str + ): + super(Spec, self).__init__( + dataSource=dataSource, + replicationState=replicationState, + volumeReplicationClass=volumeReplicationClass, + ) + + @property + def dataSource(self): + # type: () -> DataSource + return self._property_impl('dataSource') + + @dataSource.setter + def dataSource(self, new_val): + # type: (DataSource) -> None + self._dataSource = new_val + + @property + def replicationState(self): + # type: () -> str + return self._property_impl('replicationState') + + @replicationState.setter + def replicationState(self, new_val): + # type: (str) -> None + self._replicationState = new_val + + @property + def volumeReplicationClass(self): + # type: () -> str + return self._property_impl('volumeReplicationClass') + + @volumeReplicationClass.setter + def volumeReplicationClass(self, new_val): + # type: (str) -> None + self._volumeReplicationClass = new_val + + +class ConditionsItem(CrdObject): + _properties = [ + ('lastTransitionTime', 'lastTransitionTime', str, True, False), + ('message', 'message', str, True, False), + ('observedGeneration', 'observedGeneration', int, False, False), + ('reason', 'reason', str, True, False), + ('status', 'status', str, True, False), + ('type', 'type', str, True, False) + ] + + def __init__(self, + lastTransitionTime, # type: str + message, # type: str + reason, # type: str + status, # type: str + type, # type: str + observedGeneration=_omit, # type: Optional[int] + ): + super(ConditionsItem, self).__init__( + lastTransitionTime=lastTransitionTime, + message=message, + reason=reason, + status=status, + type=type, + observedGeneration=observedGeneration, + ) + + @property + def lastTransitionTime(self): + # type: () -> str + return self._property_impl('lastTransitionTime') + + @lastTransitionTime.setter + def lastTransitionTime(self, new_val): + # type: (str) -> None + self._lastTransitionTime = new_val + + @property + def message(self): + # type: () -> str + return self._property_impl('message') + + @message.setter + def message(self, new_val): + # type: (str) -> None + self._message = new_val + + @property + def observedGeneration(self): + # type: () -> int + return self._property_impl('observedGeneration') + + @observedGeneration.setter + def observedGeneration(self, new_val): + # type: (Optional[int]) -> None + self._observedGeneration = new_val + + @property + def reason(self): + # type: () -> str + return self._property_impl('reason') + + @reason.setter + def reason(self, new_val): + # type: (str) -> None + self._reason = new_val + + @property + def status(self): + # type: () -> str + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (str) -> None + self._status = new_val + + @property + def type(self): + # type: () -> str + return self._property_impl('type') + + @type.setter + def type(self, new_val): + # type: (str) -> None + self._type = new_val + + +class ConditionsList(CrdObjectList): + _items_type = ConditionsItem + + +class Status(CrdObject): + _properties = [ + ('conditions', 'conditions', 'ConditionsList', False, False), + ('lastCompletionTime', 'lastCompletionTime', str, False, False), + ('lastStartTime', 'lastStartTime', str, False, False), + ('message', 'message', str, False, False), + ('observedGeneration', 'observedGeneration', int, False, False), + ('state', 'state', str, False, False) + ] + + def __init__(self, + conditions=_omit, # type: Optional[Union[List[ConditionsItem], CrdObjectList]] + lastCompletionTime=_omit, # type: Optional[str] + lastStartTime=_omit, # type: Optional[str] + message=_omit, # type: Optional[str] + observedGeneration=_omit, # type: Optional[int] + state=_omit, # type: Optional[str] + ): + super(Status, self).__init__( + conditions=conditions, + lastCompletionTime=lastCompletionTime, + lastStartTime=lastStartTime, + message=message, + observedGeneration=observedGeneration, + state=state, + ) + + @property + def conditions(self): + # type: () -> Union[List[ConditionsItem], CrdObjectList] + return self._property_impl('conditions') + + @conditions.setter + def conditions(self, new_val): + # type: (Optional[Union[List[ConditionsItem], CrdObjectList]]) -> None + self._conditions = new_val + + @property + def lastCompletionTime(self): + # type: () -> str + return self._property_impl('lastCompletionTime') + + @lastCompletionTime.setter + def lastCompletionTime(self, new_val): + # type: (Optional[str]) -> None + self._lastCompletionTime = new_val + + @property + def lastStartTime(self): + # type: () -> str + return self._property_impl('lastStartTime') + + @lastStartTime.setter + def lastStartTime(self, new_val): + # type: (Optional[str]) -> None + self._lastStartTime = new_val + + @property + def message(self): + # type: () -> str + return self._property_impl('message') + + @message.setter + def message(self, new_val): + # type: (Optional[str]) -> None + self._message = new_val + + @property + def observedGeneration(self): + # type: () -> int + return self._property_impl('observedGeneration') + + @observedGeneration.setter + def observedGeneration(self, new_val): + # type: (Optional[int]) -> None + self._observedGeneration = new_val + + @property + def state(self): + # type: () -> str + return self._property_impl('state') + + @state.setter + def state(self, new_val): + # type: (Optional[str]) -> None + self._state = new_val + + +class VolumeReplication(CrdClass): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', object, False, False), + ('spec', 'spec', 'Spec', True, False), + ('status', 'status', 'Status', False, False) + ] + + def __init__(self, + spec, # type: Spec + apiVersion=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Any] + status=_omit, # type: Optional[Status] + ): + super(VolumeReplication, self).__init__( + spec=spec, + apiVersion=apiVersion, + kind=kind, + metadata=metadata, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Any]) -> None + self._metadata = new_val + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Spec) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Status + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Status]) -> None + self._status = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/volumereplicationclass.py b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/volumereplicationclass.py new file mode 100644 index 000000000..842a131e1 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/ceph/volumereplicationclass.py @@ -0,0 +1,121 @@ +""" +This file is automatically generated. +Do not modify. +""" + +try: + from typing import Any, Optional, Union, List +except ImportError: + pass + +from .._helper import _omit, CrdObject, CrdObjectList, CrdClass + +class Spec(CrdObject): + _properties = [ + ('parameters', 'parameters', object, False, False), + ('provisioner', 'provisioner', str, True, False) + ] + + def __init__(self, + provisioner, # type: str + parameters=_omit, # type: Optional[Any] + ): + super(Spec, self).__init__( + provisioner=provisioner, + parameters=parameters, + ) + + @property + def parameters(self): + # type: () -> Any + return self._property_impl('parameters') + + @parameters.setter + def parameters(self, new_val): + # type: (Optional[Any]) -> None + self._parameters = new_val + + @property + def provisioner(self): + # type: () -> str + return self._property_impl('provisioner') + + @provisioner.setter + def provisioner(self, new_val): + # type: (str) -> None + self._provisioner = new_val + + +class VolumeReplicationClass(CrdClass): + _properties = [ + ('apiVersion', 'apiVersion', str, False, False), + ('kind', 'kind', str, False, False), + ('metadata', 'metadata', object, False, False), + ('spec', 'spec', 'Spec', True, False), + ('status', 'status', object, False, False) + ] + + def __init__(self, + spec, # type: Spec + apiVersion=_omit, # type: Optional[str] + kind=_omit, # type: Optional[str] + metadata=_omit, # type: Optional[Any] + status=_omit, # type: Optional[Any] + ): + super(VolumeReplicationClass, self).__init__( + spec=spec, + apiVersion=apiVersion, + kind=kind, + metadata=metadata, + status=status, + ) + + @property + def apiVersion(self): + # type: () -> str + return self._property_impl('apiVersion') + + @apiVersion.setter + def apiVersion(self, new_val): + # type: (Optional[str]) -> None + self._apiVersion = new_val + + @property + def kind(self): + # type: () -> str + return self._property_impl('kind') + + @kind.setter + def kind(self, new_val): + # type: (Optional[str]) -> None + self._kind = new_val + + @property + def metadata(self): + # type: () -> Any + return self._property_impl('metadata') + + @metadata.setter + def metadata(self, new_val): + # type: (Optional[Any]) -> None + self._metadata = new_val + + @property + def spec(self): + # type: () -> Spec + return self._property_impl('spec') + + @spec.setter + def spec(self, new_val): + # type: (Spec) -> None + self._spec = new_val + + @property + def status(self): + # type: () -> Any + return self._property_impl('status') + + @status.setter + def status(self, new_val): + # type: (Optional[Any]) -> None + self._status = new_val diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/py.typed b/src/pybind/mgr/rook/rook-client-python/rook_client/py.typed new file mode 100644 index 000000000..80dd90bf1 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. This package uses inline types. diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/tests/__init__.py b/src/pybind/mgr/rook/rook-client-python/rook_client/tests/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/tests/__init__.py diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/tests/test_README.py b/src/pybind/mgr/rook/rook-client-python/rook_client/tests/test_README.py new file mode 100644 index 000000000..50d6c41b4 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/tests/test_README.py @@ -0,0 +1,28 @@ +def objectstore(api_name, name, namespace, instances): + from rook_client.ceph import cephobjectstore as cos + rook_os = cos.CephObjectStore( + apiVersion=api_name, + metadata=dict( + name=name, + namespace=namespace + ), + spec=cos.Spec( + metadataPool=cos.MetadataPool( + failureDomain='host', + replicated=cos.Replicated( + size=1 + ) + ), + dataPool=cos.DataPool( + failureDomain='osd', + replicated=cos.Replicated( + size=1 + ) + ), + gateway=cos.Gateway( + port=80, + instances=instances + ) + ) + ) + return rook_os.to_json() diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/tests/test_examples.py b/src/pybind/mgr/rook/rook-client-python/rook_client/tests/test_examples.py new file mode 100644 index 000000000..5367844ec --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/tests/test_examples.py @@ -0,0 +1,52 @@ +from os.path import expanduser, dirname, realpath + +import yaml +import pytest + +import rook_client +from rook_client.cassandra.cluster import Cluster as CassandraCluster +from rook_client.ceph.cephcluster import CephCluster +from rook_client.ceph.cephfilesystem import CephFilesystem +from rook_client.ceph.cephnfs import CephNFS +from rook_client.ceph.cephobjectstore import CephObjectStore +from rook_client.ceph.cephblockpool import CephBlockPool + + +def _load_example(crd_base, what): + with open(expanduser('{crd_base}/{what}').format(crd_base=crd_base, what=what)) as f: + return f.read() + + +@pytest.mark.parametrize( + "strict,cls,filename", + [ + (True, CephCluster, "ceph/cluster-external.yaml"), + (True, CephCluster, "ceph/cluster-on-pvc.yaml"), + (True, CephCluster, "ceph/cluster.yaml"), + (True, CephFilesystem, "ceph/filesystem-ec.yaml"), + (True, CephFilesystem, "ceph/filesystem-test.yaml"), + (True, CephFilesystem, "ceph/filesystem.yaml"), + (True, CephObjectStore, "ceph/object-ec.yaml"), + (True, CephObjectStore, "ceph/object-openshift.yaml"), + (True, CephObjectStore, "ceph/object-test.yaml"), + (True, CephObjectStore, "ceph/object.yaml"), + (True, CephNFS, "ceph/nfs.yaml"), + (True, CephBlockPool, "ceph/pool.yaml"), + (True, CephBlockPool, "ceph/pool-ec.yaml"), + (True, CephBlockPool, "ceph/pool-test.yaml"), + + # schema invalid: + # (False, CassandraCluster, "cassandra/cluster.yaml"), + ], +) +def test_exact_match(strict, cls, filename, crd_base): + crds = yaml.safe_load_all(_load_example(crd_base, filename)) + rook_client.STRICT = strict + [crd] = [e for e in crds if e.get('kind', '') == cls.__name__] + + c = cls.from_json(crd) + assert crd == c.to_json() + + + + diff --git a/src/pybind/mgr/rook/rook-client-python/rook_client/tests/test_properties.py b/src/pybind/mgr/rook/rook-client-python/rook_client/tests/test_properties.py new file mode 100644 index 000000000..0d580e43f --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/rook_client/tests/test_properties.py @@ -0,0 +1,13 @@ +from copy import deepcopy + +import pytest + +from rook_client.ceph import cephcluster as cc + + +def test_omit(): + cv = cc.CephVersion() + with pytest.raises(AttributeError): + cv.allowUnsupported + + assert not hasattr(cv, 'allowUnsupported') diff --git a/src/pybind/mgr/rook/rook-client-python/setup.py b/src/pybind/mgr/rook/rook-client-python/setup.py new file mode 100644 index 000000000..86601fd6a --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/setup.py @@ -0,0 +1,20 @@ +from setuptools import setup, find_packages + +with open("README.md", "r") as fh: + long_description = fh.read() + +setup( + name='rook-client', + version='1.0.0', + packages=find_packages(), + package_data = { + 'rook_client': ['py.typed'], + }, + url='', + license='Apache License v2', + author='Sebastian Wagner', + author_email='swagner@suse.com', + description='Client model classes for the CRDs exposed by Rook', + long_description=long_description, + long_description_content_type="text/markdown", +) diff --git a/src/pybind/mgr/rook/rook-client-python/tox.ini b/src/pybind/mgr/rook/rook-client-python/tox.ini new file mode 100644 index 000000000..b619fabf1 --- /dev/null +++ b/src/pybind/mgr/rook/rook-client-python/tox.ini @@ -0,0 +1,24 @@ +[tox] +envlist = py2,py36,py37,py38,mypy +skipsdist = true + + +[testenv] +deps = -rrequirements.txt +commands = pytest {posargs} + + +[testenv:mypy] +basepython = python3 +deps = + -rrequirements.txt + mypy + types-PyYAML +commands = + mkcodes --github --output rook_client/tests/test_\{name\}.py README.md + mypy --config-file=mypy.ini \ + rook_client \ + conftest.py \ + generate_model_classes.py \ + setup.py + diff --git a/src/pybind/mgr/rook/rook_client/__init__.py b/src/pybind/mgr/rook/rook_client/__init__.py new file mode 100644 index 000000000..3fa2272dd --- /dev/null +++ b/src/pybind/mgr/rook/rook_client/__init__.py @@ -0,0 +1 @@ +from ._helper import STRICT
\ No newline at end of file diff --git a/src/pybind/mgr/rook/rook_client/_helper.py b/src/pybind/mgr/rook/rook_client/_helper.py new file mode 100644 index 000000000..382d04c27 --- /dev/null +++ b/src/pybind/mgr/rook/rook_client/_helper.py @@ -0,0 +1,128 @@ +import logging +import sys +try: + from typing import List, Dict, Any, Optional +except ImportError: + pass + +logger = logging.getLogger(__name__) + +# Tricking mypy to think `_omit`'s type is NoneType +# To make us not add things like `Union[Optional[str], OmitType]` +NoneType = type(None) +_omit = None # type: NoneType +_omit = object() # type: ignore + + +# Don't add any additionalProperties to objects. Useful for completeness testing +STRICT = False + +def _str_to_class(cls, typ_str): + if isinstance(typ_str, str): + return getattr(sys.modules[cls.__module__], typ_str) + return typ_str + + +def _property_from_json(cls, data, breadcrumb, name, py_name, typ_str, required, nullable): + if not required and name not in data: + return _omit + try: + obj = data[name] + except KeyError as e: + raise ValueError('KeyError in {}: {}'.format(breadcrumb, e)) + if nullable and obj is None: + return obj + typ = _str_to_class(cls, typ_str) + if issubclass(typ, CrdObject) or issubclass(typ, CrdObjectList): + return typ.from_json(obj, breadcrumb + '.' + name) + return obj + + +class CrdObject(object): + _properties = [] # type: List + + def __init__(self, **kwargs): + for prop in self._properties: + setattr(self, prop[1], kwargs.pop(prop[1])) + if kwargs: + raise TypeError( + '{} got unexpected arguments {}'.format(self.__class__.__name__, kwargs.keys())) + self._additionalProperties = {} # type: Dict[str, Any] + + def _property_impl(self, name): + obj = getattr(self, '_' + name) + if obj is _omit: + raise AttributeError(name + ' not found') + return obj + + def _property_to_json(self, name, py_name, typ_str, required, nullable): + obj = getattr(self, '_' + py_name) + typ = _str_to_class(self.__class__, typ_str) + if issubclass(typ, CrdObject) or issubclass(typ, CrdObjectList): + if nullable and obj is None: + return obj + if not required and obj is _omit: + return obj + return obj.to_json() + else: + return obj + + def to_json(self): + # type: () -> Dict[str, Any] + res = {p[0]: self._property_to_json(*p) for p in self._properties} + res.update(self._additionalProperties) + return {k: v for k, v in res.items() if v is not _omit} + + @classmethod + def from_json(cls, data, breadcrumb=''): + try: + sanitized = { + p[1]: _property_from_json(cls, data, breadcrumb, *p) for p in cls._properties + } + extra = {k:v for k,v in data.items() if k not in sanitized} + ret = cls(**sanitized) + ret._additionalProperties = {} if STRICT else extra + return ret + except (TypeError, AttributeError, KeyError): + logger.exception(breadcrumb) + raise + + +class CrdClass(CrdObject): + @classmethod + def from_json(cls, data, breadcrumb=''): + kind = data['kind'] + if kind != cls.__name__: + raise ValueError("kind mismatch: {} != {}".format(kind, cls.__name__)) + return super(CrdClass, cls).from_json(data, breadcrumb) + + def to_json(self): + ret = super(CrdClass, self).to_json() + ret['kind'] = self.__class__.__name__ + return ret + + +class CrdObjectList(list): + # Py3: Replace `Any` with `TypeVar('T_CrdObject', bound='CrdObject')` + _items_type = None # type: Optional[Any] + + def to_json(self): + # type: () -> List + if self._items_type is None: + return self + if issubclass(self._items_type, CrdObject) or issubclass(self._items_type, CrdObjectList): + return [e.to_json() for e in self] + return list(self) + + + @classmethod + def from_json(cls, data, breadcrumb=''): + if cls._items_type is None: + return cls(data) + if issubclass(cls._items_type, CrdObject) or issubclass(cls._items_type, CrdObjectList): + return cls(cls._items_type.from_json(e, breadcrumb + '[{}]'.format(i)) for i, e in enumerate(data)) + return cls(data) + + def __repr__(self): + return '{}({})'.format(self.__class__.__name__, repr(list(self))) + diff --git a/src/pybind/mgr/rook/rook_cluster.py b/src/pybind/mgr/rook/rook_cluster.py new file mode 100644 index 000000000..5c7c9fc04 --- /dev/null +++ b/src/pybind/mgr/rook/rook_cluster.py @@ -0,0 +1,1591 @@ +""" +This module wrap's Rook + Kubernetes APIs to expose the calls +needed to implement an orchestrator module. While the orchestrator +module exposes an async API, this module simply exposes blocking API +call methods. + +This module is runnable outside of ceph-mgr, useful for testing. +""" +import datetime +import threading +import logging +from contextlib import contextmanager +from time import sleep +import re +from orchestrator import OrchResult + +import jsonpatch +from urllib.parse import urljoin +import json + +# Optional kubernetes imports to enable MgrModule.can_run +# to behave cleanly. +from urllib3.exceptions import ProtocolError + +from ceph.deployment.inventory import Device +from ceph.deployment.drive_group import DriveGroupSpec +from ceph.deployment.service_spec import ServiceSpec, NFSServiceSpec, RGWSpec, PlacementSpec, HostPlacementSpec +from ceph.utils import datetime_now +from ceph.deployment.drive_selection.matchers import SizeMatcher +from nfs.cluster import create_ganesha_pool +from nfs.module import Module +from nfs.export import NFSRados +from mgr_module import NFS_POOL_NAME +from mgr_util import merge_dicts + +from typing import Optional, Tuple, TypeVar, List, Callable, Any, cast, Generic, \ + Iterable, Dict, Iterator, Type + +try: + from kubernetes import client, watch + from kubernetes.client.rest import ApiException +except ImportError: + class ApiException(Exception): # type: ignore + status = 0 + +from .rook_client.ceph import cephfilesystem as cfs +from .rook_client.ceph import cephnfs as cnfs +from .rook_client.ceph import cephobjectstore as cos +from .rook_client.ceph import cephcluster as ccl +from .rook_client.ceph import cephrbdmirror as crbdm +from .rook_client._helper import CrdClass + +import orchestrator + +try: + from rook.module import RookEnv, RookOrchestrator +except ImportError: + pass # just used for type checking. + + +T = TypeVar('T') +FuncT = TypeVar('FuncT', bound=Callable) + +CrdClassT = TypeVar('CrdClassT', bound=CrdClass) + + +log = logging.getLogger(__name__) + + +def __urllib3_supports_read_chunked() -> bool: + # There is a bug in CentOS 7 as it ships a urllib3 which is lower + # than required by kubernetes-client + try: + from urllib3.response import HTTPResponse + return hasattr(HTTPResponse, 'read_chunked') + except ImportError: + return False + + +_urllib3_supports_read_chunked = __urllib3_supports_read_chunked() + +class ApplyException(orchestrator.OrchestratorError): + """ + For failures to update the Rook CRDs, usually indicating + some kind of interference between our attempted update + and other conflicting activity. + """ + + +def threaded(f: Callable[..., None]) -> Callable[..., threading.Thread]: + def wrapper(*args: Any, **kwargs: Any) -> threading.Thread: + t = threading.Thread(target=f, args=args, kwargs=kwargs) + t.start() + return t + + return cast(Callable[..., threading.Thread], wrapper) + + +class DefaultFetcher(): + def __init__(self, storage_class_name: str, coreV1_api: 'client.CoreV1Api', rook_env: 'RookEnv'): + self.storage_class_name = storage_class_name + self.coreV1_api = coreV1_api + self.rook_env = rook_env + self.pvs_in_sc: List[client.V1PersistentVolumeList] = [] + + def fetch(self) -> None: + self.inventory: KubernetesResource[client.V1PersistentVolumeList] = KubernetesResource(self.coreV1_api.list_persistent_volume) + self.pvs_in_sc = [i for i in self.inventory.items if i.spec.storage_class_name == self.storage_class_name] + + def convert_size(self, size_str: str) -> int: + units = ("", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "", "K", "M", "G", "T", "P", "E") + coeff_and_unit = re.search('(\d+)(\D+)', size_str) + assert coeff_and_unit is not None + coeff = int(coeff_and_unit[1]) + unit = coeff_and_unit[2] + try: + factor = units.index(unit) % 7 + except ValueError: + log.error("PV size format invalid") + raise + size = coeff * (2 ** (10 * factor)) + return size + + def devices(self) -> Dict[str, List[Device]]: + nodename_to_devices: Dict[str, List[Device]] = {} + for i in self.pvs_in_sc: + node, device = self.device(i) + if node not in nodename_to_devices: + nodename_to_devices[node] = [] + nodename_to_devices[node].append(device) + return nodename_to_devices + + def device(self, i: 'client.V1PersistentVolume') -> Tuple[str, Device]: + node = 'N/A' + if i.spec.node_affinity: + terms = i.spec.node_affinity.required.node_selector_terms + if len(terms) == 1 and len(terms[0].match_expressions) == 1 and terms[0].match_expressions[0].key == 'kubernetes.io/hostname' and len(terms[0].match_expressions[0].values) == 1: + node = terms[0].match_expressions[0].values[0] + size = self.convert_size(i.spec.capacity['storage']) + path = i.spec.host_path.path if i.spec.host_path else i.spec.local.path if i.spec.local else ('/dev/' + i.metadata.annotations['storage.openshift.com/device-name']) if i.metadata.annotations and 'storage.openshift.com/device-name' in i.metadata.annotations else '' + state = i.spec.volume_mode == 'Block' and i.status.phase == 'Available' + pv_name = i.metadata.name + device = Device( + path = path, + sys_api = dict( + size = size, + node = node, + pv_name = pv_name + ), + available = state, + ) + return (node, device) + + +class LSOFetcher(DefaultFetcher): + def __init__(self, storage_class: 'str', coreV1_api: 'client.CoreV1Api', rook_env: 'RookEnv', customObjects_api: 'client.CustomObjectsApi', nodenames: 'Optional[List[str]]' = None): + super().__init__(storage_class, coreV1_api, rook_env) + self.customObjects_api = customObjects_api + self.nodenames = nodenames + + def fetch(self) -> None: + super().fetch() + self.discovery: KubernetesCustomResource = KubernetesCustomResource(self.customObjects_api.list_cluster_custom_object, + group="local.storage.openshift.io", + version="v1alpha1", + plural="localvolumediscoveryresults") + + def predicate(self, item: 'client.V1ConfigMapList') -> bool: + if self.nodenames is not None: + return item['spec']['nodeName'] in self.nodenames + else: + return True + + def devices(self) -> Dict[str, List[Device]]: + try: + lso_discovery_results = [i for i in self.discovery.items if self.predicate(i)] + except ApiException as dummy_e: + log.error("Failed to fetch device metadata") + raise + self.lso_devices = {} + for i in lso_discovery_results: + drives = i['status']['discoveredDevices'] + for drive in drives: + self.lso_devices[drive['deviceID'].split('/')[-1]] = drive + nodename_to_devices: Dict[str, List[Device]] = {} + for i in self.pvs_in_sc: + node, device = (None, None) + if (not i.metadata.annotations) or ('storage.openshift.com/device-id' not in i.metadata.annotations) or (i.metadata.annotations['storage.openshift.com/device-id'] not in self.lso_devices): + node, device = super().device(i) + else: + node, device = self.device(i) + if node not in nodename_to_devices: + nodename_to_devices[node] = [] + nodename_to_devices[node].append(device) + return nodename_to_devices + + def device(self, i: Any) -> Tuple[str, Device]: + node = i.metadata.labels['kubernetes.io/hostname'] + device_discovery = self.lso_devices[i.metadata.annotations['storage.openshift.com/device-id']] + pv_name = i.metadata.name + vendor: str = device_discovery['model'].split()[0] if len(device_discovery['model'].split()) >= 1 else '' + model: str = ' '.join(device_discovery['model'].split()[1:]) if len(device_discovery['model'].split()) > 1 else '' + device = Device( + path = device_discovery['path'], + sys_api = dict( + size = device_discovery['size'], + rotational = '1' if device_discovery['property']=='Rotational' else '0', + node = node, + pv_name = pv_name, + model = model, + vendor = vendor + ), + available = device_discovery['status']['state']=='Available', + device_id = device_discovery['deviceID'].split('/')[-1], + lsm_data = dict( + serialNum = device_discovery['serial'] + ) + ) + return (node, device) + + +class PDFetcher(DefaultFetcher): + """ Physical Devices Fetcher""" + def __init__(self, coreV1_api: 'client.CoreV1Api', rook_env: 'RookEnv'): + super().__init__('', coreV1_api, rook_env) + + def fetch(self) -> None: + """ Collect the devices information from k8s configmaps""" + self.dev_cms: KubernetesResource = KubernetesResource(self.coreV1_api.list_namespaced_config_map, + namespace=self.rook_env.operator_namespace, + label_selector='app=rook-discover') + + def devices(self) -> Dict[str, List[Device]]: + """ Return the list of devices found""" + node_devices: Dict[str, List[Device]] = {} + for i in self.dev_cms.items: + devices_list: List[Device] = [] + for d in json.loads(i.data['devices']): + devices_list.append(self.device(d)[1]) + node_devices[i.metadata.labels['rook.io/node']] = devices_list + + return node_devices + + def device(self, devData: Dict[str,str]) -> Tuple[str, Device]: + """ Build an orchestrator device """ + if 'cephVolumeData' in devData and devData['cephVolumeData']: + return "", Device.from_json(json.loads(devData['cephVolumeData'])) + else: + return "", Device( + path='/dev/' + devData['name'], + sys_api=dict( + rotational='1' if devData['rotational'] else '0', + size=devData['size'] + ), + available=False, + rejected_reasons=['device data coming from ceph-volume not provided'], + ) + + +class KubernetesResource(Generic[T]): + def __init__(self, api_func: Callable, **kwargs: Any) -> None: + """ + Generic kubernetes Resource parent class + + The api fetch and watch methods should be common across resource types, + + Exceptions in the runner thread are propagated to the caller. + + :param api_func: kubernetes client api function that is passed to the watcher + :param filter_func: signature: ``(Item) -> bool``. + """ + self.kwargs = kwargs + self.api_func = api_func + + # ``_items`` is accessed by different threads. I assume assignment is atomic. + self._items: Dict[str, T] = dict() + self.thread = None # type: Optional[threading.Thread] + self.exception: Optional[Exception] = None + if not _urllib3_supports_read_chunked: + logging.info('urllib3 is too old. Fallback to full fetches') + + def _fetch(self) -> str: + """ Execute the requested api method as a one-off fetch""" + response = self.api_func(**self.kwargs) + metadata = response.metadata + self._items = {item.metadata.name: item for item in response.items} + log.info('Full fetch of {}. result: {}'.format(self.api_func, len(self._items))) + return metadata.resource_version + + @property + def items(self) -> Iterable[T]: + """ + Returns the items of the request. + Creates the watcher as a side effect. + :return: + """ + if self.exception: + e = self.exception + self.exception = None + raise e # Propagate the exception to the user. + if not self.thread or not self.thread.is_alive(): + resource_version = self._fetch() + if _urllib3_supports_read_chunked: + # Start a thread which will use the kubernetes watch client against a resource + log.debug("Attaching resource watcher for k8s {}".format(self.api_func)) + self.thread = self._watch(resource_version) + + return self._items.values() + + def get_item_name(self, item: Any) -> Any: + try: + return item.metadata.name + except AttributeError: + raise AttributeError( + "{} doesn't contain a metadata.name. Unable to track changes".format( + self.api_func)) + @threaded + def _watch(self, res_ver: Optional[str]) -> None: + """ worker thread that runs the kubernetes watch """ + + self.exception = None + + w = watch.Watch() + + try: + # execute generator to continually watch resource for changes + for event in w.stream(self.api_func, resource_version=res_ver, watch=True, + **self.kwargs): + self.health = '' + item = event['object'] + name = self.get_item_name(item) + + log.info('{} event: {}'.format(event['type'], name)) + + if event['type'] in ('ADDED', 'MODIFIED'): + self._items = merge_dicts(self._items, {name: item}) + elif event['type'] == 'DELETED': + self._items = {k:v for k,v in self._items.items() if k != name} + elif event['type'] == 'BOOKMARK': + pass + elif event['type'] == 'ERROR': + raise ApiException(str(event)) + else: + raise KeyError('Unknown watch event {}'.format(event['type'])) + except ProtocolError as e: + if 'Connection broken' in str(e): + log.info('Connection reset.') + return + raise + except ApiException as e: + log.exception('K8s API failed. {}'.format(self.api_func)) + self.exception = e + raise + except Exception as e: + log.exception("Watcher failed. ({})".format(self.api_func)) + self.exception = e + raise + +class KubernetesCustomResource(KubernetesResource): + def _fetch(self) -> str: + response = self.api_func(**self.kwargs) + metadata = response['metadata'] + self._items = {item['metadata']['name']: item for item in response['items']} + log.info('Full fetch of {}. result: {}'.format(self.api_func, len(self._items))) + return metadata['resourceVersion'] + + def get_item_name(self, item: Any) -> Any: + try: + return item['metadata']['name'] + except AttributeError: + raise AttributeError( + "{} doesn't contain a metadata.name. Unable to track changes".format( + self.api_func)) + +class DefaultCreator(): + def __init__(self, inventory: 'Dict[str, List[Device]]', coreV1_api: 'client.CoreV1Api', storage_class_name: 'str'): + self.coreV1_api = coreV1_api + self.storage_class_name = storage_class_name + self.inventory = inventory + + def device_to_device_set(self, drive_group: DriveGroupSpec, d: Device) -> ccl.StorageClassDeviceSetsItem: + device_set = ccl.StorageClassDeviceSetsItem( + name=d.sys_api['pv_name'], + volumeClaimTemplates= ccl.VolumeClaimTemplatesList(), + count=1, + encrypted=drive_group.encrypted, + portable=False + ) + device_set.volumeClaimTemplates.append( + ccl.VolumeClaimTemplatesItem( + metadata=ccl.Metadata( + name="data" + ), + spec=ccl.Spec( + storageClassName=self.storage_class_name, + volumeMode="Block", + accessModes=ccl.CrdObjectList(["ReadWriteOnce"]), + resources={ + "requests":{ + "storage": 1 + } + }, + volumeName=d.sys_api['pv_name'] + ) + ) + ) + return device_set + + def filter_devices(self, rook_pods: KubernetesResource, drive_group: DriveGroupSpec, matching_hosts: List[str]) -> List[Device]: + device_list = [] + assert drive_group.data_devices is not None + sizematcher: Optional[SizeMatcher] = None + if drive_group.data_devices.size: + sizematcher = SizeMatcher('size', drive_group.data_devices.size) + limit = getattr(drive_group.data_devices, 'limit', None) + count = 0 + all = getattr(drive_group.data_devices, 'all', None) + paths = [device.path for device in drive_group.data_devices.paths] + osd_list = [] + for pod in rook_pods.items: + if ( + hasattr(pod, 'metadata') + and hasattr(pod.metadata, 'labels') + and 'osd' in pod.metadata.labels + and 'ceph.rook.io/DeviceSet' in pod.metadata.labels + ): + osd_list.append(pod.metadata.labels['ceph.rook.io/DeviceSet']) + for _, node in self.inventory.items(): + for device in node: + if device.sys_api['pv_name'] in osd_list: + count += 1 + for _, node in self.inventory.items(): + for device in node: + if not limit or (count < limit): + if device.available: + if ( + all + or ( + device.sys_api['node'] in matching_hosts + and ((sizematcher != None) or sizematcher.compare(device)) + and ( + not drive_group.data_devices.paths + or (device.path in paths) + ) + ) + ): + device_list.append(device) + count += 1 + + return device_list + + def add_osds(self, rook_pods: KubernetesResource, drive_group: DriveGroupSpec, matching_hosts: List[str]) -> Any: + to_create = self.filter_devices(rook_pods, drive_group,matching_hosts) + assert drive_group.data_devices is not None + def _add_osds(current_cluster, new_cluster): + # type: (ccl.CephCluster, ccl.CephCluster) -> ccl.CephCluster + if not hasattr(new_cluster.spec, 'storage') or not new_cluster.spec.storage: + new_cluster.spec.storage = ccl.Storage() + + if not hasattr(new_cluster.spec.storage, 'storageClassDeviceSets') or not new_cluster.spec.storage.storageClassDeviceSets: + new_cluster.spec.storage.storageClassDeviceSets = ccl.StorageClassDeviceSetsList() + + existing_scds = [ + scds.name for scds in new_cluster.spec.storage.storageClassDeviceSets + ] + for device in to_create: + new_scds = self.device_to_device_set(drive_group, device) + if new_scds.name not in existing_scds: + new_cluster.spec.storage.storageClassDeviceSets.append(new_scds) + return new_cluster + return _add_osds + +class LSOCreator(DefaultCreator): + def filter_devices(self, rook_pods: KubernetesResource, drive_group: DriveGroupSpec, matching_hosts: List[str]) -> List[Device]: + device_list = [] + assert drive_group.data_devices is not None + sizematcher = None + if drive_group.data_devices.size: + sizematcher = SizeMatcher('size', drive_group.data_devices.size) + limit = getattr(drive_group.data_devices, 'limit', None) + all = getattr(drive_group.data_devices, 'all', None) + paths = [device.path for device in drive_group.data_devices.paths] + vendor = getattr(drive_group.data_devices, 'vendor', None) + model = getattr(drive_group.data_devices, 'model', None) + count = 0 + osd_list = [] + for pod in rook_pods.items: + if ( + hasattr(pod, 'metadata') + and hasattr(pod.metadata, 'labels') + and 'osd' in pod.metadata.labels + and 'ceph.rook.io/DeviceSet' in pod.metadata.labels + ): + osd_list.append(pod.metadata.labels['ceph.rook.io/DeviceSet']) + for _, node in self.inventory.items(): + for device in node: + if device.sys_api['pv_name'] in osd_list: + count += 1 + for _, node in self.inventory.items(): + for device in node: + if not limit or (count < limit): + if device.available: + if ( + all + or ( + device.sys_api['node'] in matching_hosts + and ((sizematcher != None) or sizematcher.compare(device)) + and ( + not drive_group.data_devices.paths + or device.path in paths + ) + and ( + not vendor + or device.sys_api['vendor'] == vendor + ) + and ( + not model + or device.sys_api['model'].startsWith(model) + ) + ) + ): + device_list.append(device) + count += 1 + return device_list + +class DefaultRemover(): + def __init__( + self, + coreV1_api: 'client.CoreV1Api', + batchV1_api: 'client.BatchV1Api', + appsV1_api: 'client.AppsV1Api', + osd_ids: List[str], + replace_flag: bool, + force_flag: bool, + mon_command: Callable, + patch: Callable, + rook_env: 'RookEnv', + inventory: Dict[str, List[Device]] + ): + self.batchV1_api = batchV1_api + self.appsV1_api = appsV1_api + self.coreV1_api = coreV1_api + + self.osd_ids = osd_ids + self.replace_flag = replace_flag + self.force_flag = force_flag + + self.mon_command = mon_command + + self.patch = patch + self.rook_env = rook_env + + self.inventory = inventory + self.osd_pods: KubernetesResource = KubernetesResource(self.coreV1_api.list_namespaced_pod, + namespace=self.rook_env.namespace, + label_selector='app=rook-ceph-osd') + self.jobs: KubernetesResource = KubernetesResource(self.batchV1_api.list_namespaced_job, + namespace=self.rook_env.namespace, + label_selector='app=rook-ceph-osd-prepare') + self.pvcs: KubernetesResource = KubernetesResource(self.coreV1_api.list_namespaced_persistent_volume_claim, + namespace=self.rook_env.namespace) + + + def remove_device_sets(self) -> str: + self.to_remove: Dict[str, int] = {} + self.pvc_to_remove: List[str] = [] + for pod in self.osd_pods.items: + if ( + hasattr(pod, 'metadata') + and hasattr(pod.metadata, 'labels') + and 'osd' in pod.metadata.labels + and pod.metadata.labels['osd'] in self.osd_ids + ): + if pod.metadata.labels['ceph.rook.io/DeviceSet'] in self.to_remove: + self.to_remove[pod.metadata.labels['ceph.rook.io/DeviceSet']] = self.to_remove[pod.metadata.labels['ceph.rook.io/DeviceSet']] + 1 + else: + self.to_remove[pod.metadata.labels['ceph.rook.io/DeviceSet']] = 1 + self.pvc_to_remove.append(pod.metadata.labels['ceph.rook.io/pvc']) + def _remove_osds(current_cluster, new_cluster): + # type: (ccl.CephCluster, ccl.CephCluster) -> ccl.CephCluster + assert new_cluster.spec.storage is not None and new_cluster.spec.storage.storageClassDeviceSets is not None + for _set in new_cluster.spec.storage.storageClassDeviceSets: + if _set.name in self.to_remove: + if _set.count == self.to_remove[_set.name]: + new_cluster.spec.storage.storageClassDeviceSets.remove(_set) + else: + _set.count = _set.count - self.to_remove[_set.name] + return new_cluster + return self.patch(ccl.CephCluster, 'cephclusters', self.rook_env.cluster_name, _remove_osds) + + def check_force(self) -> None: + if not self.force_flag: + safe_args = {'prefix': 'osd safe-to-destroy', + 'ids': [str(x) for x in self.osd_ids]} + ret, out, err = self.mon_command(safe_args) + if ret != 0: + raise RuntimeError(err) + + def set_osds_down(self) -> None: + down_flag_args = { + 'prefix': 'osd down', + 'ids': [str(x) for x in self.osd_ids] + } + ret, out, err = self.mon_command(down_flag_args) + if ret != 0: + raise RuntimeError(err) + + def scale_deployments(self) -> None: + for osd_id in self.osd_ids: + self.appsV1_api.patch_namespaced_deployment_scale(namespace=self.rook_env.namespace, + name='rook-ceph-osd-{}'.format(osd_id), + body=client.V1Scale(spec=client.V1ScaleSpec(replicas=0))) + + def set_osds_out(self) -> None: + out_flag_args = { + 'prefix': 'osd out', + 'ids': [str(x) for x in self.osd_ids] + } + ret, out, err = self.mon_command(out_flag_args) + if ret != 0: + raise RuntimeError(err) + + def delete_deployments(self) -> None: + for osd_id in self.osd_ids: + self.appsV1_api.delete_namespaced_deployment(namespace=self.rook_env.namespace, + name='rook-ceph-osd-{}'.format(osd_id), + propagation_policy='Foreground') + + def clean_up_prepare_jobs_and_pvc(self) -> None: + for job in self.jobs.items: + if job.metadata.labels['ceph.rook.io/pvc'] in self.pvc_to_remove: + self.batchV1_api.delete_namespaced_job(name=job.metadata.name, namespace=self.rook_env.namespace, + propagation_policy='Foreground') + self.coreV1_api.delete_namespaced_persistent_volume_claim(name=job.metadata.labels['ceph.rook.io/pvc'], + namespace=self.rook_env.namespace, + propagation_policy='Foreground') + + def purge_osds(self) -> None: + for id in self.osd_ids: + purge_args = { + 'prefix': 'osd purge-actual', + 'id': int(id), + 'yes_i_really_mean_it': True + } + ret, out, err = self.mon_command(purge_args) + if ret != 0: + raise RuntimeError(err) + + def destroy_osds(self) -> None: + for id in self.osd_ids: + destroy_args = { + 'prefix': 'osd destroy-actual', + 'id': int(id), + 'yes_i_really_mean_it': True + } + ret, out, err = self.mon_command(destroy_args) + if ret != 0: + raise RuntimeError(err) + + def remove(self) -> str: + try: + self.check_force() + except Exception as e: + log.exception("Error checking if OSDs are safe to destroy") + return f"OSDs not safe to destroy or unable to check if they are safe to destroy: {e}" + try: + remove_result = self.remove_device_sets() + except Exception as e: + log.exception("Error patching ceph cluster CRD") + return f"Not possible to modify Ceph cluster CRD: {e}" + try: + self.scale_deployments() + self.delete_deployments() + self.clean_up_prepare_jobs_and_pvc() + except Exception as e: + log.exception("Ceph cluster CRD patched, but error cleaning environment") + return f"Error cleaning environment after removing OSDs from Ceph cluster CRD: {e}" + try: + self.set_osds_down() + self.set_osds_out() + if self.replace_flag: + self.destroy_osds() + else: + self.purge_osds() + except Exception as e: + log.exception("OSDs removed from environment, but not able to remove OSDs from Ceph cluster") + return f"Error removing OSDs from Ceph cluster: {e}" + + return remove_result + + + +class RookCluster(object): + # import of client.CoreV1Api must be optional at import time. + # Instead allow mgr/rook to be imported anyway. + def __init__( + self, + coreV1_api: 'client.CoreV1Api', + batchV1_api: 'client.BatchV1Api', + customObjects_api: 'client.CustomObjectsApi', + storageV1_api: 'client.StorageV1Api', + appsV1_api: 'client.AppsV1Api', + rook_env: 'RookEnv', + storage_class_name: 'str' + ): + self.rook_env = rook_env # type: RookEnv + self.coreV1_api = coreV1_api # client.CoreV1Api + self.batchV1_api = batchV1_api + self.customObjects_api = customObjects_api + self.storageV1_api = storageV1_api # client.StorageV1Api + self.appsV1_api = appsV1_api # client.AppsV1Api + self.storage_class_name = storage_class_name # type: str + + # TODO: replace direct k8s calls with Rook API calls + self.available_storage_classes : KubernetesResource = KubernetesResource(self.storageV1_api.list_storage_class) + self.configured_storage_classes = self.list_storage_classes() + + self.rook_pods: KubernetesResource[client.V1Pod] = KubernetesResource(self.coreV1_api.list_namespaced_pod, + namespace=self.rook_env.namespace, + label_selector="rook_cluster={0}".format( + self.rook_env.namespace)) + self.nodes: KubernetesResource[client.V1Node] = KubernetesResource(self.coreV1_api.list_node) + + def rook_url(self, path: str) -> str: + prefix = "/apis/ceph.rook.io/%s/namespaces/%s/" % ( + self.rook_env.crd_version, self.rook_env.namespace) + return urljoin(prefix, path) + + def rook_api_call(self, verb: str, path: str, **kwargs: Any) -> Any: + full_path = self.rook_url(path) + log.debug("[%s] %s" % (verb, full_path)) + + return self.coreV1_api.api_client.call_api( + full_path, + verb, + auth_settings=['BearerToken'], + response_type="object", + _return_http_data_only=True, + _preload_content=True, + **kwargs) + + def rook_api_get(self, path: str, **kwargs: Any) -> Any: + return self.rook_api_call("GET", path, **kwargs) + + def rook_api_delete(self, path: str) -> Any: + return self.rook_api_call("DELETE", path) + + def rook_api_patch(self, path: str, **kwargs: Any) -> Any: + return self.rook_api_call("PATCH", path, + header_params={"Content-Type": "application/json-patch+json"}, + **kwargs) + + def rook_api_post(self, path: str, **kwargs: Any) -> Any: + return self.rook_api_call("POST", path, **kwargs) + + def list_storage_classes(self) -> List[str]: + try: + crd = self.customObjects_api.get_namespaced_custom_object( + group="ceph.rook.io", + version="v1", + namespace=self.rook_env.namespace, + plural="cephclusters", + name=self.rook_env.cluster_name) + + sc_devicesets = crd['spec']['storage']['storageClassDeviceSets'] + sc_names = [vct['spec']['storageClassName'] for sc in sc_devicesets for vct in sc['volumeClaimTemplates']] + log.info(f"the cluster has the following configured sc: {sc_names}") + return sc_names + except Exception as e: + log.error(f"unable to list storage classes: {e}") + return [] + + # TODO: remove all the calls to code that uses rook_cluster.storage_class_name + def get_storage_class(self) -> 'client.V1StorageClass': + matching_sc = [i for i in self.available_storage_classes.items if self.storage_class_name == i.metadata.name] + if len(matching_sc) == 0: + log.error(f"No storage class exists matching configured Rook orchestrator storage class which currently is <{self.storage_class_name}>. This storage class can be set in ceph config (mgr/rook/storage_class)") + raise Exception('No storage class exists matching name provided in ceph config at mgr/rook/storage_class') + return matching_sc[0] + + def get_discovered_devices(self, nodenames: Optional[List[str]] = None) -> Dict[str, List[Device]]: + discovered_devices: Dict[str, List[Device]] = {} + op_settings = self.coreV1_api.read_namespaced_config_map(name="rook-ceph-operator-config", namespace=self.rook_env.operator_namespace).data + fetcher: Optional[DefaultFetcher] = None + if op_settings.get('ROOK_ENABLE_DISCOVERY_DAEMON', 'false').lower() == 'true': + fetcher = PDFetcher(self.coreV1_api, self.rook_env) + fetcher.fetch() + discovered_devices = fetcher.devices() + else: + active_storage_classes = [sc for sc in self.available_storage_classes.items if sc.metadata.name in self.configured_storage_classes] + for sc in active_storage_classes: + if sc.metadata.labels and ('local.storage.openshift.io/owner-name' in sc.metadata.labels): + fetcher = LSOFetcher(sc.metadata.name, self.coreV1_api, self.customObjects_api, nodenames) + else: + fetcher = DefaultFetcher(sc.metadata.name, self.coreV1_api, self.rook_env) + fetcher.fetch() + discovered_devices.update(fetcher.devices()) + + return discovered_devices + + def get_osds(self) -> List: + osd_pods: KubernetesResource = KubernetesResource(self.coreV1_api.list_namespaced_pod, + namespace=self.rook_env.namespace, + label_selector='app=rook-ceph-osd') + return list(osd_pods.items) + + def get_nfs_conf_url(self, nfs_cluster: str, instance: str) -> Optional[str]: + # + # Fetch cephnfs object for "nfs_cluster" and then return a rados:// + # URL for the instance within that cluster. If the fetch fails, just + # return None. + # + try: + ceph_nfs = self.rook_api_get("cephnfses/{0}".format(nfs_cluster)) + except ApiException as e: + log.info("Unable to fetch cephnfs object: {}".format(e.status)) + return None + + pool = ceph_nfs['spec']['rados']['pool'] + namespace = ceph_nfs['spec']['rados'].get('namespace', None) + + if namespace == None: + url = "rados://{0}/conf-{1}.{2}".format(pool, nfs_cluster, instance) + else: + url = "rados://{0}/{1}/conf-{2}.{3}".format(pool, namespace, nfs_cluster, instance) + return url + + def describe_pods(self, + service_type: Optional[str], + service_id: Optional[str], + nodename: Optional[str]) -> List[Dict[str, Any]]: + """ + Go query the k8s API about deployment, containers related to this + filesystem + + Example Rook Pod labels for a mgr daemon: + Labels: app=rook-ceph-mgr + pod-template-hash=2171958073 + rook_cluster=rook + And MDS containers additionally have `rook_filesystem` label + + Label filter is rook_cluster=<cluster namespace> + rook_file_system=<self.fs_name> + """ + def predicate(item): + # type: (client.V1Pod) -> bool + metadata = item.metadata + if service_type is not None: + if metadata.labels['app'] != "rook-ceph-{0}".format(service_type): + return False + + if service_id is not None: + try: + k, v = { + "mds": ("rook_file_system", service_id), + "osd": ("ceph-osd-id", service_id), + "mon": ("mon", service_id), + "mgr": ("mgr", service_id), + "nfs": ("nfs", service_id), + "rgw": ("ceph_rgw", service_id), + }[service_type] + except KeyError: + raise orchestrator.OrchestratorValidationError( + '{} not supported'.format(service_type)) + if metadata.labels[k] != v: + return False + + if nodename is not None: + if item.spec.node_name != nodename: + return False + return True + + refreshed = datetime_now() + pods = [i for i in self.rook_pods.items if predicate(i)] + + pods_summary = [] + prefix = 'sha256:' + + for p in pods: + d = p.to_dict() + + image_name = None + for c in d['spec']['containers']: + # look at the first listed container in the pod... + image_name = c['image'] + break + + ls = d['status'].get('container_statuses') + if not ls: + # ignore pods with no containers + continue + image_id = ls[0]['image_id'] + image_id = image_id.split(prefix)[1] if prefix in image_id else image_id + + s = { + "name": d['metadata']['name'], + "hostname": d['spec']['node_name'], + "labels": d['metadata']['labels'], + 'phase': d['status']['phase'], + 'container_image_name': image_name, + 'container_image_id': image_id, + 'refreshed': refreshed, + # these may get set below... + 'started': None, + 'created': None, + } + + # note: we want UTC + if d['metadata'].get('creation_timestamp', None): + s['created'] = d['metadata']['creation_timestamp'].astimezone( + tz=datetime.timezone.utc) + if d['status'].get('start_time', None): + s['started'] = d['status']['start_time'].astimezone( + tz=datetime.timezone.utc) + + pods_summary.append(s) + + return pods_summary + + def remove_pods(self, names: List[str]) -> List[str]: + pods = [i for i in self.rook_pods.items] + for p in pods: + d = p.to_dict() + daemon_type = d['metadata']['labels']['app'].replace('rook-ceph-','') + daemon_id = d['metadata']['labels']['ceph_daemon_id'] + name = daemon_type + '.' + daemon_id + if name in names: + self.coreV1_api.delete_namespaced_pod( + d['metadata']['name'], + self.rook_env.namespace, + body=client.V1DeleteOptions() + ) + return [f'Removed Pod {n}' for n in names] + + def get_node_names(self) -> List[str]: + return [i.metadata.name for i in self.nodes.items] + + @contextmanager + def ignore_409(self, what: str) -> Iterator[None]: + try: + yield + except ApiException as e: + if e.status == 409: + # Idempotent, succeed. + log.info("{} already exists".format(what)) + else: + raise + + def apply_filesystem(self, spec: ServiceSpec, num_replicas: int, + leaf_type: str) -> str: + # TODO use spec.placement + # TODO warn if spec.extended has entries we don't kow how + # to action. + all_hosts = self.get_hosts() + def _update_fs(new: cfs.CephFilesystem) -> cfs.CephFilesystem: + new.spec.metadataServer.activeCount = spec.placement.count or 1 + new.spec.metadataServer.placement = cfs.Placement( + nodeAffinity=cfs.NodeAffinity( + requiredDuringSchedulingIgnoredDuringExecution=cfs.RequiredDuringSchedulingIgnoredDuringExecution( + nodeSelectorTerms=cfs.NodeSelectorTermsList( + [placement_spec_to_node_selector(spec.placement, all_hosts)] + ) + ) + ) + ) + return new + def _create_fs() -> cfs.CephFilesystem: + fs = cfs.CephFilesystem( + apiVersion=self.rook_env.api_name, + metadata=dict( + name=spec.service_id, + namespace=self.rook_env.namespace, + ), + spec=cfs.Spec( + dataPools=cfs.DataPoolsList( + { + cfs.DataPoolsItem( + failureDomain=leaf_type, + replicated=cfs.Replicated( + size=num_replicas + ) + ) + } + ), + metadataPool=cfs.MetadataPool( + failureDomain=leaf_type, + replicated=cfs.Replicated( + size=num_replicas + ) + ), + metadataServer=cfs.MetadataServer( + activeCount=spec.placement.count or 1, + activeStandby=True, + placement= + cfs.Placement( + nodeAffinity=cfs.NodeAffinity( + requiredDuringSchedulingIgnoredDuringExecution=cfs.RequiredDuringSchedulingIgnoredDuringExecution( + nodeSelectorTerms=cfs.NodeSelectorTermsList( + [placement_spec_to_node_selector(spec.placement, all_hosts)] + ) + ) + ) + ) + ) + ) + ) + return fs + assert spec.service_id is not None + return self._create_or_patch( + cfs.CephFilesystem, 'cephfilesystems', spec.service_id, + _update_fs, _create_fs) + + def get_matching_node(self, host: str) -> Any: + matching_node = None + for node in self.nodes.items: + if node.metadata.labels['kubernetes.io/hostname'] == host: + matching_node = node + return matching_node + + def add_host_label(self, host: str, label: str) -> OrchResult[str]: + matching_node = self.get_matching_node(host) + if matching_node == None: + return OrchResult(None, RuntimeError(f"Cannot add {label} label to {host}: host not found in cluster")) + matching_node.metadata.labels['ceph-label/'+ label] = "" + self.coreV1_api.patch_node(host, matching_node) + return OrchResult(f'Added {label} label to {host}') + + def remove_host_label(self, host: str, label: str) -> OrchResult[str]: + matching_node = self.get_matching_node(host) + if matching_node == None: + return OrchResult(None, RuntimeError(f"Cannot remove {label} label from {host}: host not found in cluster")) + matching_node.metadata.labels.pop('ceph-label/' + label, None) + self.coreV1_api.patch_node(host, matching_node) + return OrchResult(f'Removed {label} label from {host}') + + def apply_objectstore(self, spec: RGWSpec, num_replicas: int, leaf_type: str) -> str: + assert spec.service_id is not None + + name = spec.service_id + + if '.' in spec.service_id: + # rook does not like . in the name. this is could + # there because it is a legacy rgw spec that was named + # like $realm.$zone, except that I doubt there were any + # users of this code. Instead, focus on future users and + # translate . to - (fingers crossed!) instead. + name = spec.service_id.replace('.', '-') + + all_hosts = self.get_hosts() + def _create_zone() -> cos.CephObjectStore: + port = None + secure_port = None + if spec.ssl: + secure_port = spec.get_port() + else: + port = spec.get_port() + object_store = cos.CephObjectStore( + apiVersion=self.rook_env.api_name, + metadata=dict( + name=name, + namespace=self.rook_env.namespace + ), + spec=cos.Spec( + gateway=cos.Gateway( + port=port, + securePort=secure_port, + instances=spec.placement.count or 1, + placement=cos.Placement( + cos.NodeAffinity( + requiredDuringSchedulingIgnoredDuringExecution=cos.RequiredDuringSchedulingIgnoredDuringExecution( + nodeSelectorTerms=cos.NodeSelectorTermsList( + [ + placement_spec_to_node_selector(spec.placement, all_hosts) + ] + ) + ) + ) + ) + ), + dataPool=cos.DataPool( + failureDomain=leaf_type, + replicated=cos.Replicated( + size=num_replicas + ) + ), + metadataPool=cos.MetadataPool( + failureDomain=leaf_type, + replicated=cos.Replicated( + size=num_replicas + ) + ) + ) + ) + if spec.rgw_zone: + object_store.spec.zone=cos.Zone( + name=spec.rgw_zone + ) + return object_store + + + def _update_zone(new: cos.CephObjectStore) -> cos.CephObjectStore: + if new.spec.gateway: + new.spec.gateway.instances = spec.placement.count or 1 + else: + new.spec.gateway=cos.Gateway( + instances=spec.placement.count or 1 + ) + return new + return self._create_or_patch( + cos.CephObjectStore, 'cephobjectstores', name, + _update_zone, _create_zone) + + def apply_nfsgw(self, spec: NFSServiceSpec, mgr: 'RookOrchestrator') -> str: + # TODO use spec.placement + # TODO warn if spec.extended has entries we don't kow how + # to action. + # TODO Number of pods should be based on the list of hosts in the + # PlacementSpec. + assert spec.service_id, "service id in NFS service spec cannot be an empty string or None " # for mypy typing + service_id = spec.service_id + mgr_module = cast(Module, mgr) + count = spec.placement.count or 1 + def _update_nfs(new: cnfs.CephNFS) -> cnfs.CephNFS: + new.spec.server.active = count + return new + + def _create_nfs() -> cnfs.CephNFS: + rook_nfsgw = cnfs.CephNFS( + apiVersion=self.rook_env.api_name, + metadata=dict( + name=spec.service_id, + namespace=self.rook_env.namespace, + ), + spec=cnfs.Spec( + rados=cnfs.Rados( + namespace=service_id, + pool=NFS_POOL_NAME, + ), + server=cnfs.Server( + active=count + ) + ) + ) + + + return rook_nfsgw + + create_ganesha_pool(mgr) + NFSRados(mgr_module.rados, service_id).write_obj('', f'conf-nfs.{spec.service_id}') + return self._create_or_patch(cnfs.CephNFS, 'cephnfses', service_id, + _update_nfs, _create_nfs) + + def rm_service(self, rooktype: str, service_id: str) -> str: + self.customObjects_api.delete_namespaced_custom_object(group="ceph.rook.io", version="v1", + namespace=self.rook_env.namespace, + plural=rooktype, name=service_id) + objpath = "{0}/{1}".format(rooktype, service_id) + return f'Removed {objpath}' + + def get_resource(self, resource_type: str) -> Iterable: + custom_objects: KubernetesCustomResource = KubernetesCustomResource(self.customObjects_api.list_namespaced_custom_object, + group="ceph.rook.io", + version="v1", + namespace=self.rook_env.namespace, + plural=resource_type) + return custom_objects.items + + def can_create_osd(self) -> bool: + current_cluster = self.rook_api_get( + "cephclusters/{0}".format(self.rook_env.cluster_name)) + use_all_nodes = current_cluster['spec'].get('useAllNodes', False) + + # If useAllNodes is set, then Rook will not be paying attention + # to anything we put in 'nodes', so can't do OSD creation. + return not use_all_nodes + + def node_exists(self, node_name: str) -> bool: + return node_name in self.get_node_names() + + def update_mon_count(self, newcount: Optional[int]) -> str: + def _update_mon_count(current, new): + # type: (ccl.CephCluster, ccl.CephCluster) -> ccl.CephCluster + if newcount is None: + raise orchestrator.OrchestratorError('unable to set mon count to None') + if not new.spec.mon: + raise orchestrator.OrchestratorError("mon attribute not specified in new spec") + new.spec.mon.count = newcount + return new + return self._patch(ccl.CephCluster, 'cephclusters', self.rook_env.cluster_name, _update_mon_count) + + def add_osds(self, drive_group, matching_hosts): + # type: (DriveGroupSpec, List[str]) -> str + assert drive_group.objectstore in ("bluestore", "filestore") + assert drive_group.service_id + storage_class = self.get_storage_class() + inventory = self.get_discovered_devices() + creator: Optional[DefaultCreator] = None + if ( + storage_class.metadata.labels + and 'local.storage.openshift.io/owner-name' in storage_class.metadata.labels + ): + creator = LSOCreator(inventory, self.coreV1_api, self.storage_class_name) + else: + creator = DefaultCreator(inventory, self.coreV1_api, self.storage_class_name) + return self._patch( + ccl.CephCluster, + 'cephclusters', + self.rook_env.cluster_name, + creator.add_osds(self.rook_pods, drive_group, matching_hosts) + ) + + def remove_osds(self, osd_ids: List[str], replace: bool, force: bool, mon_command: Callable) -> str: + inventory = self.get_discovered_devices() + self.remover = DefaultRemover( + self.coreV1_api, + self.batchV1_api, + self.appsV1_api, + osd_ids, + replace, + force, + mon_command, + self._patch, + self.rook_env, + inventory + ) + return self.remover.remove() + + def get_hosts(self) -> List[orchestrator.HostSpec]: + ret = [] + for node in self.nodes.items: + spec = orchestrator.HostSpec( + node.metadata.name, + addr='/'.join([addr.address for addr in node.status.addresses]), + labels=[label.split('/')[1] for label in node.metadata.labels if label.startswith('ceph-label')], + ) + ret.append(spec) + return ret + + def create_zap_job(self, host: str, path: str) -> None: + body = client.V1Job( + api_version="batch/v1", + metadata=client.V1ObjectMeta( + name="rook-ceph-device-zap", + namespace=self.rook_env.namespace + ), + spec=client.V1JobSpec( + template=client.V1PodTemplateSpec( + spec=client.V1PodSpec( + containers=[ + client.V1Container( + name="device-zap", + image="rook/ceph:master", + command=["bash"], + args=["-c", f"ceph-volume raw list {path} && dd if=/dev/zero of=\"{path}\" bs=1M count=1 oflag=direct,dsync || ceph-volume lvm zap --destroy {path}"], + env=[ + client.V1EnvVar( + name="ROOK_CEPH_USERNAME", + value_from=client.V1EnvVarSource( + secret_key_ref=client.V1SecretKeySelector( + key="ceph-username", + name="rook-ceph-mon" + ) + ) + ), + client.V1EnvVar( + name="ROOK_CEPH_SECRET", + value_from=client.V1EnvVarSource( + secret_key_ref=client.V1SecretKeySelector( + key="ceph-secret", + name="rook-ceph-mon" + ) + ) + ) + ], + security_context=client.V1SecurityContext( + run_as_user=0, + privileged=True + ), + volume_mounts=[ + client.V1VolumeMount( + mount_path="/etc/ceph", + name="ceph-conf-emptydir" + ), + client.V1VolumeMount( + mount_path="/etc/rook", + name="rook-config" + ), + client.V1VolumeMount( + mount_path="/dev", + name="devices" + ) + ] + ) + ], + volumes=[ + client.V1Volume( + name="ceph-conf-emptydir", + empty_dir=client.V1EmptyDirVolumeSource() + ), + client.V1Volume( + name="rook-config", + empty_dir=client.V1EmptyDirVolumeSource() + ), + client.V1Volume( + name="devices", + host_path=client.V1HostPathVolumeSource( + path="/dev" + ) + ), + ], + node_selector={ + "kubernetes.io/hostname": host + }, + restart_policy="Never" + ) + ) + ) + ) + self.batchV1_api.create_namespaced_job(self.rook_env.namespace, body) + + def rbd_mirror(self, spec: ServiceSpec) -> None: + service_id = spec.service_id or "default-rbd-mirror" + all_hosts = self.get_hosts() + def _create_rbd_mirror() -> crbdm.CephRBDMirror: + return crbdm.CephRBDMirror( + apiVersion=self.rook_env.api_name, + metadata=dict( + name=service_id, + namespace=self.rook_env.namespace, + ), + spec=crbdm.Spec( + count=spec.placement.count or 1, + placement=crbdm.Placement( + nodeAffinity=crbdm.NodeAffinity( + requiredDuringSchedulingIgnoredDuringExecution=crbdm.RequiredDuringSchedulingIgnoredDuringExecution( + nodeSelectorTerms=crbdm.NodeSelectorTermsList( + [ + placement_spec_to_node_selector(spec.placement, all_hosts) + ] + ) + ) + ) + ) + ) + ) + def _update_rbd_mirror(new: crbdm.CephRBDMirror) -> crbdm.CephRBDMirror: + new.spec.count = spec.placement.count or 1 + new.spec.placement = crbdm.Placement( + nodeAffinity=crbdm.NodeAffinity( + requiredDuringSchedulingIgnoredDuringExecution=crbdm.RequiredDuringSchedulingIgnoredDuringExecution( + nodeSelectorTerms=crbdm.NodeSelectorTermsList( + [ + placement_spec_to_node_selector(spec.placement, all_hosts) + ] + ) + ) + ) + ) + return new + self._create_or_patch(crbdm.CephRBDMirror, 'cephrbdmirrors', service_id, _update_rbd_mirror, _create_rbd_mirror) + def _patch(self, crd: Type, crd_name: str, cr_name: str, func: Callable[[CrdClassT, CrdClassT], CrdClassT]) -> str: + current_json = self.rook_api_get( + "{}/{}".format(crd_name, cr_name) + ) + + current = crd.from_json(current_json) + new = crd.from_json(current_json) # no deepcopy. + + new = func(current, new) + + patch = list(jsonpatch.make_patch(current_json, new.to_json())) + + log.info('patch for {}/{}: \n{}'.format(crd_name, cr_name, patch)) + + if len(patch) == 0: + return "No change" + + try: + self.rook_api_patch( + "{}/{}".format(crd_name, cr_name), + body=patch) + except ApiException as e: + log.exception("API exception: {0}".format(e)) + raise ApplyException( + "Failed to update {}/{}: {}".format(crd_name, cr_name, e)) + + return "Success" + + def _create_or_patch(self, + crd: Type, + crd_name: str, + cr_name: str, + update_func: Callable[[CrdClassT], CrdClassT], + create_func: Callable[[], CrdClassT]) -> str: + try: + current_json = self.rook_api_get( + "{}/{}".format(crd_name, cr_name) + ) + except ApiException as e: + if e.status == 404: + current_json = None + else: + raise + + if current_json: + new = crd.from_json(current_json) # no deepcopy. + + new = update_func(new) + + patch = list(jsonpatch.make_patch(current_json, new.to_json())) + + log.info('patch for {}/{}: \n{}'.format(crd_name, cr_name, patch)) + + if len(patch) == 0: + return "No change" + + try: + self.rook_api_patch( + "{}/{}".format(crd_name, cr_name), + body=patch) + except ApiException as e: + log.exception("API exception: {0}".format(e)) + raise ApplyException( + "Failed to update {}/{}: {}".format(crd_name, cr_name, e)) + return "Updated" + else: + new = create_func() + with self.ignore_409("{} {} already exists".format(crd_name, + cr_name)): + self.rook_api_post("{}/".format(crd_name), + body=new.to_json()) + return "Created" + def get_ceph_image(self) -> str: + try: + api_response = self.coreV1_api.list_namespaced_pod(self.rook_env.namespace, + label_selector="app=rook-ceph-mon", + timeout_seconds=10) + if api_response.items: + return api_response.items[-1].spec.containers[0].image + else: + raise orchestrator.OrchestratorError( + "Error getting ceph image. Cluster without monitors") + except ApiException as e: + raise orchestrator.OrchestratorError("Error getting ceph image: {}".format(e)) + + + def _execute_blight_job(self, ident_fault: str, on: bool, loc: orchestrator.DeviceLightLoc) -> str: + operation_id = str(hash(loc)) + message = "" + + # job definition + job_metadata = client.V1ObjectMeta(name=operation_id, + namespace= self.rook_env.namespace, + labels={"ident": operation_id}) + pod_metadata = client.V1ObjectMeta(labels={"ident": operation_id}) + pod_container = client.V1Container(name="ceph-lsmcli-command", + security_context=client.V1SecurityContext(privileged=True), + image=self.get_ceph_image(), + command=["lsmcli",], + args=['local-disk-%s-led-%s' % (ident_fault,'on' if on else 'off'), + '--path', loc.path or loc.dev,], + volume_mounts=[client.V1VolumeMount(name="devices", mount_path="/dev"), + client.V1VolumeMount(name="run-udev", mount_path="/run/udev")]) + pod_spec = client.V1PodSpec(containers=[pod_container], + active_deadline_seconds=30, # Max time to terminate pod + restart_policy="Never", + node_selector= {"kubernetes.io/hostname": loc.host}, + volumes=[client.V1Volume(name="devices", + host_path=client.V1HostPathVolumeSource(path="/dev")), + client.V1Volume(name="run-udev", + host_path=client.V1HostPathVolumeSource(path="/run/udev"))]) + pod_template = client.V1PodTemplateSpec(metadata=pod_metadata, + spec=pod_spec) + job_spec = client.V1JobSpec(active_deadline_seconds=60, # Max time to terminate job + ttl_seconds_after_finished=10, # Alfa. Lifetime after finishing (either Complete or Failed) + backoff_limit=0, + template=pod_template) + job = client.V1Job(api_version="batch/v1", + kind="Job", + metadata=job_metadata, + spec=job_spec) + + # delete previous job if it exists + try: + try: + api_response = self.batchV1_api.delete_namespaced_job(operation_id, + self.rook_env.namespace, + propagation_policy="Background") + except ApiException as e: + if e.status != 404: # No problem if the job does not exist + raise + + # wait until the job is not present + deleted = False + retries = 0 + while not deleted and retries < 10: + api_response = self.batchV1_api.list_namespaced_job(self.rook_env.namespace, + label_selector="ident=%s" % operation_id, + timeout_seconds=10) + deleted = not api_response.items + if retries > 5: + sleep(0.1) + retries += 1 + if retries == 10 and not deleted: + raise orchestrator.OrchestratorError( + "Light <{}> in <{}:{}> cannot be executed. Cannot delete previous job <{}>".format( + on, loc.host, loc.path or loc.dev, operation_id)) + + # create the job + api_response = self.batchV1_api.create_namespaced_job(self.rook_env.namespace, job) + + # get the result + finished = False + while not finished: + api_response = self.batchV1_api.read_namespaced_job(operation_id, + self.rook_env.namespace) + finished = api_response.status.succeeded or api_response.status.failed + if finished: + message = api_response.status.conditions[-1].message + + # get the result of the lsmcli command + api_response=self.coreV1_api.list_namespaced_pod(self.rook_env.namespace, + label_selector="ident=%s" % operation_id, + timeout_seconds=10) + if api_response.items: + pod_name = api_response.items[-1].metadata.name + message = self.coreV1_api.read_namespaced_pod_log(pod_name, + self.rook_env.namespace) + + except ApiException as e: + log.exception('K8s API failed. {}'.format(e)) + raise + + # Finally, delete the job. + # The job uses <ttl_seconds_after_finished>. This makes that the TTL controller delete automatically the job. + # This feature is in Alpha state, so extra explicit delete operations trying to delete the Job has been used strategically + try: + api_response = self.batchV1_api.delete_namespaced_job(operation_id, + self.rook_env.namespace, + propagation_policy="Background") + except ApiException as e: + if e.status != 404: # No problem if the job does not exist + raise + + return message + + def blink_light(self, ident_fault, on, locs): + # type: (str, bool, List[orchestrator.DeviceLightLoc]) -> List[str] + return [self._execute_blight_job(ident_fault, on, loc) for loc in locs] + +def placement_spec_to_node_selector(spec: PlacementSpec, all_hosts: List) -> ccl.NodeSelectorTermsItem: + all_hostnames = [hs.hostname for hs in all_hosts] + res = ccl.NodeSelectorTermsItem(matchExpressions=ccl.MatchExpressionsList()) + if spec.host_pattern and spec.host_pattern != "*": + raise RuntimeError("The Rook orchestrator only supports a host_pattern of * for placements") + if spec.label: + res.matchExpressions.append( + ccl.MatchExpressionsItem( + key="ceph-label/" + spec.label, + operator="Exists" + ) + ) + if spec.hosts: + host_list = [h.hostname for h in spec.hosts if h.hostname in all_hostnames] + res.matchExpressions.append( + ccl.MatchExpressionsItem( + key="kubernetes.io/hostname", + operator="In", + values=ccl.CrdObjectList(host_list) + ) + ) + if spec.host_pattern == "*" or (not spec.label and not spec.hosts and not spec.host_pattern): + res.matchExpressions.append( + ccl.MatchExpressionsItem( + key="kubernetes.io/hostname", + operator="Exists", + ) + ) + return res + +def node_selector_to_placement_spec(node_selector: ccl.NodeSelectorTermsItem) -> PlacementSpec: + res = PlacementSpec() + for expression in node_selector.matchExpressions: + if expression.key.startswith("ceph-label/"): + res.label = expression.key.split('/')[1] + elif expression.key == "kubernetes.io/hostname": + if expression.operator == "Exists": + res.host_pattern = "*" + elif expression.operator == "In": + res.hosts = [HostPlacementSpec(hostname=value, network='', name='')for value in expression.values] + return res diff --git a/src/pybind/mgr/rook/tests/__init__.py b/src/pybind/mgr/rook/tests/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/pybind/mgr/rook/tests/__init__.py diff --git a/src/pybind/mgr/rook/tests/fixtures.py b/src/pybind/mgr/rook/tests/fixtures.py new file mode 100644 index 000000000..65a519743 --- /dev/null +++ b/src/pybind/mgr/rook/tests/fixtures.py @@ -0,0 +1,11 @@ +from rook.module import RookOrchestrator +from orchestrator import raise_if_exception, OrchResult + +try: + from typing import Any +except ImportError: + pass + + +def wait(m: RookOrchestrator, c: OrchResult) -> Any: + return raise_if_exception(c) diff --git a/src/pybind/mgr/rook/tests/test_placement.py b/src/pybind/mgr/rook/tests/test_placement.py new file mode 100644 index 000000000..eeaf191e2 --- /dev/null +++ b/src/pybind/mgr/rook/tests/test_placement.py @@ -0,0 +1,100 @@ +# flake8: noqa + +from rook.rook_cluster import placement_spec_to_node_selector, node_selector_to_placement_spec +from rook.rook_client.ceph.cephcluster import MatchExpressionsItem, MatchExpressionsList, NodeSelectorTermsItem +import pytest +from orchestrator import HostSpec +from ceph.deployment.service_spec import PlacementSpec + +@pytest.mark.parametrize("hosts", + [ # noqa: E128 + [ + HostSpec( + hostname="node1", + labels=["label1"] + ), + HostSpec( + hostname="node2", + labels=[] + ), + HostSpec( + hostname="node3", + labels=["label1"] + ) + ] + ]) +@pytest.mark.parametrize("expected_placement_spec, expected_node_selector", + [ # noqa: E128 + ( + PlacementSpec( + label="label1" + ), + NodeSelectorTermsItem( + matchExpressions=MatchExpressionsList( + [ + MatchExpressionsItem( + key="ceph-label/label1", + operator="Exists" + ) + ] + ) + ) + ), + ( + PlacementSpec( + label="label1", + host_pattern="*" + ), + NodeSelectorTermsItem( + matchExpressions=MatchExpressionsList( + [ + MatchExpressionsItem( + key="ceph-label/label1", + operator="Exists" + ), + MatchExpressionsItem( + key="kubernetes.io/hostname", + operator="Exists", + ) + ] + ) + ) + ), + ( + PlacementSpec( + host_pattern="*" + ), + NodeSelectorTermsItem( + matchExpressions=MatchExpressionsList( + [ + MatchExpressionsItem( + key="kubernetes.io/hostname", + operator="Exists", + ) + ] + ) + ) + ), + ( + PlacementSpec( + hosts=["node1", "node2", "node3"] + ), + NodeSelectorTermsItem( + matchExpressions=MatchExpressionsList( + [ + MatchExpressionsItem( + key="kubernetes.io/hostname", + operator="In", + values=["node1", "node2", "node3"] + ) + ] + ) + ) + ), + ]) +def test_placement_spec_translate(hosts, expected_placement_spec, expected_node_selector): + node_selector = placement_spec_to_node_selector(expected_placement_spec, hosts) + assert [(getattr(expression, 'key', None), getattr(expression, 'operator', None), getattr(expression, 'values', None)) for expression in node_selector.matchExpressions] == [(getattr(expression, 'key', None), getattr(expression, 'operator', None), getattr(expression, 'values', None)) for expression in expected_node_selector.matchExpressions] + placement_spec = node_selector_to_placement_spec(expected_node_selector) + assert placement_spec == expected_placement_spec + assert (getattr(placement_spec, 'label', None), getattr(placement_spec, 'hosts', None), getattr(placement_spec, 'host_pattern', None)) == (getattr(expected_placement_spec, 'label', None), getattr(expected_placement_spec, 'hosts', None), getattr(expected_placement_spec, 'host_pattern', None)) diff --git a/src/pybind/mgr/rook/tests/test_rook.py b/src/pybind/mgr/rook/tests/test_rook.py new file mode 100644 index 000000000..08028ba85 --- /dev/null +++ b/src/pybind/mgr/rook/tests/test_rook.py @@ -0,0 +1,120 @@ +import orchestrator +from .fixtures import wait +import pytest +from unittest.mock import patch, PropertyMock + +from rook.module import RookOrchestrator +from rook.rook_cluster import RookCluster + + +# we use this intermediate class as .rook_cluster property +# is read only in the paretn class RookCluster +class FakeRookCluster(RookCluster): + def __init__(self): + pass + + +class TestRook(object): + + @pytest.mark.parametrize("pods, expected_daemon_types", [ + ( + [ + { + 'name': 'ceph-rook-exporter', + 'hostname': 'host1', + "labels": {'app': 'rook-ceph-exporter', + 'ceph_daemon_id': 'exporter'}, + 'phase': 'Pending', + 'container_image_name': 'quay.io/ceph/ceph:v18', + 'container_image_id': 'docker-pullable://quay.io/ceph/ceph@sha256:f239715e1c7756e32a202a572e2763a4ce15248e09fc6e8990985f8a09ffa784', + 'refreshed': 'pod1_ts', + 'started': 'pod1_ts', + 'created': 'pod1_1ts', + }, + { + 'name': 'rook-ceph-mgr-a-68c7b9b6d8-vjjhl', + 'hostname': 'host1', + "labels": {'app': 'rook-ceph-mgr', + 'ceph_daemon_type': 'mgr', + 'ceph_daemon_id': 'a'}, + 'phase': 'Failed', + 'container_image_name': 'quay.io/ceph/ceph:v18', + 'container_image_id': '', + 'refreshed': 'pod2_ts', + 'started': 'pod2_ts', + 'created': 'pod2_1ts', + }, + { + 'name': 'rook-ceph-mon-a-65fb8694b4-mmtl5', + 'hostname': 'host1', + "labels": {'app': 'rook-ceph-mon', + 'ceph_daemon_type': 'mon', + 'ceph_daemon_id': 'b'}, + 'phase': 'Running', + 'container_image_name': 'quay.io/ceph/ceph:v18', + 'container_image_id': '', + 'refreshed': 'pod3_ts', + 'started': 'pod3_ts', + 'created': 'pod3_1ts', + }, + { + 'name': 'rook-ceph-osd-0-58cbd7b65c-6cjnr', + 'hostname': 'host1', + "labels": {'app': 'rook-ceph-osd', + 'ceph-osd-id': '0', + 'ceph_daemon_type': 'osd', + 'ceph_daemon_id': '0'}, + 'phase': 'Succeeded', + 'container_image_name': 'quay.io/ceph/ceph:v18', + 'container_image_id': '', + 'refreshed': 'pod4_ts', + 'started': 'pod4_ts', + 'created': 'pod4_1ts', + }, + # unknown pod: has no labels are provided, it shouldn't + # be part of the output + { + 'name': 'unknown-pod', + 'hostname': '', + "labels": {'app': 'unkwon'}, + 'phase': 'Pending', + 'container_image_name': 'quay.io/ceph/ceph:v18', + 'container_image_id': '', + 'refreshed': '', + 'started': '', + 'created': '', + } + ], + ['ceph-exporter', 'mgr', 'mon', 'osd'] + ) + ]) + def test_list_daemons(self, pods, expected_daemon_types): + + status = { + 'Pending': orchestrator.DaemonDescriptionStatus.starting, + 'Running': orchestrator.DaemonDescriptionStatus.running, + 'Succeeded': orchestrator.DaemonDescriptionStatus.stopped, + 'Failed': orchestrator.DaemonDescriptionStatus.error, + 'Unknown': orchestrator.DaemonDescriptionStatus.unknown, + } + + fake_rook_cluster = FakeRookCluster() + ro = RookOrchestrator('rook', None, self) + with patch('rook.RookOrchestrator.rook_cluster', + new_callable=PropertyMock, + return_value=fake_rook_cluster): + with patch.object(fake_rook_cluster, 'describe_pods') as mock_describe_pods: + mock_describe_pods.return_value = pods + dds = wait(ro, ro.list_daemons()) + assert len(dds) == len(expected_daemon_types) + for i in range(0, len(dds)): + assert dds[i].daemon_type == expected_daemon_types[i] + assert dds[i].hostname == pods[i]['hostname'] + assert dds[i].status == status[pods[i]['phase']] + assert dds[i].container_image_name == pods[i]['container_image_name'] + assert dds[i].container_image_id == pods[i]['container_image_id'] + assert dds[i].created == pods[i]['created'] + assert dds[i].last_configured == pods[i]['created'] + assert dds[i].last_deployed == pods[i]['created'] + assert dds[i].started == pods[i]['started'] + assert dds[i].last_refresh == pods[i]['refreshed'] |