def _get_sample_tkg_cluster_configuration(): sample_tkg_plus_config = { "kind": "TanzuKubernetesCluster", "spec": { "topology": { "workers": { "class": "Gold_storage_profile_name", "count": 1, "storageClass": "development #sample storage class" }, "controlPlane": { "class": "Gold_storage_profile_name", "count": 1, "storageClass": "development" } }, "distribution": { "version": "v1.16" } }, "metadata": { "name": "cluster_name", "placementPolicy": "placement_policy_name", "virtualDataCenterName": "org_virtual_data_center_name" } } sample_apply_spec = yaml.dump(sample_tkg_plus_config) CLIENT_LOGGER.info(sample_apply_spec) return sample_apply_spec
def _get_sample_cluster_configuration_by_k8_runtime(k8_runtime): metadata = rde_1_0_0.Metadata('cluster_name', 'organization_name', 'org_virtual_datacenter_name') status = rde_1_0_0.Status() settings = rde_1_0_0.Settings(network='ovdc_network_name', ssh_key=None) k8_distribution = rde_1_0_0.Distribution( template_name='ubuntu-16.04_k8-1.17_weave-2.6.0', template_revision=2) control_plane = rde_1_0_0.ControlPlane( count=1, sizing_class='Large_sizing_policy_name', storage_profile='Gold_storage_profile_name') workers = rde_1_0_0.Workers(count=2, sizing_class='Medium_sizing_policy_name', storage_profile='Silver_storage_profile') nfs = rde_1_0_0.Nfs(count=0, sizing_class='Large_sizing_policy_name', storage_profile='Platinum_storage_profile_name') cluster_spec = rde_1_0_0.ClusterSpec(control_plane=control_plane, k8_distribution=k8_distribution, settings=settings, workers=workers, nfs=nfs) cluster_entity = rde_1_0_0.NativeEntity(metadata=metadata, spec=cluster_spec, status=status, kind=k8_runtime.value) sample_cluster_config = yaml.dump(dataclasses.asdict(cluster_entity)) CLIENT_LOGGER.info(sample_cluster_config) return sample_cluster_config
def _get_sample_cluster_configuration_by_k8_runtime( k8_runtime, server_rde_in_use): # noqa: E501 NativeEntityClass = rde_factory.get_rde_model(server_rde_in_use) sample_native_entity = NativeEntityClass.sample_native_entity( k8_runtime.value) # noqa: E501 native_entity_dict = sample_native_entity.to_dict() # remove status part of the entity dict del native_entity_dict['status'] sample_apply_spec = yaml.dump(native_entity_dict) CLIENT_LOGGER.info(sample_apply_spec) return sample_apply_spec
def _get_sample_cluster_configuration_by_k8_runtime( k8_runtime, server_rde_in_use): # noqa: E501 NativeEntityClass = rde_factory.get_rde_model(server_rde_in_use) sample_native_entity = NativeEntityClass.sample_native_entity( k8_runtime.value) # noqa: E501 native_entity_dict = sample_native_entity.to_dict() # remove status part of the entity dict del native_entity_dict['status'] # Hiding the network spec section for Andromeda (CSE 3.1) # spec.settings.network is targeted for CSE 3.1.1 to accommodate CNI=Antrea # Below line can be deleted post Andromeda (CSE 3.1) del native_entity_dict['spec']['settings']['network'] sample_apply_spec = yaml.dump(native_entity_dict) CLIENT_LOGGER.info(sample_apply_spec) return sample_apply_spec
def _get_sample_cluster_configuration_by_k8_runtime(k8_runtime, server_rde_in_use): # noqa: E501 NativeEntityClass = rde_factory.get_rde_model(server_rde_in_use) sample_native_entity = NativeEntityClass.sample_native_entity(k8_runtime.value) # noqa: E501 native_entity_dict = sample_native_entity.to_dict() # remove status part of the entity dict del native_entity_dict['status'] # Hiding the network spec section for Andromeda (CSE 3.1) # spec.settings.network is targeted for CSE 3.1.1 to accommodate CNI=Antrea # Below line can be deleted post Andromeda (CSE 3.1) del native_entity_dict['spec']['settings']['network'] # Hiding the cpu and memory properties from controlPlane and workers for # Andromeda (CSE 3.1). Below lines can be deleted once cpu and memory # support is added in CSE 3.1.1 del native_entity_dict['spec']['topology']['controlPlane']['cpu'] del native_entity_dict['spec']['topology']['controlPlane']['memory'] del native_entity_dict['spec']['topology']['workers']['cpu'] del native_entity_dict['spec']['topology']['workers']['memory'] sample_apply_spec = yaml.dump(native_entity_dict) CLIENT_LOGGER.info(sample_apply_spec) return sample_apply_spec