Skip to content

Commit 98ee9af

Browse files
CasLubbersmerllj-zimnowoda
authored
feat: deploy core apps via argocd (#1630)
Co-authored-by: Matthias Erll <[email protected]> Co-authored-by: jeho <[email protected]>
1 parent ba34f5d commit 98ee9af

File tree

16 files changed

+86
-30
lines changed

16 files changed

+86
-30
lines changed

charts/gitea/templates/gitea/statefulset.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,9 @@ spec:
319319
emptyDir: {}
320320
{{- else if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
321321
volumeClaimTemplates:
322-
- metadata:
322+
- apiVersion: v1
323+
kind: PersistentVolumeClaim
324+
metadata:
323325
name: data
324326
{{- with .Values.persistence.annotations }}
325327
annotations:

charts/harbor/templates/redis/statefulset.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ spec:
8585
{{- end }}
8686
{{- if and .Values.persistence.enabled (not $redis.existingClaim) }}
8787
volumeClaimTemplates:
88-
- metadata:
88+
- apiVersion: v1
89+
kind: PersistentVolumeClaim
90+
metadata:
8991
name: data
9092
labels:
9193
{{ include "harbor.labels" . | indent 8 }}

charts/harbor/templates/trivy/trivy-sts.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ spec:
182182
{{- end }}
183183
{{- if and .Values.persistence.enabled (not $trivy.existingClaim) }}
184184
volumeClaimTemplates:
185-
- metadata:
185+
- apiVersion: v1
186+
kind: PersistentVolumeClaim
187+
metadata:
186188
name: data
187189
labels:
188190
{{ include "harbor.labels" . | indent 8 }}

charts/oauth2-proxy/charts/redis/templates/master/application.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,9 @@ spec:
496496
claimName: {{ printf "redis-data-%s-master" (include "common.names.fullname" .) }}
497497
{{- else }}
498498
volumeClaimTemplates:
499-
- metadata:
499+
- apiVersion: v1
500+
kind: PersistentVolumeClaim
501+
metadata:
500502
name: redis-data
501503
labels: {{- include "common.labels.matchLabels" . | nindent 10 }}
502504
app.kubernetes.io/component: master

charts/oauth2-proxy/charts/redis/templates/replicas/statefulset.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,9 @@ spec:
493493
claimName: {{ printf "%s" (tpl .Values.replica.persistence.existingClaim .) }}
494494
{{- else }}
495495
volumeClaimTemplates:
496-
- metadata:
496+
- apiVersion: v1
497+
kind: PersistentVolumeClaim
498+
metadata:
497499
name: redis-data
498500
labels: {{- include "common.labels.matchLabels" . | nindent 10 }}
499501
app.kubernetes.io/component: replica

charts/oauth2-proxy/charts/redis/templates/sentinel/statefulset.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,9 @@ spec:
736736
claimName: {{ printf "%s" (tpl .Values.replica.persistence.existingClaim .) }}
737737
{{- else }}
738738
volumeClaimTemplates:
739-
- metadata:
739+
- apiVersion: v1
740+
kind: PersistentVolumeClaim
741+
metadata:
740742
name: redis-data
741743
labels: {{- include "common.labels.matchLabels" . | nindent 10 }}
742744
app.kubernetes.io/component: node

charts/otomi-pipelines/templates/eventlistener.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ spec:
77
triggers:
88
- name: otomi-tekton-listener
99
bindings:
10-
- ref: otomi-tekton-binding
10+
- kind: TriggerBinding
11+
ref: otomi-tekton-binding
1112
template:
1213
ref: otomi-tekton-template
1314
resources:
@@ -18,4 +19,5 @@ spec:
1819
serviceAccountName: otomi-tekton-triggers-sa
1920
containers:
2021
- resources: {{- toYaml .Values.eventListener.resources | nindent 18 }}
22+
name: ''
2123

charts/otomi-pipelines/templates/tekton-otomi-git-clone.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,24 @@ metadata:
66
spec:
77
params:
88
- name: repoUrl
9+
type: string
910
- name: commitMessage
11+
type: string
1012
- name: giteaCredentialsSecretName
13+
type: string
1114
results:
1215
- name: CI
1316
description: Determine if pipeline should run based on the commit message
17+
type: string
1418
- name: OTOMI_VERSION
1519
description: Otomi version as in values/env/settings.yaml
20+
type: string
1621
- name: TRIGGER_TEAMS_PIPELINE
1722
description: Determine if the otomi-task-teams is about to run
23+
type: string
1824
- name: TRIGGER_PLATFORM_PIPELINE
1925
description: Determine if the otomi-task is about to run
26+
type: string
2027
workspaces:
2128
- name: source
2229
mountPath: /home/app/stack/env/
@@ -28,6 +35,7 @@ spec:
2835
image: otomi/core:{{ .Values.otomiVersion }}
2936
steps:
3037
- name: git-clone
38+
computeResources: {}
3139
script: |
3240
#!/bin/bash
3341
set -e

charts/otomi-pipelines/templates/tekton-otomi-task-teams.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ metadata:
88
spec:
99
params:
1010
- name: OTOMI_VERSION
11+
type: string
1112
- name: CI
13+
type: string
1214
- name: repoUrl
15+
type: string
1316
- name: giteaCredentialsSecretName
17+
type: string
1418
workspaces:
1519
- name: source
1620
mountPath: /home/app/stack/env
@@ -37,6 +41,7 @@ spec:
3741
value: '2'
3842
steps:
3943
- name: git-clone
44+
computeResources: {}
4045
script: |
4146
#!/bin/bash
4247
set -e
@@ -57,12 +62,14 @@ spec:
5762
git clone --depth 1 https://$GITEA_USERNAME:$GITEA_PASSWORD@$url $ENV_DIR
5863
{{- end }}
5964
- name: test
65+
computeResources: {}
6066
command:
6167
- '/bin/bash'
6268
args:
6369
- '-c'
6470
- 'binzx/otomi validate-values'
6571
- name: apply
72+
computeResources: {}
6673
script: |
6774
#!/bin/bash
6875
set -e

charts/otomi-pipelines/templates/tekton-otomi-task.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ metadata:
88
spec:
99
params:
1010
- name: OTOMI_VERSION
11+
type: string
1112
- name: CI
13+
type: string
1214
- name: repoUrl
15+
type: string
1316
- name: giteaCredentialsSecretName
17+
type: string
1418
workspaces:
1519
- name: source
1620
mountPath: /home/app/stack/env
@@ -37,6 +41,7 @@ spec:
3741
value: '1'
3842
steps:
3943
- name: git-clone
44+
computeResources: {}
4045
script: |
4146
#!/bin/bash
4247
set -e
@@ -57,18 +62,21 @@ spec:
5762
git clone --depth 1 https://$GITEA_USERNAME:$GITEA_PASSWORD@$url $ENV_DIR
5863
{{- end }}
5964
- name: bootstrap
65+
computeResources: {}
6066
command:
6167
- '/bin/bash'
6268
args:
6369
- '-c'
6470
- 'binzx/otomi bootstrap'
6571
- name: test
72+
computeResources: {}
6673
command:
6774
- '/bin/bash'
6875
args:
6976
- '-c'
7077
- 'binzx/otomi validate-values'
7178
- name: apply
79+
computeResources: {}
7280
script: |
7381
#!/bin/bash
7482
set -e

charts/otomi-pipelines/templates/tekton-pipeline.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ spec:
99
- name: gitea-credentials
1010
params:
1111
- name: repoUrl
12+
type: string
1213
- name: commitMessage
14+
type: string
1315
- name: giteaCredentialsSecretName
16+
type: string
1417
tasks:
1518
- name: otomi-git-clone
1619
params:
@@ -21,6 +24,7 @@ spec:
2124
- name: giteaCredentialsSecretName
2225
value: $(params.giteaCredentialsSecretName)
2326
taskRef:
27+
kind: Task
2428
name: otomi-git-clone
2529
workspaces:
2630
- name: source
@@ -38,6 +42,7 @@ spec:
3842
- name: giteaCredentialsSecretName
3943
value: $(params.giteaCredentialsSecretName)
4044
taskRef:
45+
kind: Task
4146
name: otomi-task
4247
workspaces:
4348
- name: source
@@ -64,6 +69,7 @@ spec:
6469
- name: giteaCredentialsSecretName
6570
value: $(params.giteaCredentialsSecretName)
6671
taskRef:
72+
kind: Task
6773
name: otomi-task-teams
6874
workspaces:
6975
- name: source

charts/tempo/templates/lib/service-monitor.tpl

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ spec:
4747
scrapeTimeout: {{ . }}
4848
{{- end }}
4949
relabelings:
50-
- sourceLabels: [job]
50+
- action: replace
51+
sourceLabels: [job]
5152
replacement: "{{ $.ctx.Release.Namespace }}/{{ $.component }}"
5253
targetLabel: job
5354
{{- if kindIs "string" .clusterLabel }}

src/cmd/apply-as-apps.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const setup = (): void => {
2929
mkdirSync(valuesDir, { recursive: true })
3030
}
3131

32-
interface HelmRelese {
32+
interface HelmRelease {
3333
name: string
3434
namespace: string
3535
enabled: boolean
@@ -38,11 +38,11 @@ interface HelmRelese {
3838
chart: string
3939
version: string
4040
}
41-
const getAppName = (release: HelmRelese): string => {
41+
const getAppName = (release: HelmRelease): string => {
4242
return `${release.namespace}-${release.name}`
4343
}
4444

45-
const getArgocdAppManifest = (release: HelmRelese, values: Record<string, any>, otomiVersion) => {
45+
const getArgocdAppManifest = (release: HelmRelease, values: Record<string, any>, otomiVersion) => {
4646
return {
4747
apiVersion: 'argoproj.io/v1alpha1',
4848
kind: 'Application',
@@ -80,17 +80,17 @@ const getArgocdAppManifest = (release: HelmRelese, values: Record<string, any>,
8080
}
8181
}
8282

83-
const removeApplication = async (release: HelmRelese): Promise<void> => {
83+
const removeApplication = async (release: HelmRelease): Promise<void> => {
8484
const name = getAppName(release)
8585
if (!(await isResourcePresent('application', name, 'argocd'))) return
8686

87-
// TODO: do we always want to remove finalisers?
87+
// TODO: do we always want to remove finalizers?
8888
await $`kubectl -n argocd patch application ${name} -p '{"metadata": {"finalizers": null}}' --type merge`
8989
const resDelete = await $`kubectl -n argocd delete application ${name}`
9090
d.info(resDelete.stdout.toString())
9191
}
9292

93-
const writeApplicationManifest = async (release: HelmRelese, otomiVersion: string): Promise<void> => {
93+
const writeApplicationManifest = async (release: HelmRelease, otomiVersion: string): Promise<void> => {
9494
const appName = `${release.namespace}-${release.name}`
9595
// d.info(`Generating Argocd Application at ${appName}`)
9696
const applicationPath = `${appsDir}/${appName}.yaml`
@@ -125,9 +125,9 @@ export const applyAsApps = async (argv: HelmArguments): Promise<void> => {
125125
})
126126
const errors: Array<any> = []
127127
// Generate JSON object with all helmfile releases defined in helmfile.d
128-
const releses: [] = JSON.parse(res.stdout.toString())
128+
const releases: [] = JSON.parse(res.stdout.toString())
129129
await Promise.allSettled(
130-
releses.map(async (release: HelmRelese) => {
130+
releases.map(async (release: HelmRelease) => {
131131
try {
132132
if (release.installed) await writeApplicationManifest(release, otomiVersion)
133133
else {
@@ -147,10 +147,10 @@ export const applyAsApps = async (argv: HelmArguments): Promise<void> => {
147147
d.error(e)
148148
errors.push(e)
149149
}
150-
if (errors.length === 0) d.info(`All applications has been deployed succesfully`)
150+
if (errors.length === 0) d.info(`All applications has been deployed successfully`)
151151
else {
152152
errors.map((e) => d.error(e))
153-
d.error(`Not all applications has been deployed succesfully`)
153+
d.error(`Not all applications has been deployed successfully`)
154154
}
155155
}
156156

src/cmd/apply.ts

+9-11
Original file line numberDiff line numberDiff line change
@@ -87,27 +87,25 @@ const applyAll = async () => {
8787
// When Otomi is installed for the very first time and ArgoCD is not yet there.
8888
// The 'tag!=teams' does not include team-ns-admin release name.
8989
labelOpts = ['tag!=teams']
90+
await hf(
91+
{
92+
labelOpts,
93+
logLevel: logLevelString(),
94+
args: hfArgs,
95+
},
96+
{ streams: { stdout: d.stream.log, stderr: d.stream.error } },
97+
)
9098
} else {
9199
// When Otomi is already installed and Tekton pipeline performs GitOps.
92100
// We ensure that helmfile does not deploy any team related Helm release.
93-
labelOpts = ['pipeline!=otomi-task-teams']
94101

95102
// We still need to deploy all teams because some settings depend on platform apps.
96103
// Note that team-ns-admin contains ingress for platform apps.
97104
const params = cloneDeep(argv)
98-
params.label = ['pipeline=otomi-task-teams']
105+
//TODO here happens the real installation of the apps
99106
await applyAsApps(params)
100107
}
101108

102-
await hf(
103-
{
104-
labelOpts,
105-
logLevel: logLevelString(),
106-
args: hfArgs,
107-
},
108-
{ streams: { stdout: d.stream.log, stderr: d.stream.error } },
109-
)
110-
111109
await upgrade({ when: 'post' })
112110
if (!(env.isDev && env.DISABLE_SYNC)) {
113111
await commit()

values/argocd/argocd.gotmpl

+14
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,20 @@ configs:
111111
users.anonymous.enabled: "false"
112112
# Note that the clientSecret is not actually used
113113
# as for now oauth2-proxy handles the login
114+
resource.compareoptions: |
115+
# disables status field diffing in specified resource types
116+
ignoreAggregatedRoles: true
117+
resource.exclusions: |
118+
- apiGroups:
119+
- "*"
120+
kinds:
121+
- "PipelineRun"
122+
- "TaskRun"
123+
clusters:
124+
- "*"
125+
resource.customizations.knownTypeFields.cert-manager.io_Certificate: |
126+
- field: spec.duration
127+
type: meta/v1/Duration
114128
oidc.config: |
115129
name: Otomi
116130
issuer: {{ $v._derived.oidcBaseUrl }}

values/jaeger-operator/jaeger-operator.gotmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jaeger:
5959
securityContext:
6060
runAsNonRoot: true
6161
runAsUser: 1000
62-
strategy: allInOne
62+
strategy: allinone
6363

6464
rbac:
6565
clusterRole: true

0 commit comments

Comments
 (0)