132 lines
3.7 KiB
YAML
132 lines
3.7 KiB
YAML
# Copyright (C) 2024 Intel Corporation
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
{{- $global := .Values }}
|
|
{{- range $microservice := .Values.microservices }}
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ $microservice.name }}
|
|
namespace: default
|
|
spec:
|
|
{{- $replicas := $microservice.replicas }}
|
|
{{- range $podSpec := $global.podSpecs }}
|
|
{{- if eq $podSpec.name $microservice.name }}
|
|
{{- $replicas = $podSpec.replicas | default $microservice.replicas }}
|
|
{{- end }}
|
|
{{- end }}
|
|
replicas: {{ $replicas }}
|
|
|
|
selector:
|
|
matchLabels:
|
|
app: {{ $microservice.name }}
|
|
template:
|
|
metadata:
|
|
annotations:
|
|
sidecar.istio.io/rewriteAppHTTPProbers: 'true'
|
|
labels:
|
|
app: {{ $microservice.name }}
|
|
spec:
|
|
containers:
|
|
- envFrom:
|
|
- configMapRef:
|
|
name: {{ $global.config.CONFIG_MAP_NAME }}
|
|
{{- if $microservice.args }}
|
|
args:
|
|
{{- range $arg := $microservice.args }}
|
|
{{- if $arg.name }}
|
|
- {{ $arg.name }}
|
|
{{- end }}
|
|
{{- if $arg.value }}
|
|
- "{{ $arg.value }}"
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{- if $microservice.env }}
|
|
env:
|
|
{{- range $env := $microservice.env }}
|
|
- name: {{ $env.name }}
|
|
value: "{{ $env.value }}"
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{- $image := $microservice.image }}
|
|
{{- range $podSpec := $global.podSpecs }}
|
|
{{- if eq $podSpec.name $microservice.name }}
|
|
{{- $image = $podSpec.image | default $microservice.image }}
|
|
{{- end }}
|
|
{{- end }}
|
|
image: {{ $image }}
|
|
|
|
imagePullPolicy: IfNotPresent
|
|
name: {{ $microservice.name }}
|
|
|
|
{{- if $microservice.ports }}
|
|
ports:
|
|
{{- range $port := $microservice.ports }}
|
|
{{- range $port_name, $port_id := $port }}
|
|
- {{ $port_name }}: {{ $port_id }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{- $resources := $microservice.resources }}
|
|
{{- range $podSpec := $global.podSpecs }}
|
|
{{- if eq $podSpec.name $microservice.name }}
|
|
{{- if $podSpec.resources }}
|
|
{{- $resources = $podSpec.resources }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{- if $resources }}
|
|
resources:
|
|
{{- range $resourceType, $resource := $resources }}
|
|
{{ $resourceType }}:
|
|
{{- range $limitType, $limit := $resource }}
|
|
{{ $limitType }}: {{ $limit }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{- if $microservice.volumeMounts }}
|
|
volumeMounts:
|
|
{{- range $volumeMount := $microservice.volumeMounts }}
|
|
- mountPath: {{ $volumeMount.mountPath }}
|
|
name: {{ $volumeMount.name }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
hostIPC: true
|
|
nodeSelector:
|
|
node-type: {{ $global.config.NODE_SELECTOR }}
|
|
serviceAccountName: default
|
|
topologySpreadConstraints:
|
|
- labelSelector:
|
|
matchLabels:
|
|
app: {{ $microservice.name }}
|
|
maxSkew: 1
|
|
topologyKey: kubernetes.io/hostname
|
|
whenUnsatisfiable: ScheduleAnyway
|
|
|
|
|
|
{{- if $microservice.volumes }}
|
|
volumes:
|
|
{{- range $index, $volume := $microservice.volumes }}
|
|
- name: {{ $volume.name }}
|
|
{{- if $volume.hostPath }}
|
|
hostPath:
|
|
path: {{ $volume.hostPath.path }}
|
|
type: {{ $volume.hostPath.type }}
|
|
{{- else if $volume.emptyDir }}
|
|
emptyDir:
|
|
medium: {{ $volume.emptyDir.medium }}
|
|
sizeLimit: {{ $volume.emptyDir.sizeLimit }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
---
|
|
{{- end }}
|