Factory/akri-chart/templates/udev-configuration.yaml
Nicolas Belouin 18bd432874 Import first batch of Edge 3.1 packages
Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>
2024-10-17 14:11:42 +02:00

133 lines
6.1 KiB
YAML

{{- if .Values.udev.configuration.enabled }}
apiVersion: {{ printf "%s/%s" .Values.crds.group .Values.crds.version }}
kind: Configuration
metadata:
name: {{ .Values.udev.configuration.name }}
spec:
discoveryHandler:
name: udev
discoveryDetails: |+
groupRecursive: {{ .Values.udev.configuration.discoveryDetails.groupRecursive }}
udevRules:
{{- required "Please set at least one udev rule with `--set udev.configuration.discoveryDetails.udevRules[0]==\"<udev rule>\"' to specify what you want discovered. See the udev Configuration document at https://docs.akri.sh/discovery-handlers/udev for more information." .Values.udev.configuration.discoveryDetails.udevRules | toYaml | nindent 6 }}
{{- if or .Values.udev.configuration.brokerPod.image.repository .Values.udev.configuration.brokerJob.image.repository }}
{{- /* Only add brokerSpec if a broker image is provided */}}
brokerSpec:
{{- if .Values.udev.configuration.brokerPod.image.repository }}
brokerPodSpec:
containers:
- name: {{ .Values.udev.configuration.name }}-broker
image: {{ printf "%s:%s" .Values.udev.configuration.brokerPod.image.repository .Values.udev.configuration.brokerPod.image.tag | quote }}
{{- with .Values.udev.configuration.brokerPod.image.pullPolicy }}
imagePullPolicy: {{ . }}
{{- end }}
{{- if .Values.udev.configuration.brokerPod.env }}
env:
{{- range $key, $val := .Values.udev.configuration.brokerPod.env }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
{{- end }}
{{- if .Values.udev.configuration.brokerPod.envFrom }}
envFrom:
{{- range $val := .Values.udev.configuration.brokerPod.envFrom.secretRef }}
- secretRef:
name: {{ $val | quote }}
{{- end }}
{{- range $val := .Values.udev.configuration.brokerPod.envFrom.configMapRef }}
- configMapRef:
name: {{ $val | quote }}
{{- end }}
{{- end }}
securityContext:
{{- if .Values.udev.configuration.brokerPod.securityContext }}
{{- toYaml .Values.udev.configuration.brokerPod.securityContext | nindent 10 }}
{{- else}}
privileged: true
{{- end}}
resources:
requests:
{{`"{{PLACEHOLDER}}"`}} : "1"
memory: {{ .Values.udev.configuration.brokerPod.resources.memoryRequest }}
cpu: {{ .Values.udev.configuration.brokerPod.resources.cpuRequest }}
limits:
{{`"{{PLACEHOLDER}}"`}} : "1"
memory: {{ .Values.udev.configuration.brokerPod.resources.memoryLimit }}
cpu: {{ .Values.udev.configuration.brokerPod.resources.cpuLimit }}
{{- with .Values.udev.configuration.brokerPod.volumeMounts}}
volumeMounts:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.udev.configuration.brokerPod.volumes}}
volumes:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- else }}
brokerJobSpec:
template:
spec:
containers:
- name: {{ .Values.udev.configuration.name }}-broker
image: {{ printf "%s:%s" .Values.udev.configuration.brokerJob.image.repository .Values.udev.configuration.brokerPod.image.tag | quote }}
{{- if .Values.udev.configuration.brokerJob.command }}
command:
{{- toYaml .Values.udev.configuration.brokerJob.command | nindent 14 }}
{{- end }}
{{- with .Values.udev.configuration.pullPolicy }}
imagePullPolicy: {{ . }}
{{- end }}
resources:
requests:
{{`"{{PLACEHOLDER}}"`}} : "1"
memory: {{ .Values.udev.configuration.brokerJob.resources.memoryRequest }}
cpu: {{ .Values.udev.configuration.brokerJob.resources.cpuRequest }}
limits:
{{`"{{PLACEHOLDER}}"`}} : "1"
memory: {{ .Values.udev.configuration.brokerJob.resources.memoryLimit }}
cpu: {{ .Values.udev.configuration.brokerJob.resources.cpuLimit }}
restartPolicy: {{ .Values.udev.configuration.brokerJob.restartPolicy }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 10 }}
{{- end }}
backoffLimit: {{ .Values.udev.configuration.brokerJob.backoffLimit }}
parallelism: {{ .Values.udev.configuration.brokerJob.parallelism }}
completions: {{ .Values.udev.configuration.brokerJob.completions }}
{{- end }}
{{- end }}
{{- /* Only add service specs if a broker image was specified and service
creation was not disabled */}}
{{- if .Values.udev.configuration.brokerPod.image.repository }}
{{- if .Values.udev.configuration.createInstanceServices }}
instanceServiceSpec:
type: {{ .Values.udev.configuration.instanceService.type }}
ports:
- name: {{ .Values.udev.configuration.instanceService.portName }}
port: {{ .Values.udev.configuration.instanceService.port }}
protocol: {{ .Values.udev.configuration.instanceService.protocol }}
targetPort: {{ .Values.udev.configuration.instanceService.targetPort }}
{{- end }}
{{- if .Values.udev.configuration.createConfigurationService }}
configurationServiceSpec:
type: {{ .Values.udev.configuration.configurationService.type }}
ports:
- name: {{ .Values.udev.configuration.configurationService.portName }}
port: {{ .Values.udev.configuration.configurationService.port }}
protocol: {{ .Values.udev.configuration.configurationService.protocol }}
targetPort: {{ .Values.udev.configuration.configurationService.targetPort }}
{{- end }}
{{- end }}
{{- if .Values.udev.configuration.brokerProperties }}
brokerProperties:
{{- range $key, $val := .Values.udev.configuration.brokerProperties }}
{{- $key | nindent 4 }}: {{ $val | quote }}
{{- end }}
{{- else }}
brokerProperties: {}
{{- end }}
capacity: {{ .Values.udev.configuration.capacity }}
{{- end }}