Signed-off-by: Nick Santos <nick.santos@docker.com>
This commit is contained in:
Nick Santos 2022-06-24 14:39:27 -04:00
Родитель fd265e79e6
Коммит ee90ec60cf
15 изменённых файлов: 184 добавлений и 5 удалений

Просмотреть файл

@ -3,6 +3,8 @@ orbs:
slack: circleci/slack@3.3.0
gcp-cli: circleci/gcp-cli@1.8.3
kubernetes: circleci/kubernetes@0.9.1
helm: circleci/helm@2.0.1
go: circleci/go@1.7.1
jobs:
test:
docker:
@ -12,23 +14,44 @@ jobs:
- run: go get -v ./...
- run: go vet .
- run: go install .
integration:
docker:
- image: docker/tilt:latest
steps:
- checkout
- helm/install-helm-client
- run: |
set -e
mkdir -p /usr/local/go
curl --fail --location -sS "https://dl.google.com/go/go1.18.3.linux-amd64.tar.gz" \
| tar --no-same-owner --strip-components=1 --gunzip -x -C /usr/local/go/
echo 'export PATH=$PATH:/usr/local/go/bin' >> $BASH_ENV
chown -R $(whoami) /usr/local/go
/usr/local/go/bin/go version
- setup_remote_docker:
version: 20.10.11
- run: ctlptl create cluster kind --registry=ctlptl-registry && tilt ci
deploy:
docker:
- image: cimg/go:1.18
steps:
- setup_remote_docker
- setup_remote_docker:
version: 20.10.11
- checkout
- gcp-cli/install
- gcp-cli/initialize
- kubernetes/install-kubectl
- helm/install-helm-client
- run:
name: Setup Kubernetes
command: gcloud container clusters get-credentials windmill
- run:
name: Setup Docker Credentials
command: gcloud auth configure-docker
- run: ./deploy.sh
- run: ./hack/deploy.sh
- slack/status
workflows:
@ -36,6 +59,9 @@ workflows:
test:
jobs:
- test
- integration:
requires:
- test
deploy:
jobs:
- deploy:

2
.gitignore поставляемый
Просмотреть файл

@ -13,3 +13,5 @@
# Dependency directories (remove the comment below to include it)
# vendor/
build/

4
Dockerfile Normal file
Просмотреть файл

@ -0,0 +1,4 @@
FROM alpine
WORKDIR /app
ADD build build
ENTRYPOINT ./build/cloud-tilt-dev

17
Tiltfile Normal file
Просмотреть файл

@ -0,0 +1,17 @@
local_resource(
'build', './hack/build.sh')
docker_build(
'cloud-tilt-dev', '.')
k8s_yaml(
helm('./chart',
name='cloud-tilt-dev',
set=[
'imageName=cloud-tilt-dev',
'numReplicas=1',
]))
k8s_resource(
'snapshot-frontend',
port_forwards='10450:10450')

22
chart/.helmignore Normal file
Просмотреть файл

@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

5
chart/Chart.yaml Normal file
Просмотреть файл

@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: chart
version: 0.1.0

Просмотреть файл

Просмотреть файл

@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "chart.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "chart.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "chart.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

Просмотреть файл

@ -0,0 +1,31 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: snapshot-frontend
namespace: {{ .Values.namespace }}
labels:
app: snapshot-frontend
spec:
replicas: {{ .Values.numReplicas }}
selector:
matchLabels:
app: snapshot-frontend
template:
metadata:
labels:
app: snapshot-frontend
spec:
containers:
- name: snapshot-frontend
image: {{ .Values.imageName }}
ports:
- containerPort: 10450
readinessProbe:
httpGet:
path: /healthz
port: 10450
initialDelaySeconds: 5
periodSeconds: 5
resources:
requests:
cpu: 10m

Просмотреть файл

@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: snapshot-frontend
namespace: {{ .Values.namespace }}
labels:
app: snapshot-frontend
spec:
type: NodePort
ports:
- port: 80
targetPort: 10450
protocol: TCP
selector:
app: snapshot-frontend

3
chart/values.yaml Normal file
Просмотреть файл

@ -0,0 +1,3 @@
imageName: gcr.io/windmill-prod/cloud-tilt-dev
namespace: default
numReplicas: 3

4
hack/build.sh Executable file
Просмотреть файл

@ -0,0 +1,4 @@
#!/bin/bash
cd $(dirname $(dirname $0))
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o build/cloud-tilt-dev ./

17
hack/deploy.sh Normal file
Просмотреть файл

@ -0,0 +1,17 @@
#!/bin/bash
# Deploys cloud.tilt.dev
cd $(dirname $(dirname $0))
set -ex
./hack/build.sh
TODAY=$(date +"%Y-%m-%d")
SECONDS=$(date +"%s")
TAG="$TODAY-$SECONDS"
docker build -t "gcr.io/windmill-prod/cloud-tilt-dev:$TAG" .
docker push "gcr.io/windmill-prod/cloud-tilt-dev:$TAG"
helm upgrade --install cloud-tilt-dev ./chart \
--set "imageName=gcr.io/windmill-prod/cloud-tilt-dev:$TAG"

Просмотреть файл

@ -46,8 +46,8 @@ func NewRouter() *Router {
func main() {
http.Handle("/", NewRouter())
log.Println("Serving on port 8000")
err := http.ListenAndServe(":8000", nil)
log.Println("Serving on port 10450")
err := http.ListenAndServe(":10450", nil)
if err != nil {
log.Fatalf("Server exited with: %v", err)
}

Просмотреть файл

@ -48,7 +48,7 @@ fill="#fff"></path>
<h1 class="sc-lcepkR eFtqJS">How to Migrate off Tilt Cloud</h1>
</section>
<div class="sc-clIzBv eMwiRD">
<section class="sc-Galmp grGmty">
<section class="sc-Galmp grGmty" style="margin-bottom: 50px">
<header class="sc-fWCJzd iFUJko">
<h2 class="sc-dvQaRk imqCZO">Update for all Tilt Users</h2>
<h3 class="sc-TBWPX hfGyPt">June 24, 2022</h3>