Skip to content

Commit

Permalink
add charts back
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtzData committed Mar 25, 2024
1 parent 510574a commit a326e5a
Show file tree
Hide file tree
Showing 96 changed files with 6,697 additions and 0 deletions.
5 changes: 5 additions & 0 deletions charts/blockscout-stack/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
values-**
client-**
node-**
!values-test.yaml
frontend-test
9 changes: 9 additions & 0 deletions charts/blockscout-stack/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
appVersion: 0.6.3
version: 0.6.3
name: blockscout-stack
description: '''
Helm chart for deploying blockscout-stack in K8S
Deploy command: `helm upgrade --install -n=<namespace> blockscout-stack ./ -f values-<name>.yaml`
'''
74 changes: 74 additions & 0 deletions charts/blockscout-stack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# blockscout-stack

Installs the blockscout-stack, a collection of Kubernetes manifests: [Blockscout](https://github.com/blockscout/blockscout), [Rust services](https://github.com/blockscout/blockscout-rs), Blockscout Allowance service, frontend, Postgres DB, geth node (+ client if needed).

See the [blockscout](https://github.com/blockscout/blockscout) README for details about environments, and configuration options.

## Prerequisites

- Kubernetes 1.16+
- Helm 3+

## Get Helm Repository Info

```console
helm repo add blockscout-stack https://blockscout.github.io/blockscout-ci-cd/
helm repo update
```

_See [`helm repo`](https://helm.sh/docs/helm/helm_repo/) for command documentation._

## Install Helm Chart

```console
helm install [RELEASE_NAME] prometheus-community/kube-prometheus-stack
helm secrets install \
--repo https://blockscout.github.io/blockscout-ci-cd/ \
[RELEASE_NAME] blockscout-stack \
-f [VALUES_DIR]/values.yaml \
-f [VALUES_DIR]/secrets.yaml \
-n [APP_NAMESPACE]
```

_See [configuration](#configuration) below._

_See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._

## Uninstall Helm Chart

```console
helm uninstall [RELEASE_NAME]
```

This removes all the Kubernetes components associated with the chart and deletes the release.

_See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._

## Upgrading Chart

```console
helm secrets upgrade --install \
--repo https://blockscout.github.io/blockscout-ci-cd/ \
[RELEASE_NAME] blockscout-stack \
-f [VALUES_DIR]/values.yaml \
-f [VALUES_DIR]/secrets.yaml \
-n [APP_NAMESPACE]
```

_See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation._

## Configuration

See [Customizing the Chart Before Installing](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing). All configurable options with detailed comments are in [values.yaml](https://github.com/blockscout/blockscout-ci-cd/blob/master/charts/blockscout-stack/values.yaml).

### Enable services

To enable a service during installation, set `service_name.enabled` to `true`. For example `scVerifier.enabled`, `postgres.enabled` and `frontend.enabled`.


## Further Information

For more in-depth documentation of configuration options meanings, please see

- [Blockscout](https://github.com/blockscout/blockscout)
- [Rust services](https://github.com/blockscout/blockscout-rs)
12 changes: 12 additions & 0 deletions charts/blockscout-stack/templates/admin-rs/_envs.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- define "adminRs_env" }}
{{- range $key, $value := .Values.adminRs.environment }}
{{- $item := get $.Values.adminRs.environment $key }}
{{- if or (kindIs "string" $item) (kindIs "int64" $item) (kindIs "bool" $item)}}
- name: {{ $key }}
value: {{ $value | quote }}
{{- else }}
- name: {{ $key }}
value: {{ pluck $.Values.global.env $item | first | default $item._default | quote }}
{{- end }}
{{- end }}
{{- end }}
13 changes: 13 additions & 0 deletions charts/blockscout-stack/templates/admin-rs/cm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.adminRs.enabled }}
{{- if .Values.adminRs.files.enabled }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: admin-rs-cm
data:
{{- range $key, $value := .Values.adminRs.files.list }}
{{ $key }}: {{ toYaml $value | indent 2 }}
{{- end }}
{{- end }}
{{- end }}
84 changes: 84 additions & 0 deletions charts/blockscout-stack/templates/admin-rs/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{{- if .Values.adminRs.enabled }}
kind: Deployment
apiVersion: apps/v1
metadata:
name: {{ .Release.Name }}-admin-rs
spec:
replicas: {{ .Values.adminRs.replicas.app }}
strategy:
type: {{ .Values.adminRs.strategy }}
selector:
matchLabels:
app: {{ .Release.Name }}-admin-rs
template:
metadata:
labels:
app: {{ .Release.Name }}-admin-rs
{{- if eq .Values.adminRs.image.pullPolicy "Always" }}
annotations:
rollme: {{ randAlphaNum 5 | quote }}
{{- end }}
spec:
imagePullSecrets:
- name: regcred
containers:
- name: {{ .Release.Name }}-admin-rs
image: {{ pluck $.Values.global.env .Values.adminRs.image | first | default .Values.adminRs.image._default | quote }}
resources:
{{- with .Values.adminRs.resources }}
limits:
memory: {{ pluck $.Values.global.env .limits.memory | first | default .limits.memory._default | quote }}
cpu: {{ pluck $.Values.global.env .limits.cpu | first | default .limits.cpu._default | quote }}
requests:
memory: {{ pluck $.Values.global.env .requests.memory | first | default .requests.memory._default | quote }}
cpu: {{ pluck $.Values.global.env .requests.cpu | first | default .requests.cpu._default | quote }}
{{- end }}
imagePullPolicy: {{ .Values.adminRs.image.pullPolicy }}
ports:
- containerPort: {{ .Values.adminRs.docker.targetPort }}
# - containerPort: {{ .Values.adminRs.docker.metricsPort }}
# name: http-metrics
env:
{{- include "adminRs_env" . | indent 10 }}
{{- if .Values.adminRs.files.enabled }}
volumeMounts:
{{- range $key, $value := .Values.adminRs.files.list }}
- mountPath: {{ $.Values.adminRs.files.mountPath }}/{{ $key }}
name: admin-rs-cm
subPath: {{ $key }}
{{- end }}
{{- end }}
{{- if .Values.adminRs.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: {{ .Values.adminRs.readinessProbe.path }}
port: {{ .Values.adminRs.docker.targetPort }}
scheme: HTTP
{{- with .Values.adminRs.readinessProbe.params }}
{{ . | toYaml | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.adminRs.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: {{ .Values.adminRs.livenessProbe.path }}
port: {{ .Values.adminRs.docker.targetPort }}
scheme: HTTP
{{- with .Values.adminRs.livenessProbe.params }}
{{ . | toYaml | nindent 12 }}
{{- end }}
{{- end }}
restartPolicy: Always
{{- if .Values.adminRs.files.enabled }}
volumes:
- configMap:
name: admin-rs-cm
defaultMode: 0777
name: admin-rs-cm
{{- end }}
{{- if .Values.adminRs.nodeSelector.enabled }}
nodeSelector:
{{- pluck $.Values.global.env .Values.adminRs.nodeSelector.labels | first | default .Values.adminRs.nodeSelector.labels._default | toYaml | nindent 8 }}
{{- end }}
---
{{- end}}
47 changes: 47 additions & 0 deletions charts/blockscout-stack/templates/admin-rs/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{{- if .Values.adminRs.enabled }}
{{- if .Values.adminRs.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: internal-and-public
nginx.ingress.kubernetes.io/proxy-body-size: 500m
nginx.ingress.kubernetes.io/client-max-body-size: "500M"
nginx.ingress.kubernetes.io/proxy-buffering: "off"
nginx.ingress.kubernetes.io/proxy-connect-timeout: "15m"
nginx.ingress.kubernetes.io/proxy-send-timeout: "15m"
nginx.ingress.kubernetes.io/proxy-read-timeout: "15m"
cert-manager.io/cluster-issuer: "zerossl-prod"
{{- range .Values.adminRs.ingress.annotations }}
{{ . }}
{{- end}}
name: {{ .Release.Name }}-admin-rs-ingress
spec:
rules:
- host: {{ pluck $.Values.global.env .Values.adminRs.ingress.host | first | default .Values.adminRs.ingress.host._default | quote }}
http:
paths:
# - path: "/metrics"
# pathType: Exact
# backend:
# service:
# name: admin-rs-svc
# port:
# number: {{ .Values.adminRs.docker.metricsPort }}
- path: "/"
pathType: Prefix
backend:
service:
name: admin-rs-svc
port:
number: {{ .Values.adminRs.docker.port }}
{{- if .Values.adminRs.ingress.tls.enabled }}
tls:
- hosts:
- {{ pluck $.Values.global.env .Values.adminRs.ingress.host | first | default .Values.adminRs.ingress.host._default | quote }}
{{- if .Values.adminRs.ingress.tls.createSecret }}
secretName: {{ .Release.Name }}-admin-rs-tls
{{- end }}
{{- end }}
{{- end }}
{{- end }}
26 changes: 26 additions & 0 deletions charts/blockscout-stack/templates/admin-rs/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- if .Values.adminRs.enabled }}
kind: Service
apiVersion: v1
metadata:
name: admin-rs-svc
# annotations:
# service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
# service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
# service.beta.kubernetes.io/aws-load-balancer-type: external
labels:
app: {{ .Release.Name }}-admin-rs
spec:
type: {{ .Values.adminRs.service.type}}
ports:
- port: {{ .Values.adminRs.docker.port }}
targetPort: {{ .Values.adminRs.docker.targetPort }}
protocol: TCP
name: web
# - port: {{ .Values.adminRs.docker.metricsPort }}
# targetPort: {{ .Values.adminRs.docker.metricsPort }}
# protocol: TCP
# name: http-metrics
selector:
app: {{ .Release.Name }}-admin-rs
{{- end }}
---
14 changes: 14 additions & 0 deletions charts/blockscout-stack/templates/admin-rs/serviceMonitor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# {{- if .Values.adminRs.enabled }}
# apiVersion: monitoring.coreos.com/v1
# kind: ServiceMonitor
# metadata:
# name: {{ .Release.Name }}-admin-rs
# spec:
# endpoints:
# - scrapeTimeout: 10s
# port: http-metrics
# path: /metrics
# selector:
# matchLabels:
# app: {{ .Release.Name }}-admin-rs
# {{- end }}
12 changes: 12 additions & 0 deletions charts/blockscout-stack/templates/admin-ts/_envs.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- define "adminTs_env" }}
{{- range $key, $value := .Values.adminTs.environment }}
{{- $item := get $.Values.adminTs.environment $key }}
{{- if or (kindIs "string" $item) (kindIs "int64" $item) (kindIs "bool" $item)}}
- name: {{ $key }}
value: {{ $value | quote }}
{{- else }}
- name: {{ $key }}
value: {{ pluck $.Values.global.env $item | first | default $item._default | quote }}
{{- end }}
{{- end }}
{{- end }}
13 changes: 13 additions & 0 deletions charts/blockscout-stack/templates/admin-ts/cm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.adminTs.enabled }}
{{- if .Values.adminTs.files.enabled }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: admin-ts-cm
data:
{{- range $key, $value := .Values.adminTs.files.list }}
{{ $key }}: {{ toYaml $value | indent 2 }}
{{- end }}
{{- end }}
{{- end }}
Loading

0 comments on commit a326e5a

Please sign in to comment.