From 9aeb362daa79fd5c101e31e7f805ecb5e1bca28a Mon Sep 17 00:00:00 2001
From: Ramiro Berrelleza
Date: Mon, 10 Aug 2020 21:30:46 -0700
Subject: [PATCH 1/4] develop on okteto
Signed-off-by: Ramiro Berrelleza
---
README.md | 5 +++++
okteto-pipelines.yaml | 3 +++
2 files changed, 8 insertions(+)
create mode 100644 okteto-pipelines.yaml
diff --git a/README.md b/README.md
index 358f868..db8c05c 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,11 @@
+
+
+
+
+
**Online Boutique** is a cloud-native microservices demo application.
diff --git a/okteto-pipelines.yaml b/okteto-pipelines.yaml
new file mode 100644
index 0000000..eaaf5f8
--- /dev/null
+++ b/okteto-pipelines.yaml
@@ -0,0 +1,3 @@
+icon: https://raw.githubusercontent.com/rberrelleza/microservices-demo/master/src/frontend/static/icons/Hipster_HeroLogoCyan.svg
+deploy:
+ - kubectl apply -f release/kubernetes-manifests.yaml
\ No newline at end of file
From 04269534755094c0aa3cdacae7445c0afd12fd73 Mon Sep 17 00:00:00 2001
From: Ramiro Berrelleza
Date: Mon, 10 Aug 2020 21:35:30 -0700
Subject: [PATCH 2/4] annotate service to create ingress
Signed-off-by: Ramiro Berrelleza
---
okteto-pipelines.yaml | 3 ++-
release/kubernetes-manifests.yaml | 13 -------------
2 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/okteto-pipelines.yaml b/okteto-pipelines.yaml
index eaaf5f8..ff5aa43 100644
--- a/okteto-pipelines.yaml
+++ b/okteto-pipelines.yaml
@@ -1,3 +1,4 @@
icon: https://raw.githubusercontent.com/rberrelleza/microservices-demo/master/src/frontend/static/icons/Hipster_HeroLogoCyan.svg
deploy:
- - kubectl apply -f release/kubernetes-manifests.yaml
\ No newline at end of file
+ - kubectl apply -f release/kubernetes-manifests.yaml
+ - kubectl annotate service frontend dev.okteto.com/auto-ingress=true
\ No newline at end of file
diff --git a/release/kubernetes-manifests.yaml b/release/kubernetes-manifests.yaml
index eb29927..bdde8da 100644
--- a/release/kubernetes-manifests.yaml
+++ b/release/kubernetes-manifests.yaml
@@ -280,19 +280,6 @@ spec:
port: 80
targetPort: 8080
---
-apiVersion: v1
-kind: Service
-metadata:
- name: frontend-external
-spec:
- type: LoadBalancer
- selector:
- app: frontend
- ports:
- - name: http
- port: 80
- targetPort: 8080
----
apiVersion: apps/v1
kind: Deployment
metadata:
From cef5df5ae28a6eb6b3192849d14bbfbbfa2cacc7 Mon Sep 17 00:00:00 2001
From: Ramiro Berrelleza
Date: Tue, 11 Aug 2020 12:15:17 -0700
Subject: [PATCH 3/4] add okteto.yml for frontend
Signed-off-by: Ramiro Berrelleza
---
okteto-pipelines.yaml | 4 +++-
src/frontend/.stignore | 16 ++++++++++++++++
src/frontend/okteto.yml | 23 +++++++++++++++++++++++
3 files changed, 42 insertions(+), 1 deletion(-)
create mode 100644 src/frontend/.stignore
create mode 100644 src/frontend/okteto.yml
diff --git a/okteto-pipelines.yaml b/okteto-pipelines.yaml
index ff5aa43..8261588 100644
--- a/okteto-pipelines.yaml
+++ b/okteto-pipelines.yaml
@@ -1,4 +1,6 @@
icon: https://raw.githubusercontent.com/rberrelleza/microservices-demo/master/src/frontend/static/icons/Hipster_HeroLogoCyan.svg
deploy:
- kubectl apply -f release/kubernetes-manifests.yaml
- - kubectl annotate service frontend dev.okteto.com/auto-ingress=true
\ No newline at end of file
+ - kubectl annotate service frontend dev.okteto.com/auto-ingress=true --overwrite
+devs:
+ - src/frontend/okteto.yml
\ No newline at end of file
diff --git a/src/frontend/.stignore b/src/frontend/.stignore
new file mode 100644
index 0000000..e41f6e7
--- /dev/null
+++ b/src/frontend/.stignore
@@ -0,0 +1,16 @@
+.git
+*.exe
+*.exe~
+*.dll
+*.so
+*.dylib
+
+# Test binary, built with go test -c
+*.test
+
+# Output of the go coverage tool, specifically when used with LiteIDE
+*.out
+
+# dlv binary
+__debug_bin
+vendor
\ No newline at end of file
diff --git a/src/frontend/okteto.yml b/src/frontend/okteto.yml
new file mode 100644
index 0000000..9f9e94b
--- /dev/null
+++ b/src/frontend/okteto.yml
@@ -0,0 +1,23 @@
+name: frontend
+image: ramiro/frontend:okteto
+command:
+- sh
+build:
+ target: builder
+workdir: /go/src/github.com/GoogleCloudPlatform/microservices-demo/src/frontend
+forward:
+- 2345:2345
+- 8080:8080
+volumes:
+- /go/pkg/
+- /root/.cache/go-build/
+persistentVolume:
+ enabled: true
+resources:
+ limits:
+ cpu: "1"
+ memory: 2Gi
+securityContext:
+ capabilities:
+ add:
+ - SYS_PTRACE
From dac6256d4a5b9bd0a239e9809b3191105a7bcd44 Mon Sep 17 00:00:00 2001
From: Ramiro Berrelleza
Date: Wed, 9 Sep 2020 17:23:34 -0700
Subject: [PATCH 4/4] add kustomization.yaml
Signed-off-by: Ramiro Berrelleza
---
.github/workflows/ci.yml | 102 ++++++++----------------------
kustomization.yaml | 8 +++
okteto-pipelines.yaml | 3 +
release/kubernetes-manifests.yaml | 2 +-
4 files changed, 40 insertions(+), 75 deletions(-)
create mode 100644 kustomization.yaml
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ca15143..6243b34 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,80 +1,34 @@
-# Copyright 2020 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-name: "Continuous Integration"
+# file: .github/workflows/preview.yaml
on:
- push:
- # run on pushes to master or release/*
- branches:
- - master
- - release/*
pull_request:
- # run on pull requests targeting master
branches:
- master
+
jobs:
- run-tests:
- runs-on: self-hosted
+ preview:
+ runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- - name: License Check
- run: |
- set -x
- git init
- git add --all
- git -c user.name="CI Bot" -c user.email="<>" commit -m "initial state"
- addlicense ./
- test -z $(git diff --name-only | tee /dev/stderr)
- - name: Setup Cluster
- run: |
- set -x
- kind delete cluster || true
- kind create cluster
- kubectl get nodes
- - name: Deploy From Source
- run: |
- skaffold config set --global local-cluster true
- skaffold run --default-repo local
- - name: Wait For Pods
- timeout-minutes: 20
- run: |
- set -x
- kubectl wait --for=condition=available --timeout=500s deployment/adservice
- kubectl wait --for=condition=available --timeout=500s deployment/cartservice
- kubectl wait --for=condition=available --timeout=500s deployment/checkoutservice
- kubectl wait --for=condition=available --timeout=500s deployment/currencyservice
- kubectl wait --for=condition=available --timeout=500s deployment/emailservice
- kubectl wait --for=condition=available --timeout=500s deployment/frontend
- kubectl wait --for=condition=available --timeout=500s deployment/loadgenerator
- kubectl wait --for=condition=available --timeout=500s deployment/paymentservice
- kubectl wait --for=condition=available --timeout=500s deployment/productcatalogservice
- kubectl wait --for=condition=available --timeout=500s deployment/recommendationservice
- kubectl wait --for=condition=available --timeout=500s deployment/shippingservice
- - name: Smoke Test
- timeout-minutes: 5
- run: |
- set -x
- # start fresh loadgenerator pod
- kubectl delete pod -l app=loadgenerator
- # wait for requests to come in
- REQUEST_COUNT="0"
- while [[ "$REQUEST_COUNT" -lt "50" ]]; do
- sleep 5
- REQUEST_COUNT=$(kubectl logs -l app=loadgenerator | grep Aggregated | awk '{print $2}')
- done
- # ensure there are no errors hitting endpoints
- ERROR_COUNT=$(kubectl logs -l app=loadgenerator | grep Aggregated | awk '{print $3}' | sed "s/[(][^)]*[)]//g")
- if [[ "$ERROR_COUNT" -gt "0" ]]; then
- exit 1
- fi
+ - name: checkout
+ uses: actions/checkout@master
+
+ - name: Login
+ uses: okteto/login@master
+ with:
+ token: ${{ secrets.OKTETO_TOKEN }}
+
+ - name: Create namespace
+ uses: okteto/create-namespace@master
+ with:
+ namespace: pr-${{ github.event.number }}
+
+ - name: Deploy Application
+ uses: okteto/pipeline@master
+ with:
+ name: pr-${{ github.event.number }}
+
+ - name: comment PR
+ uses: unsplash/comment-on-pr@master
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ msg: "Preview environment available at https://frontend-pr-${{ github.event.number }}.sf.okteto.net"
\ No newline at end of file
diff --git a/kustomization.yaml b/kustomization.yaml
new file mode 100644
index 0000000..9436f51
--- /dev/null
+++ b/kustomization.yaml
@@ -0,0 +1,8 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+resources:
+- release/kubernetes-manifests.yaml
+images:
+- name: frontend
+ newName: okteto.dev/frontend
+ newTag: foo
diff --git a/okteto-pipelines.yaml b/okteto-pipelines.yaml
index 8261588..648d35d 100644
--- a/okteto-pipelines.yaml
+++ b/okteto-pipelines.yaml
@@ -1,5 +1,8 @@
icon: https://raw.githubusercontent.com/rberrelleza/microservices-demo/master/src/frontend/static/icons/Hipster_HeroLogoCyan.svg
deploy:
+ - okteto build -t okteto.dev/frontend:${OKTETO_COMMIT} src/frontend
+ - kustomize edit set image frontend=okteto.dev/frontend:${OKTETO_COMMIT}
+ - kustomize build .
- kubectl apply -f release/kubernetes-manifests.yaml
- kubectl annotate service frontend dev.okteto.com/auto-ingress=true --overwrite
devs:
diff --git a/release/kubernetes-manifests.yaml b/release/kubernetes-manifests.yaml
index bdde8da..906e7e7 100644
--- a/release/kubernetes-manifests.yaml
+++ b/release/kubernetes-manifests.yaml
@@ -215,7 +215,7 @@ spec:
spec:
containers:
- name: server
- image: gcr.io/google-samples/microservices-demo/frontend:v0.2.0
+ image: frontend
ports:
- containerPort: 8080
readinessProbe: