Giter Club home page Giter Club logo

blog-environments's Introduction

blog-environments

Repository declaratively defining the state of the environments

This repo follows the App of Apps pattern: https://argoproj.github.io/argo-cd/operator-manual/cluster-bootstrapping/#app-of-apps-pattern

It proposes this structure per environment:

├── Chart.yaml
├── templates
│   ├── app-1.yaml
│   ├── app-2.yaml
│   ├── ...
│   └── app-N.yaml
└── values.yaml

Each environment will have an "App of Apps", the main app. That Argo CD app will point to the Helm Chart defined for each environment. This Helm chart will include inside its templates directory a set of ArgoCD application manifests. Each of them represents an app deployed in the corresponding environment.

There is no specific approach to define multiple environments, following that structure. Some possible options could be:

  • One repo per environment
  • One repo for all environments and a directory per environment
  • One repo for all the environments and a branch per environment.

This repo implements the second strategy. The repo will

In general:

├── env-1
│   ├── Chart.yaml
│   ├── templates
│   │   ├── app-1.yaml
│   │   ├── app-2.yaml
│   │   ├── ...
│   │   └── app-N.yaml
│   └── values.yaml
├── env-2
│   └── ...
├── ...
└── env-N
  └── ...

For this case in specific:

├── production
│   ├── Chart.yaml
│   ├── templates
│   │   ├── app-1.yaml
│   │   ├── app-2.yaml
│   └── values.yaml
└── staging
    ├── Chart.yaml
    ├── templates
    │   ├── app-1.yaml
    │   └──  app-2.yaml
    └── values.yaml

How to start

For each environment <env>

cd <env>
kubectl apply -n argocd -f argocd-project.yaml
kubectl apply -n argocd -f argocd-app-of-apps.yaml

How to add an app

Create a new ArgoCD app manifest in /<env>/templates/. To override the values used for the App Helm Chart, add them to /<env>/templates/values.yaml. In this way:

<argocd-app-name>:
  <values-here>

For example, to a new app called my-new-app:

...
my-new-app:
  attibute1: value1
...

How to add an environment (<env>)

Create a new directory at the root, with the name of the environment (e.g.: staging) and follow the same structure of files:

my-new-env
├── argocd-app-of-apps.yaml
├── argocd-project.yaml
└── helm
    ├── Chart.yaml
    ├── templates
    │   ├── app-x.yaml
    │   └── app-y.yaml
    └── values.yaml

How to remove the objects created

For each environment <env>

  1. Delete the App of Apps (the main ArgoCD app) for <env>. Since the ArgoCD app and the apps inside it have prune enabled.
  2. Delete the Argo CD project for <env>
  3. Delete the namespaces: <env>

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.