X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=it%2Fdep.git;a=blobdiff_plain;f=smo-install%2Foran_oom%2Fnonrtric-common%2Ftemplates%2F_pods.tpl;fp=smo-install%2Foran_oom%2Fnonrtric-common%2Ftemplates%2F_pods.tpl;h=e81bc38ef0cfbef8ded2571459728c76404bd79d;hp=0000000000000000000000000000000000000000;hb=918108f729c368db61fe904024129f21269e19b7;hpb=c9ace66e2b4635918c4c4c473dfc7bcbeb41b7ae diff --git a/smo-install/oran_oom/nonrtric-common/templates/_pods.tpl b/smo-install/oran_oom/nonrtric-common/templates/_pods.tpl new file mode 100644 index 00000000..e81bc38e --- /dev/null +++ b/smo-install/oran_oom/nonrtric-common/templates/_pods.tpl @@ -0,0 +1,92 @@ +{{/* +################################################################################ +# Copyright (c) 2024 NYCU WINLab. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +*/}} + +{{- define "common.containerPorts" -}} +{{- $ports := default (list) .Values.service.ports }} +{{- range $index, $port := $ports }} +{{- if $port.targetPort -}} +- containerPort: {{ $port.targetPort }} + name: {{ $port.name }} +{{- if $port.l4_protocol }} + protocol: {{ $port.l4_protocol }} +{{- else }} + protocol: TCP +{{- end }} +{{- end }} +{{- if $port.targetPort_tls }} +- containerPort: {{ $port.targetPort_tls }} + name: {{ $port.name_tls }} +{{- if $port.l4_protocol }} + protocol: {{ $port.l4_protocol }} +{{- else }} + protocol: TCP +{{- end }} +{{- end }} +{{- end }} +{{- end -}} + +{{- define "common.probePort" -}} +{{ default (first .Values.service.ports).targetPort .Values.service.probePort }} +{{- end -}} + +{{- define "common.tcpsocketReadinessProbe" -}} +{{- $dot := default . .dot -}} +{{- $port := default (include "common.probePort" $dot) .port -}} +readinessProbe: + tcpSocket: + port: {{ $port }} + initialDelaySeconds: {{ $dot.Values.readiness.initialDelaySeconds }} + periodSeconds: {{ $dot.Values.readiness.periodSeconds }} +{{- end -}} + +{{- define "common.tcpsocketLivenessProbe" -}} +{{- $dot := default . .dot -}} +{{- $port := default (include "common.probePort" $dot) .port -}} +livenessProbe: + tcpSocket: + port: {{ $port }} + initialDelaySeconds: {{ $dot.Values.liveness.initialDelaySeconds }} + periodSeconds: {{ $dot.Values.liveness.periodSeconds }} +{{- end -}} + +{{- define "common.tcpsocketProbes" -}} +{{- include "common.tcpsocketReadinessProbe" . }} +{{ include "common.tcpsocketLivenessProbe" . }} +{{- end -}} + +{{- define "common.httpLiveProbe" -}} +{{- $dot := default . .dot }} +{{- $path := default "/status" .path -}} +livenessProbe: + httpGet: + path: {{ $path }} + port: {{ include "common.probePort" . }} + initialDelaySeconds: {{ $dot.Values.liveness.initialDelaySeconds }} + periodSeconds: {{ $dot.Values.liveness.periodSeconds }} +{{- end -}} + +{{- define "common.applicationConfigMountName" -}} +{{ include "common.name" . }}-application-config +{{- end -}} + +{{- define "common.applicationConfigVolume" -}} +- name: {{ include "common.name" . }}-application-config + configMap: + name: {{ include "common.name" . }}-application-configmap +{{- end -}} +