Skip to content

Commit

Permalink
Merge pull request #16 from blockscout/proxy-verifier
Browse files Browse the repository at this point in the history
proxy-verifier chart
  • Loading branch information
alik-agaev authored Feb 21, 2024
2 parents 26f5897 + 3f9aff6 commit b42ea5e
Show file tree
Hide file tree
Showing 12 changed files with 475 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/blockscout-proxy-verifier/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions charts/blockscout-proxy-verifier/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ChangeLog

## 1.0.0

- Initial release

24 changes: 24 additions & 0 deletions charts/blockscout-proxy-verifier/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: blockscout-proxy-verifier
description: A Helm chart to deploy Blockscout proxy-verifier

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
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: 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
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.0.0"
49 changes: 49 additions & 0 deletions charts/blockscout-proxy-verifier/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# blockscout-proxy-verifier

A Helm chart to deploy Blockscout ENC application to kubernetes cluster

## Prerequisites

- Kubernetes 1.19+
- Helm 3+
<!-- - PostgreSQL version 12 to 14
- Redis (if accounts blockscout feature is enabled) -->

## Get Helm Repository Info

```console
helm repo add blockscout https://blockscout.github.io/helm-charts
helm repo update
```

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

## Install Helm Chart

```console
helm install [RELEASE_NAME] blockscout/blockscout-proxy-verifier
```
_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]
```
_See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._
This removes all the Kubernetes components associated with the chart and deletes the release.

## Upgrading Chart

```console
helm upgrade [RELEASE_NAME] blockscout/blockscout-proxy-verifier
```

## Configuration

See [Customizing the Chart Before Installing](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing). To see all configurable options with detailed comments:

```console
helm show values blockscout/blockscout-proxy-verifier
```
This chart does not contain default values for required ENV variables.
62 changes: 62 additions & 0 deletions charts/blockscout-proxy-verifier/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "blockscout-proxy-verifier.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "blockscout-proxy-verifier.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "blockscout-proxy-verifier.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "blockscout-proxy-verifier.labels" -}}
helm.sh/chart: {{ include "blockscout-proxy-verifier.chart" . }}
{{ include "blockscout-proxy-verifier.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "blockscout-proxy-verifier.selectorLabels" -}}
app.kubernetes.io/name: {{ include "blockscout-proxy-verifier.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "blockscout-proxy-verifier.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "blockscout-proxy-verifier.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "blockscout-proxy-verifier.fullname" . }}
labels:
app: {{ .Release.Name }}
{{- include "blockscout-proxy-verifier.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.proxyVerifier.replicaCount }}
selector:
matchLabels:
app: {{ .Release.Name }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/blockscout-proxy-verifier-secret.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app: {{ .Release.Name }}
{{- include "blockscout-proxy-verifier.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "blockscout-proxy-verifier.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.proxyVerifier.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.proxyVerifier.securityContext | nindent 12 }}
image: "{{ .Values.proxyVerifier.image.repository }}:{{ .Values.proxyVerifier.image.tag }}"
resources:
{{- toYaml .Values.proxyVerifier.resources | nindent 12 }}
imagePullPolicy: {{ .Values.proxyVerifier.image.pullPolicy }}
{{- with .Values.proxyVerifier.command }}
command: {{ . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.proxyVerifier.args }}
args: {{ . | toYaml | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 8050
protocol: TCP
- name: metrics
containerPort: 6060
protocol: TCP
env:
{{- range $key, $value := .Values.proxyVerifier.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
envFrom:
- secretRef:
name: {{ include "blockscout-proxy-verifier.fullname" . }}-env
{{- if .Values.proxyVerifier.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: {{ .Values.proxyVerifier.readinessProbe.path }}
port: http
scheme: HTTP
{{- with .Values.proxyVerifier.readinessProbe.params }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.proxyVerifier.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: {{ .Values.proxyVerifier.livenessProbe.path }}
port: http
scheme: HTTP
{{- with .Values.proxyVerifier.livenessProbe.params }}
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.proxyVerifier.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ . | toYaml | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{{- if .Values.proxyVerifier.ingress.enabled }}
{{- $fullName := include "blockscout-proxy-verifier.fullname" . -}}
{{- $svcPort := "80" -}}
{{- if and .Values.proxyVerifier.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-ingress
labels:
{{- include "blockscout-proxy-verifier.labels" . | nindent 4 }}
{{- with .Values.proxyVerifier.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.proxyVerifier.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.proxyVerifier.ingress.className }}
{{- end }}
{{- if .Values.proxyVerifier.ingress.tls.enabled }}
tls:
- hosts:
- {{ .Values.proxyVerifier.ingress.hostname | quote }}
secretName: {{ $fullName }}-tls
{{- end }}
rules:
- host: {{ .Values.proxyVerifier.ingress.hostname | quote }}
http:
paths:
{{- range .Values.proxyVerifier.ingress.paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}-svc
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}-svc
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "blockscout-proxy-verifier.fullname" . }}-env
labels:
{{- include "blockscout-proxy-verifier.labels" . | nindent 4 }}
type: Opaque
data:
{{- range $key, $value := .Values.proxyVerifier.envFromSecret }}
{{ $key }}: {{ $value | b64enc }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "blockscout-proxy-verifier.fullname" . }}-svc
labels:
app: {{ .Release.Name }}-svc
{{- include "blockscout-proxy-verifier.labels" . | nindent 4 }}
spec:
type: {{ .Values.proxyVerifier.service.type }}
ports:
- port: 80
targetPort: http
protocol: TCP
name: http
- port: 6060
targetPort: http
protocol: TCP
name: metrics
selector:
app: {{ .Release.Name }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.proxyVerifier.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "blockscout-proxy-verifier.fullname" . }}-svm
labels:
{{- include "blockscout-proxy-verifier.labels" . | nindent 4 }}
spec:
endpoints:
- scrapeTimeout: 30s
port: {{ .Values.proxyVerifier.serviceMonitor.portName }}
path: {{ .Values.proxyVerifier.serviceMonitor.path }}
selector:
matchLabels:
app: {{ include "blockscout-proxy-verifier.fullname" . }}-svc
{{- end }}
12 changes: 12 additions & 0 deletions charts/blockscout-proxy-verifier/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "blockscout-proxy-verifier.serviceAccountName" . }}
labels:
{{- include "blockscout-proxy-verifier.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading

0 comments on commit b42ea5e

Please sign in to comment.