Skip to content

Instantly share code, notes, and snippets.

@elocke
Created June 28, 2020 21:06
Show Gist options
  • Save elocke/ae487360ebf1084fcc9dfcc713885998 to your computer and use it in GitHub Desktop.
Save elocke/ae487360ebf1084fcc9dfcc713885998 to your computer and use it in GitHub Desktop.
applicationset proposal
I'm just jotting down a quick idea I had for this project.
I use ArgoCD and kustomize to manage different environments of microservices. I've been thinking of using this CRD to create an ApplicationSet of my entire stack (in my case 2 namespaces of services) via the git directory generator.
```
apps/
serviceA/
argoCD-app.yaml
base/
kustomization.yaml
deployment.yaml
envs/
prod/
staging/
dev/
serviceB/
base/
envs/
prod/
staging/
dev/
```
My idea is that being able to have a hierarchy of git paths to choose would enable easy to deploy "feature branch" envs that cross service and repo boundaries.
Say my stack is compose of 5 services. And 2 are in active development between 2 teams or a shared feature or something. Each service repo has a branch named `ephemeral/fancy-new-feature`. Using some templating, on first commit via CI my gitops tool duplicates the `/dev` env to `ephemeral/fancy-new-feature`.
```
spec:
generators:
- git:
repoURL: https://github.com/infra-team/cluster-deployments.git
directories:
- path: **/ephemeral/*
- path: **/dev/*
```
```
apps/
serviceA/
argoCD-app.yaml
base/
kustomization.yaml
deployment.yaml
envs/
prod/
staging/
dev/
ephemeral/
fancy-new-feature/
serviceB/
base/
envs/
prod/
staging/
dev/
ephemeral/
fancy-new-feature/
serviceC/
base/
envs/
prod/
staging/
dev/
...
database/ (ie: deploy a db local to your dev branch but for prod level use external db)
base/
envs/
dev/
```
What I'm proposing is the git directory generator looks for `**/ephemeral/*` and fallsback to `**/dev/*` where `/dev` exists. If either doesn't exist then we don't generate it.
I could see this being useful for a few usecases. Since I use ambassador on a wildcard ingress, I can now expose this feature work to a stakeholder for quick feedback. Perhaps this enables things like telepresense or VScode remote dev server.
I've been thinking about how to do this via gitops for a while now, I think this CRD may be my answer for a clean solution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment