diff --git a/Makefile b/Makefile index 0c23c42..c5d42f9 100644 --- a/Makefile +++ b/Makefile @@ -114,6 +114,9 @@ set_dns: deploy_ui: start_minikube scripts/deploy_ui.sh +redeploy_ui: + ACTION=redeploy scripts/deploy_ui.sh + kill_all_port_forwardings: scripts/utils.sh kill_all_port_forwardings diff --git a/scripts/deploy_ui.sh b/scripts/deploy_ui.sh index 4202eae..60832cb 100755 --- a/scripts/deploy_ui.sh +++ b/scripts/deploy_ui.sh @@ -3,18 +3,31 @@ set -euo pipefail source scripts/utils.sh +export ACTION=${ACTION:-full} export NODE_IP=$(get_main_ip) export UI_PORT=${UI_PORT:-6008} export KUBECONFIG=${KUBECONFIG:-$HOME/.kube/config} export CONTAINER_COMMAND=${CONTAINER_COMMAND:-podman} export UI_DEPLOY_FILE=build/ui_deploy.yaml export UI_SERVICE_NAME=ocp-metal-ui +export UI_IMAGE=${UI_IMAGE:-quay.io/ocpmetal/ocp-metal-ui:latest} +export NAMESPACE=assisted-installer -mkdir -p build +if [ ${ACTION} = redeploy ] ; then + print_log "Restarting ui" + kubectl --kubeconfig=${KUBECONFIG} rollout restart deployment/${UI_SERVICE_NAME} -n ${NAMESPACE} +else + if kubectl --kubeconfig=${KUBECONFIG} get deployment/${UI_SERVICE_NAME} -n assisted-installer 2>&1 > /dev/null ; then + print_log "Existing UI deployment found. Consider setting:" + print_log " ACTION=redeploy $0" + fi -print_log "Starting ui" -${CONTAINER_COMMAND} run --pull=always --rm quay.io/ocpmetal/ocp-metal-ui:latest /deploy/deploy_config.sh -i quay.io/ocpmetal/ocp-metal-ui:latest > ${UI_DEPLOY_FILE} -kubectl --kubeconfig=${KUBECONFIG} apply -f ${UI_DEPLOY_FILE} + mkdir -p build + + print_log "Starting ui" + ${CONTAINER_COMMAND} run --pull=always --rm ${UI_IMAGE} /deploy/deploy_config.sh -i ${UI_IMAGE} > ${UI_DEPLOY_FILE} + kubectl --kubeconfig=${KUBECONFIG} apply -f ${UI_DEPLOY_FILE} +fi print_log "Config firewall" sudo systemctl start firewalld @@ -22,7 +35,7 @@ sudo firewall-cmd --zone=public --permanent --add-port=${UI_PORT}/tcp sudo firewall-cmd --reload print_log "Wait till ui api is ready" -wait_for_url_and_run "$(minikube service ${UI_SERVICE_NAME} --url -n assisted-installer)" "echo \"waiting for ${UI_SERVICE_NAME}\"" +wait_for_url_and_run "$(minikube service ${UI_SERVICE_NAME} --url -n ${NAMESPACE})" "echo \"waiting for ${UI_SERVICE_NAME}\"" print_log "Starting port forwarding for deployment/${UI_SERVICE_NAME}" @@ -30,3 +43,4 @@ wait_for_url_and_run "http://${NODE_IP}:${UI_PORT}" "spawn_port_forwarding_comma print_log "OCP METAL UI can be reached at http://${NODE_IP}:${UI_PORT}" print_log "Done" +