diff --git a/charts/blockscout-admin/Chart.yaml b/charts/blockscout-admin/Chart.yaml index af59183..cc02bf1 100644 --- a/charts/blockscout-admin/Chart.yaml +++ b/charts/blockscout-admin/Chart.yaml @@ -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. # @@ -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 diff --git a/charts/blockscout-admin/templates/metadata-deployment.yaml b/charts/blockscout-admin/templates/metadata-deployment.yaml new file mode 100644 index 0000000..923054d --- /dev/null +++ b/charts/blockscout-admin/templates/metadata-deployment.yaml @@ -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 }} +--- \ No newline at end of file diff --git a/charts/blockscout-admin/templates/metadata-ingress.yaml b/charts/blockscout-admin/templates/metadata-ingress.yaml new file mode 100644 index 0000000..b4a5098 --- /dev/null +++ b/charts/blockscout-admin/templates/metadata-ingress.yaml @@ -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 }} diff --git a/charts/blockscout-admin/templates/metadata-secret.yaml b/charts/blockscout-admin/templates/metadata-secret.yaml new file mode 100644 index 0000000..1344c4d --- /dev/null +++ b/charts/blockscout-admin/templates/metadata-secret.yaml @@ -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 }} +--- \ No newline at end of file diff --git a/charts/blockscout-admin/templates/metadata-service.yaml b/charts/blockscout-admin/templates/metadata-service.yaml new file mode 100644 index 0000000..8a5fa2d --- /dev/null +++ b/charts/blockscout-admin/templates/metadata-service.yaml @@ -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 }} diff --git a/charts/blockscout-admin/values.yaml b/charts/blockscout-admin/values.yaml index c97ed6f..3b15146 100644 --- a/charts/blockscout-admin/values.yaml +++ b/charts/blockscout-admin/values.yaml @@ -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: