Skip to content

Commit

Permalink
blockscout-stack: adding envs as secret, config params for common var…
Browse files Browse the repository at this point in the history
…s for front and back
  • Loading branch information
nzenchik committed Aug 4, 2023
1 parent 73a4f4a commit 5134294
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/blockscout-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.3
version: 1.0.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
54 changes: 54 additions & 0 deletions charts/blockscout-stack/templates/blockscout-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,37 @@ spec:
args: {{ . | toYaml | nindent 12 }}
{{- end }}
env:
- name: PORT
value: "4000"
- name: CHAIN_ID
value: {{ .Values.config.network.id | quote }}
{{- if .Values.config.network.currency.symbol | quote }}
- name: COIN
value: {{ .Values.config.network.currency.symbol | quote }}
{{- end }}
{{- if .Values.config.account.enabled }}
- name: ACCOUNT_ENABLED
value: "true"
{{- end }}
{{- if .Values.config.testnet }}
- name: SHOW_TESTNET_LABEL
value: "true"
{{- end }}
{{- if .Values.frontend.enabled }}
- name: API_V2_ENABLED
value: "true"
{{- end }}
{{- if .Values.blockscout.ingress.enabled }}
- name: BLOCKSCOUT_HOST
value: {{ .Values.blockscout.ingress.hostname | quote }}
{{- end }}
{{- range $key, $value := .Values.blockscout.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
envFrom:
- secretRef:
name: {{ include "blockscout-stack.fullname" . }}-blockscout-env
{{- end }}
containers:
- name: {{ .Chart.Name }}-blockscout
Expand All @@ -65,10 +92,37 @@ spec:
containerPort: 4000
protocol: TCP
env:
- name: PORT
value: "4000"
- name: CHAIN_ID
value: {{ .Values.config.network.id | quote }}
{{- if .Values.config.network.currency.symbol | quote }}
- name: COIN
value: {{ .Values.config.network.currency.symbol | quote }}
{{- end }}
{{- if .Values.config.account.enabled }}
- name: ACCOUNT_ENABLED
value: "true"
{{- end }}
{{- if .Values.config.testnet }}
- name: SHOW_TESTNET_LABEL
value: "true"
{{- end }}
{{- if .Values.frontend.enabled }}
- name: API_V2_ENABLED
value: "true"
{{- end }}
{{- if .Values.blockscout.ingress.enabled }}
- name: BLOCKSCOUT_HOST
value: {{ .Values.blockscout.ingress.hostname | quote }}
{{- end }}
{{- range $key, $value := .Values.blockscout.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
envFrom:
- secretRef:
name: {{ include "blockscout-stack.fullname" . }}-blockscout-env
{{- if .Values.blockscout.readinessProbe.enabled }}
readinessProbe:
httpGet:
Expand Down
13 changes: 13 additions & 0 deletions charts/blockscout-stack/templates/blockscout-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.blockscout.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "blockscout-stack.fullname" . }}-blockscout-env
labels:
{{- include "blockscout-stack.labels" . | nindent 4 }}
type: Opaque
data:
{{- range $key, $value := .Values.blockscout.envFromSecret }}
{{ $key }}: {{ $value | b64enc }}
{{- end }}
{{- end }}
37 changes: 37 additions & 0 deletions charts/blockscout-stack/templates/frontend-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,47 @@ spec:
containerPort: 3000
protocol: TCP
env:
- name: NEXT_PUBLIC_NETWORK_ID
value: {{ .Values.config.network.id | quote }}
- name: NEXT_PUBLIC_NETWORK_NAME
value: {{ .Values.config.network.name | quote }}
- name: NEXT_PUBLIC_NETWORK_SHORT_NAME
value: {{ .Values.config.network.shortname | quote }}
- name: NEXT_PUBLIC_NETWORK_CURRENCY_NAME
value: {{ .Values.config.network.currency.name | quote }}
{{- if .Values.config.network.currency.symbol | quote }}
- name: NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL
value: {{ .Values.config.network.currency.symbol | quote }}
{{- end }}
- name: NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS
value: {{ .Values.config.network.currency.decimals | quote }}
{{- if .Values.config.account.enabled }}
- name: NEXT_PUBLIC_IS_ACCOUNT_SUPPORTED
value: "true"
{{- end }}
{{- if .Values.config.testnet }}
- name: NEXT_PUBLIC_IS_TESTNET
value: "true"
{{- end }}
{{- if .Values.blockscout.ingress.enabled }}
- name: NEXT_PUBLIC_API_HOST
value: {{ .Values.blockscout.ingress.hostname | quote }}
{{- end }}
{{- if .Values.frontend.ingress.enabled }}
- name: NEXT_PUBLIC_APP_HOST
value: {{ .Values.frontend.ingress.hostname | quote }}
{{- end }}
{{- if .Values.stats.ingress.enabled }}
- name: NEXT_PUBLIC_STATS_API_HOST
value: https://{{ .Values.stats.ingress.hostname | quote }}
{{- end }}
{{- range $key, $value := .Values.frontend.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
envFrom:
- secretRef:
name: {{ include "blockscout-stack.fullname" . }}-frontend-env
{{- if .Values.stats.files.enabled }}
volumeMounts:
{{- range $key, $value := .Values.stats.files.list }}
Expand Down
13 changes: 13 additions & 0 deletions charts/blockscout-stack/templates/frontend-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.frontend.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "blockscout-stack.fullname" . }}-frontend-env
labels:
{{- include "blockscout-stack.labels" . | nindent 4 }}
type: Opaque
data:
{{- range $key, $value := .Values.frontend.envFromSecret }}
{{ $key }}: {{ $value | b64enc }}
{{- end }}
{{- end }}
3 changes: 3 additions & 0 deletions charts/blockscout-stack/templates/stats-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ spec:
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
envFrom:
- secretRef:
name: {{ include "blockscout-stack.fullname" . }}-stats-env
{{- if .Values.stats.readinessProbe.enabled }}
readinessProbe:
httpGet:
Expand Down
13 changes: 13 additions & 0 deletions charts/blockscout-stack/templates/stats-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.stats.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "blockscout-stack.fullname" . }}-stats-env
labels:
{{- include "blockscout-stack.labels" . | nindent 4 }}
type: Opaque
data:
{{- range $key, $value := .Values.stats.envFromSecret }}
{{ $key }}: {{ $value | b64enc }}
{{- end }}
{{- end }}
21 changes: 19 additions & 2 deletions charts/blockscout-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ fullnameOverride: ""

imagePullSecrets: []

config:
network:
id: 1
name: Ether
shortname: Ether
currency:
name: Ether
symbol: ETH
decimals: 18
account:
enabled: false
testnet: false
blockscout:
enabled: true
replicaCount: 1
Expand All @@ -21,6 +33,8 @@ blockscout:
- bin/blockscout eval "Elixir.Explorer.ReleaseTasks.create_and_migrate()"
env: []
# NAME: VALUE
envFromSecret: []
# NAME: VALUE

command:
- /bin/sh
Expand Down Expand Up @@ -157,6 +171,8 @@ frontend:

env: []
# NAME: VALUE
envFromSecret: []
# NAME: VALUE

stats:
enabled: false
Expand Down Expand Up @@ -221,8 +237,9 @@ stats:
timeoutSeconds: 60

env: []
# DATABASE_URL: postgresql://<user>:<pass>@postgres:5432/<db>

# NAME: VALUE
envFromSecret: []
# NAME: VALUE
serviceAccount:
# Specifies whether a service account should be created
create: true
Expand Down

0 comments on commit 5134294

Please sign in to comment.