Skip to content

Commit

Permalink
feat: setup of temporary dataapps URL redirector for CSAS migration
Browse files Browse the repository at this point in the history
  • Loading branch information
kauf303 committed Sep 23, 2024
1 parent e275fc7 commit 419e2ea
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 0 deletions.
7 changes: 7 additions & 0 deletions provisioning/apps-proxy/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,10 @@ kubectl apply -f ./kubernetes/deploy/proxy/config-map.yaml
kubectl apply -f ./kubernetes/deploy/proxy/pdb.yaml
kubectl apply -f ./kubernetes/deploy/proxy/network-policy.yaml
kubectl apply -f ./kubernetes/deploy/proxy/deployment.yaml

# CSAS migration dataaps users redirector
export CSAS_MIGRATION_APPS_PROXY_REDIRECT_REPLICAS="${CSAS_MIGRATION_APPS_PROXY_REDIRECT_REPLICAS:=0}"
if [ "$CSAS_MIGRATION_APPS_PROXY_REDIRECT_REPLICAS" -gt 0 ]; then
kubectl apply -f ./kubernetes/deploy/nginx-redir/config-map.yaml
kubectl apply -f ./kubernetes/deploy/nginx-redir/deployment.yaml
fi
5 changes: 5 additions & 0 deletions provisioning/apps-proxy/kubernetes/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ envsubst < templates/proxy/pdb.yaml > deploy/proxy/pdb.yaml
envsubst < templates/proxy/network-policy.yaml > deploy/proxy/network-policy.yaml
envsubst < templates/proxy/deployment.yaml > deploy/proxy/deployment.yaml

# CSAS migration, without condition because it's trashed after build
envsubst < templates/nginx-redir/deployment.yaml > deploy/nginx-redir/deployment.yaml
# required NGINX configuration breaks ideal templating so skipping it
cat templates/nginx-redir/config-map.yaml > deploy/nginx-redir/config-map.yaml

# Remove resources requests/limits to fit all pods to the CI environment
REMOVE_RESOURCES_LIMITS="${REMOVE_RESOURCES_LIMITS:=false}"
if [[ "$REMOVE_RESOURCES_LIMITS" == "true" ]]; then
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-config
namespace: apps-proxy
data:
nginx.conf: |
events {
# Events block is needed
}
http {
server {
listen 8000;
server_name ~^(?<subdomain>.+)\.hub\.csas\.keboola\.cloud$;
location / {
return 302 https://$subdomain.hub.cs.keboola.cloud$request_uri;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-csas-redirector
namespace: $NAMESPACE
labels:
app: apps-proxy
spec:
replicas: $CSAS_MIGRATION_APPS_PROXY_REDIRECT_REPLICAS
selector:
matchLabels:
app: apps-proxy
template:
metadata:
labels:
app: apps-proxy
spec:
containers:
- name: nginx
image: nginx:latest
volumeMounts:
- name: nginx-config-volume
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
ports:
- containerPort: 8000
volumes:
- name: nginx-config-volume
configMap:
name: nginx-config

0 comments on commit 419e2ea

Please sign in to comment.