diff --git a/modules/python/clients/kubernetes_client.py b/modules/python/clients/kubernetes_client.py index 60838d2ce4..f6464ffd95 100644 --- a/modules/python/clients/kubernetes_client.py +++ b/modules/python/clients/kubernetes_client.py @@ -975,7 +975,8 @@ def wait_for_condition(self, resource_type: str, wait_condition_type: str, names valid_conditions = { 'deployment': ['available', 'progressing', 'replicafailure', 'ready'], 'deployments': ['available', 'progressing', 'replicafailure', 'ready'], - # Add more resource types as needed + 'statefulset': ['ready'], + 'statefulsets': ['ready'], } # Validate wait_condition_type format and type @@ -1049,6 +1050,9 @@ def _check_resource_condition(self, resource_type: str, resource_name: str, cond if resource_type_lower in ['deployment', 'deployments']: return self._check_deployment_condition(resource_name, condition_type, namespace, wait_all) + if resource_type_lower in ['statefulset', 'statefulsets']: + return self._check_statefulset_condition(resource_name, namespace, wait_all) + logger.warning(f"Unsupported resource type for condition checking: {resource_type}") return False @@ -1079,6 +1083,37 @@ def _check_deployment_condition(self, resource_name: str, condition_type: str, n return False raise e + def _check_statefulset_condition(self, resource_name: str, namespace: str, wait_all: bool) -> bool: + """Check statefulset condition (e.g., 'ready').""" + try: + if wait_all or not resource_name: + statefulsets = self.app.list_namespaced_stateful_set(namespace=namespace).items + else: + statefulset = self.app.read_namespaced_stateful_set(name=resource_name, namespace=namespace) + statefulsets = [statefulset] + + for statefulset in statefulsets: + if not self._is_statefulset_ready(statefulset): + return False + + return True + + except client.rest.ApiException as e: + if e.status == 404: + logger.debug("StatefulSet not found, waiting...") + return False + raise e + + def _is_statefulset_ready(self, statefulset) -> bool: + """Check if a statefulset has all replicas ready, including scale-to-zero.""" + status = statefulset.status + spec_replicas = statefulset.spec.replicas or 0 + return ( + status is not None + and status.ready_replicas is not None + and status.ready_replicas == spec_replicas + ) + def _is_deployment_condition_met(self, deployment, condition_type: str) -> bool: """Check if a deployment meets the specified condition.""" if not deployment.status or not deployment.status.conditions: diff --git a/modules/python/crud/azure/node_pool_crud.py b/modules/python/crud/azure/node_pool_crud.py index 208589d3d7..d475de9ca9 100644 --- a/modules/python/crud/azure/node_pool_crud.py +++ b/modules/python/crud/azure/node_pool_crud.py @@ -23,6 +23,23 @@ get_logger("azure.core.pipeline").setLevel(logging.ERROR) get_logger("msal").setLevel(logging.ERROR) +# Workload type configuration for unified _apply_workload helper +WORKLOAD_CONFIG = { + "deployment": { + "template_file": "deployment.yml", + "count_key": "DEPLOYMENT_REPLICAS", + "resource_type": "deployment", + "wait_condition": "available", + "verify_pods_ready": True, + }, + "statefulset": { + "template_file": "statefulset.yml", + "count_key": "STATEFULSET_REPLICAS", + "resource_type": "statefulset", + "wait_condition": "ready", + "verify_pods_ready": True, + }, +} class NodePoolCRUD: """Performs AKS node pool operations - metrics collection is handled directly by AKSClient""" @@ -273,79 +290,6 @@ def all( errors.append(error_msg) return False - def _apply_deployment( - self, - k8s_client, - node_pool_name, - deployment_index, - replicas, - manifest_dir, - label_selector, - namespace - ): - """Helper for create_deployment — applies and verifies a single deployment.""" - if manifest_dir: - # Use the template path from manifest_dir - template_path = f"{manifest_dir}/deployment.yml" - else: - # Use default template path (relative to workingDirectory: modules/python) - template_path = os.path.join( - os.path.dirname(os.path.abspath(__file__)), - "..", "workload_templates", "deployment.yml" - ) - - # Generate deployment name - deployment_name = f"myapp-{node_pool_name}-{deployment_index}" - - # Use per-deployment label to avoid selector collision - deployment_label = f"{label_selector.split('=', 1)[-1]}-{deployment_index}" - - # Create deployment template using k8s_client.create_template - deployment_template = k8s_client.create_template( - template_path, - { - "DEPLOYMENT_REPLICAS": replicas, - "NODE_POOL_NAME": node_pool_name, - "INDEX": deployment_index, - "LABEL_VALUE": deployment_label, - } - ) - - # Apply each document in the rendered multi-doc template - for doc in yaml.safe_load_all(deployment_template): - if doc: - k8s_client.apply_manifest_from_file(manifest_dict=doc, namespace=namespace) - - logger.info("Applied manifest for deployment %s", deployment_name) - - # Wait for deployment to be available (successful deployment verification) - logger.info("Waiting for deployment %s to become available...", deployment_name) - deployment_ready = k8s_client.wait_for_condition( - resource_type="deployment", - wait_condition_type="available", - resource_name=deployment_name, - namespace=namespace, - timeout_seconds=self.step_timeout - ) - - if not deployment_ready: - raise TimeoutError( - f"Deployment {deployment_name} failed to become available within timeout" - ) - - logger.info("Deployment %s is successfully available", deployment_name) - - # Additionally wait for pods to be ready - logger.info("Waiting for pods of deployment %s to be ready...", deployment_name) - k8s_client.wait_for_pods_ready( - operation_timeout_in_minutes=5, - namespace=namespace, - pod_count=replicas, - label_selector=f"app={deployment_label}" - ) - - logger.info("Successfully created and verified deployment %d", deployment_index) - def create_deployment( self, node_pool_name, @@ -369,43 +313,200 @@ def create_deployment( Returns: True if all deployment creations were successful, False otherwise """ - logger.info("Creating %d deployment(s)", number_of_deployments) + return self._create_workloads( + workload_type="deployment", + node_pool_name=node_pool_name, + count=replicas, + number_of_workloads=number_of_deployments, + manifest_dir=manifest_dir, + label_selector=label_selector, + namespace=namespace + ) + + def create_statefulset( + self, + node_pool_name, + replicas=10, + manifest_dir=None, + number_of_statefulsets=1, + label_selector="app=nginx-container", + namespace="default" + ): + """ + Create Kubernetes StatefulSets after node pool operations. + + Args: + node_pool_name: Name of the node pool to target + namespace: Kubernetes namespace (default: "default") + replicas: Number of replicas for the StatefulSet (default: 10) + manifest_dir: Directory containing Kubernetes manifest files + number_of_statefulsets: Number of StatefulSets to create (default: 1) + label_selector: Label selector for pods (default: "app=nginx-container") + + Returns: + True if all StatefulSet creations were successful, False otherwise + """ + return self._create_workloads( + workload_type="statefulset", + node_pool_name=node_pool_name, + count=replicas, + number_of_workloads=number_of_statefulsets, + manifest_dir=manifest_dir, + label_selector=label_selector, + namespace=namespace + ) + + def _create_workloads( + self, + workload_type, + node_pool_name, + count, + number_of_workloads, + manifest_dir, + label_selector, + namespace + ): + """Unified helper to create multiple workload instances. + + Args: + workload_type: Type of workload ("deployment" or "statefulset") + node_pool_name: Name of the target node pool + count: Number of replicas per workload instance + number_of_workloads: Total number of workload instances to create + manifest_dir: Optional custom manifest directory + label_selector: Base label selector (e.g., "app=nginx-container") + namespace: Kubernetes namespace + + Returns: + True if all workloads created successfully, False otherwise + """ + workload_type_display = workload_type.capitalize() + logger.info("Creating %d %s(s)", number_of_workloads, workload_type_display) logger.info("Target node pool: %s", node_pool_name) - logger.info("Replicas per deployment: %d", replicas) + logger.info("Replicas per %s: %d", workload_type, count) logger.info("Using manifest directory: %s", manifest_dir) - # Get Kubernetes client from AKS client k8s_client = self.aks_client.k8s_client - if not k8s_client: logger.error("Kubernetes client not available") return False - successful_deployments = 0 - - # Loop through number of deployments - for deployment_index in range(1, number_of_deployments + 1): - logger.info("Creating deployment %d/%d", deployment_index, number_of_deployments) - + successes = 0 + for index in range(1, number_of_workloads + 1): + logger.info("Creating %s %d/%d", workload_type, index, number_of_workloads) try: - self._apply_deployment( + self._apply_workload( k8s_client=k8s_client, + workload_type=workload_type, node_pool_name=node_pool_name, - deployment_index=deployment_index, - replicas=replicas, + index=index, + count=count, manifest_dir=manifest_dir, label_selector=label_selector, namespace=namespace ) - successful_deployments += 1 + successes += 1 except Exception as e: - logger.error("Failed to create deployment %d: %s", deployment_index, e) - # Continue with next deployment instead of failing completely + logger.error("Failed to create %s %d: %s", workload_type, index, e) continue - # Check if all deployments were successful - if successful_deployments == number_of_deployments: - logger.info("Successfully created all %d deployment(s)", number_of_deployments) + if successes == number_of_workloads: + logger.info("Successfully created all %d %s(s)", number_of_workloads, workload_type_display) return True - logger.warning("Created %d/%d deployment(s)", successful_deployments, number_of_deployments) + logger.warning("Created %d/%d %s(s)", successes, number_of_workloads, workload_type_display) return False + + def _apply_workload( + self, + k8s_client, + workload_type, + node_pool_name, + index, + count, + manifest_dir, + label_selector, + namespace + ): + """Unified helper to apply and verify a single workload instance. + + Args: + k8s_client: Kubernetes client instance + workload_type: Type of workload ("deployment" or "statefulset") + node_pool_name: Name of the target node pool + index: Workload instance index (1-based) + count: Number of replicas/completions + manifest_dir: Optional custom manifest directory + label_selector: Base label selector (e.g., "app=nginx-container") + namespace: Kubernetes namespace + + Raises: + ValueError: If workload_type is not in WORKLOAD_CONFIG + TimeoutError: If workload fails to reach ready state + """ + if workload_type not in WORKLOAD_CONFIG: + raise ValueError(f"Unknown workload type: {workload_type}") + + config = WORKLOAD_CONFIG[workload_type] + + # Resolve template path + if manifest_dir: + template_path = f"{manifest_dir}/{config['template_file']}" + else: + template_path = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + "..", "workload_templates", config["template_file"] + ) + + # Generate resource name and label + resource_name = f"myapp-{node_pool_name}-{index}" + workload_label = f"{label_selector.split('=', 1)[-1]}-{workload_type}-{index}" + + # Render template + rendered_template = k8s_client.create_template( + template_path, + { + config["count_key"]: count, + "NODE_POOL_NAME": node_pool_name, + "INDEX": index, + "LABEL_VALUE": workload_label, + } + ) + + # Apply each document in the rendered multi-doc template + for doc in yaml.safe_load_all(rendered_template): + if doc: + k8s_client.apply_manifest_from_file(manifest_dict=doc, namespace=namespace) + + logger.info("Applied manifest for %s %s", workload_type, resource_name) + + # Wait for workload to reach target condition + logger.info("Waiting for %s %s to become %s...", + workload_type, resource_name, config["wait_condition"]) + ready = k8s_client.wait_for_condition( + resource_type=config["resource_type"], + wait_condition_type=config["wait_condition"], + resource_name=resource_name, + namespace=namespace, + timeout_seconds=self.step_timeout + ) + + if not ready: + raise TimeoutError( + f"{workload_type.capitalize()} {resource_name} failed to become " + f"{config['wait_condition']} within timeout" + ) + + logger.info("%s %s is successfully %s", + workload_type.capitalize(), resource_name, config["wait_condition"]) + + # Wait for pods if configured (skipped for Jobs) + if config["verify_pods_ready"]: + logger.info("Waiting for pods of %s %s to be ready...", workload_type, resource_name) + k8s_client.wait_for_pods_ready( + operation_timeout_in_minutes=5, + namespace=namespace, + pod_count=count, + label_selector=f"app={workload_label}" + ) + + logger.info("Successfully created and verified %s %d", workload_type, index) diff --git a/modules/python/crud/main.py b/modules/python/crud/main.py index c73fda23cc..743a753d3b 100644 --- a/modules/python/crud/main.py +++ b/modules/python/crud/main.py @@ -162,7 +162,7 @@ def handle_node_pool_operation(node_pool_crud, args): return 1 def handle_workload_operations(node_pool_crud, args): - """Handle workload operations (deployment, statefulset, jobs) based on the command""" + """Handle workload operations (deployment, statefulset) based on the command""" command = args.command result = None @@ -182,6 +182,21 @@ def handle_workload_operations(node_pool_crud, args): } result = node_pool_crud.create_deployment(**deploy_kwargs) + elif command == "statefulset": + if not hasattr(node_pool_crud, 'create_statefulset'): + logger.error("Cloud provider does not support statefulset workload operations") + return 1 + + # Prepare statefulset arguments + statefulset_kwargs = { + "node_pool_name": args.node_pool_name, + "replicas": args.replicas, + "manifest_dir": args.manifest_dir, + "number_of_statefulsets": args.count, + "label_selector": args.label_selector, + } + + result = node_pool_crud.create_statefulset(**statefulset_kwargs) else: logger.error("Unknown workload command: '%s'", command) return 1 @@ -508,6 +523,14 @@ def main(): ) deployment_parser.set_defaults(func=handle_workload_operations) + # StatefulSet command + statefulset_parser = subparsers.add_parser( + "statefulset", + parents=[common_parser, workload_common_parser], + help="create statefulsets" + ) + statefulset_parser.set_defaults(func=handle_workload_operations) + # Create-machine command (AKS Machine API) _add_create_machine_subparser(subparsers, common_parser) diff --git a/modules/python/crud/workload_templates/statefulset.yml b/modules/python/crud/workload_templates/statefulset.yml new file mode 100644 index 0000000000..c85725316c --- /dev/null +++ b/modules/python/crud/workload_templates/statefulset.yml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: myapp-{{NODE_POOL_NAME}}-{{INDEX}} + labels: + app: {{LABEL_VALUE}} +spec: + serviceName: myapp-{{NODE_POOL_NAME}}-{{INDEX}} + replicas: {{STATEFULSET_REPLICAS}} + selector: + matchLabels: + app: {{LABEL_VALUE}} + template: + metadata: + labels: + app: {{LABEL_VALUE}} + spec: + containers: + - name: {{LABEL_VALUE}} + image: mcr.microsoft.com/oss/nginx/nginx:1.21.6 + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: myapp-{{NODE_POOL_NAME}}-{{INDEX}} +spec: + ports: + - port: 80 + name: myapp + clusterIP: None + selector: + app: {{LABEL_VALUE}} diff --git a/modules/python/tests/clients/test_kubernetes_client.py b/modules/python/tests/clients/test_kubernetes_client.py index 8190789361..a67d52fef2 100644 --- a/modules/python/tests/clients/test_kubernetes_client.py +++ b/modules/python/tests/clients/test_kubernetes_client.py @@ -3407,6 +3407,77 @@ def test_wait_for_condition_case_insensitive(self): ) self.assertTrue(result) + @patch('time.time') + def test_wait_for_condition_statefulset_success(self, mock_time): + """Test wait_for_condition for statefulset - success case""" + mock_time.side_effect = [0, 0, 1, 2, 2] + + mock_statefulset = MagicMock() + mock_statefulset.spec.replicas = 3 + mock_statefulset.status.ready_replicas = 3 + + with patch.object(self.client, 'app') as mock_app, \ + patch('time.sleep'): + mock_app.read_namespaced_stateful_set.return_value = mock_statefulset + + result = self.client.wait_for_condition( + resource_type="statefulset", + resource_name="test-statefulset", + wait_condition_type="ready", + namespace="test-namespace", + timeout_seconds=5 + ) + + self.assertTrue(result) + mock_app.read_namespaced_stateful_set.assert_called_with( + name="test-statefulset", + namespace="test-namespace" + ) + + @patch('time.time') + def test_wait_for_condition_statefulset_timeout(self, mock_time): + """Test wait_for_condition for statefulset - timeout case""" + mock_time.side_effect = [0, 0, 2, 5, 6, 6] + + mock_statefulset = MagicMock() + mock_statefulset.spec.replicas = 3 + mock_statefulset.status.ready_replicas = 1 + + with patch.object(self.client, 'app') as mock_app, \ + patch('time.sleep'): + mock_app.read_namespaced_stateful_set.return_value = mock_statefulset + + result = self.client.wait_for_condition( + resource_type="statefulset", + resource_name="test-statefulset", + wait_condition_type="ready", + namespace="test-namespace", + timeout_seconds=1 + ) + + self.assertFalse(result) + + @patch('time.time') + def test_wait_for_condition_statefulset_not_found(self, mock_time): + """Test wait_for_condition for statefulset - not found case""" + mock_time.side_effect = [0, 0, 2, 5, 6, 6] + + api_exception = ApiException(status=404, reason="Not Found") + + with patch.object(self.client, 'app') as mock_app, \ + patch('time.sleep'): + mock_app.read_namespaced_stateful_set.side_effect = api_exception + + result = self.client.wait_for_condition( + resource_type="statefulset", + resource_name="nonexistent", + wait_condition_type="ready", + namespace="test-namespace", + timeout_seconds=1 + ) + + self.assertFalse(result) + # Tests for the enhanced apply_manifest_from_file method with folder support @patch('os.path.isdir') @patch('os.path.isfile') diff --git a/modules/python/tests/crud/test_azure_node_pool_crud.py b/modules/python/tests/crud/test_azure_node_pool_crud.py index 9064a5af4a..20ba49e558 100644 --- a/modules/python/tests/crud/test_azure_node_pool_crud.py +++ b/modules/python/tests/crud/test_azure_node_pool_crud.py @@ -393,5 +393,75 @@ def test_create_deployment_partial_success(self): # Verify create_template was called 3 times (attempted all deployments) self.assertEqual(mock_k8s_client.create_template.call_count, 3) + def test_create_statefulset_success(self): + """Test successful statefulset creation""" + # Setup + mock_k8s_client = mock.MagicMock() + self.mock_aks_client.k8s_client = mock_k8s_client + # Must return a real string - yaml.safe_load_all(MagicMock()) causes an infinite loop + mock_k8s_client.create_template.return_value = "apiVersion: apps/v1\nkind: StatefulSet\n" + mock_k8s_client.wait_for_condition.return_value = True + + # Execute + result = self.node_pool_crud.create_statefulset(node_pool_name="test-pool") + + # Verify + self.assertTrue(result) + + def test_create_statefulset_failure(self): + """Test statefulset creation failure""" + # Setup + mock_k8s_client = mock.MagicMock() + self.mock_aks_client.k8s_client = mock_k8s_client + # Must return a real string - yaml.safe_load_all(MagicMock()) causes an infinite loop + mock_k8s_client.create_template.return_value = "apiVersion: apps/v1\nkind: StatefulSet\n" + mock_k8s_client.wait_for_condition.return_value = False + + # Execute + result = self.node_pool_crud.create_statefulset(node_pool_name="test-pool") + + # Verify + self.assertFalse(result) + + def test_create_statefulset_no_client(self): + """Test statefulset creation with no Kubernetes client""" + # Setup + self.mock_aks_client.k8s_client = None + + # Execute + result = self.node_pool_crud.create_statefulset(node_pool_name="test-pool") + + # Verify + self.assertFalse(result) + + def test_create_statefulset_partial_success(self): + """Test Statefulset creation when some Statefulsets succeed and others fail""" + # Setup + mock_k8s_client = mock.MagicMock() + self.mock_aks_client.k8s_client = mock_k8s_client + + # Must return a real string - yaml.safe_load_all(MagicMock()) causes an infinite loop + mock_k8s_client.create_template.return_value = "apiVersion: apps/v1\nkind: StatefulSet\n" + + # Simulate: StatefulSet 1 succeeds, StatefulSet 2 fails, StatefulSet 3 succeeds + # wait_for_condition returns True/False for each StatefulSet + mock_k8s_client.wait_for_condition.side_effect = [True, False, True] + + # Execute - request 3 StatefulSets + result = self.node_pool_crud.create_statefulset( + node_pool_name="test-pool", + number_of_statefulsets=3, + replicas=5 + ) + + # Verify - should return False (not all statefulsets succeeded) + self.assertFalse(result) + + # Verify wait_for_condition was called 3 times (once per statefulset) + self.assertEqual(mock_k8s_client.wait_for_condition.call_count, 3) + + # Verify create_template was called 3 times (attempted all statefulsets) + self.assertEqual(mock_k8s_client.create_template.call_count, 3) + if __name__ == "__main__": unittest.main() diff --git a/steps/engine/crud/k8s/execute.yml b/steps/engine/crud/k8s/execute.yml index bd3fbef2e3..e84e3a1f7b 100644 --- a/steps/engine/crud/k8s/execute.yml +++ b/steps/engine/crud/k8s/execute.yml @@ -1,17 +1,5 @@ parameters: - result_dir: "" - vm_size: "" - create_node_count: "" - scale_node_count: "" - scale_step_up_count: "" - pool_name: "" cloud: "" - step_time_out: 600 - step_wait_time: 30 - gpu_node_pool: false - count: 1 - replicas: 10 - manifest_dir: "" steps: - script: | @@ -45,16 +33,16 @@ steps: workingDirectory: modules/python env: PYTHON_SCRIPT_FILE: $(Pipeline.Workspace)/s/modules/python/crud/main.py - VM_SIZE: ${{ parameters.vm_size }} - CREATE_NODE_COUNT: ${{ parameters.create_node_count }} - SCALE_NODE_COUNT: ${{ parameters.scale_node_count }} - SCALE_STEP_SIZE: ${{ parameters.scale_step_up_count }} - POOL_NAME: ${{ parameters.pool_name }} + VM_SIZE: $(VM_SIZE) + CREATE_NODE_COUNT: $(CREATE_NODE_COUNT) + SCALE_NODE_COUNT: $(SCALE_NODE_COUNT) + SCALE_STEP_SIZE: $(SCALE_STEP_SIZE) + POOL_NAME: $(POOL_NAME) CLOUD: ${{ parameters.cloud }} - STEP_TIME_OUT: ${{ parameters.step_time_out }} + STEP_TIME_OUT: $(STEP_TIME_OUT) RESULT_DIR: $(System.DefaultWorkingDirectory)/$(RUN_ID) - GPU_NODE_POOL: ${{ parameters.gpu_node_pool }} - STEP_WAIT_TIME: ${{ parameters.step_wait_time }} + GPU_NODE_POOL: $(GPU_NODE_POOL) + STEP_WAIT_TIME: $(STEP_WAIT_TIME) ${{ if eq(parameters.cloud, 'aws') }}: CAPACITY_TYPE: $(CAPACITY_TYPE) @@ -77,14 +65,41 @@ steps: workingDirectory: modules/python env: PYTHON_SCRIPT_FILE: $(Pipeline.Workspace)/s/modules/python/crud/main.py - POOL_NAME: ${{ parameters.pool_name }} + POOL_NAME: $(POOL_NAME) CLOUD: ${{ parameters.cloud }} - STEP_TIME_OUT: ${{ parameters.step_time_out }} + STEP_TIME_OUT: $(STEP_TIME_OUT) RESULT_DIR: $(System.DefaultWorkingDirectory)/$(RUN_ID) - GPU_NODE_POOL: ${{ parameters.gpu_node_pool }} - COUNT: ${{ parameters.count }} - REPLICAS: ${{ parameters.replicas }} - MANIFEST_DIR: ${{ parameters.manifest_dir }} + GPU_NODE_POOL: $(GPU_NODE_POOL) + COUNT: $(COUNT) + REPLICAS: $(REPLICAS) + MANIFEST_DIR: $(MANIFEST_DIR) + + - script: | + set -eo pipefail + + # Deploy StatefulSets + PYTHONPATH=$PYTHONPATH:$(pwd) python3 "$PYTHON_SCRIPT_FILE" statefulset \ + --cloud "$CLOUD" \ + --run-id "$RUN_ID" \ + --result-dir "$RESULT_DIR" \ + --node-pool-name "$POOL_NAME" \ + --count "$COUNT" \ + --replicas "$REPLICAS" \ + ${MANIFEST_DIR:+--manifest-dir "$MANIFEST_DIR"} \ + --step-timeout "$STEP_TIME_OUT" \ + ${GPU_NODE_POOL:+--gpu-node-pool} + displayName: 'Execute K8s StatefulSet operations for ${{ parameters.cloud }}' + workingDirectory: modules/python + env: + PYTHON_SCRIPT_FILE: $(Pipeline.Workspace)/s/modules/python/crud/main.py + POOL_NAME: $(POOL_NAME) + CLOUD: ${{ parameters.cloud }} + STEP_TIME_OUT: $(STEP_TIME_OUT) + RESULT_DIR: $(System.DefaultWorkingDirectory)/$(RUN_ID) + GPU_NODE_POOL: $(GPU_NODE_POOL) + COUNT: $(COUNT) + REPLICAS: $(REPLICAS) + MANIFEST_DIR: $(MANIFEST_DIR) - script: | set -eo pipefail @@ -113,15 +128,15 @@ steps: workingDirectory: modules/python env: PYTHON_SCRIPT_FILE: $(Pipeline.Workspace)/s/modules/python/crud/main.py - VM_SIZE: ${{ parameters.vm_size }} - CREATE_NODE_COUNT: ${{ parameters.create_node_count }} - SCALE_NODE_COUNT: ${{ parameters.scale_node_count }} - SCALE_STEP_SIZE: ${{ parameters.scale_step_up_count }} - POOL_NAME: ${{ parameters.pool_name }} + VM_SIZE: $(VM_SIZE) + CREATE_NODE_COUNT: $(CREATE_NODE_COUNT) + SCALE_NODE_COUNT: $(SCALE_NODE_COUNT) + SCALE_STEP_SIZE: $(SCALE_STEP_SIZE) + POOL_NAME: $(POOL_NAME) CLOUD: ${{ parameters.cloud }} - STEP_TIME_OUT: ${{ parameters.step_time_out }} + STEP_TIME_OUT: $(STEP_TIME_OUT) RESULT_DIR: $(System.DefaultWorkingDirectory)/$(RUN_ID) - GPU_NODE_POOL: ${{ parameters.gpu_node_pool }} - STEP_WAIT_TIME: ${{ parameters.step_wait_time }} + GPU_NODE_POOL: $(GPU_NODE_POOL) + STEP_WAIT_TIME: $(STEP_WAIT_TIME) ${{ if eq(parameters.cloud, 'aws') }}: CAPACITY_TYPE: $(CAPACITY_TYPE) diff --git a/steps/topology/k8s-crud-gpu/execute-crud.yml b/steps/topology/k8s-crud-gpu/execute-crud.yml index 1c2b02d9c6..1b585b617e 100644 --- a/steps/topology/k8s-crud-gpu/execute-crud.yml +++ b/steps/topology/k8s-crud-gpu/execute-crud.yml @@ -13,15 +13,3 @@ steps: - template: /steps/engine/crud/k8s/execute.yml parameters: cloud: ${{ parameters.cloud }} - vm_size: $(VM_SIZE) - create_node_count: $(CREATE_NODE_COUNT) - scale_node_count: $(SCALE_NODE_COUNT) - scale_step_up_count: $(SCALE_STEP_SIZE) - pool_name: $(POOL_NAME) - step_time_out: $(STEP_TIME_OUT) - result_dir: $(System.DefaultWorkingDirectory)/$(RUN_ID) - gpu_node_pool: $(GPU_NODE_POOL) - step_wait_time: $(STEP_WAIT_TIME) - count: $(COUNT) - replicas: $(REPLICAS) - manifest_dir: $(MANIFEST_DIR)