Skip to content

Commit

Permalink
Merge pull request #16 from natrontech/fix-ingress
Browse files Browse the repository at this point in the history
fix: make agenthost dynamic
  • Loading branch information
janlauber authored Aug 4, 2023
2 parents 52b90f2 + 6a550cc commit 0e4d06b
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 11 deletions.
3 changes: 2 additions & 1 deletion deploy/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
name: kubelab-config
data:
KUBELAB_AGENT_IMAGE: ghcr.io/natrontech/kubelab-agent:latest
ALLOWED_HOSTS: kubelab.swisscom.k8s.natron.cloud
ALLOWED_HOSTS: kubelab.natr-demo.k8s.natron.cloud
PODS_LIMIT: "70"
STORAGE_LIMIT: "50Gi"
AGENT_INGRESS_CLASS: nginx-external
10 changes: 8 additions & 2 deletions deploy/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ metadata:
name: kubelab-ingress
namespace: kubelab
annotations:
# cert-manager.io/cluster-issuer: letsencrypt-prod-natron-cloud
cert-manager.io/private-key-rotation-policy: Always
ingress.kubernetes.io/force-ssl-redirect: "true"
spec:
ingressClassName: nginx
ingressClassName: nginx-external
rules:
- host: kubelab.swisscom.k8s.natron.cloud
- host: kubelab.natr-demo.k8s.natron.cloud
http:
paths:
- pathType: Prefix
Expand All @@ -18,3 +20,7 @@ spec:
name: kubelab-service
port:
number: 8090
# tls:
# - hosts:
# - kubelab.natr-demo.k8s.natron.cloud
# secretName: kubelab-tls
2 changes: 1 addition & 1 deletion deploy/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ spec:
resources:
requests:
storage: 10Gi
storageClassName: hcloud-volumes
storageClassName: nfs-data
6 changes: 3 additions & 3 deletions kubelab-fill/.env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export LABS_UPLOAD_URL=https://kubelab.swisscom.k8s.natron.cloud/api/collections/labs/records
export USER_UPLOAD_URL=https://kubelab.swisscom.k8s.natron.cloud/api/collections/users/records
export EXERCISES_UPLOAD_URL=https://kubelab.swisscom.k8s.natron.cloud/api/collections/exercises/records
export LABS_UPLOAD_URL=https://kubelab.natr-demo.k8s.natron.cloud/api/collections/labs/records
export USER_UPLOAD_URL=https://kubelab.natr-demo.k8s.natron.cloud/api/collections/users/records
export EXERCISES_UPLOAD_URL=https://kubelab.natr-demo.k8s.natron.cloud/api/collections/exercises/records
export URL_PREFIX=https://raw.githubusercontent.com/natrontech/kubelab-workshops/main/kubernetes-basics/
export WORSHOP_DIR_PATH=/Users/janlauber/code/github.com/natrontech/kubelab-workshops/kubernetes-basics
export CSV_PATH=/Users/janlauber/code/github.com/natrontech/kubelab/kubelab-fill/example_users.csv
6 changes: 4 additions & 2 deletions kubelab-ui/src/lib/components/Console.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts">
import { page } from "$app/stores";
import { client } from "$lib/pocketbase";
import { layout_store } from "$lib/stores/layout_store";
import { terminal_size } from "$lib/stores/terminal";
Expand Down Expand Up @@ -68,8 +67,11 @@
const initializeWebSocket = () => {
const lab_session_id = window.location.pathname.split("/")[2];
const exercise_id = window.location.pathname.split("/")[3];
const agentHost = window.location.host;
agentUrl =
"kubelab.swisscom.k8s.natron.cloud/kubelab-" +
agentHost +
"/kubelab-" +
lab_session_id +
"-" +
exercise_id +
Expand Down
10 changes: 8 additions & 2 deletions kubelab-ui/src/routes/labs/[id]/[id]/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@
// if 500, then exercise is not completed
let lab_session_id = data.pathname.split("/")[2];
let exercise_id = window.location.pathname.split("/")[3];
let agentHost = window.location.host;
let agentUrl =
"kubelab.swisscom.k8s.natron.cloud/kubelab-" +
agentHost +
"/kubelab-" +
lab_session_id +
"-" +
exercise_id +
Expand Down Expand Up @@ -97,8 +100,11 @@
restartLoading = true;
let lab_session_id = data.pathname.split("/")[2];
let exercise_id = window.location.pathname.split("/")[3];
let agentHost = window.location.host;
let agentUrl =
"kubelab.swisscom.k8s.natron.cloud/kubelab-" +
agentHost +
"/kubelab-" +
lab_session_id +
"-" +
exercise_id +
Expand Down

0 comments on commit 0e4d06b

Please sign in to comment.