From bac94941a6d4b19c754a72e2adc01df5b9260849 Mon Sep 17 00:00:00 2001 From: Helmut Hutzler <helmut.hutzler@th-nuernberg.de> Date: Mon, 5 Dec 2022 15:10:47 +0000 Subject: [PATCH] Reworked Angular App deployment --- deployments/deploy_angular.sh | 23 +++++++++++++ deployments/deploy_angular_app.yaml | 42 ++++++++++++++++++++++++ deployments/install_angular_frontend.log | 20 +++++++++++ deployments/ir_angular_app.yaml | 27 +++++++++++++++ 4 files changed, 112 insertions(+) create mode 100755 deployments/deploy_angular.sh create mode 100644 deployments/deploy_angular_app.yaml create mode 100644 deployments/install_angular_frontend.log create mode 100644 deployments/ir_angular_app.yaml diff --git a/deployments/deploy_angular.sh b/deployments/deploy_angular.sh new file mode 100755 index 0000000..20fe41a --- /dev/null +++ b/deployments/deploy_angular.sh @@ -0,0 +1,23 @@ + +#!/bin/bash +if [ -z "$1" ]; then + echo "Error : Missing namespace " + echo "Sample: $0 myoidc-app-ns" + exit 1 +fi + +NAME_SPACE=$1 +LOG_FILE=./install_angular_frontend.log + +kubectl -n $NAME_SPACE delete -f deploy_angular_app.yaml +kubectl -n $NAME_SPACE delete -f ir_angular_app.yaml +kubectl -n $NAME_SPACE apply -f deploy_angular_app.yaml +kubectl -n $NAME_SPACE apply -f ir_angular_app.yaml +sleep 5 +rm $LOG_FILE +echo "________________________________ Kubernetes resources for namespace: $NAME_SPACE ___________________________________________" > $LOG_FILE + +kubectl -n $NAME_SPACE get all 2>&1 >> $LOG_FILE +cat $LOG_FILE + + diff --git a/deployments/deploy_angular_app.yaml b/deployments/deploy_angular_app.yaml new file mode 100644 index 0000000..5326e83 --- /dev/null +++ b/deployments/deploy_angular_app.yaml @@ -0,0 +1,42 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: angular-oidc-auth-sample-production + name: angular-oidc-auth-sample-production-svc +spec: + ports: + - port: 9604 + protocol: TCP + targetPort: 80 + selector: + app: oidc-autologin-app + deployment: angular-oidc-auth-sample-production + type: ClusterIP +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + note: Hello, I am staging! + labels: + app: angular-oidc-auth-sample-production + name: angular-oidc-auth-sample-production-pod +spec: + replicas: 1 + selector: + matchLabels: + app: angular-oidc-auth-sample-production + deployment: angular-oidc-auth-sample-production + template: + metadata: + labels: + app: angular-oidc-auth-sample-production + deployment: angular-oidc-auth-sample-production + spec: + containers: + - image: ghcr.io/hhutzler/angular-oidc-authorization-sample-production + imagePullPolicy: Always + name: the-app-container + ports: + - containerPort: 80 diff --git a/deployments/install_angular_frontend.log b/deployments/install_angular_frontend.log new file mode 100644 index 0000000..6e858e6 --- /dev/null +++ b/deployments/install_angular_frontend.log @@ -0,0 +1,20 @@ +________________________________ Kubernetes resources for namespace: myoidc-app-ns ___________________________________________ +NAME READY STATUS RESTARTS AGE +pod/keycloak-oidc-deployment-79b66584d5-f5772 1/1 Running 0 3d3h +pod/quarkus-oidc-auth-sample-production-6d7f789569-5zxmt 1/1 Running 0 27h +pod/angular-oidc-auth-sample-production-pod-66d7fd795b-gjx2q 1/1 Running 0 6s + +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +service/keycloak-oidc-service LoadBalancer 10.43.33.116 141.75.148.138,141.75.148.139,141.75.148.140 8285:30444/TCP 3d3h +service/quarkus-oidc-auth-sample-production ClusterIP 10.43.245.47 <none> 80/TCP 27h +service/angular-oidc-auth-sample-production-svc ClusterIP 10.43.162.33 <none> 9604/TCP 6s + +NAME READY UP-TO-DATE AVAILABLE AGE +deployment.apps/keycloak-oidc-deployment 1/1 1 1 3d3h +deployment.apps/quarkus-oidc-auth-sample-production 1/1 1 1 27h +deployment.apps/angular-oidc-auth-sample-production-pod 1/1 1 1 6s + +NAME DESIRED CURRENT READY AGE +replicaset.apps/keycloak-oidc-deployment-79b66584d5 1 1 1 3d3h +replicaset.apps/quarkus-oidc-auth-sample-production-6d7f789569 1 1 1 27h +replicaset.apps/angular-oidc-auth-sample-production-pod-66d7fd795b 1 1 1 6s diff --git a/deployments/ir_angular_app.yaml b/deployments/ir_angular_app.yaml new file mode 100644 index 0000000..0c0078f --- /dev/null +++ b/deployments/ir_angular_app.yaml @@ -0,0 +1,27 @@ +apiVersion: traefik.containo.us/v1alpha1 +kind: Middleware +metadata: + name: oidc-strip-path-prefix +spec: + stripPrefix: + prefixes: + - /oidcapp +--- +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute +metadata: + name: ingressroute-nginx +spec: + entryPoints: + - websecure + tls: + secretName: kube-master-h1-tls-cert + routes: + - match: Host(`kube-master-h1.informatik.fh-nuernberg.de`) && PathPrefix(`/`) + kind: Rule + services: + - name: staging-oidc-autologin-svc + port: 9604 + + + -- GitLab