diff --git a/.zuul.yaml b/.zuul.yaml index 0b3f97d..1ac10a2 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -49,9 +49,11 @@ - project: check: jobs: + - chart-testing-lint - smokeping_prober:image:build gate: jobs: + - chart-testing-lint - smokeping_prober:image:upload promote: jobs: diff --git a/charts/smokeping-prober/Chart.yaml b/charts/smokeping-prober/Chart.yaml new file mode 100644 index 0000000..48496e4 --- /dev/null +++ b/charts/smokeping-prober/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +name: smokeping-prober +description: Helm charts for deploying smokeping_prober +version: 0.0.0 +appVersion: 0.0.1 +home: https://opendev.org/vexxhost/smokeping_prober-helm diff --git a/charts/smokeping-prober/templates/_helpers.tpl b/charts/smokeping-prober/templates/_helpers.tpl new file mode 100644 index 0000000..196330c --- /dev/null +++ b/charts/smokeping-prober/templates/_helpers.tpl @@ -0,0 +1,52 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "smokeping.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 "smokeping.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 "smokeping.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "smokeping.labels" -}} +helm.sh/chart: {{ include "smokeping.chart" . }} +{{ include "smokeping.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "smokeping.selectorLabels" -}} +app.kubernetes.io/name: {{ include "smokeping.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} diff --git a/charts/smokeping-prober/templates/deployment.yaml b/charts/smokeping-prober/templates/deployment.yaml new file mode 100644 index 0000000..2f72231 --- /dev/null +++ b/charts/smokeping-prober/templates/deployment.yaml @@ -0,0 +1,57 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "smokeping.fullname" . }} + labels: + {{- include "smokeping.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "smokeping.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "smokeping.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.version }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + - --ping.interval=1s + - --privileged + - --log.level=info + {{- range .Values.hosts }} + - "{{ .ip }}" + {{- end }} + ports: + - name: http + containerPort: 9374 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.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 }} diff --git a/charts/smokeping-prober/templates/service.yaml b/charts/smokeping-prober/templates/service.yaml new file mode 100644 index 0000000..70dc89c --- /dev/null +++ b/charts/smokeping-prober/templates/service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "smokeping.fullname" . }} + labels: + {{- include "smokeping.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http +{{ if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }} + nodePort: {{.Values.service.nodePort}} +{{ end }} + selector: + {{- include "smokeping.selectorLabels" . | nindent 4 }} diff --git a/charts/smokeping-prober/values.yaml b/charts/smokeping-prober/values.yaml new file mode 100644 index 0000000..27bc407 --- /dev/null +++ b/charts/smokeping-prober/values.yaml @@ -0,0 +1,51 @@ +# Default values for smokeping. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: vexxhost/smokeping + version: latest + pullPolicy: IfNotPresent + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +hosts: + - ip: localhost + +service: + type: NodePort + port: 80 + nodePort: 30080 + +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 + +nodeSelector: {} + +tolerations: [] + +affinity: {}