apiVersion: apps/v1
kind: Deployment
metadata:
  name: smf-deployment
  namespace: MY_NAMESPACE
  labels:
    app: smf
spec:
  replicas: 1
  selector:
    matchLabels:
      app: smf
  template:
    metadata:
      labels:
        app: smf
      annotations:
        cni.projectcalico.org/ipAddrs: "[\"SMF_ADDR\"]"
    spec:
      hostname: smf
      subdomain: localdomain
      hostAliases:
      - ip: "AMF_ADDR"
        hostnames:
        - "amf.localdomain"
      - ip: "HSS_ADDR"
        hostnames:
        - "hss.localdomain"
      - ip: "SMF_ADDR"
        hostnames:
        - "smf.localdomain"
      - ip: "PCRF_ADDR"
        hostnames:
        - "pcrf.localdomain"
      - ip: "UPF_ADDR"
        hostnames:
        - "upf.localdomain"
      containers:
      - name: smf-container
        image: "sufuf3/nextepc-build:latest"
        command: ["/bin/bash"]
        args: ["-c", "/usr/src/free5gc/free5gc-smfd"]
        imagePullPolicy: IfNotPresent
        env:
          - name: DB_URI
            value: mongodb://mongo-external.MY_NAMESPACE.svc.cluster.local/nextepc
        volumeMounts:
        - name: config-volume
          mountPath: /usr/src/free5gc/install/etc/free5gc/free5gc.conf
          subPath: free5gc.conf
        - name: freediameter-volume
          mountPath: /usr/src/free5gc/install/etc/free5gc/freeDiameter/smf.conf
          subPath: smf.conf
        securityContext:
          privileged: true
          capabilities:
            add: ["NET_ADMIN", "SYS_TIME"]
      securityContext:
        sysctls:
          - name: net.ipv6.conf.all.disable_ipv6
            value: "0"
      volumes:
        - name: config-volume
          configMap:
            name: free5gc-config
            items:
            - key: config.file
              path: free5gc.conf
        - name: freediameter-volume
          configMap:
            name: freediameter-smf-config
            items:
            - key: config.file
              path: smf.conf
