Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ metric indicates if the probe has been successful.

### Release process

- Update the Helm chart version in [`charts/exporter/Chart.yaml`](charts/exporter/Chart.yaml)
- Create a release in Github with a semver tag and GH actions will:
- Add a changelog
- Upload binaries
Expand Down
6 changes: 6 additions & 0 deletions charts/exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: ssl_exporter
description: A Helm chart for SSL Exporter
type: application
version: 0.1.0
appVersion: 2.3.1
39 changes: 39 additions & 0 deletions charts/exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{/*****************************************************************************

General templates

*****************************************************************************/}}

{{- define "name" -}}{{- /******************************************************
Expand the name of the chart
***************************************************************************/ -}}
{{- $.Chart.Name | trunc 63 | trimSuffix "-" }}
{{- end }}


{{- define "releasename" -}}{{- /**********************************************
Expand the name of the instance
***************************************************************************/ -}}
{{- $.Release.Name | trunc 63 | trimSuffix "-" }}
{{- end }}


{{- define "labels" -}}{{- /****************************************************
Define controller labels
***************************************************************************/ -}}
app.kubernetes.io/name: {{ include "name" $ }}
helm.sh/chart: {{ $.Chart.Name }}-{{ $.Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ $.Release.Service }}
app.kubernetes.io/instance: {{ $.Release.Name }}
app.kubernetes.io/version: {{ $.Chart.AppVersion }}
{{- end }}


{{- define "matchLabels" -}}{{- /**********************************************
Define labels are used by controllers to find their pods
***************************************************************************/ -}}
app.kubernetes.io/name: {{ include "name" $ }}
app.kubernetes.io/managed-by: {{ $.Release.Service }}
app.kubernetes.io/instance: {{ $.Release.Name }}
{{- end }}

12 changes: 12 additions & 0 deletions charts/exporter/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if $.Values.configMap.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ .Release.Namespace | quote }}
name: {{ include "releasename" $ | quote }}
labels:
{{- include "labels" . | nindent 4 }}
data:
config.yaml: |
{{ $.Values.configMap.data | indent 4 }}
{{- end }}
57 changes: 57 additions & 0 deletions charts/exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: {{ $.Release.Namespace | quote }}
name: {{ include "releasename" $ | quote }}
labels: {{- include "labels" $ | nindent 4 }}
annotations: {{- toYaml $.Values.annotations | nindent 4 }}
spec:
selector:
matchLabels: {{- include "matchLabels" $ | nindent 6 }}
replicas: {{ int $.Values.replicaCount }}
strategy:
type: RollingUpdate
revisionHistoryLimit: 3
template:
metadata:
labels: {{- include "labels" $ | nindent 8 }}
spec:
restartPolicy: Always
terminationGracePeriodSeconds: {{ $.Values.terminationGracePeriodSeconds }}
nodeSelector: {{- toYaml $.Values.nodeSelector | nindent 8 }}
tolerations: {{- toYaml $.Values.tolerations | nindent 8 }}
affinity: {{- toYaml $.Values.affinity | nindent 8 }}
securityContext: {{- toYaml $.Values.securityContext | nindent 8 }}
imagePullSecrets: {{- toYaml $.Values.imagePullSecrets | nindent 8 }}
{{- if $.Values.configMap.enabled }}
volumes:
- name: config
configMap:
name: {{ include "releasename" $ | quote }}
{{- end }}
containers:
- name: exporter
image: ribbybibby/ssl-exporter:v{{ $.Chart.AppVersion }}
imagePullPolicy: {{ $.Values.podImagePullPolicy | quote }}
resources: {{ toYaml $.Values.resources | nindent 12 }}
{{- if $.Values.configMap.enabled }}
args: ["--config.file=/config/config.yaml"]
{{- end }}
ports:
- name: exporter
containerPort: 9219
readinessProbe:
{{- toYaml $.Values.probes.readiness | nindent 12 }}
httpGet:
port: exporter
path: /
livenessProbe:
{{- toYaml $.Values.probes.liveness | nindent 12 }}
httpGet:
port: exporter
path: /
{{- if $.Values.configMap.enabled }}
volumeMounts:
- name: config
mountPath: /config
{{- end }}
17 changes: 17 additions & 0 deletions charts/exporter/templates/prometheus-operator-probes/demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if $.Values.prometheusOperator.enableExampleProbes }}
apiVersion: monitoring.coreos.com/v1
kind: Probe
metadata:
name: probe-demo
labels:
release: prometheus-operator
{{- include "labels" $ | nindent 4 }}
spec:
prober:
url: {{ printf "%s.%s.svc" (include "releasename" .) $.Release.Namespace | quote }}
module: http
targets:
staticConfig:
static:
- "https://demo.do.prometheus.io"
{{- end }}
16 changes: 16 additions & 0 deletions charts/exporter/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
namespace: {{ $.Release.Namespace | quote }}
name: {{ include "releasename" $ | quote }}
labels: {{- include "labels" $ | nindent 4 }}
annotations: {{- toYaml $.Values.service.annotations | nindent 4 }}
spec:
ports:
- name: exporter
port: {{ $.Values.service.port }}
protocol: TCP
targetPort: exporter
selector: {{- include "matchLabels" $ | nindent 4 }}
sessionAffinity: {{ $.Values.service.sessionAffinity | quote }}
type: {{ $.Values.service.type | quote }}
85 changes: 85 additions & 0 deletions charts/exporter/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
annotations: {}
replicaCount: 1
imagePullPolicy: IfNotPresent
imagePullSecrets: []
nodeSelector: {}
tolerations: []
affinity: {}
securityContext: {}
# fsGroup: 1001
# runAsGroup: 1001
# runAsNonRoot: true
# runAsUser: 1001
Comment on lines +9 to +12
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these (and the resources below) commented out? As an example?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As example.
I didn't dive deep into securityContext, for now.
Perhaps you'll advise better default value for the parameter?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# fsGroup: 1001
# runAsGroup: 1001
# runAsNonRoot: true
# runAsUser: 1001
fsGroup: 100
runAsGroup: 100
runAsNonRoot: true
runAsUser: 100

The image runs as user 100 by default, so let's go with that.

resources: {}
# limits:
# cpu: 500m
# memory: 256Mi
# requests:
# cpu: 200m
# memory: 128Mi
terminationGracePeriodSeconds: 5
probes:
readiness:
initialDelaySeconds: 3
periodSeconds: 5
timeoutSeconds: 5
failureThreshold: 3
successThreshold: 1
liveness:
initialDelaySeconds: 3
periodSeconds: 5
timeoutSeconds: 5
failureThreshold: 3
successThreshold: 1
service:
enabled: true
annotations: {}
port: 80
sessionAffinity: None

prometheusOperator:
enableExampleProbes: false

configMap:
enabled: false
data: |
modules:
https:
prober: https
https_insecure:
prober: https
tls_config:
insecure_skip_verify: true
https_proxy:
prober: https
https:
proxy_url: "socks5://localhost:8123"
https_timeout:
prober: https
timeout: 3s
tcp:
prober: tcp
tcp_servername:
prober: tcp
tls_config:
server_name: example.com
tcp_client_auth:
prober: tcp
tls_config:
ca_file: /etc/tls/ca.crt
cert_file: /etc/tls/tls.crt
key_file: /etc/tls/tls.key
tcp_smtp_starttls:
prober: tcp
tcp:
starttls: smtp
file:
prober: file
kubernetes:
prober: kubernetes
kubernetes_kubeconfig:
prober: kubernetes
kubernetes:
kubeconfig: /root/.kube/config
kubeconfig:
prober: kubeconfig