Skip to content

Commit

Permalink
feat: support flavor dependent defaults (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjorge-graphops authored Nov 6, 2023
1 parent ad0486d commit 8203751
Show file tree
Hide file tree
Showing 28 changed files with 1,050 additions and 155 deletions.
Binary file modified .yarn/install-state.gz
Binary file not shown.
12 changes: 11 additions & 1 deletion arbitrum/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
#namespace defaults
{{ $_ := set .Values "_defaults" ( `{"flavor":"mainnet","common":{},"mainnet":{"targetNamespace":"arbitrum-mainnet"}}` | fromJson ) }}
#set default flavor when missing
{{ if not ( hasKey .Values "flavor" ) }}
{{ $_ := set .Values "flavor" "mainnet" }}
{{ end }}

environments:
{{ .Environment.Name }}:
values:
- flavor: {{ .Values.flavor }}
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---


environments:
{{ .Environment.Name }}:
values:
- flavor: {{ .Values.flavor }}
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---
{{- $_tplTransforms := (print `
Expand Down Expand Up @@ -86,7 +96,7 @@ kubeVersion: {{ .Values.kubeVersion }}
{{ end }}

#set default namespace
{{ $_defaultNamespace := ( print "arbitrum-" .Values.flavor ) }}
{{ $_defaultNamespace := .Values._defaults | get .Values.flavor | get "targetNamespace" }}


{{- $_commonLabels := dict
Expand Down
12 changes: 11 additions & 1 deletion avalanche/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
#namespace defaults
{{ $_ := set .Values "_defaults" ( `{"flavor":"mainnet","common":{},"mainnet":{"targetNamespace":"avalanche-mainnet"}}` | fromJson ) }}
#set default flavor when missing
{{ if not ( hasKey .Values "flavor" ) }}
{{ $_ := set .Values "flavor" "mainnet" }}
{{ end }}

environments:
{{ .Environment.Name }}:
values:
- flavor: {{ .Values.flavor }}
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---


environments:
{{ .Environment.Name }}:
values:
- flavor: {{ .Values.flavor }}
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---
{{- $_tplTransforms := (print `
Expand Down Expand Up @@ -86,7 +96,7 @@ kubeVersion: {{ .Values.kubeVersion }}
{{ end }}

#set default namespace
{{ $_defaultNamespace := ( print "avalanche-" .Values.flavor ) }}
{{ $_defaultNamespace := .Values._defaults | get .Values.flavor | get "targetNamespace" }}


{{- $_commonLabels := dict
Expand Down
12 changes: 11 additions & 1 deletion celo/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
#namespace defaults
{{ $_ := set .Values "_defaults" ( `{"flavor":"mainnet","common":{},"mainnet":{"targetNamespace":"celo-mainnet"}}` | fromJson ) }}
#set default flavor when missing
{{ if not ( hasKey .Values "flavor" ) }}
{{ $_ := set .Values "flavor" "mainnet" }}
{{ end }}

environments:
{{ .Environment.Name }}:
values:
- flavor: {{ .Values.flavor }}
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---


environments:
{{ .Environment.Name }}:
values:
- flavor: {{ .Values.flavor }}
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---
{{- $_tplTransforms := (print `
Expand Down Expand Up @@ -86,7 +96,7 @@ kubeVersion: {{ .Values.kubeVersion }}
{{ end }}

#set default namespace
{{ $_defaultNamespace := ( print "celo-" .Values.flavor ) }}
{{ $_defaultNamespace := .Values._defaults | get .Values.flavor | get "targetNamespace" }}


{{- $_commonLabels := dict
Expand Down
19 changes: 13 additions & 6 deletions ethereum/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
#namespace defaults
{{ $_ := set .Values "_defaults" ( `{"flavor":"mainnet","mainnet":{"targetNamespace":"eth-mainnet","features":["nimbus","proxyd"],"scaling":{"deployments":1}},"goerli":{"targetNamespace":"eth-goerli","features":["nimbus","proxyd"],"scaling":{"deployments":1}},"common":{"features":["nimbus","proxyd"],"scaling":{"deployments":1}},"holesky":{"targetNamespace":"eth-holesky","features":["nimbus","proxyd"],"scaling":{"deployments":1}}}` | fromJson ) }}
#set default flavor when missing
{{ if not ( hasKey .Values "flavor" ) }}
{{ $_ := set .Values "flavor" "mainnet" }}
{{ end }}

environments:
{{ .Environment.Name }}:
values:
- flavor: {{ .Values.flavor }}
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---
# Define default features when undefined
{{ if not (hasKey .Values "features") }}
{{ $_ := set .Values "features" (list
`nimbus`
`proxyd`
) }}
{{ $_ := set .Values "features" ( .Values._defaults | get .Values.flavor | get "features" ) }}
{{ end }}

#set default number of deployments when missing
{{ if not ( hasKey .Values "scaling" ) }}
{{ $_ := set .Values "scaling" dict }}
{{ end }}
{{ if not ( hasKey ( .Values | get "scaling" dict ) "deployments" ) }}
{{ $_ := set .Values.scaling "deployments" 1 }}
{{ $_ := set .Values.scaling "deployments" ( .Values._defaults | get .Values.flavor | get "scaling" | get "deployments" ) }}
{{ end }}

environments:
{{ .Environment.Name }}:
values:
- flavor: {{ .Values.flavor }}
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}
- features: {{ .Values.features | toYaml | nindent 10 }}
- scaling:
deployments: {{ .Values.scaling.deployments }}
Expand Down Expand Up @@ -103,7 +110,7 @@ kubeVersion: {{ .Values.kubeVersion }}
{{ end }}

#set default namespace
{{ $_defaultNamespace := ( print "eth-" .Values.flavor ) }}
{{ $_defaultNamespace := .Values._defaults | get .Values.flavor | get "targetNamespace" }}

{{ $_templatedValue_0 := .Values.flavor }}
{{- $_commonLabels := dict
Expand Down
12 changes: 11 additions & 1 deletion gnosis/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
#namespace defaults
{{ $_ := set .Values "_defaults" ( `{"flavor":"mainnet","common":{},"mainnet":{"targetNamespace":"gnosis-mainnet"}}` | fromJson ) }}
#set default flavor when missing
{{ if not ( hasKey .Values "flavor" ) }}
{{ $_ := set .Values "flavor" "mainnet" }}
{{ end }}

environments:
{{ .Environment.Name }}:
values:
- flavor: {{ .Values.flavor }}
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---


environments:
{{ .Environment.Name }}:
values:
- flavor: {{ .Values.flavor }}
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---
{{- $_tplTransforms := (print `
Expand Down Expand Up @@ -86,7 +96,7 @@ kubeVersion: {{ .Values.kubeVersion }}
{{ end }}

#set default namespace
{{ $_defaultNamespace := ( print "gnosis-" .Values.flavor ) }}
{{ $_defaultNamespace := .Values._defaults | get .Values.flavor | get "targetNamespace" }}


{{- $_commonLabels := dict
Expand Down
16 changes: 12 additions & 4 deletions graph/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
#namespace defaults
{{ $_ := set .Values "_defaults" ( `{"flavor":"mainnet","goerli":{"targetNamespace":"graph-goerli","features":["subgraph-radio"]},"mainnet":{"targetNamespace":"graph-mainnet","features":["subgraph-radio"]},"arbitrum_goerli":{"targetNamespace":"graph-arbitrum-goerli","features":["subgraph-radio"]},"common":{"features":["subgraph-radio"]},"arbitrum_one":{"targetNamespace":"graph-arbitrum-one","features":["subgraph-radio"]}}` | fromJson ) }}
#set default flavor when missing
{{ if not ( hasKey .Values "flavor" ) }}
{{ $_ := set .Values "flavor" "mainnet" }}
{{ end }}

environments:
{{ .Environment.Name }}:
values:
- flavor: {{ .Values.flavor }}
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---
# Define default features when undefined
{{ if not (hasKey .Values "features") }}
{{ $_ := set .Values "features" (list
`subgraph-radio`
) }}
{{ $_ := set .Values "features" ( .Values._defaults | get .Values.flavor | get "features" ) }}
{{ end }}


environments:
{{ .Environment.Name }}:
values:
- flavor: {{ .Values.flavor }}
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}
- features: {{ .Values.features | toYaml | nindent 10 }}

---
Expand Down Expand Up @@ -93,7 +101,7 @@ kubeVersion: {{ .Values.kubeVersion }}
{{ end }}

#set default namespace
{{ $_defaultNamespace := ( print "graph-" .Values.flavor ) }}
{{ $_defaultNamespace := .Values._defaults | get .Values.flavor | get "targetNamespace" }}


{{- $_commonLabels := dict
Expand Down
16 changes: 11 additions & 5 deletions ingress/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#namespace defaults
{{ $_ := set .Values "_defaults" ( `{"common":{"targetNamespace":"ingress","features":["ingress","cert-manager"]}}` | fromJson ) }}

environments:
{{ .Environment.Name }}:
values:
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---
# Define default features when undefined
{{ if not (hasKey .Values "features") }}
{{ $_ := set .Values "features" (list
`ingress`
`cert-manager`
) }}
{{ $_ := set .Values "features" .Values._defaults.common.features }}
{{ end }}


environments:
{{ .Environment.Name }}:
values:
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}
- features: {{ .Values.features | toYaml | nindent 10 }}

---
Expand Down Expand Up @@ -89,7 +95,7 @@ kubeVersion: {{ .Values.kubeVersion }}
{{ end }}

#set default namespace
{{ $_defaultNamespace := `ingress` }}
{{ $_defaultNamespace := .Values._defaults.common.targetNamespace }}


{{- $_commonLabels := dict
Expand Down
16 changes: 11 additions & 5 deletions monitoring/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#namespace defaults
{{ $_ := set .Values "_defaults" ( `{"common":{"targetNamespace":"monitoring","features":["metrics","logs"]}}` | fromJson ) }}

environments:
{{ .Environment.Name }}:
values:
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---
# Define default features when undefined
{{ if not (hasKey .Values "features") }}
{{ $_ := set .Values "features" (list
`metrics`
`logs`
) }}
{{ $_ := set .Values "features" .Values._defaults.common.features }}
{{ end }}


environments:
{{ .Environment.Name }}:
values:
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}
- features: {{ .Values.features | toYaml | nindent 10 }}

---
Expand Down Expand Up @@ -89,7 +95,7 @@ kubeVersion: {{ .Values.kubeVersion }}
{{ end }}

#set default namespace
{{ $_defaultNamespace := `monitoring` }}
{{ $_defaultNamespace := .Values._defaults.common.targetNamespace }}


{{- $_commonLabels := dict
Expand Down
12 changes: 11 additions & 1 deletion polygon/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
#namespace defaults
{{ $_ := set .Values "_defaults" ( `{"flavor":"mainnet","common":{},"mainnet":{"targetNamespace":"polygon-mainnet"}}` | fromJson ) }}
#set default flavor when missing
{{ if not ( hasKey .Values "flavor" ) }}
{{ $_ := set .Values "flavor" "mainnet" }}
{{ end }}

environments:
{{ .Environment.Name }}:
values:
- flavor: {{ .Values.flavor }}
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---


environments:
{{ .Environment.Name }}:
values:
- flavor: {{ .Values.flavor }}
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---
{{- $_tplTransforms := (print `
Expand Down Expand Up @@ -86,7 +96,7 @@ kubeVersion: {{ .Values.kubeVersion }}
{{ end }}

#set default namespace
{{ $_defaultNamespace := ( print "polygon-" .Values.flavor ) }}
{{ $_defaultNamespace := .Values._defaults | get .Values.flavor | get "targetNamespace" }}


{{- $_commonLabels := dict
Expand Down
13 changes: 11 additions & 2 deletions postgres-operator/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
#namespace defaults
{{ $_ := set .Values "_defaults" ( `{"common":{"targetNamespace":"postgres-operator"}}` | fromJson ) }}

environments:
{{ .Environment.Name }}:
values:
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---


environments:
{{ .Environment.Name }}:
values: []
values:
- _defaults: {{ .Values._defaults | toYaml | nindent 10 }}

---
{{- $_tplTransforms := (print `
Expand Down Expand Up @@ -81,7 +90,7 @@ kubeVersion: {{ .Values.kubeVersion }}
{{ end }}

#set default namespace
{{ $_defaultNamespace := `postgres-operator` }}
{{ $_defaultNamespace := .Values._defaults.common.targetNamespace }}


{{- $_commonLabels := dict
Expand Down
Loading

0 comments on commit 8203751

Please sign in to comment.