# Copyright 2019-2024 Open Networking Foundation (ONF) and the ONF Contributors
#
# 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.
{{- $log_level := tpl .Values.adapter_open_onu.log_level . | upper }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: "{{ template "fullname" . }}"
  namespace: {{ .Release.Namespace }}
  {{- if or (hasKey .Values "extra_deployment_labels") (hasKey .Values "openonu_deployment_labels") }}
  labels:
    {{- if hasKey .Values "extra_deployment_labels" }}
    {{- range $key, $val := .Values.extra_deployment_labels }}
    {{ $key }}: {{ $val | quote }}
    {{- end }}
    {{- end }}
    {{- if hasKey .Values "openonu_deployment_labels" }}
    {{- range $key, $val := .Values.openonu_deployment_labels }}
    {{ $key }}: {{ $val | quote }}
    {{- end }}
    {{- end }}
  {{- end }}
spec:
  replicas: {{ .Values.replicas.adapter_open_onu }}
  selector:
    matchLabels:
      app: adapter-open-onu
      release: {{ .Release.Name }}
  template:
    metadata:
      namespace: {{ .Release.Namespace }}
      labels:
        app: adapter-open-onu
        release: {{ .Release.Name }}
        app.kubernetes.io/name: "adapter-open-onu"
        app.kubernetes.io/version: {{ quote .Chart.AppVersion }}
        app.kubernetes.io/component: "adapter"
        app.kubernetes.io/part-of: "voltha"
        app.kubernetes.io/stack: "{{ .Values.global.stack_name }}"
        app.kubernetes.io/managed-by: {{ quote .Release.Service }}
        helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
        {{- if hasKey .Values "extra_pod_labels" }}
        {{- range $key, $val := .Values.extra_pod_labels }}
        {{ $key }}: {{ $val | quote }}
        {{- end }}
        {{- end }}
        {{- if hasKey .Values "openonu_pod_labels" }}
        {{- range $key, $val := .Values.openonu_pod_labels }}
        {{ $key }}: {{ $val | quote }}
        {{- end }}
        {{- end }}
    spec:
      {{- if .Values.securityContext.enabled }}
      securityContext:
        runAsUser: {{ .Values.securityContext.runAsUser }}
        runAsGroup: {{ .Values.securityContext.runAsGroup }}
        fsGroup: {{ .Values.securityContext.fsGroup }}
      {{- end }}
      containers:
        - name: adapter-open-onu
          image: '{{ tpl .Values.images.adapter_open_onu_go.registry . }}{{ tpl .Values.images.adapter_open_onu_go.repository . }}:{{ tpl ( tpl .Values.images.adapter_open_onu_go.tag . ) . }}'
          imagePullPolicy: {{ tpl .Values.images.adapter_open_onu_go.pullPolicy . }}
          env:
            - name: COMPONENT_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.labels['app.kubernetes.io/name']
            - name: KV_STORE_DATAPATH_PREFIX
              value: {{ tpl .Values.adapter_open_onu.kv_store_data_prefix . }}
          args:
            - "/app/openonu"
            - "--banner=true"
            - "--kafka_reconnect_retries=-1"
            - "--core_endpoint={{ tpl .Values.global.core_endpoint . }}"
            - "--adapter_endpoint={{ tpl .Values.adapter_open_onu.endpoints.address . }}.{{ .Release.Namespace }}.svc:{{ print .Values.adapter_open_onu.endpoints.port }}"
            - "--kafka_cluster_address={{ tpl .Values.services.kafka.cluster.address . }}"
            - "--event_topic={{ .Values.adapter_open_onu.topics.event_topic }}"
            - "--kv_store_type={{ tpl .Values.services.kvstore.type . }}"
            - "--kv_store_address={{ tpl .Values.services.kvstore.address . }}"
            - "--kv_store_request_timeout={{ tpl .Values.adapter_open_onu.kv_store_timeout . }}"
            - "--log_level={{ $log_level }}"
            - "--probe_port=8080"
            - "--accept_incr_evto={{ tpl .Values.adapter_open_onu.incremental_evto_update . }}"
            - "--max_timeout_interadapter_comm={{ tpl .Values.adapter_open_onu.max_timeout_interadapter_comm . }}"
            - "--max_timeout_reconciling={{ tpl .Values.adapter_open_onu.max_timeout_reconciling . }}"
            - "--omci_timeout={{ tpl .Values.adapter_open_onu.omci_timeout . }}"
            - "--rpc_timeout={{ tpl .Values.adapter_open_onu.rpc_timeout . }}"
            - "--trace_enabled={{ .Values.global.tracing.enabled }}"
            - "--trace_agent_address={{ tpl .Values.services.tracing_agent.address . }}"
            - "--log_correlation_enabled={{ .Values.global.log_correlation.enabled }}"
            - "--allowed_onu_vendors={{ template "allowed_onu_vendors" . }}"
            - "--metrics_enabled={{ .Values.global.metrics.enabled }}"
            - "--extended_omci_support_enabled={{ .Values.global.extended_omci_support.enabled }}"
            - "--mib_audit_interval={{ .Values.global.mib_audit.interval }}"
            - "--alarm_audit_interval={{ .Values.global.alarm_audit.interval }}"
            - "--uni_port_mask={{ .Values.adapter_open_onu.uni_port_mask }}"
            - "--skip_onu_config_enabled={{ .Values.global.skip_onu_config.enabled }}"              
          {{- if .Values.securityContext.enabled }}
          securityContext:
            allowPrivilegeEscalation: false
          {{- end }}
          ports:
            - containerPort: {{ .Values.adapter_open_onu.endpoints.port }}
              name: grpc
          livenessProbe:
            httpGet:
              path: /healthz
              port: 8080
            initialDelaySeconds: {{ .Values.probe.liveness.initial_delay_seconds }}
            periodSeconds: {{ .Values.probe.liveness.period_seconds }}
          readinessProbe:
            httpGet:
              path: /readz
              port: 8080
            initialDelaySeconds: {{ .Values.probe.readiness.initial_delay_seconds }}
            periodSeconds: {{ .Values.probe.readiness.period_seconds }}
          resources:
            requests:
              {{- if .Values.resources.requests.memory }}
              memory: {{ .Values.resources.requests.memory }}
              {{- end }}
              {{- if .Values.resources.requests.cpu }}
              cpu: {{ .Values.resources.requests.cpu }}
              {{- end }}
            limits:
              {{- if .Values.resources.limits.memory }}
              memory: {{ .Values.resources.limits.memory }}
              {{- end }}
              {{- if .Values.resources.limits.cpu }}
              cpu: {{ .Values.resources.limits.cpu }}
              {{- end }}
      affinity:
        podAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            {{- if .Values.scheduleRules.preferStackPodsOnSameNode }}
            - podAffinityTerm:
                topologyKey: kubernetes.io/hostname
                labelSelector:
                  matchExpressions:
                    - key: app.kubernetes.io/stack
                      operator: In
                      values:
                        - {{ .Values.global.stack_name }}
              weight: 100
            {{- end }}
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            {{- if .Values.scheduleRules.preferStacksOnDifferentNodes }}
            - podAffinityTerm:
                topologyKey: kubernetes.io/hostname
                labelSelector:
                  matchExpressions:
                    - key: app.kubernetes.io/name
                      operator: In
                      values:
                        - adapter-open-onu
              weight: 100
            {{- end }}
