Skip to content

Commit

Permalink
Merge branch 'master' into odh_dash400
Browse files Browse the repository at this point in the history
  • Loading branch information
manosnoam authored Mar 21, 2024
2 parents c8e1012 + 1d3cfaf commit 18e6b66
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 36 deletions.
20 changes: 11 additions & 9 deletions ods_ci/tasks/Resources/Provisioning/Hive/OSP/create_fips.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ export BASE_DOMAIN=${2:-$BASE_DOMAIN}
export OSP_NETWORK=${3:-$OSP_NETWORK}
export OSP_CLOUD=${4:-openstack}
export OUTPUT_DIR=${5:-.${CLUSTER_NAME}_conf}
export AWS_ACCESS_KEY_ID=${6:-$AWS_ACCESS_KEY_ID}
export AWS_SECRET_ACCESS_KEY=${7:-$AWS_SECRET_ACCESS_KEY}

# Cluster name should be converted to lowercase
export CLUSTER_NAME=${CLUSTER_NAME,,}
export CLUSTER_NAME=${CLUSTER_NAME,,}

if [[ -z $CLUSTER_NAME || -z $BASE_DOMAIN || -z $OSP_NETWORK ]] ; then
echo -e "Some global variables are missing, for example:
# export CLUSTER_NAME=${CLUSTER_NAME:-"rhods-qe-007"} # To set the cluster Subdomain (A Record) in AWS.
echo -e "Some global variables are missing, for example:
# export CLUSTER_NAME=${CLUSTER_NAME:-"rhods-qe-007"} # To set the cluster Subdomain (A Record) in AWS.
# export BASE_DOMAIN=${BASE_DOMAIN:-"rhods.ccitredhat.com"} # To set the cluster Domain in AWS.
# export OSP_NETWORK=${OSP_NETWORK:-"shared_net_5"} # The external network for the new Floating IPs on OSP.
"
Expand Down Expand Up @@ -88,11 +90,11 @@ fi

echo "Updating DNS records (cluster api's) in AWS Route53"
RESPONSE=$(aws route53 change-resource-record-sets --hosted-zone-id "$ZONE_ID" --change-batch \
'{ "Comment": "Update A record for cluster API", "Changes":
[ { "Action": "UPSERT", "ResourceRecordSet": { "Name": "api.'"$CLUSTER_NAME"'.'"$BASE_DOMAIN"'",
'{ "Comment": "Update A record for cluster API", "Changes":
[ { "Action": "UPSERT", "ResourceRecordSet": { "Name": "api.'"$CLUSTER_NAME"'.'"$BASE_DOMAIN"'",
"Type": "A", "TTL": 300, "ResourceRecords": [ { "Value": "'"$FIP_API"'" } ] } } ] }' --output json) || rc=$?
if [[ -n "$rc" ]] ; then
echo -e "Failed to update DNS A record in AWS for cluster API.
echo -e "Failed to update DNS A record in AWS for cluster API.
\n Releasing previously allocated floating IP in $OS_CLOUD ($FIP_API)"
openstack floating ip delete "$FIP_API"
exit ${rc:+$rc}
Expand All @@ -103,12 +105,12 @@ aws route53 wait resource-record-sets-changed --id "$(echo "$RESPONSE" | jq -r '

echo "Updating DNS records (cluster ingress) in AWS Route53"
RESPONSE=$(aws route53 change-resource-record-sets --hosted-zone-id "$ZONE_ID" --change-batch \
'{ "Comment": "Update A record for cluster APPS", "Changes":
[ { "Action": "UPSERT", "ResourceRecordSet": { "Name": "*.apps.'"$CLUSTER_NAME"'.'"$BASE_DOMAIN"'",
'{ "Comment": "Update A record for cluster APPS", "Changes":
[ { "Action": "UPSERT", "ResourceRecordSet": { "Name": "*.apps.'"$CLUSTER_NAME"'.'"$BASE_DOMAIN"'",
"Type": "A", "TTL": 300, "ResourceRecords": [ { "Value": "'"$FIP_APPS"'" } ] } } ] }' --output json) || rc=$?

if [[ -n "$rc" ]] ; then
echo -e "Failed to update DNS A record in AWS for cluster APPS.
echo -e "Failed to update DNS A record in AWS for cluster APPS.
\n Releasing previously allocated floating IP in $OS_CLOUD ($FIP_APPS)"
openstack floating ip delete "$FIP_APPS"
exit ${rc:+$rc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ items:
name: ${infrastructure_configurations}[hive_cluster_name]-sec # see line 30
size: 1
maxSize: 1
maxConcurrent: 1
runningCount: 1
skipMachinePools: true
- apiVersion: v1
Expand Down Expand Up @@ -61,7 +60,7 @@ items:
platform:
openstack:
cloud: ${infrastructure_configurations}[osp_cloud_name]
computeFlavor: m1.large
computeFlavor: g.standard.xxl
externalDNS: null
externalNetwork: ${infrastructure_configurations}[osp_network]
pullSecret: '${infrastructure_configurations}[quay_pull_sec]'
Expand Down Expand Up @@ -100,4 +99,4 @@ items:
name: ${infrastructure_configurations}[image_set]
namespace: ${infrastructure_configurations}[hive_claim_ns]
spec:
releaseImage: quay.io/openshift-release-dev/ocp-release:${infrastructure_configurations}[ocp_version]-x86_64
releaseImage: quay.io/openshift-release-dev/ocp-release:${infrastructure_configurations}[ocp_version]-x86_64
38 changes: 16 additions & 22 deletions ods_ci/tasks/Resources/Provisioning/Hive/provision.robot
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Create Floating IPs
${shell_script} = Catenate
... ${CURDIR}/OSP/create_fips.sh ${cluster_name} ${infrastructure_configurations}[base_domain]
... ${infrastructure_configurations}[osp_network] ${infrastructure_configurations}[osp_cloud_name] ${artifacts_dir}/
... ${infrastructure_configurations}[AWS_ACCESS_KEY_ID] ${infrastructure_configurations}[AWS_SECRET_ACCESS_KEY]
${return_code} = Run and Watch Command ${shell_script} output_should_contain=Exporting Floating IPs
Should Be Equal As Integers ${return_code} 0 msg=Error creating floating IPs for cluster '${cluster_name}'
${fips_file_to_export} = Set Variable
Expand Down Expand Up @@ -145,6 +146,7 @@ Watch Hive Install Log

Wait For Cluster To Be Ready
${pool_namespace} = Get Cluster Pool Namespace ${pool_name}
Set Task Variable ${pool_namespace}
Log Watching Hive Pool namespace: ${pool_namespace} console=True
${install_log_file} = Set Variable ${artifacts_dir}/${cluster_name}_install.log
Create File ${install_log_file}
Expand All @@ -157,7 +159,7 @@ Wait For Cluster To Be Ready
... oc -n ${pool_namespace} get cd ${pool_namespace} -o json | jq -r '.status.webConsoleURL' --exit-status
... shell=yes
${claim_status} = Run Process
... oc -n ${hive_namespace} wait --for\=condition\=ClusterRunning\=True clusterclaim ${claim_name} --timeout\=10m shell=yes # robocop: disable:line-too-long
... oc -n ${hive_namespace} wait --for\=condition\=ClusterRunning\=True clusterclaim ${claim_name} --timeout\=15m shell=yes # robocop: disable:line-too-long
# Workaround for old Hive with Openstack - Cluster is displayed as Resuming even when it is Running
# add also support to the new Hive where the Cluster is displayed as Running
IF "${provider_type}" == "OSP"
Expand All @@ -177,28 +179,29 @@ Wait For Cluster To Be Ready

Save Cluster Credentials
Set Task Variable ${cluster_details} ${artifacts_dir}/${cluster_name}_details.txt
Set Task Variable ${cluster_kubeconf} ${artifacts_dir}/kubeconfig
${pool_namespace} = Get Cluster Pool Namespace ${pool_name}
${result} = Run Process oc -n ${pool_namespace} get cd ${pool_namespace} -o json | jq -r '.status.apiURL' --exit-status shell=yes
Should Be True ${result.rc} == 0 Hive Cluster deployment '${pool_namespace}' does not have a valid API access
${result} = Run Process
... oc -n ${pool_namespace} get cd ${pool_namespace} -o json | jq -r '.status.webConsoleURL' --exit-status
... shell=yes
Should Be True ${result.rc} == 0
... Hive Cluster deployment '${pool_namespace}' does not have a valid webConsoleURL access
Create File ${cluster_details} console=${result.stdout}\n
${ClusterDeployment} = Oc Get kind=ClusterDeployment name=${pool_namespace}
... namespace=${pool_namespace} api_version=hive.openshift.io/v1
${apiURL} = Set Variable "${ClusterDeployment[0]['status']['apiURL']}"
Append to File ${cluster_details} api=${apiURL}\n
${result} = Run Process
... oc -n ${pool_namespace} get cd ${pool_namespace} -o json | jq -r '.status.apiURL' --exit-status
... shell=yes
Append To File ${cluster_details} api=${result.stdout}\n
${result} = Run Process oc extract -n ${pool_namespace} --confirm secret/$(oc -n ${pool_namespace} get cd ${pool_namespace} -o jsonpath\='{.spec.clusterMetadata.adminPasswordSecretRef.name}') --to\=${artifacts_dir}
... shell=yes
Should Be True ${result.rc} == 0
${username} = Get File ${artifacts_dir}/username
${password} = Get File ${artifacts_dir}/password
Append to File ${cluster_details} username=${username}\n
Append to File ${cluster_details} password=${password}\n
Append To File ${cluster_details} username=${username}\n
Append To File ${cluster_details} password=${password}\n
${result} = Run Process oc extract -n ${pool_namespace} --confirm secret/$(oc -n ${pool_namespace} get cd ${pool_namespace} -o jsonpath\='{.spec.clusterMetadata.adminKubeconfigSecretRef.name}') --to\=${artifacts_dir}
... shell=yes
Should Be True ${result.rc} == 0
RETURN ${cluster_kubeconf}

Login To Cluster
${cluster_kubeconf} = Set Variable ${artifacts_dir}/kubeconfig
Export Variables From File ${cluster_details}
Create File ${cluster_kubeconf}
# Test the extracted credentials
Expand All @@ -209,18 +212,9 @@ Login To Cluster
Log ${result.stdout}\n${result.stderr} console=True
Should Be True ${result.rc} == 0

Set Cluster Storage
Log Update Cluster ${cluster_name} Storage Class console=True
${result} = Run Process oc --kubeconfig\=${cluster_kubeconf} patch StorageClass standard -p '{"metadata": {"annotations": {"storageclass.kubernetes.io/is-default-class": "false"}}}'
... shell=yes
Log StorageClass standard:\n${result.stdout}\n${result.stderr} console=True
${result} = Run Process oc --kubeconfig\=${cluster_kubeconf} patch StorageClass standard-csi -p '{"metadata": {"annotations": {"storageclass.kubernetes.io/is-default-class": "true"}}}'
... shell=yes
Log StorageClass standard-csi:\n${result.stdout}\n${result.stderr} console=True
Run Keyword And Ignore Error Should Be True ${result.rc} == 0

Get Cluster Pool Namespace
[Arguments] ${hive_pool_name}
Log Cluster pool name is: ${hive_pool_name} console=True
${namespace} = Wait Until Keyword Succeeds 2 min 2 s
... Oc Get kind=Namespace label_selector=hive.openshift.io/cluster-pool-name=${hive_pool_name}
${pool_namespace} = Set Variable ${namespace[0]['metadata']['name']}
Expand Down
3 changes: 1 addition & 2 deletions ods_ci/tasks/Tasks/provision_self_managed_cluster.robot
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Provision Self-Managed Cluster
Wait For Cluster To Be Ready
Save Cluster Credentials
Login To Cluster
Set Cluster Storage
Pass Execution Self-Managed Cluster ${cluster_name} provisionend successfully

Deprovision Self-Managed Cluster
Expand All @@ -55,4 +54,4 @@ Delete GPU Node From Self-Managed AWS Cluster
Disconnect Self-Managed Cluster
[Documentation] Disconnect a self-managed cluster
[Tags] self_managed_disconnect
Disconnect Cluster
Disconnect Cluster

0 comments on commit 18e6b66

Please sign in to comment.