Skip to content

Commit

Permalink
Merge pull request #50 from natrontech/argocd-structure
Browse files Browse the repository at this point in the history
fix: new structure according to argocd
  • Loading branch information
Joel-Haeberli authored Oct 2, 2023
2 parents 846ce89 + 1eac233 commit 4f32c55
Show file tree
Hide file tree
Showing 14 changed files with 176 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ dist/
_temp/

./momentum-core/momentum-core
./momentum-core/.vscode/
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: to-be-patched
namespace: argocd
annotations:
pref.argocd.argoproj.io/default-view: network
pref.argocd.argoproj.io/default-pod-sort: parentResource
spec:
source:
chart: {{ .HelmChartName }}
repoURL: {{ .HelmRepoUrl }}
targetRevision: {{ .HelmChartVersion }}
helm:
releaseName: {{ .ApplicationName }}
valuesObject:
destination:
server: "https://kubernetes.default.svc"
namespace: to-be-patched
syncPolicy:
automated:
allowEmpty: true
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- application.yaml
labels:
- includeSelectors: true
pairs:
gitops.natron.io/application: '{{ .ApplicationName }}'
patches:
- path: values.yaml
target:
kind: Application

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: to-be-patched
spec:
source:
helm:
valuesObject:

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- project.yaml
labels:
- includeSelectors: true
pairs:
gitops.natron.io/app: "{{ .ApplicationName }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: {{ .ApplicationName }}-{{ .StageNames }}
namespace: argocd
spec:
clusterResourceWhitelist:
- group: '*'
kind: '*'
description: This is the Project for {{ .ApplicationName }}
destinations:
- name: in-cluster
namespace: {{ .ApplicationName }}-{{ .StageNames }}-*
server: https://kubernetes.default.svc
namespaceResourceWhitelist:
- group: '*'
kind: '*'
# sourceRepos:
orphanedResources:
warn: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: to-be-patched
spec:
project: {{ .ApplicationName }}-{{ .StageNames }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../_base/
labels:
- includeSelectors: true
pairs:
gitops.natron.io/app: "{{ .ApplicationName }}"
patches:
- path: application.yaml
target:
kind: Application
- path: values.yaml
target:
kind: Application
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: to-be-patched
spec:
source:
helm:
valuesObject:
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
spec:
destination:
namespace: {{ .ApplicationName }}-{{ .StageNames }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../_base/ # applications _base
labels:
- includeSelectors: true
pairs:
# Patched on stage above // wont work if addtionall resources are added on this level
#gitops.natron.io/app: ""
gitops.natron.io/stage: "{{ .StageName }}"
patches:
- path: application.yaml
target:
kind: Application
- path: values.yaml
target:
kind: Application
- path: secrets.yaml
target:
kind: Application
- target:
kind: Application
name: .*
patch: |-
- op: replace
path: /metadata/name
# {{ .ApplicationName }}-{{ .StageNames }}
value: {{ .MetadataName }}
- target:
group: image.toolkit.fluxcd.io
name: .*
patch: |-
- op: replace
path: /metadata/namespace
value: {{ .MetadataName }}
- target:
group: notification.toolkit.fluxcd.io
name: .*
patch: |-
- op: replace
path: /metadata/namespace
value: {{ .MetadataName }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: to-be-patched
spec:
source:
helm:
valuesObject:

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: to-be-patched
spec:
source:
helm:
valuesObject:

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./_deploy/prod/
#- ./_deploy/dev/

0 comments on commit 4f32c55

Please sign in to comment.