From cb52066c83f259f912609d25e278c7e27a99ee96 Mon Sep 17 00:00:00 2001 From: bharathappali Date: Wed, 9 Aug 2023 11:02:41 +0530 Subject: [PATCH] Update the manifests Signed-off-by: bharathappali --- .../minikube/kruize-crc-minikube.yaml | 26 ++++--- .../openshift/kruize-crc-openshift.yaml | 69 ++++++++++++++++++ .../minikube/kruize-crc-minikube.yaml | 26 ++++--- .../openshift/kruize-crc-openshift.yaml | 70 +++++++++++++++++++ scripts/common_utils.sh | 17 +++-- 5 files changed, 184 insertions(+), 24 deletions(-) diff --git a/manifests/crc/BYODB-installation/minikube/kruize-crc-minikube.yaml b/manifests/crc/BYODB-installation/minikube/kruize-crc-minikube.yaml index e6d5dae15..7215e4117 100644 --- a/manifests/crc/BYODB-installation/minikube/kruize-crc-minikube.yaml +++ b/manifests/crc/BYODB-installation/minikube/kruize-crc-minikube.yaml @@ -147,18 +147,20 @@ data: } server { - listen 80; + listen 8080; server_name localhost; - location / { - root /usr/share/nginx/html; - index index.html index.htm; - } - - location /api/ { + root /usr/share/nginx/html; + + location ^~ /api/ { rewrite ^/api(.*)$ $1 break; proxy_pass http://kruize-api; } + + location / { + index index.html; + error_page 404 =200 /index.html; + } } } --- @@ -171,8 +173,8 @@ spec: type: NodePort ports: - name: http - port: 80 - targetPort: 80 + port: 8080 + targetPort: 8080 selector: app: kruize-ui-nginx --- @@ -186,8 +188,11 @@ metadata: spec: containers: - name: kruize-ui-nginx-container - image: docker.io/bharathappali/kruize-ui:test + image: docker.io/bharathappali/kruize-ui:central-config imagePullPolicy: Always + env: + - name: KRUIZE_UI_ENV + value: "production" volumeMounts: - name: nginx-config-volume mountPath: /etc/nginx/nginx.conf @@ -196,3 +201,4 @@ spec: - name: nginx-config-volume configMap: name: nginx-config + diff --git a/manifests/crc/BYODB-installation/openshift/kruize-crc-openshift.yaml b/manifests/crc/BYODB-installation/openshift/kruize-crc-openshift.yaml index e73a964b9..24045a54e 100644 --- a/manifests/crc/BYODB-installation/openshift/kruize-crc-openshift.yaml +++ b/manifests/crc/BYODB-installation/openshift/kruize-crc-openshift.yaml @@ -138,3 +138,72 @@ spec: - port: kruize-port interval: 30s path: /metrics +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-config + namespace: openshift-tuning +data: + nginx.conf: | + events {} + http { + upstream kruize-api { + server kruize:8080; + } + + server { + listen 8080; + server_name localhost; + + root /usr/share/nginx/html; + + location ^~ /api/ { + rewrite ^/api(.*)$ $1 break; + proxy_pass http://kruize-api; + } + + location / { + index index.html; + error_page 404 =200 /index.html; + } + } + } +--- +apiVersion: v1 +kind: Service +metadata: + name: kruize-ui-nginx-service + namespace: openshift-tuning +spec: + type: NodePort + ports: + - name: http + port: 8080 + targetPort: 8080 + selector: + app: kruize-ui-nginx +--- +apiVersion: v1 +kind: Pod +metadata: + name: kruize-ui-nginx-pod + namespace: openshift-tuning + labels: + app: kruize-ui-nginx +spec: + containers: + - name: kruize-ui-nginx-container + image: docker.io/bharathappali/kruize-ui:central-config + imagePullPolicy: Always + env: + - name: KRUIZE_UI_ENV + value: "production" + volumeMounts: + - name: nginx-config-volume + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf + volumes: + - name: nginx-config-volume + configMap: + name: nginx-config diff --git a/manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml b/manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml index 371c2cebb..6948878bb 100644 --- a/manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml +++ b/manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml @@ -225,18 +225,20 @@ data: } server { - listen 80; + listen 8080; server_name localhost; - location / { - root /usr/share/nginx/html; - index index.html index.htm; - } - - location /api/ { + root /usr/share/nginx/html; + + location ^~ /api/ { rewrite ^/api(.*)$ $1 break; proxy_pass http://kruize-api; } + + location / { + index index.html; + error_page 404 =200 /index.html; + } } } --- @@ -249,8 +251,8 @@ spec: type: NodePort ports: - name: http - port: 80 - targetPort: 80 + port: 8080 + targetPort: 8080 selector: app: kruize-ui-nginx --- @@ -264,8 +266,11 @@ metadata: spec: containers: - name: kruize-ui-nginx-container - image: docker.io/bharathappali/kruize-ui:test + image: docker.io/bharathappali/kruize-ui:central-config imagePullPolicy: Always + env: + - name: KRUIZE_UI_ENV + value: "production" volumeMounts: - name: nginx-config-volume mountPath: /etc/nginx/nginx.conf @@ -274,3 +279,4 @@ spec: - name: nginx-config-volume configMap: name: nginx-config + diff --git a/manifests/crc/default-db-included-installation/openshift/kruize-crc-openshift.yaml b/manifests/crc/default-db-included-installation/openshift/kruize-crc-openshift.yaml index 88483a1e2..11d3e465a 100644 --- a/manifests/crc/default-db-included-installation/openshift/kruize-crc-openshift.yaml +++ b/manifests/crc/default-db-included-installation/openshift/kruize-crc-openshift.yaml @@ -255,3 +255,73 @@ spec: - port: kruize-port interval: 30s path: /metrics +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-config + namespace: monitoring +data: + nginx.conf: | + events {} + http { + upstream kruize-api { + server kruize:8080; + } + + server { + listen 8080; + server_name localhost; + + root /usr/share/nginx/html; + + location ^~ /api/ { + rewrite ^/api(.*)$ $1 break; + proxy_pass http://kruize-api; + } + + location / { + index index.html; + error_page 404 =200 /index.html; + } + } + } +--- +apiVersion: v1 +kind: Service +metadata: + name: kruize-ui-nginx-service + namespace: openshift-tuning +spec: + type: NodePort + ports: + - name: http + port: 8080 + targetPort: 8080 + selector: + app: kruize-ui-nginx +--- +apiVersion: v1 +kind: Pod +metadata: + name: kruize-ui-nginx-pod + namespace: openshift-tuning + labels: + app: kruize-ui-nginx +spec: + containers: + - name: kruize-ui-nginx-container + image: docker.io/bharathappali/kruize-ui:central-config + imagePullPolicy: Always + env: + - name: KRUIZE_UI_ENV + value: "production" + volumeMounts: + - name: nginx-config-volume + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf + volumes: + - name: nginx-config-volume + configMap: + name: nginx-config + diff --git a/scripts/common_utils.sh b/scripts/common_utils.sh index 697a5ac45..509a2f6a8 100755 --- a/scripts/common_utils.sh +++ b/scripts/common_utils.sh @@ -21,6 +21,7 @@ function check_running() { check_pod=$1 check_pod_ns=$2 + ignore_pod=$3 kubectl_cmd="kubectl -n ${check_pod_ns}" echo "Info: Waiting for ${check_pod} to come up....." @@ -29,8 +30,16 @@ function check_running() { while true; do sleep 2 - ${kubectl_cmd} get pods | grep ${check_pod} - pod_stat=$(${kubectl_cmd} get pods | grep ${check_pod} | awk '{ print $3 }') +# Check if ignore pod is sent + if [[ ! -z "${ignore_pod}" ]]; then + ${kubectl_cmd} get pods | grep ${check_pod} | grep -v ${ignore_pod} + pod_stat=$(${kubectl_cmd} get pods | grep ${check_pod} | grep -v ${ignore_pod} | awk '{ print $3 }') + else + ${kubectl_cmd} get pods | grep ${check_pod} + pod_stat=$(${kubectl_cmd} get pods | grep ${check_pod} | awk '{ print $3 }') + fi + + case "${pod_stat}" in "Running") echo "Info: ${check_pod} deploy succeeded: ${pod_stat}" @@ -49,7 +58,7 @@ function check_running() { *) sleep 2 if [ $counter == 200 ]; then - ${kubectl_cmd} describe pod ${scheck_pod} + ${kubectl_cmd} describe pod ${check_pod} echo "ERROR: Prometheus Pods failed to come up!" exit -1 fi @@ -95,7 +104,7 @@ kruize_crc_start() { } else { print } }' ${CRC_MANIFEST_FILE_OLD} > ${CRC_MANIFEST_FILE} ${kubectl_cmd} apply -f ${CRC_MANIFEST_FILE} - check_running kruize ${autotune_ns} + check_running kruize ${autotune_ns} kruize-ui if [ "${err}" != "0" ]; then # Indicate deploy failed on error exit 1