diff --git a/charts/smart-contract-verification/.helmignore b/charts/smart-contract-verification/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/smart-contract-verification/.helmignore @@ -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/ diff --git a/charts/smart-contract-verification/Chart.yaml b/charts/smart-contract-verification/Chart.yaml new file mode 100644 index 0000000..cfc305a --- /dev/null +++ b/charts/smart-contract-verification/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: smart-contract-verification +description: A Helm chart for Kubernetes + +# 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: 0.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 +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.0.0" diff --git a/charts/smart-contract-verification/templates/_helpers.tpl b/charts/smart-contract-verification/templates/_helpers.tpl new file mode 100644 index 0000000..7abde75 --- /dev/null +++ b/charts/smart-contract-verification/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "smart-contract-verification.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 "smart-contract-verification.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 "smart-contract-verification.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "smart-contract-verification.labels" -}} +helm.sh/chart: {{ include "smart-contract-verification.chart" . }} +{{ include "smart-contract-verification.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "smart-contract-verification.selectorLabels" -}} +app.kubernetes.io/name: {{ include "smart-contract-verification.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "smart-contract-verification.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "smart-contract-verification.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/smart-contract-verification/templates/eth-bytecode-db-deployment.yaml b/charts/smart-contract-verification/templates/eth-bytecode-db-deployment.yaml new file mode 100644 index 0000000..719b7a3 --- /dev/null +++ b/charts/smart-contract-verification/templates/eth-bytecode-db-deployment.yaml @@ -0,0 +1,99 @@ +{{- if .Values.ethBytecodeDb.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "smart-contract-verification.fullname" . }}-eth-bytecode-db + labels: + app: {{ include "smart-contract-verification.fullname" . }}-eth-bytecode-db + {{- include "smart-contract-verification.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.ethBytecodeDb.replicaCount }} + selector: + matchLabels: + app: {{ include "smart-contract-verification.fullname" . }}-eth-bytecode-db + {{- include "smart-contract-verification.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if eq .Values.ethBytecodeDb.image.pullPolicy "Always" }} + rollme: {{ randAlphaNum 5 | quote }} + {{- end }} + {{- with .Values.ethBytecodeDb.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + app: {{ include "smart-contract-verification.fullname" . }}-eth-bytecode-db + {{- include "smart-contract-verification.labels" . | nindent 8 }} + {{- with .Values.ethBytecodeDb.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "smart-contract-verification.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.ethBytecodeDb.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }}-eth-bytecode-db + securityContext: + {{- toYaml .Values.ethBytecodeDb.securityContext | nindent 12 }} + image: "{{ .Values.ethBytecodeDb.image.repository }}:{{ .Values.ethBytecodeDb.image.tag }}" + imagePullPolicy: {{ .Values.ethBytecodeDb.image.pullPolicy }} + env: + - name: ETH_BYTECODE_DB__SERVER__HTTP__ADDR + value: "0.0.0.0:{{ .Values.ethBytecodeDb.service.port }}" + - name: ETH_BYTECODE_DB__VERIFIER__HTTP_URL + value: http://{{ include "smart-contract-verification.fullname" . }}-smart-contract-verifier:{{ .Values.smartContractVerifier.service.port }} + {{- if .Values.metrics.enabled }} + - name: ETH_BYTECODE_DB__METRICS__ENABLED + value: 'true' + - name: ETH_BYTECODE_DB__METRICS__ADDR + value: 0.0.0.0:{{ .Values.metrics.port }} + {{- end }} + {{- range $key, $value := .Values.ethBytecodeDb.env }} + - name: {{ $key }} + value: {{ $value | quote }} + {{- end }} + {{- if or .Values.ethBytecodeDb.envFromSecret }} + envFrom: + - secretRef: + name: {{ include "smart-contract-verification.fullname" . }}-eth-bytecode-db-env + {{- end }} + ports: + - name: http + containerPort: {{ .Values.ethBytecodeDb.service.port }} + protocol: TCP + {{- if .Values.metrics.enabled }} + - name: metrics + containerPort: {{ .Values.metrics.port }} + protocol: TCP + {{- end }} + livenessProbe: + {{- toYaml .Values.ethBytecodeDb.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.ethBytecodeDb.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.ethBytecodeDb.resources | nindent 12 }} + {{- with .Values.ethBytecodeDb.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.ethBytecodeDb.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/smart-contract-verification/templates/eth-bytecode-db-ingress.yaml b/charts/smart-contract-verification/templates/eth-bytecode-db-ingress.yaml new file mode 100644 index 0000000..8116641 --- /dev/null +++ b/charts/smart-contract-verification/templates/eth-bytecode-db-ingress.yaml @@ -0,0 +1,51 @@ +{{- if .Values.ethBytecodeDb.ingress.enabled -}} +{{- $fullName := include "smart-contract-verification.fullname" . -}} +{{- $svcPort := .Values.ethBytecodeDb.service.port -}} +{{- if and .Values.ethBytecodeDb.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ethBytecodeDb.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ethBytecodeDb.ingress.annotations "kubernetes.io/ingress.class" .Values.ethBytecodeDb.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 }}-eth-bytecode-db + labels: + {{- include "smart-contract-verification.labels" . | nindent 4 }} + {{- with .Values.ethBytecodeDb.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ethBytecodeDb.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ethBytecodeDb.ingress.className }} + {{- end }} + {{- if .Values.ethBytecodeDb.ingress.tls.enabled }} + tls: + - hosts: + - {{ .Values.ethBytecodeDb.ingress.hostname | quote }} + secretName: {{ $fullName }}-eth-bytecode-db-ingress-tls + {{- end }} + rules: + - host: {{ .Values.ethBytecodeDb.ingress.hostname | quote }} + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }}-eth-bytecode-db + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }}-eth-bytecode-db + servicePort: {{ $svcPort }} + {{- end }} +{{- end }} diff --git a/charts/smart-contract-verification/templates/eth-bytecode-db-secret.yaml b/charts/smart-contract-verification/templates/eth-bytecode-db-secret.yaml new file mode 100644 index 0000000..0979283 --- /dev/null +++ b/charts/smart-contract-verification/templates/eth-bytecode-db-secret.yaml @@ -0,0 +1,13 @@ +{{- if .Values.ethBytecodeDb.envFromSecret }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "smart-contract-verification.fullname" . }}-eth-bytecode-db-env + labels: + {{- include "smart-contract-verification.labels" . | nindent 4 }} +type: Opaque +data: +{{- range $key, $value := .Values.ethBytecodeDb.envFromSecret }} + {{ $key }}: {{ $value | b64enc }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/smart-contract-verification/templates/eth-bytecode-db-service.yaml b/charts/smart-contract-verification/templates/eth-bytecode-db-service.yaml new file mode 100644 index 0000000..514df33 --- /dev/null +++ b/charts/smart-contract-verification/templates/eth-bytecode-db-service.yaml @@ -0,0 +1,24 @@ +{{- if .Values.ethBytecodeDb.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "smart-contract-verification.fullname" . }}-eth-bytecode-db + labels: + {{- include "smart-contract-verification.labels" . | nindent 4 }} +spec: + type: {{ .Values.ethBytecodeDb.service.type }} + ports: + - port: {{ .Values.ethBytecodeDb.service.port }} + targetPort: http + protocol: TCP + name: http + {{- if .Values.metrics.enabled }} + - port: {{ .Values.metrics.port }} + targetPort: metrics + protocol: TCP + name: metrics + {{- end }} + selector: + app: {{ include "smart-contract-verification.fullname" . }}-eth-bytecode-db + {{- include "smart-contract-verification.selectorLabels" . | nindent 4 }} +{{- end }} \ No newline at end of file diff --git a/charts/smart-contract-verification/templates/eth-bytecode-db-servicemonitor.yaml b/charts/smart-contract-verification/templates/eth-bytecode-db-servicemonitor.yaml new file mode 100644 index 0000000..ad7a177 --- /dev/null +++ b/charts/smart-contract-verification/templates/eth-bytecode-db-servicemonitor.yaml @@ -0,0 +1,16 @@ +{{- if and .Values.metrics.enabled .Values.metrics.prometheus.enabled .Values.ethBytecodeDb.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "smart-contract-verification.fullname" . }}-eth-bytecode-db + labels: + {{- include "smart-contract-verification.labels" . | nindent 4 }} +spec: + endpoints: + - scrapeTimeout: 30s + port: metrics + path: /metrics + selector: + matchLabels: + app: {{ include "smart-contract-verification.fullname" . }}-eth-bytecode-db +{{- end }} \ No newline at end of file diff --git a/charts/smart-contract-verification/templates/serviceaccount.yaml b/charts/smart-contract-verification/templates/serviceaccount.yaml new file mode 100644 index 0000000..f3f00f6 --- /dev/null +++ b/charts/smart-contract-verification/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "smart-contract-verification.serviceAccountName" . }} + labels: + {{- include "smart-contract-verification.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/charts/smart-contract-verification/templates/sig-provider-deployment.yaml b/charts/smart-contract-verification/templates/sig-provider-deployment.yaml new file mode 100644 index 0000000..2e71d69 --- /dev/null +++ b/charts/smart-contract-verification/templates/sig-provider-deployment.yaml @@ -0,0 +1,94 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "smart-contract-verification.fullname" . }}-sig-provider + labels: + app: {{ include "smart-contract-verification.fullname" . }}-sig-provider + {{- include "smart-contract-verification.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.sigProvider.replicaCount }} + selector: + matchLabels: + app: {{ include "smart-contract-verification.fullname" . }}-sig-provider + {{- include "smart-contract-verification.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if eq .Values.sigProvider.image.pullPolicy "Always" }} + rollme: {{ randAlphaNum 5 | quote }} + {{- end }} + {{- with .Values.sigProvider.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + app: {{ include "smart-contract-verification.fullname" . }}-sig-provider + {{- include "smart-contract-verification.labels" . | nindent 8 }} + {{- with .Values.sigProvider.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "smart-contract-verification.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.sigProvider.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }}-sig-provider + securityContext: + {{- toYaml .Values.sigProvider.securityContext | nindent 12 }} + image: "{{ .Values.sigProvider.image.repository }}:{{ .Values.sigProvider.image.tag }}" + imagePullPolicy: {{ .Values.sigProvider.image.pullPolicy }} + env: + - name: SIG_PROVIDER__SERVER__HTTP__ADDR + value: "0.0.0.0:{{ .Values.sigProvider.service.port }}" + {{- if .Values.metrics.enabled }} + - name: SIG_PROVIDER__METRICS__ENABLED + value: 'true' + {{- end }} + {{- if .Values.ethBytecodeDb.enabled }} + - name: SIG_PROVIDER__SOURCES__ETH_BYTECODE_DB__ENABLED + value: 'true' + - name: SIG_PROVIDER__SOURCES__ETH_BYTECODE_DB__URL + value: http://{{ include "smart-contract-verification.fullname" . }}-eth-bytecode-db:{{ .Values.ethBytecodeDb.service.port }} + {{- end }} + {{- range $key, $value := .Values.sigProvider.env }} + - name: {{ $key }} + value: {{ $value | quote }} + {{- end }} + ports: + - name: http + containerPort: {{ .Values.sigProvider.service.port }} + protocol: TCP + {{- if .Values.metrics.enabled }} + - name: metrics + containerPort: {{ .Values.metrics.port }} + protocol: TCP + {{- end }} + livenessProbe: + {{- toYaml .Values.sigProvider.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.sigProvider.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.sigProvider.resources | nindent 12 }} + {{- with .Values.sigProvider.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.sigProvider.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/smart-contract-verification/templates/sig-provider-ingress.yaml b/charts/smart-contract-verification/templates/sig-provider-ingress.yaml new file mode 100644 index 0000000..c05e5c7 --- /dev/null +++ b/charts/smart-contract-verification/templates/sig-provider-ingress.yaml @@ -0,0 +1,51 @@ +{{- if .Values.sigProvider.ingress.enabled -}} +{{- $fullName := include "smart-contract-verification.fullname" . -}} +{{- $svcPort := .Values.sigProvider.service.port -}} +{{- if and .Values.sigProvider.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.sigProvider.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.sigProvider.ingress.annotations "kubernetes.io/ingress.class" .Values.sigProvider.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 }}-sig-provider + labels: + {{- include "smart-contract-verification.labels" . | nindent 4 }} + {{- with .Values.sigProvider.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.sigProvider.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.sigProvider.ingress.className }} + {{- end }} + {{- if .Values.sigProvider.ingress.tls.enabled }} + tls: + - hosts: + - {{ .Values.sigProvider.ingress.hostname | quote }} + secretName: {{ $fullName }}-sig-provider-ingress-tls + {{- end }} + rules: + - host: {{ .Values.sigProvider.ingress.hostname | quote }} + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }}-sig-provider + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }}-sig-provider + servicePort: {{ $svcPort }} + {{- end }} +{{- end }} diff --git a/charts/smart-contract-verification/templates/sig-provider-service.yaml b/charts/smart-contract-verification/templates/sig-provider-service.yaml new file mode 100644 index 0000000..951492d --- /dev/null +++ b/charts/smart-contract-verification/templates/sig-provider-service.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "smart-contract-verification.fullname" . }}-sig-provider + labels: + {{- include "smart-contract-verification.labels" . | nindent 4 }} +spec: + type: {{ .Values.sigProvider.service.type }} + ports: + - port: {{ .Values.sigProvider.service.port }} + targetPort: http + protocol: TCP + name: http + {{- if .Values.metrics.enabled }} + - port: {{ .Values.metrics.port }} + targetPort: metrics + protocol: TCP + name: metrics + {{- end }} + selector: + app: {{ include "smart-contract-verification.fullname" . }}-sig-provider + {{- include "smart-contract-verification.selectorLabels" . | nindent 4 }} diff --git a/charts/smart-contract-verification/templates/sig-provider-servicemonitor.yaml b/charts/smart-contract-verification/templates/sig-provider-servicemonitor.yaml new file mode 100644 index 0000000..ec90a17 --- /dev/null +++ b/charts/smart-contract-verification/templates/sig-provider-servicemonitor.yaml @@ -0,0 +1,16 @@ +{{- if and .Values.metrics.enabled .Values.metrics.prometheus.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "smart-contract-verification.fullname" . }}-sig-provider + labels: + {{- include "smart-contract-verification.labels" . | nindent 4 }} +spec: + endpoints: + - scrapeTimeout: 30s + port: metrics + path: /metrics + selector: + matchLabels: + app: {{ include "smart-contract-verification.fullname" . }}-sig-provider +{{- end }} \ No newline at end of file diff --git a/charts/smart-contract-verification/templates/smart-contract-verifier-deployment.yaml b/charts/smart-contract-verification/templates/smart-contract-verifier-deployment.yaml new file mode 100644 index 0000000..079c007 --- /dev/null +++ b/charts/smart-contract-verification/templates/smart-contract-verifier-deployment.yaml @@ -0,0 +1,108 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "smart-contract-verification.fullname" . }}-smart-contract-verifier + labels: + app: {{ include "smart-contract-verification.fullname" . }}-smart-contract-verifier + {{- include "smart-contract-verification.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.smartContractVerifier.replicaCount }} + selector: + matchLabels: + app: {{ include "smart-contract-verification.fullname" . }}-smart-contract-verifier + {{- include "smart-contract-verification.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + {{- if eq .Values.smartContractVerifier.image.pullPolicy "Always" }} + rollme: {{ randAlphaNum 5 | quote }} + {{- end }} + {{- with .Values.smartContractVerifier.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + app: {{ include "smart-contract-verification.fullname" . }}-smart-contract-verifier + {{- include "smart-contract-verification.labels" . | nindent 8 }} + {{- with .Values.smartContractVerifier.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "smart-contract-verification.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.smartContractVerifier.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }}-smart-contract-verifier + securityContext: + {{- toYaml .Values.smartContractVerifier.securityContext | nindent 12 }} + image: "{{ .Values.smartContractVerifier.image.repository }}:{{ .Values.smartContractVerifier.image.tag }}" + imagePullPolicy: {{ .Values.smartContractVerifier.image.pullPolicy }} + env: + - name: SMART_CONTRACT_VERIFIER__SERVER__HTTP__ADDR + value: "0.0.0.0:{{ .Values.smartContractVerifier.service.port }}" + {{- if .Values.smartContractVerifier.grpc.enabled }} + - name: SMART_CONTRACT_VERIFIER__SERVER__GRPC__ENABLED + value: 'true' + - name: SMART_CONTRACT_VERIFIER__SERVER__GRPC__ADDR + value: 0.0.0.0:{{ .Values.smartContractVerifier.grpc.port }} + {{- end }} + {{- if .Values.metrics.enabled }} + - name: SMART_CONTRACT_VERIFIER__METRICS__ENABLED + value: 'true' + - name: SMART_CONTRACT_VERIFIER__METRICS__ADDR + value: 0.0.0.0:{{ .Values.metrics.port }} + - name: SMART_CONTRACT_VERIFIER__METRICS__ROUTE + value: /metrics + {{- end }} + {{- range $key, $value := .Values.smartContractVerifier.env }} + - name: {{ $key }} + value: {{ $value | quote }} + {{- end }} + {{- if or .Values.smartContractVerifier.envFromSecret }} + envFrom: + - secretRef: + name: {{ include "smart-contract-verification.fullname" . }}-smart-contract-verifier-env + {{- end }} + ports: + - name: http + containerPort: {{ .Values.smartContractVerifier.service.port }} + protocol: TCP + {{- if .Values.smartContractVerifier.grpc.enabled }} + - name: grpc + containerPort: {{ .Values.smartContractVerifier.grpc.port }} + protocol: TCP + {{- end}} + {{- if .Values.metrics.enabled }} + - name: metrics + containerPort: {{ .Values.metrics.port }} + protocol: TCP + {{- end }} + livenessProbe: + {{- toYaml .Values.smartContractVerifier.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.smartContractVerifier.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.smartContractVerifier.resources | nindent 12 }} + {{- with .Values.smartContractVerifier.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.smartContractVerifier.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/smart-contract-verification/templates/smart-contract-verifier-ingress.yaml b/charts/smart-contract-verification/templates/smart-contract-verifier-ingress.yaml new file mode 100644 index 0000000..bcad7d1 --- /dev/null +++ b/charts/smart-contract-verification/templates/smart-contract-verifier-ingress.yaml @@ -0,0 +1,103 @@ +{{- if .Values.smartContractVerifier.ingress.enabled -}} +{{- $fullName := include "smart-contract-verification.fullname" . -}} +{{- $svcPort := .Values.smartContractVerifier.service.port -}} +{{- if and .Values.smartContractVerifier.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.smartContractVerifier.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.smartContractVerifier.ingress.annotations "kubernetes.io/ingress.class" .Values.smartContractVerifier.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 }}-smart-contract-verifier + labels: + {{- include "smart-contract-verification.labels" . | nindent 4 }} + {{- with .Values.smartContractVerifier.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.smartContractVerifier.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.smartContractVerifier.ingress.className }} + {{- end }} + {{- if .Values.smartContractVerifier.ingress.tls.enabled }} + tls: + - hosts: + - {{ .Values.smartContractVerifier.ingress.hostname | quote }} + secretName: {{ $fullName }}-smart-contract-verifier-ingress-tls + {{- end }} + rules: + - host: {{ .Values.smartContractVerifier.ingress.hostname | quote }} + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }}-smart-contract-verifier + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }}-smart-contract-verifier + servicePort: {{ $svcPort }} + {{- end }} +{{- end }} +--- +{{- if .Values.smartContractVerifier.grpc.ingress.enabled -}} +{{- $fullName := include "smart-contract-verification.fullname" . -}} +{{- $svcPort := .Values.smartContractVerifier.grpc.port -}} +{{- if and .Values.smartContractVerifier.grpc.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.smartContractVerifier.grpc.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.smartContractVerifier.grpc.ingress.annotations "kubernetes.io/ingress.class" .Values.smartContractVerifier.grpc.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 }}-smart-contract-verifier-grpc + labels: + {{- include "smart-contract-verification.labels" . | nindent 4 }} + {{- with .Values.smartContractVerifier.grpc.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.smartContractVerifier.grpc.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.smartContractVerifier.grpc.ingress.className }} + {{- end }} + {{- if .Values.smartContractVerifier.grpc.ingress.tls.enabled }} + tls: + - hosts: + - {{ .Values.smartContractVerifier.grpc.ingress.hostname | quote }} + secretName: {{ $fullName }}-grpc-smart-contract-verifier-ingress-tls + {{- end }} + rules: + - host: {{ .Values.smartContractVerifier.grpc.ingress.hostname | quote }} + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }}-smart-contract-verifier + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }}-smart-contract-verifier + servicePort: {{ $svcPort }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/smart-contract-verification/templates/smart-contract-verifier-secret.yaml b/charts/smart-contract-verification/templates/smart-contract-verifier-secret.yaml new file mode 100644 index 0000000..5abb56a --- /dev/null +++ b/charts/smart-contract-verification/templates/smart-contract-verifier-secret.yaml @@ -0,0 +1,13 @@ +{{- if .Values.smartContractVerifier.envFromSecret }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "smart-contract-verification.fullname" . }}-smart-contract-verifier-env + labels: + {{- include "smart-contract-verification.labels" . | nindent 4 }} +type: Opaque +data: +{{- range $key, $value := .Values.smartContractVerifier.envFromSecret }} + {{ $key }}: {{ $value | b64enc }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/smart-contract-verification/templates/smart-contract-verifier-service.yaml b/charts/smart-contract-verification/templates/smart-contract-verifier-service.yaml new file mode 100644 index 0000000..959a983 --- /dev/null +++ b/charts/smart-contract-verification/templates/smart-contract-verifier-service.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "smart-contract-verification.fullname" . }}-smart-contract-verifier + labels: + {{- include "smart-contract-verification.labels" . | nindent 4 }} +spec: + type: {{ .Values.smartContractVerifier.service.type }} + ports: + - port: {{ .Values.smartContractVerifier.service.port }} + targetPort: http + protocol: TCP + name: http + {{- if .Values.smartContractVerifier.grpc.enabled }} + - port: {{ .Values.smartContractVerifier.grpc.port }} + targetPort: grpc + protocol: TCP + name: grpc + {{- end}} + {{- if .Values.metrics.enabled }} + - port: {{ .Values.metrics.port }} + targetPort: metrics + protocol: TCP + name: metrics + {{- end }} + selector: + app: {{ include "smart-contract-verification.fullname" . }}-smart-contract-verifier + {{- include "smart-contract-verification.selectorLabels" . | nindent 4 }} diff --git a/charts/smart-contract-verification/templates/smart-contract-verifier-servicemonitor.yaml b/charts/smart-contract-verification/templates/smart-contract-verifier-servicemonitor.yaml new file mode 100644 index 0000000..9125005 --- /dev/null +++ b/charts/smart-contract-verification/templates/smart-contract-verifier-servicemonitor.yaml @@ -0,0 +1,16 @@ +{{- if and .Values.metrics.enabled .Values.metrics.prometheus.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "smart-contract-verification.fullname" . }}-smart-contract-verifier + labels: + {{- include "smart-contract-verification.labels" . | nindent 4 }} +spec: + endpoints: + - scrapeTimeout: 30s + port: metrics + path: /metrics + selector: + matchLabels: + app: {{ include "smart-contract-verification.fullname" . }}-smart-contract-verifier +{{- end }} \ No newline at end of file diff --git a/charts/smart-contract-verification/values.yaml b/charts/smart-contract-verification/values.yaml new file mode 100644 index 0000000..b5a3faf --- /dev/null +++ b/charts/smart-contract-verification/values.yaml @@ -0,0 +1,262 @@ +# Default values for sig-provider. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +sigProvider: + replicaCount: 2 + + image: + repository: ghcr.io/blockscout/sig-provider + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "latest" + + podAnnotations: {} + podLabels: {} + + podSecurityContext: {} + # fsGroup: 2000 + + securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + + service: + type: ClusterIP + port: 8043 + + ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hostname: sig-provider.local + tls: + enabled: false + + env: [] + # NAME: VALUE + + resources: + limits: + memory: 256Mi + cpu: 250m + requests: + memory: 128Mi + cpu: 100m + + livenessProbe: + httpGet: + path: /health?service= + port: http + readinessProbe: + httpGet: + path: /health?service= + port: http + + # Additional volumes on the output Deployment definition. + volumes: [] + # - name: foo + # secret: + # secretName: mysecret + # optional: false + + # Additional volumeMounts on the output Deployment definition. + volumeMounts: [] + # - name: foo + # mountPath: "/etc/foo" + # readOnly: true + +smartContractVerifier: + replicaCount: 2 + + image: + repository: ghcr.io/blockscout/smart-contract-verifier + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "latest" + + podAnnotations: {} + podLabels: {} + + podSecurityContext: {} + # fsGroup: 2000 + + securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + + service: + type: ClusterIP + port: 8050 + grpc: + enabled: true + port: 8051 + #GRPC ingress configuration + ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hostname: grpc-smart-contract-verifier.local + tls: + enabled: false + ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hostname: smart-contract-verifier.local + tls: + enabled: false + + env: [] + # NAME: VALUE + envFromSecret: [] + # NAME: VALUE + + resources: + limits: + memory: "8Gi" + cpu: "1" + requests: + memory: "1Gi" + cpu: "250m" + + livenessProbe: + httpGet: + path: /health?service= + port: http + readinessProbe: + httpGet: + path: /health?service= + port: http + + # Additional volumes on the output Deployment definition. + volumes: [] + # - name: foo + # secret: + # secretName: mysecret + # optional: false + + # Additional volumeMounts on the output Deployment definition. + volumeMounts: [] + # - name: foo + # mountPath: "/etc/foo" + # readOnly: true +ethBytecodeDb: + enabled: false + replicaCount: 1 + + image: + repository: ghcr.io/blockscout/eth-bytecode-db + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "latest" + + podAnnotations: {} + podLabels: {} + + podSecurityContext: {} + # fsGroup: 2000 + + securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + + service: + type: ClusterIP + port: 8050 + + ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hostname: eth-bytecode-db.local + tls: + enabled: false + + env: [] + # NAME: VALUE + envFromSecret: [] + # NAME: VALUE + resources: + limits: + memory: 1Gi + cpu: 500m + requests: + memory: 512Mi + cpu: 250m + + livenessProbe: + httpGet: + path: /health?service= + port: http + initialDelaySeconds: 100 + periodSeconds: 100 + timeoutSeconds: 30 + readinessProbe: + httpGet: + path: /health?service= + port: http + initialDelaySeconds: 100 + periodSeconds: 100 + timeoutSeconds: 30 + + # Additional volumes on the output Deployment definition. + volumes: [] + # - name: foo + # secret: + # secretName: mysecret + # optional: false + + # Additional volumeMounts on the output Deployment definition. + volumeMounts: [] + # - name: foo + # mountPath: "/etc/foo" + # readOnly: true + + +metrics: + enabled: false + port: 6060 + prometheus: + enabled: false + +nodeSelector: {} + +tolerations: [] + +affinity: {}