Skip to content

Commit

Permalink
Adding metadata admin-service
Browse files Browse the repository at this point in the history
  • Loading branch information
nzenchik committed Jan 22, 2024
1 parent 3541812 commit 7f8da3e
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 2 deletions.
4 changes: 2 additions & 2 deletions charts/blockscout-admin/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: blockscout-admin
description: A Helm chart for Blockscout admin services - admin-rs, admin-ts, contracts-info, token-info-extractor
description: A Helm chart for Blockscout admin services - admin-rs, admin-ts, contracts-info, metadata, token-info-extractor

# A chart can be either an 'application' or a 'library' chart.
#
Expand All @@ -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: 1.0.1
version: 1.1.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
79 changes: 79 additions & 0 deletions charts/blockscout-admin/templates/metadata-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: metadata-{{ include "blockscout-admin.fullname" . }}
labels:
{{- include "blockscout-admin.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.metadata.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: metadata-{{ include "blockscout-admin.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
annotations:
{{- if eq .Values.metadata.image.pullPolicy "Always" }}
rollme: {{ randAlphaNum 5 | quote }}
{{- end }}
checksum/config: {{ include (print $.Template.BasePath "/metadata-secret.yaml") . | sha256sum }}
labels:
app.kubernetes.io/name: metadata-{{ include "blockscout-admin.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "blockscout-admin.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Release.Name }}-metadata
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.metadata.image.repository }}:{{ .Values.metadata.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.metadata.image.pullPolicy }}
env:
{{- range .Values.metadata.environment }}
- name: {{ .name }}
value: {{ .value | quote }}
{{- end }}
envFrom:
- secretRef:
name: metadata-{{ include "blockscout-admin.fullname" . }}-env
ports:
- name: http
containerPort: {{ .Values.metadata.service.targetPort }}
protocol: TCP
readinessProbe:
httpGet:
path: /health
port: {{ .Values.metadata.service.targetPort }}
scheme: HTTP
{{- with .Values.readinessProbe.params -}}
{{ . | toYaml | nindent 12 }}
{{- end }}
livenessProbe:
httpGet:
path: /health
port: {{ .Values.metadata.service.targetPort }}
scheme: HTTP
{{- with .Values.livenessProbe.params -}}
{{ . | toYaml | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.metadata.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
---
61 changes: 61 additions & 0 deletions charts/blockscout-admin/templates/metadata-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- if .Values.metadata.ingress.enabled -}}
{{- $fullName := include "blockscout-admin.fullname" . -}}
{{- $svcPort := .Values.metadata.service.port -}}
{{- if and .Values.metadata.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.metadata.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.metadata.ingress.annotations "kubernetes.io/ingress.class" .Values.metadata.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: metadata-{{ $fullName }}
labels:
{{- include "blockscout-admin.labels" . | nindent 4 }}
{{- with .Values.metadata.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.metadata.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.metadata.ingress.className }}
{{- end }}
{{- if .Values.metadata.ingress.tls }}
tls:
{{- range .Values.metadata.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.metadata.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .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: metadata-{{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: metadata-{{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
12 changes: 12 additions & 0 deletions charts/blockscout-admin/templates/metadata-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Secret
metadata:
name: metadata-{{ include "blockscout-admin.fullname" . }}-env
labels:
{{- include "blockscout-admin.labels" . | nindent 4 }}
type: Opaque
data:
{{- range .Values.metadata.envFromSecret }}
{{ .name }}: {{ .value | b64enc }}
{{- end }}
---
16 changes: 16 additions & 0 deletions charts/blockscout-admin/templates/metadata-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: metadata-{{ include "blockscout-admin.fullname" . }}
labels:
{{- include "blockscout-admin.labels" . | nindent 4 }}
spec:
type: {{ .Values.metadata.service.type }}
ports:
- port: {{ .Values.metadata.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/name: metadata-{{ include "blockscout-admin.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
41 changes: 41 additions & 0 deletions charts/blockscout-admin/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,47 @@ contractsInfo:
memory: "96Mi"
cpu: "50m"

metadata:
replicaCount: 1

image:
repository: ghcr.io/blockscout/metadata
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
service:
type: ClusterIP
port: 80
targetPort: 8050
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
environment: {}
#- name: SOME_ENV
# value: value
envFromSecret: {}
#- name: SOME_SECRET_ENV
# value: secret_value
resource:
limits:
memory: "256Mi"
cpu: "100m"
requests:
memory: "96Mi"
cpu: "50m"

tokenInfoExtractor:
enabled: false
image:
Expand Down

0 comments on commit 7f8da3e

Please sign in to comment.