Skip to content

Changes to zones and spinnaker install #184

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

Merged
merged 18 commits into from
Jun 14, 2018
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
24 changes: 9 additions & 15 deletions bootcamps/advancedk8s/dm-setup/student-vm-startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ for CLUSTER_INFO in ${WORKLOAD_CLUSTERS}; do

# Get credentials for setting client as admin
gcloud container clusters get-credentials ${CLUSTER_INFO_ARRAY[0]} --zone ${CLUSTER_INFO_ARRAY[1]}
export PROJECT=$(gcloud info --format='value(config.project)')
kubectx gke-${CLUSTER_INFO_ARRAY[1]:3:-3}="gke_"$PROJECT"_"${CLUSTER_INFO_ARRAY[1]}_${CLUSTER_INFO_ARRAY[0]}
kubectl create clusterrolebinding client-cluster-admin-binding --clusterrole=cluster-admin --user=client
# Needed for Spinnaker to be able to authenticate to the API
export CLOUDSDK_CONTAINER_USE_CLIENT_CERTIFICATE=True
Expand Down Expand Up @@ -129,6 +131,8 @@ SPINNAKER_CLUSTERS=$(gcloud container clusters list --format 'csv[no-heading](na
for CLUSTER_INFO in ${SPINNAKER_CLUSTERS}; do
CLUSTER_INFO_ARRAY=(${CLUSTER_INFO//,/ })
gcloud container clusters get-credentials ${CLUSTER_INFO_ARRAY[0]} --zone ${CLUSTER_INFO_ARRAY[1]}
export PROJECT=$(gcloud info --format='value(config.project)')
kubectx gke-spinnaker="gke_"$PROJECT"_"${CLUSTER_INFO_ARRAY[1]}_${CLUSTER_INFO_ARRAY[0]}
kubectl apply -f tiller-rbac.yaml
helm init --service-account tiller
# Wait for tiller to be running
Expand All @@ -148,10 +152,10 @@ for CLUSTER_INFO in ${SPINNAKER_CLUSTERS}; do
gsutil mb -c regional -l us-central1 gs://${BUCKET}

# Use upstream once this PR is merged: https://github.com/kubernetes/charts/pull/5456
git clone https://github.com/viglesiasce/charts -b mcs
pushd charts/stable/spinnaker
helm dep build
popd
# git clone https://github.com/viglesiasce/charts -b mcs
# pushd charts/stable/spinnaker
# helm dep build
# popd

kubectl create secret generic --from-file=config=${HOME}/.kube/config my-kubeconfig

Expand All @@ -169,7 +173,6 @@ gcs:
enabled: true
project: ${PROJECT}
jsonKey: '${SA_JSON}'

# Disable minio the default
minio:
enabled: false
Expand All @@ -186,14 +189,5 @@ accounts:
password: '${SA_JSON}'
email: [email protected]
EOF
helm install -n adv-k8s charts/stable/spinnaker -f spinnaker-config.yaml --timeout 600

export GKE_EAST=$(gcloud container clusters list --zone us-east4-b --format='value(name)')
export GKE_CENTRAL=$(gcloud container clusters list --zone us-central1-f --format='value(name)')
export GKE_SPINNAKER=$(gcloud container clusters list --zone us-central1-f --format='value(name)')
export PROJECT=$(gcloud info --format='value(config.project)')
kubectx gke-spinnaker="gke_"$PROJECT"_us-central1-f_"$GKE_SPINNAKER
kubectx gke-east="gke_"$PROJECT"_us-east4-b_"$GKE_EAST
kubectx gke-central="gke_"$PROJECT"_us-central1-f_"$GKE_CENTRAL

helm install -n adv-k8s stable/spinnaker -f spinnaker-config.yaml --timeout 600
done
6 changes: 3 additions & 3 deletions bootcamps/advancedk8s/dm-setup/workshop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ imports:
resources:
- name: iam
type: iam.jinja
- name: west
- name: central
type: cluster.jinja
properties:
location: us-west1-c
location: us-central1-f
purpose: workloads
apiVersion: v1beta1
kubernetesVersion: "1.10"
Expand Down Expand Up @@ -52,4 +52,4 @@ resources:
- east
- west
properties:
zone: us-central11-f
zone: us-central1-f
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ kind: "Ingress"
metadata:
annotations:
kubernetes.io/ingress.class: "istio"
name: "myapp-gke-west-ingress"
name: "myapp-gke-central-ingress"
namespace: "default"
spec:
backend:
serviceName: "myapp-gke-west-lb"
serviceName: "myapp-gke-central-lb"
servicePort: 80
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: "v1"
kind: "Service"
metadata:
name: "myapp-gke-west-lb"
name: "myapp-gke-central-lb"
namespace: "default"
spec:
ports:
Expand All @@ -11,6 +11,6 @@ spec:
protocol: "TCP"
targetPort: 80
selector:
load-balancer-myapp-gke-west-lb: "true"
load-balancer-myapp-gke-central-lb: "true"
sessionAffinity: "None"
type: "NodePort"
2 changes: 1 addition & 1 deletion bootcamps/advancedk8s/module-2/lb/myapp-rr-100c.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: myapp-routerules-100p
spec:
destination:
name: myapp-gke-west-lb
name: myapp-gke-central-lb
domain: svc.cluster.local
route:
- labels:
Expand Down
2 changes: 1 addition & 1 deletion bootcamps/advancedk8s/module-2/lb/myapp-rr-100p.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: myapp-routerules-100p
spec:
destination:
name: myapp-gke-west-lb
name: myapp-gke-central-lb
domain: svc.cluster.local
route:
- labels:
Expand Down
2 changes: 1 addition & 1 deletion bootcamps/advancedk8s/module-2/lb/myapp-rr-95p-5c.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: myapp-routerules-5050
spec:
destination:
name: myapp-gke-west-lb
name: myapp-gke-central-lb
domain: svc.cluster.local
route:
- labels:
Expand Down
4 changes: 2 additions & 2 deletions bootcamps/advancedk8s/module-2/lb/rl100.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
# The following override applies to 'ratings' when
# the source is 'reviews'.
- dimensions:
destination: myapp-gke-west-lb
destination: myapp-gke-central-lb
maxAmount: 1
validDuration: 1s
---
Expand Down Expand Up @@ -62,5 +62,5 @@ spec:
- name: request-count
namespace: default
services:
- name: myapp-gke-west-lb
- name: myapp-gke-central-lb
namespace: default
4 changes: 2 additions & 2 deletions bootcamps/advancedk8s/module-2/lb/rl50.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
# The following override applies to 'ratings' when
# the source is 'reviews'.
- dimensions:
destination: myapp-gke-west-lb
destination: myapp-gke-central-lb
maxAmount: 1
validDuration: 1s
---
Expand Down Expand Up @@ -62,5 +62,5 @@ spec:
- name: request-count
namespace: default
services:
- name: myapp-gke-west-lb
- name: myapp-gke-central-lb
namespace: default
32 changes: 16 additions & 16 deletions bootcamps/advancedk8s/module-2/spinnaker/pipeline.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
{
"clusters": [
{
"account": "gke_PROJECT_ZONE_WEST_GKE_WEST",
"account": "gke_PROJECT_ZONE_ONE_GKE_ONE",
"application": "myapp",
"cloudProvider": "kubernetes",
"containers": [
{
"args": [
"-name=myapp-canary-gke-west-$(VOLUME)"
"-name=myapp-canary-gke-central-$(VOLUME)"
],
"command": [],
"envFrom": [],
Expand Down Expand Up @@ -61,14 +61,14 @@
"revisionHistoryLimit": 2
},
"dnsPolicy": "ClusterFirst",
"freeFormDetails": "gke-west",
"freeFormDetails": "gke-central",
"initContainers": [],
"interestingHealthProviderNames": [
"KubernetesContainer",
"KubernetesPod"
],
"loadBalancers": [
"myapp-gke-west-lb"
"myapp-gke-central-lb"
],
"namespace": "default",
"nodeSelector": {},
Expand All @@ -86,15 +86,15 @@
"volumeSources": []
}
],
"name": "Deploy Canary to GKE-West Cluster",
"name": "Deploy Canary to GKE-Central Cluster",
"refId": "1",
"requisiteStageRefIds": [],
"type": "deploy"
},
{
"clusters": [
{
"account": "gke_PROJECT_ZONE_EAST_GKE_EAST",
"account": "gke_PROJECT_ZONE_TWO_GKE_TWO",
"application": "myapp",
"cloudProvider": "kubernetes",
"containers": [
Expand Down Expand Up @@ -176,7 +176,7 @@
"type": "deploy"
},
{
"account": "gke_PROJECT_ZONE_WEST_GKE_WEST",
"account": "gke_PROJECT_ZONE_ONE_GKE_ONE",
"annotations": {
"sidecar.istio.io/inject": "false"
},
Expand All @@ -188,7 +188,7 @@
"args": [],
"command": [
"curl",
"http://myapp-gke-west-lb:80"
"http://myapp-gke-central-lb:80"
],
"envFrom": [],
"envVars": [],
Expand All @@ -215,7 +215,7 @@
],
"dnsPolicy": "ClusterFirst",
"labels": {},
"name": "Test Canary on GKE-West",
"name": "Test Canary on GKE-Central",
"namespace": "default",
"refId": "3",
"requisiteStageRefIds": [
Expand All @@ -224,7 +224,7 @@
"type": "runJob"
},
{
"account": "gke_PROJECT_ZONE_EAST_GKE_EAST",
"account": "gke_PROJECT_ZONE_TWO_GKE_TWO",
"annotations": {
"sidecar.istio.io/inject": "false"
},
Expand Down Expand Up @@ -287,13 +287,13 @@
{
"clusters": [
{
"account": "gke_PROJECT_ZONE_WEST_GKE_WEST",
"account": "gke_PROJECT_ZONE_ONE_GKE_ONE",
"application": "myapp",
"cloudProvider": "kubernetes",
"containers": [
{
"args": [
"-name=myapp-prod-gke-west-$(VOLUME)"
"-name=myapp-prod-gke-central-$(VOLUME)"
],
"command": [],
"envFrom": [],
Expand Down Expand Up @@ -338,14 +338,14 @@
"revisionHistoryLimit": 2
},
"dnsPolicy": "ClusterFirst",
"freeFormDetails": "gke-west",
"freeFormDetails": "gke-central",
"initContainers": [],
"interestingHealthProviderNames": [
"KubernetesContainer",
"KubernetesPod"
],
"loadBalancers": [
"myapp-gke-west-lb"
"myapp-gke-central-lb"
],
"namespace": "default",
"nodeSelector": {},
Expand All @@ -363,7 +363,7 @@
"volumeSources": []
}
],
"name": "Deploy on GKE-West Production",
"name": "Deploy on GKE-Central Production",
"refId": "6",
"requisiteStageRefIds": [
"5"
Expand All @@ -373,7 +373,7 @@
{
"clusters": [
{
"account": "gke_PROJECT_ZONE_EAST_GKE_EAST",
"account": "gke_PROJECT_ZONE_TWO_GKE_TWO",
"application": "myapp",
"cloudProvider": "kubernetes",
"containers": [
Expand Down