Skip to content

Commit

Permalink
fix: use argohook instead of helm hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
kirinnee committed Oct 20, 2023
1 parent 85be874 commit fb81832
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 12 deletions.
1 change: 1 addition & 0 deletions infra/migration_chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ A Chart to migrate .NET Microservice
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| annotations | object | `{}` | |
| appSettings.App.Mode | string | `"Migration"` | |
| aspNetEnv | string | `"Development"` | |
| backoffLimit | int | `4` | |
Expand Down
3 changes: 3 additions & 0 deletions infra/migration_chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ Common annotations
{{- range $k, $v := .Values.serviceTree }}
"atomi.cloud/{{ $k }}": "{{ $v }}"
{{- end }}
{{- range $k, $v := .Values.annotations }}
"{{ $k }}": "{{ $v }}"
{{- end }}
{{- end }}

{{/*
Expand Down
2 changes: 0 additions & 2 deletions infra/migration_chart/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ metadata:
name: {{ include "dotnet-migration.fullname-with-suffix" (dict "arg" "config" "root" .) }}
labels: {{- include "dotnet-migration.labels" . | nindent 4 }}
annotations: {{- include "dotnet-migration.annotations" . | nindent 4 }}
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "-2"
data:
settings.yaml: |
{{- $pathBase := printf "%ssettings.yaml" "app/" -}}
Expand Down
2 changes: 0 additions & 2 deletions infra/migration_chart/templates/migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ metadata:
name: {{ include "dotnet-migration.fullname" . }}
labels: {{- include "dotnet-migration.labels" . | nindent 4 }}
annotations: {{- include "dotnet-migration.annotations" . | nindent 4 }}
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "-1"
spec:
backoffLimit: {{ .Values.backoffLimit }}
template:
Expand Down
2 changes: 0 additions & 2 deletions infra/migration_chart/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ metadata:
name: {{ include "dotnet-migration.serviceAccountName" . }}
labels: {{- include "dotnet-migration.labels" . | nindent 4 }}
annotations: {{- include "dotnet-migration.annotations" . | nindent 4 }}
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "-1"
{{- with .Values.serviceAccount.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
Expand Down
2 changes: 2 additions & 0 deletions infra/migration_chart/values.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ appSettings:
App:
Mode: Migration

annotations: {}

envFromSecret: sulfone-zinc

configMountPath: /app/App/Config/settings.yaml
Expand Down
2 changes: 2 additions & 0 deletions infra/migration_chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ appSettings:
App:
Mode: Migration

annotations: {}

backoffLimit: 4
configMountPath: /app/App/Config/settings.yaml

Expand Down
6 changes: 3 additions & 3 deletions infra/root_chart/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ dependencies:
version: 0.1.0
- name: sulfoxide-bromine
repository: oci://ghcr.io/atomicloud/sulfoxide.bromine
version: 1.1.1
version: 1.2.3
- name: postgresql
repository: oci://registry-1.docker.io/bitnamicharts
version: 12.5.5
digest: sha256:17f4e26524001361d516d5014ff39a221f259de2f5ffd81e13a79b0bb2350c1e
generated: "2023-10-20T13:00:08.219088+08:00"
digest: sha256:e36e015253dbbb4e1a57637010c553db342f60dfb67ad6677103a7990754f969
generated: "2023-10-21T00:52:02.718304+08:00"
2 changes: 1 addition & 1 deletion infra/root_chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:
condition: migration.enabled
alias: migration
- name: sulfoxide-bromine
version: 1.1.1
version: 1.2.3
condition: bromine.enable
alias: bromine
repository: oci://ghcr.io/atomicloud/sulfoxide.bromine
Expand Down
6 changes: 5 additions & 1 deletion infra/root_chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Root Chart to a single Service
|------------|------|---------|
| file://../api_chart | api(dotnet-chart) | 0.1.0 |
| file://../migration_chart | migration(dotnet-migration) | 0.1.0 |
| oci://ghcr.io/atomicloud/sulfoxide.bromine | bromine(sulfoxide-bromine) | 1.1.1 |
| oci://ghcr.io/atomicloud/sulfoxide.bromine | bromine(sulfoxide-bromine) | 1.2.3 |
| oci://registry-1.docker.io/bitnamicharts | maindb(postgresql) | 12.5.5 |

## Values
Expand Down Expand Up @@ -64,6 +64,8 @@ Root Chart to a single Service
| api.serviceTree.module | string | `"api"` | |
| api.tolerations | list | `[]` | |
| api.topologySpreadConstraints | object | `{}` | |
| bromine.annotations."argocd.argoproj.io/hook" | string | `"PreSync"` | |
| bromine.annotations."argocd.argoproj.io/sync-wave" | string | `"0"` | |
| bromine.enable | bool | `false` | |
| bromine.rootSecret | object | `{"ref":"SULFONE_ZINC"}` | Secret of Secrets reference |
| bromine.rootSecret.ref | string | `"SULFONE_ZINC"` | DOPPLER Token Reference |
Expand All @@ -74,6 +76,8 @@ Root Chart to a single Service
| maindb.nameOverride | string | `"main-database"` | |
| maindb.primary.persistence.enabled | bool | `false` | |
| migration.affinity | object | `{}` | |
| migration.annotations."argocd.argoproj.io/hook" | string | `"PreSync"` | |
| migration.annotations."argocd.argoproj.io/sync-wave" | string | `"1"` | |
| migration.appSettings.App.Mode | string | `"Migration"` | |
| migration.aspNetEnv | string | `"Development"` | |
| migration.backoffLimit | int | `4` | |
Expand Down
7 changes: 6 additions & 1 deletion infra/root_chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ serviceTree: &serviceTree
layer: "2"

bromine:
annotations:
argocd.argoproj.io/hook: PreSync
argocd.argoproj.io/sync-wave: "0"
enable: false
# -- Store name to create
storeName: sulfone-zinc
Expand Down Expand Up @@ -100,7 +103,9 @@ api:

migration:
enabled: false

annotations:
argocd.argoproj.io/hook: PreSync
argocd.argoproj.io/sync-wave: "1"
nameOverride: "migration"
fullnameOverride: ""

Expand Down

0 comments on commit fb81832

Please sign in to comment.