Commit 12e82e39 by Frank Mai Committed by Alena Prokharchyk

Support new Windows node-exporter image

Copy the binary to the host before wins cli prc run
parent 1e0304e9
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "app.fullname" . }}
labels:
app: {{ template "app.name" . }}
chart: {{ template "app.version" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
data:
copy-binary.ps1: |-
$ErrorActionPreference = 'Stop'
function Create-Directory
{
param (
[parameter(Mandatory = $false, ValueFromPipeline = $true)] [string]$Path
)
if (Test-Path -Path $Path) {
if (-not (Test-Path -Path $Path -PathType Container)) {
# clean the same path file
Remove-Item -Recurse -Force -Path $Path -ErrorAction Ignore | Out-Null
}
return
}
New-Item -Force -ItemType Directory -Path $Path | Out-Null
}
function Transfer-File
{
param (
[parameter(Mandatory = $true)] [string]$Src,
[parameter(Mandatory = $true)] [string]$Dst
)
if (Test-Path -PathType leaf -Path $Dst) {
$dstHasher = Get-FileHash -Path $Dst
$srcHasher = Get-FileHash -Path $Src
if ($dstHasher.Hash -eq $srcHasher.Hash) {
return
}
}
$null = Copy-Item -Force -Path $Src -Destination $Dst
}
Create-Directory -Path "c:\host\etc\wmi-exporter"
Transfer-File -Src "c:\etc\wmi-exporter\wmi-exporter.exe" -Dst "c:\host\etc\wmi-exporter\wmi-exporter.exe"
...@@ -20,6 +20,22 @@ spec: ...@@ -20,6 +20,22 @@ spec:
chart: {{ template "app.version" . }} chart: {{ template "app.version" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
spec: spec:
initContainers:
- name: exporter-node-binary-copy
image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
command:
- pwsh
- -f
- c:/scripts/copy-binary.ps1
{{- if and .Values.resources .Values.resources.inits }}
resources:
{{ toYaml .Values.resources.inits | indent 10 }}
{{- end }}
volumeMounts:
- name: binary-host-path
mountPath: c:/host/etc/wmi-exporter
- name: exporter-scripts
mountPath: c:/scripts/
containers: containers:
- name: exporter-node - name: exporter-node
image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }} image: {{ template "system_default_registry" . }}{{ .Values.image.repository }}:{{ .Values.image.tag }}
...@@ -39,8 +55,10 @@ spec: ...@@ -39,8 +55,10 @@ spec:
{{- if .Values.extraEnv }} {{- if .Values.extraEnv }}
{{ toYaml .Values.extraEnv | indent 10 }} {{ toYaml .Values.extraEnv | indent 10 }}
{{- end }} {{- end }}
{{- if and .Values.resources .Values.resources.core }}
resources: resources:
{{ toYaml .Values.resources | indent 10 }} {{ toYaml .Values.resources.core | indent 10 }}
{{- end }}
volumeMounts: volumeMounts:
- name: wins-pipe - name: wins-pipe
mountPath: \\.\pipe\rancher_wins mountPath: \\.\pipe\rancher_wins
...@@ -67,3 +85,10 @@ spec: ...@@ -67,3 +85,10 @@ spec:
- name: wins-pipe - name: wins-pipe
hostPath: hostPath:
path: \\.\pipe\rancher_wins path: \\.\pipe\rancher_wins
- name: binary-host-path
hostPath:
path: c:/etc/wmi-exporter
type: DirectoryOrCreate
- name: exporter-scripts
configMap:
name: {{ template "app.fullname" . }}
...@@ -172,7 +172,8 @@ exporter-node-windows: ...@@ -172,7 +172,8 @@ exporter-node-windows:
image: image:
os: windows os: windows
repository: rancher/wmi_exporter-package repository: rancher/wmi_exporter-package
tag: v0.0.2 tag: v0.0.3
resources: {}
ports: ports:
metrics: metrics:
name: windows-metrics name: windows-metrics
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment