---
# Source: visualqna/charts/lvm-uservice/templates/configmap.yaml
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: ConfigMap
metadata:
  name: visualqna-lvm-uservice-config
  labels:
    helm.sh/chart: lvm-uservice-0.8.0
    app.kubernetes.io/name: lvm-uservice
    app.kubernetes.io/instance: visualqna
    app.kubernetes.io/version: "1.0.0"
    app.kubernetes.io/managed-by: Helm
data:
  LVM_ENDPOINT: "http://visualqna-tgi"
  HF_HOME: "/tmp/.cache/huggingface"
  http_proxy: ""
  https_proxy: ""
  no_proxy: ""
---
# Source: visualqna/charts/tgi/templates/configmap.yaml
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: ConfigMap
metadata:
  name: visualqna-tgi-config
  labels:
    helm.sh/chart: tgi-0.8.0
    app.kubernetes.io/name: tgi
    app.kubernetes.io/instance: visualqna
    app.kubernetes.io/version: "2.1.0"
    app.kubernetes.io/managed-by: Helm
data:
  MODEL_ID: "llava-hf/llava-v1.6-mistral-7b-hf"
  PORT: "8399"
  MAX_INPUT_TOKENS: "4096"
  MAX_TOTAL_TOKENS: "8192"
  CUDA_GRAPHS: "0"
  http_proxy: ""
  https_proxy: ""
  no_proxy: ""
  HABANA_LOGS: "/tmp/habana_logs"
  NUMBA_CACHE_DIR: "/tmp"
  TRANSFORMERS_CACHE: "/tmp/transformers_cache"
  HF_HOME: "/tmp/.cache/huggingface"
---
# Source: visualqna/charts/lvm-uservice/templates/service.yaml
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: Service
metadata:
  name: visualqna-lvm-uservice
  labels:
    helm.sh/chart: lvm-uservice-0.8.0
    app.kubernetes.io/name: lvm-uservice
    app.kubernetes.io/instance: visualqna
    app.kubernetes.io/version: "1.0.0"
    app.kubernetes.io/managed-by: Helm
spec:
  type: ClusterIP
  ports:
    - port: 9399
      targetPort: 9399
      protocol: TCP
      name: lvm-uservice
  selector:
    app.kubernetes.io/name: lvm-uservice
    app.kubernetes.io/instance: visualqna
---
# Source: visualqna/charts/tgi/templates/service.yaml
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: Service
metadata:
  name: visualqna-tgi
  labels:
    helm.sh/chart: tgi-0.8.0
    app.kubernetes.io/name: tgi
    app.kubernetes.io/instance: visualqna
    app.kubernetes.io/version: "2.1.0"
    app.kubernetes.io/managed-by: Helm
spec:
  type: ClusterIP
  ports:
    - port: 80
      targetPort: 8399
      protocol: TCP
      name: tgi
  selector:
    app.kubernetes.io/name: tgi
    app.kubernetes.io/instance: visualqna
---
# Source: visualqna/templates/service.yaml
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: Service
metadata:
  name: visualqna
  labels:
    helm.sh/chart: visualqna-0.8.0
    app.kubernetes.io/name: visualqna
    app.kubernetes.io/instance: visualqna
    app.kubernetes.io/version: "1.0.0"
    app.kubernetes.io/managed-by: Helm
spec:
  type: ClusterIP
  ports:
    - port: 8888
      targetPort: 8888
      protocol: TCP
      name: visualqna
  selector:
    app.kubernetes.io/name: visualqna
    app.kubernetes.io/instance: visualqna
---
# Source: visualqna/charts/lvm-uservice/templates/deployment.yaml
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: apps/v1
kind: Deployment
metadata:
  name: visualqna-lvm-uservice
  labels:
    helm.sh/chart: lvm-uservice-0.8.0
    app.kubernetes.io/name: lvm-uservice
    app.kubernetes.io/instance: visualqna
    app.kubernetes.io/version: "1.0.0"
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: lvm-uservice
      app.kubernetes.io/instance: visualqna
  template:
    metadata:
      labels:
        app.kubernetes.io/name: lvm-uservice
        app.kubernetes.io/instance: visualqna
    spec:
      securityContext:
        {}
      containers:
        - name: visualqna
          envFrom:
            - configMapRef:
                name: visualqna-lvm-uservice-config
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
              - ALL
            readOnlyRootFilesystem: false
            runAsNonRoot: true
            runAsUser: 1000
            seccompProfile:
              type: RuntimeDefault
          image: "opea/lvm-tgi:latest"
          imagePullPolicy: IfNotPresent
          ports:
            - name: lvm-uservice
              containerPort: 9399
              protocol: TCP
          volumeMounts:
            - mountPath: /tmp
              name: tmp
          resources:
            {}
      volumes:
        - name: tmp
          emptyDir: {}
---
# Source: visualqna/charts/tgi/templates/deployment.yaml
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: apps/v1
kind: Deployment
metadata:
  name: visualqna-tgi
  labels:
    helm.sh/chart: tgi-0.8.0
    app.kubernetes.io/name: tgi
    app.kubernetes.io/instance: visualqna
    app.kubernetes.io/version: "2.1.0"
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: tgi
      app.kubernetes.io/instance: visualqna
  template:
    metadata:
      labels:
        app.kubernetes.io/name: tgi
        app.kubernetes.io/instance: visualqna
    spec:
      securityContext:
        {}
      containers:
        - name: tgi
          envFrom:
            - configMapRef:
                name: visualqna-tgi-config
          securityContext:
            {}
          image: "ghcr.io/huggingface/text-generation-inference:2.4.0-intel-cpu"
          imagePullPolicy: IfNotPresent
          volumeMounts:
            - mountPath: /data
              name: model-volume
            - mountPath: /tmp
              name: tmp
          ports:
            - name: http
              containerPort: 8399
              protocol: TCP
          resources:
            {}
      volumes:
        - name: model-volume
          hostPath:
            path: /mnt/opea-models
            type: Directory
        - name: tmp
          emptyDir: {}
---
# Source: visualqna/templates/deployment.yaml
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: apps/v1
kind: Deployment
metadata:
  name: visualqna
  labels:
    helm.sh/chart: visualqna-0.8.0
    app.kubernetes.io/name: visualqna
    app.kubernetes.io/instance: visualqna
    app.kubernetes.io/version: "1.0.0"
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: visualqna
      app.kubernetes.io/instance: visualqna
  template:
    metadata:
      labels:
        app.kubernetes.io/name: visualqna
        app.kubernetes.io/instance: visualqna
    spec:
      securityContext:
        null
      containers:
        - name: visualqna
          env:
            - name: LVM_SERVICE_HOST_IP
              value: visualqna-lvm-uservice
            #- name: MEGA_SERVICE_PORT
            #  value: 8888
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
              - ALL
            readOnlyRootFilesystem: true
            runAsNonRoot: true
            runAsUser: 1000
            seccompProfile:
              type: RuntimeDefault
          image: "opea/visualqna:latest"
          imagePullPolicy: IfNotPresent
          volumeMounts:
            - mountPath: /tmp
              name: tmp
          ports:
            - name: visualqna
              containerPort: 8888
              protocol: TCP
          resources:
            null
      volumes:
        - name: tmp
          emptyDir: {}
---
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: ConfigMap
metadata:
  name: visualqna-nginx-config
data:
  default.conf: |
    server {
        listen       80;
        listen  [::]:80;

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }

        location /v1/visualqna {
            proxy_pass http://visualqna:8888;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }
    }
---
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: apps/v1
kind: Deployment
metadata:
  name: visualqna-nginx-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80
        volumeMounts:
        - name: nginx-config-volume
          mountPath: /etc/nginx/conf.d/default.conf
          subPath: default.conf
      volumes:
      - name: nginx-config-volume
        configMap:
          name: visualqna-nginx-config
---
kind: Service
apiVersion: v1
metadata:
  name: nginx-svc
spec:
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
      nodePort: 30789
  type: NodePort
