-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from DownUnderCTF/update/2023
2023 Update
- Loading branch information
Showing
15 changed files
with
516 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
|
||
|
||
kube-janitor: | ||
quota: | ||
limits: | ||
|
@@ -33,19 +32,21 @@ landing: | |
requests: | ||
cpu: 50m | ||
memory: 256Mi | ||
|
||
domain: | ||
challenges: chal.example.com | ||
management: management.example.com | ||
|
||
# google project ID | ||
googleProject: example | ||
googleRegion: australia-southeast1 | ||
googleRepositoryName: example | ||
|
||
cert: | ||
email: [email protected] | ||
cfDNSToken: example | ||
|
||
# Don't change these unless you know what you're doing | ||
challengeNamespaces: | ||
- challenges | ||
- challenges-isolated | ||
- challenges | ||
- challenges-isolated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,62 +4,17 @@ | |
source `dirname "$0"`"/util" | ||
|
||
PROJECT_ID=`gcloud config get-value project` | ||
APPENGINE_REGION=`gcloud app describe | grep -oP '^locationId: \K[\da-z-]+'` | ||
BASE_DOMAIN="example.com" | ||
KUBECTF_NAMESPACE="kubectf" | ||
# ADMIN_EMAIL="[email protected]" | ||
|
||
|
||
# ask the questions | ||
CLUSTER_NAME=`ask_with_default "Cluster name" ""` | ||
APPENGINE_REGION=`ask_with_default "App Engine Region" "$APPENGINE_REGION"` | ||
KUBECTF_NAMESPACE=`ask_with_default "KubeCTF Instance (should be the same as in values.yaml)" "$KUBECTF_NAMESPACE"` | ||
SERVICE_ACCOUNT_CHALLENGE_MANAGER="gke-challenge-manager" | ||
# BASE_DOMAIN=`ask_with_default "Base Domain" "$BASE_DOMAIN"` | ||
# ADMIN_EMAIL=`ask_with_default "Admin Email Address" "$ADMIN_EMAIL"` | ||
|
||
# # clean up old dir | ||
# rm -rf services/ | ||
|
||
# # generate configs | ||
# for file in `find service-templates/ -type f -name "*.yml"` | ||
# do | ||
# new_file="services/"`echo "$file" | cut -d'/' -f2-` | ||
# mkdir -p `dirname "$new_file"` | ||
# envsubst < "$file" > "$new_file" | ||
# done | ||
|
||
# # create datastore for deployment templates and create iam user | ||
gcloud app create --region="$APPENGINE_REGION" | ||
gcloud datastore databases create --region "$APPENGINE_REGION" | ||
|
||
gcloud iam service-accounts create "$SERVICE_ACCOUNT_CHALLENGE_MANAGER" | ||
|
||
gcloud projects add-iam-policy-binding "$PROJECT_ID" \ | ||
--member="serviceAccount:$SERVICE_ACCOUNT_CHALLENGE_MANAGER@$PROJECT_ID.iam.gserviceaccount.com" \ | ||
--role=roles/datastore.viewer | ||
|
||
gcloud iam service-accounts add-iam-policy-binding \ | ||
--role roles/iam.workloadIdentityUser \ | ||
--member "serviceAccount:$PROJECT_ID.svc.id.goog[$KUBECTF_NAMESPACE-management/challenge-manager]" \ | ||
"$SERVICE_ACCOUNT_CHALLENGE_MANAGER@$PROJECT_ID.iam.gserviceaccount.com" | ||
|
||
|
||
# create namespaces | ||
kubectl create namespace traefik | ||
kubectl label namespace cert-manager app.kubernetes.io/name=cert-manager | ||
kubectl label namespace traefik app.kubernetes.io/name=traefik | ||
|
||
# install helm stuff | ||
helm repo add jetstack https://charts.jetstack.io | ||
helm repo add traefik https://helm.traefik.io/traefik | ||
helm repo update | ||
|
||
# install the proxification stuff | ||
helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace \ | ||
--version v1.9.1 \ | ||
--set installCRDs=true | ||
helm install traefik traefik/traefik \ | ||
--namespace traefik \ | ||
--create-namespace \ | ||
--set "deployment.kind=DaemonSet,providers.kubernetesCRD.allowCrossNamespaces=true,logs.general.level=INFO,service.spec.externalTrafficPolicy=Local" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
source `dirname "$0"`"/util" | ||
|
||
PROJECT_ID=`gcloud config get-value project` | ||
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_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" | ||
|
||
|
||
gcloud builds submit ./services/challenge-manager/ \ | ||
--config ./services/challenge-manager/cloudbuild.yaml \ | ||
--region ${REPO_LOCATION} \ | ||
--async | ||
gcloud builds submit ./services/landing/ \ | ||
--config ./services/landing/cloudbuild.yaml \ | ||
--region ${REPO_LOCATION} \ | ||
--async |
Oops, something went wrong.