feature:TSG-12527:新增mrzcpd监控部署

This commit is contained in:
fumingwei
2022-11-03 14:49:57 +08:00
parent 7c66dbd50e
commit 0bbf0a84ea
8 changed files with 261 additions and 0 deletions

View File

@@ -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/

View File

@@ -0,0 +1,6 @@
apiVersion: v2
appVersion: v22.10-rc2-fb83add
description: A Helm chart for Kubernetes
name: exporter-mrzcpd
type: application
version: 0.1.0

View File

@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "exporter-mrzcpd.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 "exporter-mrzcpd.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 "exporter-mrzcpd.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "exporter-mrzcpd.labels" -}}
helm.sh/chart: {{ include "exporter-mrzcpd.chart" . }}
{{ include "exporter-mrzcpd.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "exporter-mrzcpd.selectorLabels" -}}
app.kubernetes.io/name: {{ include "exporter-mrzcpd.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "exporter-mrzcpd.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "exporter-mrzcpd.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,93 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: mrzcpd-exporter
name: mrzcpd-exporter
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
matchLabels:
app: mrzcpd-exporter
strategy:
type: Recreate
template:
metadata:
labels:
app: mrzcpd-exporter
spec:
containers:
- command:
- /opt/tsg/mrzcpd/bin/monit_device
- --prometheus-client
image: "{{ .Values.mrzcpdExporter.image.repository }}:{{ .Values.mrzcpdExporter.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.mrzcpdExporter.image.pullPolicy }}
name: mrapm-device
volumeMounts:
- mountPath: /opt/tsg/mrzcpd
name: opt-tsg-mrzcpd
readOnly: true
- mountPath: /var/run/mrzcpd
name: var-run-mrzcpd
readOnly: true
- mountPath: /var/run/dpdk
name: var-run-dpdk
readOnly: true
- mountPath: /root/sys
name: root-sys
readOnly: true
- mountPath: /etc/localtime
name: localtime-node
readOnly: true
- command:
- /opt/tsg/mrzcpd/bin/monit_stream
- --prometheus-client
image: "{{ .Values.mrzcpdExporter.image.repository }}:{{ .Values.mrzcpdExporter.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.mrzcpdExporter.image.pullPolicy }}
name: monit-stream
volumeMounts:
- mountPath: /opt/tsg/mrzcpd
name: opt-tsg-mrzcpd
readOnly: true
- mountPath: /var/run/mrzcpd
name: var-run-mrzcpd
readOnly: true
- mountPath: /var/run/dpdk
name: var-run-dpdk
readOnly: true
- mountPath: /root/sys
name: root-sys
readOnly: true
- mountPath: /etc/localtime
name: localtime-node
readOnly: true
- env:
- name: MERGER_URLS
value: {{ .Values.mergeExporter.mergeUrls }}
- name: MERGER_PORT
value: "{{ .Values.mergeExporter.mergePort }}"
image: "{{ .Values.mergeExporter.image.repository }}:{{ .Values.mergeExporter.image.tag }}"
imagePullPolicy: {{ .Values.mergeExporter.image.pullPolicy }}
name: exporter-merger
ports:
- name: ex-mrzcpd-port
containerPort: {{ .Values.mergeExporter.mergePort }}
protocol: TCP
volumes:
- hostPath:
path: /opt/tsg/mrzcpd
name: opt-tsg-mrzcpd
- hostPath:
path: /var/run/mrzcpd
name: var-run-mrzcpd
- hostPath:
path: /var/run/dpdk
name: var-run-dpdk
- hostPath:
path: /root/sys
name: root-sys
- hostPath:
path: /etc/localtime
name: localtime-node

View File

@@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: mrzcpd-exporter
name: mrzcpd-exporter
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
namespace: {{ .Release.Namespace }}
spec:
ports:
- name: mrzcpd-exporter-port
{{- if .Values.service.nodePort }}
nodePort: {{ .Values.service.nodePort }}
{{- end }}
port: {{ .Values.service.port }}
targetPort: ex-mrzcpd-port
selector:
app: mrzcpd-exporter
type: {{ .Values.service.type }}

View File

@@ -0,0 +1,21 @@
mrzcpdExporter:
image:
repository: docker.io/library/tsg-init
pullPolicy: Never
tag: "rel_22.10-20221009110641-f8db60e"
replicaCount: 1
mergeExporter:
image:
repository: quay.io/rebuy/exporter-merger
pullPolicy: Never
tag: "v0.2.0"
mergePort: "9005"
mergeUrls: "http://localhost:8901/metrics http://localhost:8902/metrics"
service:
type: ClusterIP
# nodePort: "30081"
port: "9005"
annotations: {}

View File

@@ -43,3 +43,22 @@
- prometheus-pushgateway.tar
- prometheus.tar
- name: "copy chart directory to dest"
copy:
src: "{{ role_path }}/files/mrzcpd/helm"
dest: /tmp/exporter-mrzcpd/
- name: "create charts packages"
shell: helm package --app-version {{os_release_ver}} --version {{helm_chart_ver}} -d /var/lib/rancher/k3s/server/static/charts/ /tmp/exporter-mrzcpd/helm
- name: "copy prometheus crd file to dest"
template:
src: "{{ role_path }}/templates/exporter-mrzcpd-crd.yaml.j2"
dest: /var/lib/rancher/k3s/server/manifests/exporter-mrzcpd-crd.yaml
- name: "get merge-exporter images to dest"
get_url:
url: https://repo.geedge.net/filerepo/install/release/tsg-container-images/exporter-merger.tar
dest: /var/lib/rancher/k3s/agent/images/ipmi-exporter.tar
url_username: "{{ lookup('env', 'PULP_REPO_USERNAME') }}"
url_password: "{{ lookup('env', 'PULP_REPO_PASSWORD') }}"

View File

@@ -0,0 +1,13 @@
apiVersion: helm.cattle.io/v1
kind: HelmChart
metadata:
name: exporter-mrzcpd
namespace: kube-system
spec:
chart: https://%{KUBERNETES_API}%/static/charts/exporter-mrzcpd-{{helm_chart_ver}}.tgz
targetNamespace: tsg-os-system
valuesContent: |-
service:
annotations:
prometheus.io/scrape: "true"