Skip to content

Commit

Permalink
Updated nomad-monitor helm chart with nomad-agent-monitor (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud Delabarre authored Jul 25, 2022
1 parent 720bd7d commit 78d09fb
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 82 deletions.
6 changes: 3 additions & 3 deletions charts/nomad-monitor/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: nomad-monitor
description: A tool that queries metrics about Ethereum accounts
description: A tool that pull metrics for bridges

# A chart can be either an 'application' or a 'library' chart.
#
Expand All @@ -15,10 +15,10 @@ 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.3"
version: "0.2.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.16.0"
appVersion: "1.0.0"
11 changes: 11 additions & 0 deletions charts/nomad-monitor/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,14 @@ Selector labels
app.kubernetes.io/name: {{ include "monitor.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "monitor.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "monitor.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

This file was deleted.

7 changes: 0 additions & 7 deletions charts/nomad-monitor/templates/configmap.yaml

This file was deleted.

79 changes: 79 additions & 0 deletions charts/nomad-monitor/templates/monitor-statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{{- if .Values.monitor.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "monitor.fullname" . }}
labels: {{- include "monitor.labels" . | nindent 4 }}
app.kubernetes.io/component: monitor
spec:
selector:
matchLabels: {{- include "monitor.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: monitor
replicas: {{ .Values.monitor.replicas }}
serviceName: {{ include "monitor.fullname" . }}-monitor-svc
template:
metadata:
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.monitor.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels: {{- include "monitor.labels" . | nindent 8 }}
app.kubernetes.io/component: monitor
{{- with .Values.commonLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.monitor.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
terminationGracePeriodSeconds: 10
{{- if .Values.podSecurityContext.enabled }}
securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.monitor.image.registry }}/{{ .Values.monitor.image.repository }}:{{ .Values.monitor.image.tag }}"
imagePullPolicy: {{ .Values.monitor.image.pullPolicy }}
{{- if .Values.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
command: ["./monitor"]
envFrom:
{{- with .Values.commonEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.monitor.envFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
env:
{{- with .Values.commonEnvVars }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.monitor.envVars }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.monitor.resources }}
resources: {{- toYaml .Values.monitor.resources | nindent 12 }}
{{- end }}
ports:
- name: metrics
containerPort: {{ .Values.metrics.port }}
{{- if .Values.serviceAccount.create }}
serviceAccountName: {{ include "monitor.serviceAccountName" . }}
{{- end }}
{{- with .Values.monitor.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.monitor.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.monitor.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
13 changes: 13 additions & 0 deletions charts/nomad-monitor/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "monitor.serviceAccountName" . }}
labels: {{- include "monitor.labels" . | nindent 4 }}
{{- with .Values.commonLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.commonAnnotations }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
113 changes: 88 additions & 25 deletions charts/nomad-monitor/values.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,95 @@
replicaCount: 1

image:
repository: gcr.io/nomad-xyz/nomad-monitor
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: 'latest'
# nameOverride -- String to partially override monitor.fullname template with a string (will prepend the release name)
#
nameOverride: ""

monitor:
networks: ["kovan", "moonbasealpha"]
config: # Contents of .env file
# fullnameOverride -- String to fully override monitor.fullname template with a string
#
fullnameOverride: ""

# serviceAccount -- ServiceAccount configuration
#
serviceAccount:
# serviceAccount.create -- Create service account
create: true
# serviceAccount.name -- Name of service account to use if create is true
name: ""

# -- Configure Pods Security Context
# ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod
#
podSecurityContext:
# podSecurityContext.enabled -- Enable pod security context
enabled: true
# podSecurityContext.fsGroup -- fsGroup ID for the pod
fsGroup: 1001

# -- Configure Container Security Context (only main container)
# ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container
#
containerSecurityContext:
# containerSecurityContext.enabled -- Enable container security context
enabled: true
# containerSecurityContext.runAsUser -- User ID for the container
runAsUser: 1001

imagePullSecrets: []
nameOverride: ''
fullnameOverride: ''
# commonLabels -- Add extra labels to all pods
#
commonLabels: {}

podAnnotations:
# commonAnnotations -- Add extra annotations to all pods
#
commonAnnotations:
prometheus.io/scrape: 'true'
prometheus.io/port: '9090'

resources:
{}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
# commonEnvFrom -- Common environment variables from a config/secret file
commonEnvFrom: []

# commonEnvVars -- Common environment variables to add all pods
#
commonEnvVars: []

# metrics -- Container port exposing Nomad Monitor metrics
#
metrics:
port: '9090'

# Monitoring Agent configuration
#
monitor:

# monitor.enabled -- Enable Nomad agent monitor
enabled: true

# monitor.replicas -- Number of instances of monitor
replicas: 1

# monitor.image -- Nomad agent monitor docker image configuration (immutable image tags are recommended)
image:
registry: gcr.io
repository: nomad-xyz/nomad-agent
# tag: latest
pullPolicy: Always

# monitor.envFrom -- Environment variables from a config/secret file
envFrom: []

# monitor.envVars -- Environment variables to add Nomad agent monitor pod
envVars: []

# monitor.resources -- monitor container's resource requests and limits
# ref: https://kubernetes.io/docs/user-guide/compute-resources/
resources:
# limits:
# cpu: 100m
# memory: 100Mb
# requests:
# cpu: 50m
# memory: 50Mb

# monitor.podLabels -- Add extra labels to the pods
podLabels: {}

# monitor.podAnnotations -- Add extra annotations to the pod
podAnnotations: {}

0 comments on commit 78d09fb

Please sign in to comment.