Skip to content
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
5 changes: 3 additions & 2 deletions chart/templates/challenge-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
serviceAccountName: challenge-manager
containers:
- name: challenge-manager
image: {{ .Values.googleRegion }}-docker.pkg.dev/{{ .Values.googleProject }}/{{ .Values.googleRepositoryName }}/services/challenge-manager:latest
image: {{ .Values.googleRegion }}-docker.pkg.dev/{{ .Values.googleProject }}/{{ .Values.googleRepositoryName }}/challenge-manager:latest
readinessProbe:
httpGet:
port: 3000
Expand Down Expand Up @@ -70,7 +70,7 @@ spec:
ports:
- port: 3000
---
apiVersion: traefik.containo.us/v1alpha1
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: challenge-manager
Expand Down Expand Up @@ -117,6 +117,7 @@ rules:
- namespaces
- secrets
- networkpolicies
- configmaps
verbs:
- create
- delete
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/landing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
automountServiceAccountToken: false
containers:
- name: web
image: {{ .Values.googleRegion }}-docker.pkg.dev/{{ .Values.googleProject }}/{{ .Values.googleRepositoryName }}/services/landing:latest
image: {{ .Values.googleRegion }}-docker.pkg.dev/{{ .Values.googleProject }}/{{ .Values.googleRepositoryName }}/landing:latest
resources:
{{ toYaml (index .Values "landing").quota | indent 10 }}
ports:
Expand All @@ -40,7 +40,7 @@ spec:
- port: 80
---
# default ingressroute
apiVersion: traefik.containo.us/v1alpha1
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: landing
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/namespaces.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ metadata:
app.kubernetes.io/instance: {{ $relname }}
app.kubernetes.io/component: {{ . }}
---
apiVersion: traefik.containo.us/v1alpha1
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: secure-headers
Expand Down
6 changes: 3 additions & 3 deletions chart/templates/traefik.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- $relname := .Release.Name -}}
{{- range .Values.challengeNamespaces }}
apiVersion: traefik.containo.us/v1alpha1
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: hsts
Expand All @@ -12,7 +12,7 @@ spec:
stsIncludeSubdomains: true
---
{{- end }}
apiVersion: traefik.containo.us/v1alpha1
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: hsts
Expand All @@ -23,7 +23,7 @@ spec:
forceSTSHeader: true
stsIncludeSubdomains: true
---
apiVersion: traefik.containo.us/v1alpha1
apiVersion: traefik.io/v1alpha1
kind: TLSStore
metadata:
name: default
Expand Down
2 changes: 1 addition & 1 deletion scripts/cluster-configure
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PROJECT_ID=`gcloud config get-value project`
KUBECTF_NAMESPACE="kubectf"

# ask the questions
CLUSTER_NAME=`ask_with_default "Cluster name" ""`
CLUSTER_NAME=`ask_with_default "Cluster name" "ctf-cluster"`
KUBECTF_NAMESPACE=`ask_with_default "KubeCTF Instance (should be the same as in values.yaml)" "$KUBECTF_NAMESPACE"`
SERVICE_ACCOUNT_CHALLENGE_MANAGER="gke-challenge-manager"

Expand Down
2 changes: 1 addition & 1 deletion scripts/cluster-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -e
PROJECT_ID=`gcloud config get-value project`
CLUSTER_NAME="ctf-cluster"
CLUSTER_REGION="us-central1-a"
CLUSTER_VERSION="1.27.3-gke.100"
CLUSTER_VERSION="1.29.4-gke.1043002"
MACHINE_TYPE="e2-medium"
DISK_SIZE="30"
DISK_TYPE="pd-standard"
Expand Down
8 changes: 6 additions & 2 deletions scripts/cluster-install
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ helm install traefik traefik/traefik \
--create-namespace \
--values <(cat <<EOF
installCRDs: true
core:
defaultRuleSyntax: v2
deployment:
kind: DaemonSet
providers:
Expand All @@ -34,12 +36,14 @@ service:
ports:
blockchain:
port: 8545
expose: true
expose:
default: true
protocol: 'TCP'
exposedPort: 8545
tcpsecure:
port: 40000
expose: true
expose:
default: true
protocol: 'TCP'
exposedPort: 32000
tls:
Expand Down
30 changes: 23 additions & 7 deletions scripts/services-build
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,41 @@ REPO_NAME="ductf"
REPO_LOCATION="australia-southeast1"

PROJECT_ID=`ask_with_default "Project ID" "$PROJECT_ID"`
REPO_NAME=`ask_with_default "AR Repo Name" "$REPO_NAME"`
# REPO_NAME=`ask_with_default "AR Repo Name" "$REPO_NAME"`
REPO_LOCATION=`ask_with_default "AR Repo Location" "$REPO_LOCATION"`


gcloud services enable artifactregistry.googleapis.com
gcloud services enable cloudbuild.googleapis.com

# Create artifact registry repo
gcloud artifacts repositories create ${REPO_NAME} \
--repository-format=docker \
--location=${REPO_LOCATION} \
--description="registry for CTF related images"
# set +e
# Check if repo already exists
# gcloud artifacts repositories describe ${REPO_NAME} \
# --location=${REPO_LOCATION} \
# --project=${PROJECT_ID}

# set -e

# if [ $? -eq 1 ]
# then
# echo "Creating repo: ${REPO_NAME} in ${REPO_LOCATION}"
# # Create artifact registry repo
# gcloud artifacts repositories create ${REPO_NAME} \
# --repository-format=docker \
# --location=${REPO_LOCATION} \
# --project=${PROJECT_ID} \
# --description="registry for CTF related images"
# fi


gcloud builds submit ./services/challenge-manager/ \
--config ./services/challenge-manager/cloudbuild.yaml \
--region ${REPO_LOCATION} \
--async
--project=${PROJECT_ID} \
--async

gcloud builds submit ./services/landing/ \
--config ./services/landing/cloudbuild.yaml \
--region ${REPO_LOCATION} \
--project=${PROJECT_ID} \
--async
2 changes: 1 addition & 1 deletion services/challenge-manager/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ steps:
- id: build
name: 'gcr.io/kaniko-project/executor:latest'
args:
- --destination=$LOCATION-docker.pkg.dev/$PROJECT_ID/ductf/services/challenge-manager
- --destination=$LOCATION-docker.pkg.dev/$PROJECT_ID/infra/services/challenge-manager
- --cache=true
- --cache-ttl=168h
# - --context=dir://services/challenge-manager
2 changes: 1 addition & 1 deletion services/landing/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ steps:
- id: build
name: "gcr.io/kaniko-project/executor:latest"
args:
- --destination=$LOCATION-docker.pkg.dev/$PROJECT_ID/ductf/services/landing
- --destination=$LOCATION-docker.pkg.dev/$PROJECT_ID/infra/services/landing
- --cache=true
- --cache-ttl=168h
# - --context=dir://services/landing
7 changes: 5 additions & 2 deletions services/landing/public/subdomain.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

function checkChallengeReady() {
const host = window.location.origin;
fetch(host)
fetch(host, {cache: 'no-store'})
.then(res => {
if (res.status === 200) {
// Parse response text
Expand All @@ -17,7 +17,10 @@
location.reload(true)
}
})
} else { console.log("instance not ready")}
} else if (res.status < 500) {
location.reload(true)
}
else { console.log("instance not ready")}
})
.catch(e => console.error(e))
}
Expand Down
5 changes: 2 additions & 3 deletions templates/whoami/kube-isolated.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

apiVersion: kube-ctf.downunderctf.com/v1
kind: IsolatedChallenge
metadata:
Expand Down Expand Up @@ -71,7 +70,7 @@ spec:
- port: 80
name: port-80
---
apiVersion: traefik.containo.us/v1alpha1
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: ingress-ctf-{{ deployment_id }}
Expand All @@ -97,4 +96,4 @@ spec:
- name: secure-headers
services:
- name: ctf-{{ deployment_id }}
port: 80
port: 80
Loading