diff --git a/charts/relayer-exporter/.helmignore b/charts/relayer-exporter/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/relayer-exporter/.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/relayer-exporter/Chart.yaml b/charts/relayer-exporter/Chart.yaml new file mode 100644 index 0000000..9cd5598 --- /dev/null +++ b/charts/relayer-exporter/Chart.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: v2 +name: relayer-exporter +description: A Helm chart for relayer_exporter +type: application +version: 0.1.0 +appVersion: 0.4.0 diff --git a/charts/relayer-exporter/templates/_helpers.tpl b/charts/relayer-exporter/templates/_helpers.tpl new file mode 100644 index 0000000..7a88dd7 --- /dev/null +++ b/charts/relayer-exporter/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "relayer-exporter.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 "relayer-exporter.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 "relayer-exporter.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "relayer-exporter.labels" -}} +helm.sh/chart: {{ include "relayer-exporter.chart" . }} +{{ include "relayer-exporter.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "relayer-exporter.selectorLabels" -}} +app.kubernetes.io/name: {{ include "relayer-exporter.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "relayer-exporter.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "relayer-exporter.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/relayer-exporter/templates/configMap.yaml b/charts/relayer-exporter/templates/configMap.yaml new file mode 100644 index 0000000..4386287 --- /dev/null +++ b/charts/relayer-exporter/templates/configMap.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "relayer-exporter.fullname" . }}-config + labels: + {{- include "relayer-exporter.labels" . | nindent 4 }} +data: + config.yaml: | +{{ toYaml .Values.config | indent 4 }} diff --git a/charts/relayer-exporter/templates/deployment.yaml b/charts/relayer-exporter/templates/deployment.yaml new file mode 100644 index 0000000..07f0cd6 --- /dev/null +++ b/charts/relayer-exporter/templates/deployment.yaml @@ -0,0 +1,67 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "relayer-exporter.fullname" . }} + labels: + {{- include "relayer-exporter.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "relayer-exporter.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configMap.yaml") . | sha256sum }} + {{- with .Values.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "relayer-exporter.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + - name: config + configMap: + name: {{ .Release.Name }}-config + items: + - key: config.yaml + path: config.yaml + + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.containerSecurityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + - --config + - /config/config.yaml + - --log-level={{ .Values.logLevel }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: config + mountPath: /config/ + + {{- 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/relayer-exporter/templates/service.yaml b/charts/relayer-exporter/templates/service.yaml new file mode 100644 index 0000000..2fe08ba --- /dev/null +++ b/charts/relayer-exporter/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "relayer-exporter.fullname" . }} + labels: + {{- include "relayer-exporter.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "relayer-exporter.selectorLabels" . | nindent 4 }} diff --git a/charts/relayer-exporter/templates/serviceMonitor.yaml b/charts/relayer-exporter/templates/serviceMonitor.yaml new file mode 100644 index 0000000..8b1faf9 --- /dev/null +++ b/charts/relayer-exporter/templates/serviceMonitor.yaml @@ -0,0 +1,42 @@ +{{- if.Values.serviceMonitor.enabled -}} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "relayer-exporter.fullname" . }} + labels: + {{- include "relayer-exporter.labels" . | nindent 4 }} + {{- with .Values.serviceMonitor.additionalLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + jobLabel: {{ .Release.Name }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + selector: + matchLabels: + {{- include "relayer-exporter.selectorLabels" . | nindent 6 }} + endpoints: + - port: http + path: {{ .Values.serviceMonitor.telemetryPath }} + {{- with .Values.serviceMonitor.interval }} + interval: {{ . }} + {{- end }} + {{- with .Values.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ . }} + {{- end }} + {{- if .Values.serviceMonitor.metricRelabelings }} + metricRelabelings: + {{ toYaml .Values.serviceMonitor.metricRelabelings | indent 4 }} + {{- end }} + {{- if .Values.serviceMonitor.relabelings }} + relabelings: + {{ toYaml .Values.serviceMonitor.relabelings | nindent 4 }} + {{- end }} + {{- if .Values.serviceMonitor.targetLabels }} + targetLabels: + {{- range .Values.serviceMonitor.targetLabels }} + - {{ . }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/relayer-exporter/values.yaml b/charts/relayer-exporter/values.yaml new file mode 100644 index 0000000..6e00507 --- /dev/null +++ b/charts/relayer-exporter/values.yaml @@ -0,0 +1,52 @@ +image: + repository: ghcr.io/archway-network/relayer_exporter + pullPolicy: IfNotPresent + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +podAnnotations: {} + +podSecurityContext: + runAsNonRoot: true + runAsGroup: 65532 + runAsUser: 65532 + fsGroup: 65532 + seccompProfile: + type: RuntimeDefault +containerSecurityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + privileged: false + +service: + type: ClusterIP + port: 8008 + +resources: {} +nodeSelector: {} +tolerations: [] +affinity: {} + +serviceMonitor: + enabled: false + additionalLabels: {} + interval: 1m + scrapeTimeout: 10s + telemetryPath: /metrics + targetLabels: [] + metricRelabelings: [] + relabelings: [] + +logLevel: info + +config: + rpc: [] + github: + org: archway-network + repo: networks + dir: _IBC