apiVersion: v1
kind: Namespace
metadata:
  name: cavisson

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cavproxy
  namespace: cavisson
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cavproxy
  template:
    metadata:
      labels:
        app: cavproxy
    spec:
      containers:
        - name: cavproxy
          image: cavissonsystem/cavndproxy-ubuntu:4.14.1.B35
          imagePullPolicy: Always
          args:
            - |
              chmod -R 755 /opt/cavisson/netdiagnostics

          ports:
            - name: proxy
              containerPort: 7923

          # Resource limits (adjust if needed)
          resources:
            requests:
              cpu: "250m"
              memory: "2Gi"
            limits:
              cpu: "500m"
              memory: "2Gi"

          # Environment variables
          env:
            - name: NDHOME
              value: "/opt/cavisson/netdiagnostics"
            - name: LD_LIBRARY_PATH
              value: "/usr/lib/x86_64-linux-gnu"
            - name: CAV_APP_AGENT_NDCHOST
              value: "66.220.31.146"
            - name: CAV_APP_AGENT_NDCPORT
              value: "443"
            - name: CAV_APP_AGENT_NDC_COMM_PROTOCOL
              value: "WSS"
            - name: CAV_APP_AGENT_PROXYPORT
              value: "7923"
            - name: CAV_APP_AGENT_AGENTLOGGINGMODE
              value: "1"


          volumeMounts:
            - name: proxy-config
              mountPath: /opt/cavisson/netdiagnostics/proxy/config

      volumes:
        - name: proxy-config
          emptyDir: {}

---
apiVersion: v1
kind: Service
metadata:
  name: cavproxy
  namespace: cavisson
spec:
  type: ClusterIP
  selector:
    app: cavproxy
  ports:
    - name: proxy
      port: 443
      targetPort: 7923
