Skip to content

Commit d1297b7

Browse files
Small fixes, infra and gitter script
1 parent d437139 commit d1297b7

File tree

3 files changed

+66
-3
lines changed

3 files changed

+66
-3
lines changed

setup_gitter.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
#
4+
export workshopNamespace=workshop
5+
export gitterRoom="ContainerSolutions/warsaw-workshop"
6+
7+
echo "Import gitter keys from gitter.env"
8+
source gitter.env
9+
echo "Create secrets"
10+
kubectl create secret generic gitter \
11+
--from-literal=GITTER_OAUTH_KEY=$GITTER_OAUTH_KEY \
12+
--from-literal=GITTER_OAUTH_SECRET=$GITTER_OAUTH_SECRET
13+
14+
curl -sL https://raw.githubusercontent.com/lalyos/gitter-scripter/master/gitter-template.yaml \
15+
| envsubst \
16+
| kubectl apply -f -
17+
18+
kubectl patch deployments gitter --patch '{"spec":{"template":{"spec":{"$setElementOrder/containers":[{"name":"gitter"}],"containers":[{"$setElementOrder/env":[{"name":"GITTER_ROOM_NAME"},{"name":"DOMAIN"}],"env":[{"name":"GITTER_ROOM_NAME","value":"'${gitterRoom}'"}],"name":"gitter"}]}}}}'
19+

setup_infra.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
PROJECT_ID=${PROJECT_ID:-"container-solutions-workshops"}
2+
CLUSTER_NAME=${CLUSTER_NAME:-"workshop"}
3+
ZONE=${ZONE:-"europe-west3-b"}
4+
5+
gcloud beta container \
6+
--project "${PROJECT_ID}" \
7+
clusters create "${CLUSTER_NAME}" \
8+
--zone "${ZONE}" \
9+
--username "admin" \
10+
--machine-type "n1-standard-4" \
11+
--image-type "UBUNTU" \
12+
--disk-type "pd-standard" \
13+
--disk-size "100" \
14+
--metadata disable-legacy-endpoints=true \
15+
--scopes "https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append" \
16+
--num-nodes "3" \
17+
--enable-cloud-logging \
18+
--enable-cloud-monitoring \
19+
--no-enable-ip-alias \
20+
--network "projects/container-solutions-workshops/global/networks/default" \
21+
--addons HorizontalPodAutoscaling \
22+
--no-enable-autoupgrade \
23+
--enable-autorepair
24+
#cloud beta container \
25+
# --project "container-solutions-workshops" \
26+
# node-pools create "pool-1" \
27+
# --cluster "workshop" \
28+
# --machine-type "n1-standard-2" \
29+
# --image-type "UBUNTU" \
30+
# --disk-type "pd-standard" \
31+
# --disk-size "100" \
32+
# --metadata disable-legacy-endpoints=true \
33+
# --scopes "https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append" \
34+
# --preemptible \
35+
# --num-nodes "3" \
36+
# --no-enable-autoupgrade \
37+
# --enable-autorepairi \
38+
# --zone "europe-west3-b"

workshop-functions.sh

100644100755
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ rules:
3232
- jobs
3333
- cronjobs
3434
verbs: ["*"]
35+
- apiGroups: ["networking.istio.io"]
36+
resources:
37+
- virtualservices
38+
- gateways
39+
- destinationrules
40+
verbs: ["*"]
3541
- apiGroups: ["rbac.authorization.k8s.io"]
3642
resources:
3743
- roles
@@ -105,7 +111,7 @@ namespace() {
105111
kubectl label clusterrolebinding crb-cc-${namespace} user=${namespace}
106112

107113
kubectl create clusterrolebinding crb-ssh-${namespace} --clusterrole=sshreader --serviceaccount=${workshopNamespace}:sa-${namespace}
108-
kubectl label clusterrolebinding crb-ssh-${namespace} user=${namespace}
114+
kubectl label clusterrolebinding crb-ssh-${namespace} user=${namespace}
109115
}
110116

111117
enable-namespaces() {
@@ -130,7 +136,7 @@ depl() {
130136
: ${namespace:? required}
131137
: ${gitrepo:? required}
132138
: ${sessionSecret:=cloudnative1337}
133-
139+
134140
local name=${namespace}
135141

136142
cat <<EOF
@@ -412,7 +418,7 @@ EOF
412418
ingressip=$(kubectl get svc -n ingress-nginx ingress-nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
413419

414420
echo "---> checking DNS A record (*.${domain}) points to: $ingressip ..."
415-
if [[ $(dig +short "*.${domain}") == $ingressip ]] ; then
421+
if [[ $(dig +short "*.${domain}") == $ingressip ]] ; then
416422
echo "DNS setting are ok"
417423
else
418424
echo "---> set external dns A record (*.${domain}) to: $ingressip"

0 commit comments

Comments
 (0)