-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add possibility to deploy emqx-exporter with FlowFuse helm chart (
#500)
- Loading branch information
1 parent
739d69a
commit d01ac22
Showing
9 changed files
with
220 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{{- if .Values.broker.monitoring.emqxExporter.enabled }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: emqx-exporter-config | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{ include "forge.emqxExporterSelectorLabels" . | nindent 4 }} | ||
data: | ||
config.yaml: | | ||
metrics: | ||
target: emqx-dashboard.{{ .Release.Namespace }}:18083 | ||
api_key: "flowfuse" | ||
api_secret: <%= ENV['BOOTSTRAP_API_KEY'] %> | ||
probes: | ||
- target: emqx-listeners.default.svc.cluster.local:1883 | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{{- if .Values.broker.monitoring.emqxExporter.enabled }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
{{ include "forge.emqxExporterSelectorLabels" . | nindent 4 }} | ||
name: emqx-exporter-service | ||
namespace: {{ .Release.Namespace }} | ||
spec: | ||
ports: | ||
- name: metrics | ||
port: 8085 | ||
targetPort: metrics | ||
selector: | ||
{{ include "forge.emqxExporterSelectorLabels" . | nindent 6 }} | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: emqx-exporter | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{ include "forge.emqxExporterSelectorLabels" . | nindent 4 }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
{{ include "forge.emqxExporterSelectorLabels" . | nindent 6 }} | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
{{ include "forge.emqxExporterSelectorLabels" . | nindent 8 }} | ||
annotations: | ||
checksum/config: {{ include (print $.Template.BasePath "/emqx-exporter-config.yaml") . | sha256sum }} | ||
spec: | ||
securityContext: | ||
runAsUser: 1000 | ||
initContainers: | ||
- name: config | ||
image: "ruby:2.7-slim" | ||
imagePullPolicy: Always | ||
command: ['sh', '-c', 'erb /tmpl/config.yaml > /config/config.yaml' ] | ||
volumeMounts: | ||
- name: configtemplate | ||
mountPath: /tmpl | ||
- name: configdir | ||
mountPath: /config | ||
env: | ||
- name: BOOTSTRAP_API_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: emqx-config-secrets | ||
key: api_key_secret | ||
securityContext: | ||
readOnlyRootFilesystem: true | ||
allowPrivilegeEscalation: false | ||
capabilities: | ||
drop: | ||
- ALL | ||
containers: | ||
- name: exporter | ||
image: emqx/emqx-exporter:0.2 | ||
imagePullPolicy: IfNotPresent | ||
args: | ||
- --config.file | ||
- /etc/emqx-exporter/config.yaml | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
runAsNonRoot: true | ||
ports: | ||
- containerPort: 8085 | ||
name: metrics | ||
protocol: TCP | ||
resources: | ||
limits: | ||
cpu: 100m | ||
memory: 100Mi | ||
requests: | ||
cpu: 100m | ||
memory: 20Mi | ||
volumeMounts: | ||
- name: configdir | ||
mountPath: /etc/emqx-exporter/ | ||
volumes: | ||
- name: configdir | ||
emptyDir: {} | ||
- name: configtemplate | ||
configMap: | ||
name: emqx-exporter-config | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json | ||
suite: test emqx-exporter deployment object | ||
templates: | ||
- emqx-exporter.yaml | ||
- emqx-exporter-config.yaml | ||
set: | ||
forge.domain: "chart-unit-tests.com" | ||
broker.monitoring.emqxExporter.enabled: true | ||
tests: | ||
- it: should create a service for emqx-exporter | ||
templates: | ||
- emqx-exporter.yaml | ||
documentSelector: | ||
path: metadata.name | ||
value: emqx-exporter-service | ||
asserts: | ||
- isKind: | ||
of: Service | ||
- matchRegex: | ||
path: metadata.name | ||
pattern: ^emqx-exporter-service$ | ||
- it: should create a deployment for emqx-exporter | ||
templates: | ||
- emqx-exporter.yaml | ||
documentSelector: | ||
path: metadata.name | ||
value: emqx-exporter | ||
asserts: | ||
- isKind: | ||
of: Deployment | ||
- matchRegex: | ||
path: metadata.name | ||
pattern: ^emqx-exporter$ | ||
- lengthEqual: | ||
path: spec.template.spec.containers | ||
count: 1 | ||
- it: should create a configmap for emqx-exporter | ||
templates: | ||
- emqx-exporter-config.yaml | ||
asserts: | ||
- isKind: | ||
of: ConfigMap | ||
- equal: | ||
path: metadata.name | ||
value: emqx-exporter-config | ||
- it: should create an init container with one secret | ||
template: emqx-exporter.yaml | ||
documentSelector: | ||
path: metadata.name | ||
value: emqx-exporter | ||
asserts: | ||
- isNotNullOrEmpty: | ||
path: spec.template.spec.initContainers[0].env | ||
- lengthEqual: | ||
path: spec.template.spec.initContainers[0].env | ||
count: 1 | ||
- equal: | ||
path: spec.template.spec.initContainers[0].env[0].name | ||
value: BOOTSTRAP_API_KEY | ||
- equal: | ||
path: spec.template.spec.initContainers[0].env[*].valueFrom.secretKeyRef.name | ||
value: emqx-config-secrets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters