GithubHelp home page GithubHelp logo

valery-barysok / pop-kustomize Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vszal/pop-kustomize

0.0 2.0 0.0 92 KB

Kustomize and Skaffold example repo using a simple Python Flask app

License: MIT License

Dockerfile 6.80% Python 42.61% HTML 28.26% Shell 22.33%

pop-kustomize's Introduction

Google Cloud CI/CD End-to-End Demo

This repo demostrates Kubernetes CI/CD with Google Cloud devops tools Google Cloud Deploy, Cloud Build, and Artifact Registry. The example app is based on a simple Python Flask example app named "Population Stats" and uses Kustomize overlays for manifest generation.

Google Cloud E2E DevOps Architecture Diagram (1)

Create a repo

This demo relies on you making git check-ins to simulate a developer workflow. Fork this repo, or otherwise copy it into your own Github repo.

Customize Cloud Deploy yaml

  1. In clouddeploy.yaml, replace project-id-here with your actual project for each of the three targets.

Bootstrap Google Cloud demo

Bootstrap scripts are in the bootstrap folder.

The init.sh script is provided to bootstrap much of the configuration setup. You'll still need to do some steps manually after this script runs though.

  1. In init.sh, replace project-id-here with your Google Cloud project-id on line 3.
  2. Run . ./bootstrap/init.sh
  3. Verify that the Google Cloud Deploy pipeline was created in Google Cloud Deploy UI
  4. Setup a Cloud Build trigger for your repo

Create GKE clusters

You'll need GKE clusters to deploy out to as part of the demo. This repo refers to three clusters:

  • testcluster
  • stagingcluster
  • productcluster

If you have/want different cluster names update cluster definitions in the gke-cluster-init.sh bash script and in clouddeploy.yaml

To create the clusters, edit bootstrap/gke-cluster-init.sh:

  1. Replace project-id-here with your project-id on line 3.
  2. Run . ./bootstrap/gke-cluster-init.sh

IAM and service account setup

You must give Cloud Build explicit permission to trigger a Cloud Deploy release.

  1. Read the docs
  2. Navigate to IAM and locate your Cloud Build service account
  3. Add these two roles
  • Cloud Deploy Releaser
  • Service Account User

Demo

The demo is very simple at this stage.

  1. User commits a change the main branch of the repo
  2. Cloud Build is automatically triggered, which:
  • builds and pushes impages to Artifact Registry
  • creates a Cloud Deploy release in the pipeline
  1. User then navigates to Cloud Deploy UI and shows promotion events:
  • test cluster to staging clusters
  • staging cluster to product cluster, with approval gate

Tear down

To remove the three running GKE clusters, edit bootstrap/gke-cluster-delete.sh:

  1. Replace project-id-here with your project-id on line 3.
  2. Run . ./bootstrap/gke-cluster-delete.sh

Local dev

To run this app locally, start minikube or some other local k8s framework and from the root of the repo run:

skaffold dev

The default skaffold settings use the "dev" customer overlay.

Once running, you can make file changes and observe the rebuilding of the container and redeployment.

To test the staging overlays/profile:

skaffold run --profile staging

To test the staging overlays/profile:

skaffold run --profile prod

Try it in Cloud Shell

Google Cloud Shell provides a free environment in which to play with these files:

Open in cloud shell

About the Sample app - Population stats

Simple web app that pulls population data based on U.S. address queries. Note, other countries are currently not supported.

Population data gathered from the U.S. Census Bureau Population Estimate API.

Feedback and contributions welcomed.

pop-kustomize's People

Contributors

vszal avatar sbbogdanc avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.