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

feat: setup of temporary dataapps URL redirector for CSAS migration #2031

Merged
merged 1 commit into from
Sep 23, 2024
Merged
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
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
Loading