Giter VIP home page Giter VIP logo

droot / solutions-modern-cicd-anthos Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlecloudplatform/solutions-modern-cicd-anthos

0.0 2.0 0.0 5.89 MB

An end-to-end operating model for onboarding and continually deploying services with Anthos.

License: Apache License 2.0

HCL 5.19% Shell 5.15% Smarty 0.05% Dockerfile 2.94% Makefile 0.07% Go 20.57% HTML 3.67% Python 23.05% Java 2.91% C# 34.09% Batchfile 0.63% JavaScript 1.67%

solutions-modern-cicd-anthos's Introduction

Modern CI/CD with Anthos

CI

Introduction

Kubernetes has given us wonderful abstraction that we can use to optimize the way we develop, deploy, and maintain software projects across multiple environments. In many cases though, Kubernetes is too complex for end users to learn and feel empowered with. To alleviate this learning curve, many teams are looking to build platform abstractions on top of Kubernetes to streamline onboarding and reduce maintenenance for software projects.

In this repository we lay out a prescriptive way to create a multi-team software delivery platform using Anthos. The platform has the following capabilities:

  • Allow platform administrators to create and update best practices for provisioning apps
  • Ensure App Developers can iterate independently in their own "landing zones" without interfering with each other
  • Allow security teams to seamlessly implement and propagate policy across the platform
  • Use GitOps for deployment

For more details, please watch this talk on Youtube.

Architecture Overview

After the Quick Start you will have the following infra:

Anthos Platform Infrastructure

  • GitLab deployed on GKE to host your source code repostitories
  • 1 Dev cluster that can be used for iterative development with tools like Skaffold
  • 1 Staging cluster
  • 2 Production clusters in different GCP regions

Within GitLab you will have the following repo structure: Anthos Platform Repos

Starter repos have examples for:

Pre-requisites

  1. Clone this repo to your local machine.

  2. Install gcloud SDK.

  3. Create a new GCP project.

  4. Enable billing for GCP project

  5. Set the us-central1 region to deploy infrastructure

    export REGION="us-central1"
    gcloud config set compute/region ${REGION}

Build Infrastructure

  1. Run the following commands to setup Cloud Build

    export PROJECT_ID=<INSERT_YOUR_PROJECT_ID>
    gcloud config set core/project ${PROJECT_ID}
    export PROJECT_NUMBER=$(gcloud projects describe ${PROJECT_ID} --format 'value(projectNumber)')
    gcloud services enable cloudbuild.googleapis.com
    gcloud services enable anthos.googleapis.com
    gcloud services enable serviceusage.googleapis.com
    gcloud services enable cloudkms.googleapis.com
    gcloud services enable containeranalysis.googleapis.com
    gcloud projects add-iam-policy-binding ${PROJECT_ID} --member serviceAccount:${PROJECT_NUMBER}@cloudbuild.gserviceaccount.com --role roles/owner
    gcloud projects add-iam-policy-binding ${PROJECT_ID} --member serviceAccount:${PROJECT_NUMBER}@cloudbuild.gserviceaccount.com --role roles/containeranalysis.admin
  2. Run Cloud Build to create the necessary resources.

    gcloud builds submit

    โš ๏ธ This operation may take up to 30 minutes depending on region. Do not close the console or connection as the operation is NOT idempotent. If a failure occurs, clean up the environment and attempt again.

  3. Log in to your GitLab instance with the URL, username and password printed at the end of the build. Hang on to this password, you will need it for later steps.

  4. Follow the steps in the docs to go through a user journey (add, deploy, and change applications).

Important Variables

  1. Take note and record the Password for your Gitlab account.

  2. URL for Gitlab

    echo "https://gitlab.endpoints.${PROJECT_ID}.cloud.goog"
  3. User and Password for GitLab are stored in the Secrets Manager

export GITLAB_USER=$(gcloud secrets versions access latest --secret="gitlab-user")
export GITLAB_PASSWORD=$(gcloud secrets versions access latest --secret="gitlab-password")

echo "User: ${GITLAB_USER}"
echo "Password: ${GITLAB_PASSWORD}"

Clean Up

  1. Remove infrastructure

    gcloud builds submit --config cloudbuild-destroy.yaml
    gcloud endpoints services delete gitlab.endpoints.${PROJECT_ID}.cloud.goog
    gcloud endpoints services delete registry.endpoints.${PROJECT_ID}.cloud.goog
  2. Unset variables (optional)

    unset PROJECT_ID
    unset REGION

Securing the ACM repository

At this stage, you should have a working ACM installation good enough for most demos. If you want to follow production best practices, read Best practices for policy management with Anthos Config Management and GitLab.

Always leave at least one namespace defined in namespaces/managed-apps, otherwise ACM will stop syncing.

solutions-modern-cicd-anthos's People

Contributors

bgood avatar bmenasha avatar dependabot[bot] avatar frankfarzan avatar henrybell avatar kenthua avatar knee-berts avatar michael-intindola avatar mike-ensor avatar mml avatar morgante avatar mrtrustor avatar

Watchers

 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.