Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce CMMO dag #323

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions dags/openshift_nightlies/config/install/rosa/rosa-cmmo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"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": null,
"install_cmmo": "true",
"cmmo_password": "",
"cmmo_username": ""
}
26 changes: 26 additions & 0 deletions dags/openshift_nightlies/scripts/install/rosa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ setup(){
export ES_SERVER=$(cat ${json_file} | jq -r .es_server)
export HCP=$(cat ${json_file} | jq -r .rosa_hcp)
export UUID=$(uuidgen)
export INSTALL_CMMO=$(cat ${json_file} | jq -r .install_cmmo)
export CMMO_USERNAME=$(cat ${json_file} | jq -r .cmmo_username)
export CMMO_PASSWORD=$(cat ${json_file} | jq -r .cmmo_password)
if [ $HCP == "true" ]; then
export STAGE_CONFIG=""
export MGMT_CLUSTER_NAME=$(cat ${json_file} | jq -r .staging_mgmt_cluster_name)
Expand Down Expand Up @@ -428,10 +431,33 @@ postinstall(){
fi
kubectl delete secret ${KUBEADMIN_NAME} || true
kubectl create secret generic ${KUBEADMIN_NAME} --from-literal=KUBEADMIN_PASSWORD=${PASSWORD}
# Check if CMMO Install is true
if [ $INSTALL_CMMO == "true" ]; then
export KUBECONFIG=./kubeconfig
_install_cmmo
fi
if [ $HCP == "true" ]; then index_metadata "cluster-install"; fi
return 0
}

_install_cmmo(){
echo "INFO: Installing Cost Management Metrics Operator"
git clone https://github.com/krishvoor/cmmo-cli-install /home/airflow/workspace/cmmo-cli-install

# Update variable values
sed -i "s/UPDATE_SOURCE_NAME/${UUID}/g" CostManagementMetricsConfig.yaml
sed -i "s/UPDATE_PASSWORD/${CMMO_PASSWORD}/g" secret.yaml
sed -i "s/UPDATE_USERNAME/${CMMO_USERNAME}/g" secret.yaml

# Install the Operator
pushd /home/airflow/workspace/cmmo-cli-install
oc create -f operator_group.yaml
oc create -f secret.yaml
oc create -f CostManagementMetricsConfig.yaml
popd
echo "INFO: Installed the Cost Management Metrics Operator"
}

index_metadata(){
if [[ ! "${INDEXDATA[*]}" =~ "cleanup" ]] ; then
_download_kubeconfig "$(_get_cluster_id ${CLUSTER_NAME})" ./kubeconfig
Expand Down
3 changes: 2 additions & 1 deletion dags/openshift_nightlies/tasks/install/rosa/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@
"rosa_hcp": "false",
"staging_mgmt_cluster_name": "",
"staging_mgmt_provisioner_shards": "",
"aws_region": "us-west-2"
"aws_region": "us-west-2",
"enable_cmmo": "false"
}