rename argo to replace

This commit is contained in:
Jan Husak
2025-04-11 13:21:23 +02:00
parent 2607a25784
commit 4f1391c729
165 changed files with 1 additions and 1 deletions

View File

@@ -0,0 +1,85 @@
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: k8s-apps-helm-application-set-v1
namespace: argocd
annotations:
argocd.argoproj.io/debug: "true"
spec:
goTemplate: true
goTemplateOptions: ["missingkey=error"]
applyNestedSelectors: true
generators:
# Create a matrix generator that will install all chart in all clusters
- matrix:
generators:
- matrix:
generators:
# Get all clusters, that are appropriately labeled
- clusters:
selector:
matchExpressions:
- key: stage-name
operator: Exists
- key: cluster-name
operator: Exists
# In this repo, find all files named argocd.json.
# The files are expected to contain {apiVersion: "ysoft.com/v1"}
- git:
repoURL: https://github.com/ysoftdevs/argo-poc.git
revision: main
files:
- path: "apps/**/argocd.json"
values:
stageName: '{{ index .metadata.labels "stage-name" }}'
clusterName: '{{ index .metadata.labels "cluster-name" }}'
provider: '{{ index .metadata.labels "provider" | default "aws" }}'
selector:
matchLabels:
apiVersion: "ysoft.com/v1"
- list:
# List of one element is a workaround to Argo's inabilility to access '.values.enabled' (which is a result of git generator) in a selector.
# The list generator transforms that into '.enabled', which works
# As a side effect, it also allows access to previously defined values, like '.values.stageName'
elements:
# The selector also had troubles with booleans vs. strings, hence the 'yes' and not 'true'
- enabled: '{{ dig "clusters" .values.clusterName "enabled" false . | ternary "yes" "" }}'
appName: "{{ .path.basename }}"
selector:
matchLabels:
enabled: "yes"
template:
metadata:
name: "{{ .path.basename }}-{{ .values.clusterName }}"
spec:
project: default
destination:
server: "{{.server}}"
namespace: "{{ .destination.namespace }}"
syncPolicy:
automated:
prune: true
syncOptions:
- ServerSideApply={{ dig "syncPolicy" "syncOptions" "ServerSideApply" "true" . }}
- CreateNamespace={{ dig "syncPolicy" "syncOptions" "CreateNamespace" "true" . }}
templatePatch: |
spec:
sources:
# First source is for value files
# Default revision is HEAD but can be overriden with clusters.${name}.valuesRevision
- repoURL: https://github.com/ysoftdevs/argo-poc.git
targetRevision: '{{ dig "stages" .values.clusterName "valuesRevision" (dig "valuesRevision" "" .source) . }}'
ref: values
# Second source is for chart
# Default revision is .source.targetRevision but can be overriden with clusters.${name}.chartRevision
- repoURL: "{{ .source.repoURL }}"
targetRevision: '{{ dig "stages" .values.clusterName "chartRevision" (dig "chartRevision" "" .source) . }}'
ref: chart
chart: '{{ default "" .source.chart }}'
path: '{{ default "" .source.path }}'
helm:
releaseName: "{{ .path.basename }}"
valueFiles: {{- $v := .values }}{{- $ := . }}
{{- range $valueFile := ( .valueFiles ) }}
- $values/apps/{{$.appName}}/{{ $valueFile | replace "%provider%" $v.provider | replace "%stage%" $v.stageName | replace "%cluster%" $v.clusterName }}
{{- end }}

32
apps/argocd/argocd.json Normal file
View File

@@ -0,0 +1,32 @@
{
"apiVersion": "ysoft.com/v1",
"source": {
"repoURL": "https://github.com/ysoftdevs/argo-poc.git",
"path": "helm-repo/argocd/argo-cd-7.8.23",
"chartRevision": "main",
"valuesRevision": "main",
"chart": ""
},
"destination": {
"namespace": "argocd"
},
"syncPolicy": {
"syncOptions": {
"ServerSideApply": true,
"CreateNamespace": true
}
},
"valueFiles": [
"values/registry/%provider%-%stage%-values.yaml",
"values/app-version/%stage%-values.yaml"
],
"clusters": {
"control-plane-dev": {
"enabled": true,
"revision": "test"
},
"ohio": {
"enabled": false
}
}
}

View File

@@ -0,0 +1,12 @@
server:
ingress:
enabled: true
hostname: "argo.control-plane-dev.ysoft-dev.com"
global:
image:
tag: v3.0.0-rc3
configs:
params:
server.insecure: true