Skip to content
Snippets Groups Projects
Commit 5b7b1c2a authored by Jason Zaman's avatar Jason Zaman
Browse files

Migrate to new GCP project for RBE


Signed-off-by: default avatarJason Zaman <jason@perfinion.com>
parent 342bfb53
No related branches found
No related tags found
No related merge requests found
......@@ -11,11 +11,23 @@ kubectl apply -f namespace.yaml
kubectl apply -f role-admin.yaml
kubectl apply -f role-webhook.yaml
# Add GitHub webhook validator for trigger event-listener
kubectl apply -f webhook-deployment.yaml
# Tasks for tf/build repo
kubectl apply -f build-tasks.yaml
kubectl apply -f build-pipeline.yaml
# Initial cluster setup should not apply build-triggers.
# Tne trigger event listener needs the validator image
# built first so kick off a PipelineRun to build everything,
# then apply the webhook and triggers later
if [[ $1 == "--install" ]]; then
# PipelineRun to build the linxcpu build image and webhook validator
kubectl apply -f build-pipeline-run.yaml
else
# Add GitHub webhook validator for trigger event-listener
kubectl apply -f webhook-deployment.yaml
# Triggers and ingress for GitHub webhook
kubectl apply -f build-triggers.yaml
fi
---
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: repo-perfinion-build
namespace: sig-build
spec:
type: git
params:
- name: revision
value: master
- name: url
value: https://github.com/perfinion/build.git
---
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: image-linuxcpu
namespace: sig-build
spec:
type: image
params:
- name: url
value: gcr.io/tensorflow-build-224104/tensorflow-build/linux/cpu:latest
---
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: image-webhook
namespace: sig-build
spec:
type: image
params:
- name: url
value: gcr.io/tensorflow-build-224104/tensorflow-build/webhook:latest
---
apiVersion: tekton.dev/v1alpha1
kind: PipelineRun
metadata:
name: build-pipeline-run
namespace: sig-build
spec:
pipelineRef:
name: build-pipeline
serviceAccountName: kaniko-push
resources:
- name: source-repo
resourceRef:
name: repo-perfinion-build
- name: image-webhook
resourceRef:
name: image-webhook
- name: image-linuxcpu
resourceRef:
name: image-linuxcpu
---
......@@ -46,7 +46,7 @@ spec:
type: image
params:
- name: url
value: gcr.io/perfinion/$(params.git-repo-owner)-$(params.git-repo-name)/webhook:latest
value: gcr.io/tensorflow-build-224104/$(params.git-repo-owner)-$(params.git-repo-name)/webhook:latest
- apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
......@@ -57,7 +57,7 @@ spec:
type: image
params:
- name: url
value: gcr.io/perfinion/$(params.git-repo-owner)-$(params.git-repo-name)/linux/cpu:latest
value: gcr.io/tensorflow-build-224104/$(params.git-repo-owner)-$(params.git-repo-name)/linux/cpu:latest
- apiVersion: tekton.dev/v1alpha1
kind: PipelineRun
......
#!/bin/bash
: ${PROJECT:=perfinion}
: ${PROJECT:=tensorflow-build-224104}
: ${CLUSTER_NAME:=tf-build-dev}
: ${CLUSTER_REGION:=us-central1}
: ${CLUSTER_ZONE:=${CLUSTER_REGION}-a}
: ${TKN_PIPELINE_VERSION:=v0.9.0}
: ${TKN_TRIGGERS_VERSION:=v0.1.0}
: ${TKN_DASHBOARD_VERSION:=v0.4.0}
# Check if cluster is running
gcloud container clusters describe ${CLUSTER_NAME} --zone=${CLUSTER_ZONE}
gcloud container clusters describe ${CLUSTER_NAME} --project=${PROJECT} --zone=${CLUSTER_ZONE} >/dev/null
if [[ $? -eq 1 ]]; then
echo "ERROR: GKE cluster does not exist" >&2
echo "" >&2
......@@ -20,25 +21,24 @@ if [[ $? -eq 1 ]]; then
echo "Quitting ..." >&2
exit 1
fi
fi
set -e
# Create GKE cluster
gcloud container clusters create ${CLUSTER_NAME} \
gcloud beta container clusters create ${CLUSTER_NAME} \
--project ${PROJECT} \
--zone ${CLUSTER_ZONE} \
--no-enable-basic-auth \
--cluster-version "1.13.11-gke.14" \
--machine-type "n1-standard-1" \
--release-channel "regular" \
--machine-type "n1-standard-2" \
--num-nodes "1" \
--image-type "COS" \
--disk-type "pd-standard" \
--disk-size "100" \
--metadata disable-legacy-endpoints=true \
--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" \
--enable-cloud-logging \
--enable-cloud-monitoring \
--enable-stackdriver-kubernetes \
--enable-vertical-pod-autoscaling \
--enable-ip-alias \
--network "projects/${PROJECT}/global/networks/default" \
--subnetwork "projects/${PROJECT}/regions/${CLUSTER_REGION}/subnetworks/default" \
......@@ -52,14 +52,26 @@ kubectl create clusterrolebinding cluster-admin-binding \
--clusterrole=cluster-admin \
--user=$(gcloud config get-value core/account)
fi
set -e
# get creds for kubectl
gcloud container clusters get-credentials ${CLUSTER_NAME} --project=${PROJECT} --zone=${CLUSTER_ZONE}
# Install tekton pipelines on new cluster
kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/previous/${TKN_PIPELINE_VERSION}/release.yaml
# Install tekton triggers on new cluster
kubectl apply -f https://storage.googleapis.com/tekton-releases/triggers/previous/${TKN_TRIGGERS_VERSION}/release.yaml
# Install tekton dashboard
kubectl apply -f https://storage.googleapis.com/tekton-releases/dashboard/previous/${TKN_DASHBOARD_VERSION}/release.yaml
# New cluster should have a 'tekton-pipelines' namespace and several tekton pods
kubectl get pods --all-namespaces
# Create sig-build namespace first
kubectl apply -f namespace.yaml
# Apply all the configs except triggers
# Trigger needs the validator service image built first
./apply.sh --install
......@@ -10,3 +10,14 @@ spec:
finalizers:
- kubernetes
---
apiVersion: v1
kind: Namespace
metadata:
name: tensorflow
spec:
finalizers:
- kubernetes
......@@ -24,7 +24,7 @@ spec:
spec:
containers:
- name: webhook-validator
image: gcr.io/perfinion/tensorflow-build/webhook:latest
image: gcr.io/tensorflow-build-224104/tensorflow-build/webhook:latest
imagePullPolicy: IfNotPresent
ports:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment