Skip to content

Commit

Permalink
Merge pull request #41 from natrontech/update-structure
Browse files Browse the repository at this point in the history
Update structure
  • Loading branch information
janlauber authored Jul 20, 2023
2 parents 237331d + 13e7660 commit 406d403
Show file tree
Hide file tree
Showing 65 changed files with 122 additions and 241 deletions.
22 changes: 11 additions & 11 deletions momentum-structure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ The structure is as follows (generated with `tree -a -I`):

```bash
.
└── {root}
├── kustomization.yaml
└── {application} # An application e.g. my-app (level 1)
└── momentum-root # This is the root of the repository
├── kustomization.yaml # This is the root kustomization file
└── {application}
├── _base
│ ├── kustomization.yaml
│ ├── ns.yaml
│ ├── release.yaml
│ ├── release.yaml # This is the helm release for base
│ ├── secrets.yaml
│ └── values.yaml
├── _deploy
Expand All @@ -24,13 +24,13 @@ The structure is as follows (generated with `tree -a -I`):
│ ├── secrets.yaml
│ └── values.yaml
├── _template
│ ├── secrets.yaml # The helmrelease keys for secrets templated with go template
│ └── values.yaml # The helmrelease values templated with go template
│ ├── secrets.yaml
│ └── values.yaml
├── kustomization.yaml
├── ns.yaml # The namespace of the application (to store the helmrepository stuff)
├── repository.yaml # The helm repository of the application
├── {deployment}.yaml # A deployment of the application, which is a flux kustomization
└── {stage} # A stage of the application e.g. cluster-test, cluster-prod (level 2)
├── ns.yaml
├── repository.yaml
├── {deployment}.yaml
└── {stage}
├── _base
│ ├── kustomization.yaml
│ ├── release.yaml
Expand All @@ -47,7 +47,7 @@ The structure is as follows (generated with `tree -a -I`):
│ └── values.yaml
├── kustomization.yaml
├── {deployment}.yaml
└── {stage} # A stage of the application e.g. test,prod (level 3)
└── {stage}
├── _base
│ ├── kustomization.yaml
│ ├── release.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ configMapGenerator:
disableNameSuffixHash: true
secretGenerator:
- files:
- secrets.yaml
- values.yaml=secrets.yaml
name: base-secrets
options:
disableNameSuffixHash: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: patch
name: patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ kind: HelmRelease
metadata:
name: '{application}'
spec:
interval: 10m
interval: '{application-interval}'
chart:
spec:
chart: '{application-chart}'
version: '{application-chart-version}'
sourceRef:
kind: HelmRepository
name: '{application}-charts'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
base-secretkey: base-secretvalue
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
base-key: base-value
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ configMapGenerator:
disableNameSuffixHash: true
secretGenerator:
- files:
- secrets.yaml
- values.yaml=secrets.yaml
name: deploy-secrets
options:
disableNameSuffixHash: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: '{application}'
spec:
interval: '{application-interval}'
chart:
spec:
version: '{application-chart-version}'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deploy-secretkey: deploy-secretvalue
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deploy-key: deploy-value
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
template-secretkey: {{ .template-secretvalue }}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
template-key: {{.template-value}}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: '{deployment}'
namespace: flux-system
spec:
targetNamespace: '{deployment}'
interval: 5m0s
path: ./_deploy/{deployment}/
path: ./momentum-root/{application}/_deploy/{deployment}/
prune: true
sourceRef:
kind: GitRepository
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../_base/
configMapGenerator:
- files:
- values.yaml
name: '{stage}-values'
options:
disableNameSuffixHash: true
secretGenerator:
- files:
- values.yaml=secrets.yaml
name: '{stage}-secrets'
options:
disableNameSuffixHash: true
patches:
- path: release.yaml
labels:
- includeSelectors: true
pairs:
gitops.natron.io/application: '{application}'
gitops.natron.io/stage: '{stage}'
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ kind: HelmRelease
metadata:
name: '{application}'
spec:
interval: '{application-interval}'
chart:
spec:
version: '{application-chart-version}'
valuesFrom:
- kind: ConfigMap
name: base-values
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stage-base-secretkey: stage-base-secretvalue
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stage-base-key: stage-base-value
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ configMapGenerator:
disableNameSuffixHash: true
secretGenerator:
- files:
- secrets.yaml
- values.yaml=secrets.yaml
name: deploy-secrets
options:
disableNameSuffixHash: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: '{application}'
spec:
interval: '{application-interval}'
chart:
spec:
version: '{application-chart-version}'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deploy-secretkey: deploy-secretvalue
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deploy-key: deploy-value
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
template-secretkey: {{ .template-secretvalue }}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
template-key: {{.template-value}}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: '{deployment}-{stage}' # next stage would be '{deployment}-{stage}-{next_stage}'
namespace: flux-system
spec:
targetNamespace: '{deployment}-{stage}'
interval: 5m0s
path: ./_deploy/{deployment}/
path: ./momentum-root/{application}/{stage}/_deploy/{deployment}/
prune: true
sourceRef:
kind: GitRepository
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../_base/
configMapGenerator:
- files:
- values.yaml
name: '{stage}-{stage}-values'
options:
disableNameSuffixHash: true
secretGenerator:
- files:
- values.yaml=secrets.yaml
name: '{stage}-{stage}-secrets'
options:
disableNameSuffixHash: true
patches:
- path: release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ kind: HelmRelease
metadata:
name: '{application}'
spec:
interval: '{application-interval}'
chart:
spec:
version: '{application-chart-version}'
valuesFrom:
- kind: ConfigMap
name: base-values
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stage-base-secretkey: stage-base-secretvalue
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stage-base-key: stage-base-value
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ configMapGenerator:
disableNameSuffixHash: true
secretGenerator:
- files:
- secrets.yaml
- values.yaml=secrets.yaml
name: deploy-secrets
options:
disableNameSuffixHash: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: '{application}'
spec:
interval: '{application-interval}'
chart:
spec:
version: '{application-chart-version}'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deploy-secretkey: deploy-secretvalue
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deploy-key: deploy-value
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
template-secretkey: {{ .template-secretvalue }}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
template-key: {{.template-value}}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: '{deployment}-{stage}-{stage}' # next stage would be '{deployment}-{stage}--{stage}-{next_stage}'
name: '{deployment}-{stage}-{stage}' # next stage would be '{deployment}-{stage}-{stage}-{next_stage}'
namespace: flux-system
spec:
targetNamespace: '{deployment}-{stage}-{stage}'
interval: 5m0s
path: ./_deploy/{deployment}/
path: ./momentum-root/{application}/{stage}/{stage}/_deploy/{deployment}/
prune: true
sourceRef:
kind: GitRepository
Expand Down
123 changes: 0 additions & 123 deletions momentum-structure/test.yaml

This file was deleted.

Loading

0 comments on commit 406d403

Please sign in to comment.