diff --git a/dags/openshift_nightlies/config/install/rosa/ovn-small-spot.json b/dags/openshift_nightlies/config/install/rosa/ovn-small-spot.json new file mode 100644 index 000000000..9149aa402 --- /dev/null +++ b/dags/openshift_nightlies/config/install/rosa/ovn-small-spot.json @@ -0,0 +1,17 @@ +{ + "aws_profile": "", + "aws_access_key_id": "", + "aws_secret_access_key": "", + "aws_authentication_method": "sts", + "rosa_environment": "staging", + "rosa_cli_version": "container", + "ocm_environment": "stage", + "managed_channel_group": "nightly", + "managed_ocp_version": "latest", + "openshift_worker_count": 24, + "openshift_network_type": "OVNKubernetes", + "openshift_worker_instance_type": "m5.2xlarge", + "machineset_metadata_label_prefix": "machine.openshift.io", + "openshift_workload_node_instance_type": "m5.2xlarge", + "enable_spot_workers": true +} diff --git a/dags/openshift_nightlies/manifest.yaml b/dags/openshift_nightlies/manifest.yaml index 6dfc0d24c..187d18062 100644 --- a/dags/openshift_nightlies/manifest.yaml +++ b/dags/openshift_nightlies/manifest.yaml @@ -83,6 +83,11 @@ platforms: config: install: rosa/ovn-small.json benchmarks: small-control-plane-mgs.json + - name: sts-ovn-small-spot-cp + schedule: "0 12 * * 3" + config: + install: rosa/ovb-small-spot.json + benchmarks: small-control-plane-mgs.json - name: sts-ovn-medium-cp schedule: "5 12 * * 1" config: diff --git a/dags/openshift_nightlies/scripts/install/rosa.sh b/dags/openshift_nightlies/scripts/install/rosa.sh index 998e8b0cb..2a2c89f19 100755 --- a/dags/openshift_nightlies/scripts/install/rosa.sh +++ b/dags/openshift_nightlies/scripts/install/rosa.sh @@ -31,6 +31,7 @@ _wait_for_nodes_ready(){ export KUBECONFIG=./kubeconfig ALL_READY_ITERATIONS=0 ITERATIONS=0 + # Node count is number of workers + 3 infra NODES_COUNT=$(($2+3)) # 30 seconds per node, waiting for all nodes ready to finalize @@ -131,6 +132,7 @@ setup(){ export COMPUTE_WORKERS_NUMBER=$(cat ${json_file} | jq -r .openshift_worker_count) export NETWORK_TYPE=$(cat ${json_file} | jq -r .openshift_network_type) export ES_SERVER=$(cat ${json_file} | jq -r .es_server) + export ENABLE_SPOT_WORKERS=$(cat ${json_file} | jq -r .enable_spot_workers) export UUID=$(uuidgen) export OCM_CLI_VERSION=$(cat ${json_file} | jq -r .ocm_cli_version) if [[ ${OCM_CLI_VERSION} != "container" ]]; then @@ -171,12 +173,21 @@ install(){ export COMPUTE_WORKERS_TYPE=$(cat ${json_file} | jq -r .openshift_worker_instance_type) export CLUSTER_AUTOSCALE=$(cat ${json_file} | jq -r .cluster_autoscale) export OIDC_CONFIG=$(cat ${json_file} | jq -r .oidc_config) - export INSTALLATION_PARAMS="" - if [ $AWS_AUTHENTICATION_METHOD == "sts" ] ; then + if [ $AWS_AUTHENTICATION_METHOD == "sts" ]; then INSTALLATION_PARAMS="${INSTALLATION_PARAMS} --sts -m auto --yes" fi - INSTALLATION_PARAMS="${INSTALLATION_PARAMS} --multi-az" # Multi AZ is default on hosted-cp cluster - rosa create cluster --tags=User:${GITHUB_USERNAME} --cluster-name ${CLUSTER_NAME} --version "${ROSA_VERSION}" --channel-group=${MANAGED_CHANNEL_GROUP} --compute-machine-type ${COMPUTE_WORKERS_TYPE} --replicas ${COMPUTE_WORKERS_NUMBER} --network-type ${NETWORK_TYPE} ${INSTALLATION_PARAMS} + INSTALLATION_PARAMS="${INSTALLATION_PARAMS} --multi-az" # Multi AZ is default on hosted-cp cluster + + if [ "$ENABLE_SPOT_WORKERS" == "true" ]; then + rosa create cluster --tags=User:${GITHUB_USERNAME} --cluster-name ${CLUSTER_NAME} --version "${ROSA_VERSION}" --channel-group=${MANAGED_CHANNEL_GROUP} --compute-machine-type ${COMPUTE_WORKERS_TYPE} --network-type ${NETWORK_TYPE} ${INSTALLATION_PARAMS} + _wait_for_cluster_ready ${CLUSTER_NAME} + rosa create machinepool -c ${CLUSTER_NAME} --name="${CLUSTER_NAME}-spot-pool" --replicas=${COMPUTE_WORKERS_NUMBER} --instance-type="${COMPUTE_WORKERS_TYPE}" --labels="rosa-spots=true" --use-spot-instances + _wait_for_nodes_ready $CLUSTER_NAME $COMPUTE_WORKERS_NUMBER "rosa-spots=true" + export SPOT_POOL_READY=true + else + rosa create cluster --tags=User:${GITHUB_USERNAME} --cluster-name ${CLUSTER_NAME} --version "${ROSA_VERSION}" --channel-group=${MANAGED_CHANNEL_GROUP} --compute-machine-type ${COMPUTE_WORKERS_TYPE} --replicas ${COMPUTE_WORKERS_NUMBER} --network-type ${NETWORK_TYPE} ${INSTALLATION_PARAMS} + fi + postinstall return 0 } diff --git a/dags/openshift_nightlies/tasks/install/rosa/defaults.json b/dags/openshift_nightlies/tasks/install/rosa/defaults.json index 29f67d108..ff961b9cc 100644 --- a/dags/openshift_nightlies/tasks/install/rosa/defaults.json +++ b/dags/openshift_nightlies/tasks/install/rosa/defaults.json @@ -36,5 +36,6 @@ "ocm_cli_fork": "https://github.com/openshift-online/ocm-cli", "ocm_cli_version": "container", "rosa_hcp": "false", - "aws_region": "us-west-2" + "aws_region": "us-west-2", + "enable_spot_workers": false }