1
0
forked from suse-edge/Factory
Factory/akri-chart/templates/onvif-configuration.yaml

225 lines
9.8 KiB
YAML
Raw Normal View History

{{- if .Values.onvif.configuration.enabled }}
apiVersion: {{ printf "%s/%s" .Values.crds.group .Values.crds.version }}
kind: Configuration
metadata:
name: {{ .Values.onvif.configuration.name }}
spec:
discoveryHandler:
name: onvif
discoveryDetails: |+
ipAddresses:
action: {{ .Values.onvif.configuration.discoveryDetails.ipAddresses.action }}
{{- if .Values.onvif.configuration.discoveryDetails.ipAddresses.items}}
items:
{{- toYaml .Values.onvif.configuration.discoveryDetails.ipAddresses.items | nindent 8 }}
{{- else }}
items: []
{{- end }}
macAddresses:
action: {{ .Values.onvif.configuration.discoveryDetails.macAddresses.action }}
{{- if .Values.onvif.configuration.discoveryDetails.macAddresses.items}}
items:
{{- toYaml .Values.onvif.configuration.discoveryDetails.macAddresses.items | nindent 8 }}
{{- else }}
items: []
{{- end }}
scopes:
action: {{ .Values.onvif.configuration.discoveryDetails.scopes.action }}
{{- if .Values.onvif.configuration.discoveryDetails.scopes.items}}
items:
{{- toYaml .Values.onvif.configuration.discoveryDetails.scopes.items | nindent 8 }}
{{- else }}
items: []
{{- end }}
uuids:
action: {{ .Values.onvif.configuration.discoveryDetails.uuids.action }}
{{- if .Values.onvif.configuration.discoveryDetails.uuids.items}}
items:
{{- toYaml .Values.onvif.configuration.discoveryDetails.uuids.items | nindent 8 }}
{{- else }}
items: []
{{- end }}
discoveryTimeoutSeconds: {{ .Values.onvif.configuration.discoveryDetails.discoveryTimeoutSeconds }}
{{- if .Values.onvif.configuration.discoveryProperties}}
discoveryProperties:
{{- range $property := .Values.onvif.configuration.discoveryProperties }}
- name: {{ $property.name }}
{{- if $property.valueFrom }}
valueFrom:
{{- if $property.valueFrom.secretKeyRef }}
secretKeyRef:
name: {{ $property.valueFrom.secretKeyRef.name }}
{{- if $property.valueFrom.secretKeyRef.namespace }}
namespace: {{ $property.valueFrom.secretKeyRef.namespace }}
{{- end }}
{{- if $property.valueFrom.secretKeyRef.key }}
key: {{ $property.valueFrom.secretKeyRef.key }}
{{- end }}
{{- if hasKey $property.valueFrom.secretKeyRef "optional" }}
optional: {{ $property.valueFrom.secretKeyRef.optional }}
{{- end }}
{{- else if $property.valueFrom.configMapKeyRef}}
configMapKeyRef:
name: {{ $property.valueFrom.configMapKeyRef.name }}
{{- if $property.valueFrom.configMapKeyRef.namespace }}
namespace: {{ $property.valueFrom.configMapKeyRef.namespace }}
{{- end }}
{{- if $property.valueFrom.configMapKeyRef.key }}
key: {{ $property.valueFrom.configMapKeyRef.key }}
{{- end }}
{{- if hasKey $property.valueFrom.configMapKeyRef "optional" }}
optional: {{ $property.configMapKeyRef.optional }}
{{- end }}
{{- end }}
{{- else }}
value: {{ $property.value | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- if or .Values.onvif.configuration.brokerPod.image.repository .Values.onvif.configuration.brokerJob.image.repository }}
{{- /* Only add brokerSpec if a broker image is provided */}}
brokerSpec:
{{- if .Values.onvif.configuration.brokerPod.image.repository }}
brokerPodSpec:
containers:
- name: {{ .Values.onvif.configuration.name }}-broker
image: {{ printf "%s:%s" .Values.onvif.configuration.brokerPod.image.repository .Values.onvif.configuration.brokerPod.image.tag | quote }}
{{- with .Values.onvif.configuration.brokerPod.image.pullPolicy }}
imagePullPolicy: {{ . }}
{{- end }}
{{- if .Values.onvif.configuration.brokerPod.env }}
env:
{{- range $key, $val := .Values.onvif.configuration.brokerPod.env }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
{{- end }}
{{- if .Values.onvif.configuration.brokerPod.env }}
env:
{{- range $key, $val := .Values.onvif.configuration.brokerPod.env }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
{{- end }}
{{- if .Values.onvif.configuration.brokerPod.envFrom }}
envFrom:
{{- range $val := .Values.onvif.configuration.brokerPod.envFrom.secretRef }}
- secretRef:
name: {{ $val | quote }}
{{- end }}
{{- range $val := .Values.onvif.configuration.brokerPod.envFrom.configMapRef }}
- configMapRef:
name: {{ $val | quote }}
{{- end }}
{{- end }}
resources:
requests:
{{`"{{PLACEHOLDER}}"`}} : "1"
memory: {{ .Values.onvif.configuration.brokerPod.resources.memoryRequest }}
cpu: {{ .Values.onvif.configuration.brokerPod.resources.cpuRequest }}
limits:
{{`"{{PLACEHOLDER}}"`}} : "1"
memory: {{ .Values.onvif.configuration.brokerPod.resources.memoryLimit }}
cpu: {{ .Values.onvif.configuration.brokerPod.resources.cpuLimit }}
{{- with .Values.onvif.configuration.brokerPod.volumeMounts}}
volumeMounts:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.onvif.configuration.brokerPod.volumes}}
volumes:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- else }}
brokerJobSpec:
template:
spec:
containers:
- name: {{ .Values.onvif.configuration.name }}-broker
image: {{ printf "%s:%s" .Values.onvif.configuration.brokerJob.image.repository .Values.onvif.configuration.brokerPod.image.tag | quote }}
{{- if .Values.onvif.configuration.brokerJob.command }}
command:
{{- toYaml .Values.onvif.configuration.brokerJob.command | nindent 14 }}
{{- end }}
{{- with .Values.onvif.configuration.pullPolicy }}
imagePullPolicy: {{ . }}
{{- end }}
{{- if .Values.onvif.configuration.brokerJob.env }}
env:
{{- range $key, $val := .Values.onvif.configuration.brokerJob.env }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
{{- end }}
{{- if .Values.onvif.configuration.brokerJob.envFrom }}
envFrom:
{{- range $val := .Values.onvif.configuration.brokerJob.envFrom.secretRef }}
- secretRef:
name: {{ $val | quote }}
{{- end }}
{{- range $val := .Values.onvif.configuration.brokerJob.envFrom.configMapRef }}
- configMapRef:
name: {{ $val | quote }}
{{- end }}
{{- end }}
resources:
requests:
{{`"{{PLACEHOLDER}}"`}} : "1"
memory: {{ .Values.onvif.configuration.brokerJob.resources.memoryRequest }}
cpu: {{ .Values.onvif.configuration.brokerJob.resources.cpuRequest }}
limits:
{{`"{{PLACEHOLDER}}"`}} : "1"
memory: {{ .Values.onvif.configuration.brokerJob.resources.memoryLimit }}
cpu: {{ .Values.onvif.configuration.brokerJob.resources.cpuLimit }}
{{- with .Values.onvif.configuration.brokerJob.volumeMounts}}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.onvif.configuration.brokerJob.volumes}}
volumes:
{{- toYaml . | nindent 10 }}
{{- end }}
restartPolicy: {{ .Values.onvif.configuration.brokerJob.restartPolicy }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 10 }}
{{- end }}
backoffLimit: {{ .Values.onvif.configuration.brokerJob.backoffLimit }}
parallelism: {{ .Values.onvif.configuration.brokerJob.parallelism }}
completions: {{ .Values.onvif.configuration.brokerJob.completions }}
{{- end }}
{{- end }}
{{- /* Only add service specs if a broker image was specified and service creation was not disabled */}}
{{- if .Values.onvif.configuration.brokerPod.image.repository }}
{{- if .Values.onvif.configuration.createInstanceServices }}
instanceServiceSpec:
type: {{ .Values.onvif.configuration.instanceService.type }}
ports:
- name: {{ .Values.onvif.configuration.instanceService.portName }}
port: {{ .Values.onvif.configuration.instanceService.port }}
protocol: {{ .Values.onvif.configuration.instanceService.protocol }}
targetPort: {{ .Values.onvif.configuration.instanceService.targetPort }}
{{- end }}
{{- if .Values.onvif.configuration.createConfigurationService }}
configurationServiceSpec:
type: {{ .Values.onvif.configuration.configurationService.type }}
ports:
- name: {{ .Values.onvif.configuration.configurationService.portName }}
port: {{ .Values.onvif.configuration.configurationService.port }}
protocol: {{ .Values.onvif.configuration.configurationService.protocol }}
targetPort: {{ .Values.onvif.configuration.configurationService.targetPort }}
{{- end }}
{{- end }}
{{- if .Values.onvif.configuration.brokerProperties }}
brokerProperties:
{{- range $key, $val := .Values.onvif.configuration.brokerProperties }}
{{- $key | nindent 4 }}: {{ $val | quote }}
{{- end }}
{{- else }}
brokerProperties: {}
{{- end }}
capacity: {{ .Values.onvif.configuration.capacity }}
{{- end }}