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

apiVersion: v1
kind: ConfigMap
metadata:
  name: codegen-codegen-ui-config
  labels:
    helm.sh/chart: codegen-ui-1.0.0
    app.kubernetes.io/name: codegen-ui
    app.kubernetes.io/instance: codegen
    app.kubernetes.io/version: "v1.0"
    app.kubernetes.io/managed-by: Helm
data:
  APP_BACKEND_SERVICE_ENDPOINT: "/v1/codegen"
  APP_DATA_PREP_SERVICE_URL: "/v1/dataprep"
  CHAT_BASE_URL: "/v1/codegen"
  UPLOAD_FILE_BASE_URL: "/v1/dataprep"
  GET_FILE: "/v1/dataprep/get_file"
  DELETE_FILE: "/v1/dataprep/delete_file"
  BASE_URL: "/v1/codegen"
  DOC_BASE_URL: "/v1/codegen"
  BASIC_URL: "/v1/codegen"
  VITE_CODE_GEN_URL: "/v1/codegen"
  VITE_DOC_SUM_URL: "/v1/codegen"
---
# Source: codegen/charts/llm-uservice/templates/configmap.yaml
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: ConfigMap
metadata:
  name: codegen-llm-uservice-config
  labels:
    helm.sh/chart: llm-uservice-1.0.0
    app.kubernetes.io/name: llm-uservice
    app.kubernetes.io/instance: codegen
    app.kubernetes.io/version: "v1.0"
    app.kubernetes.io/managed-by: Helm
data:
  TGI_LLM_ENDPOINT: "http://codegen-tgi"
  HUGGINGFACEHUB_API_TOKEN: "insert-your-huggingface-token-here"
  HF_HOME: "/tmp/.cache/huggingface"
  http_proxy: ""
  https_proxy: ""
  no_proxy: ""
  LOGFLAG: ""
---
# Source: codegen/charts/tgi/templates/configmap.yaml
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: ConfigMap
metadata:
  name: codegen-tgi-config
  labels:
    helm.sh/chart: tgi-1.0.0
    app.kubernetes.io/name: tgi
    app.kubernetes.io/instance: codegen
    app.kubernetes.io/version: "2.1.0"
    app.kubernetes.io/managed-by: Helm
data:
  MODEL_ID: "meta-llama/CodeLlama-7b-hf"
  PORT: "2080"
  HF_TOKEN: "insert-your-huggingface-token-here"
  http_proxy: ""
  https_proxy: ""
  no_proxy: ""
  HABANA_LOGS: "/tmp/habana_logs"
  NUMBA_CACHE_DIR: "/tmp"
  HF_HOME: "/tmp/.cache/huggingface"
  MAX_INPUT_LENGTH: "1024"
  MAX_TOTAL_TOKENS: "2048"
---
# Source: codegen/templates/nginx-deployment.yaml
apiVersion: v1
data:
  default.conf: |+
    # Copyright (C) 2024 Intel Corporation
    # SPDX-License-Identifier: Apache-2.0


    server {
        listen       80;
        listen  [::]:80;

        location /home {
            alias  /usr/share/nginx/html/index.html;
        }

        location / {
            proxy_pass http://codegen-codegen-ui:5174;
            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;
        }

        location /v1/codegen {
            proxy_pass http://codegen:7778;
            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;
        }
    }

kind: ConfigMap
metadata:
  name: codegen-nginx-config
---
# Source: codegen/charts/codegen-ui/templates/service.yaml
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

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

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

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

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

apiVersion: apps/v1
kind: Deployment
metadata:
  name: codegen-codegen-ui
  labels:
    helm.sh/chart: codegen-ui-1.0.0
    app.kubernetes.io/name: codegen-ui
    app.kubernetes.io/instance: codegen
    app.kubernetes.io/version: "v1.0"
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: codegen-ui
      app.kubernetes.io/instance: codegen
  template:
    metadata:
      labels:
        helm.sh/chart: codegen-ui-1.0.0
        app.kubernetes.io/name: codegen-ui
        app.kubernetes.io/instance: codegen
        app.kubernetes.io/version: "v1.0"
        app.kubernetes.io/managed-by: Helm
    spec:
      securityContext:
        {}
      containers:
        - name: codegen-ui
          envFrom:
            - configMapRef:
                name: codegen-codegen-ui-config
          securityContext:
            {}
          image: "opea/codegen-ui:latest"
          imagePullPolicy: IfNotPresent
          ports:
            - name: ui
              containerPort: 5173
              protocol: TCP
          resources:
            {}
          volumeMounts:
            - mountPath: /tmp
              name: tmp
      volumes:
        - name: tmp
          emptyDir: {}
---
# Source: codegen/charts/llm-uservice/templates/deployment.yaml
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

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

apiVersion: apps/v1
kind: Deployment
metadata:
  name: codegen-tgi
  labels:
    helm.sh/chart: tgi-1.0.0
    app.kubernetes.io/name: tgi
    app.kubernetes.io/instance: codegen
    app.kubernetes.io/version: "2.1.0"
    app.kubernetes.io/managed-by: Helm
spec:
  # use explicit replica counts only of HorizontalPodAutoscaler is disabled
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: tgi
      app.kubernetes.io/instance: codegen
  template:
    metadata:
      labels:
        app.kubernetes.io/name: tgi
        app.kubernetes.io/instance: codegen
    spec:
      securityContext:
        {}
      containers:
        - name: tgi
          envFrom:
            - configMapRef:
                name: codegen-tgi-config
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
              - ALL
            readOnlyRootFilesystem: true
            runAsNonRoot: true
            runAsUser: 1000
            seccompProfile:
              type: RuntimeDefault
          image: "ghcr.io/huggingface/tgi-gaudi:2.0.1"
          imagePullPolicy: IfNotPresent
          volumeMounts:
            - mountPath: /data
              name: model-volume
            - mountPath: /tmp
              name: tmp
          ports:
            - name: http
              containerPort: 2080
              protocol: TCP
          livenessProbe:
            failureThreshold: 24
            initialDelaySeconds: 5
            periodSeconds: 5
            tcpSocket:
              port: http
          readinessProbe:
            initialDelaySeconds: 5
            periodSeconds: 5
            tcpSocket:
              port: http
          startupProbe:
            failureThreshold: 120
            initialDelaySeconds: 5
            periodSeconds: 5
            tcpSocket:
              port: http
          resources:
            limits:
              habana.ai/gaudi: 1
              memory: 64Gi
              hugepages-2Mi: 500Mi
      volumes:
        - name: model-volume
          emptyDir: {}
        - name: tmp
          emptyDir: {}
---
# Source: codegen/templates/deployment.yaml
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

apiVersion: apps/v1
kind: Deployment
metadata:
  name: codegen
  labels:
    helm.sh/chart: codegen-1.0.0
    app.kubernetes.io/name: codegen
    app.kubernetes.io/instance: codegen
    app.kubernetes.io/version: "v1.0"
    app.kubernetes.io/managed-by: Helm
    app: codegen
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: codegen
      app.kubernetes.io/instance: codegen
      app: codegen
  template:
    metadata:
      labels:
        app.kubernetes.io/name: codegen
        app.kubernetes.io/instance: codegen
        app: codegen
    spec:
      securityContext:
        null
      containers:
        - name: codegen
          env:
            - name: LLM_SERVICE_HOST_IP
              value: codegen-llm-uservice
            #- name: MEGA_SERVICE_PORT
            #  value: 7778
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
              - ALL
            readOnlyRootFilesystem: true
            runAsNonRoot: true
            runAsUser: 1000
            seccompProfile:
              type: RuntimeDefault
          image: "opea/codegen:latest"
          imagePullPolicy: IfNotPresent
          volumeMounts:
            - mountPath: /tmp
              name: tmp
          ports:
            - name: codegen
              containerPort: 7778
              protocol: TCP
          resources:
            null
      volumes:
        - name: tmp
          emptyDir: {}
---
# Source: codegen/templates/nginx-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: codegen-nginx
  labels:
    helm.sh/chart: codegen-1.0.0
    app.kubernetes.io/name: codegen
    app.kubernetes.io/instance: codegen
    app.kubernetes.io/version: "v1.0"
    app.kubernetes.io/managed-by: Helm
    app: codegen-nginx
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: codegen
      app.kubernetes.io/instance: codegen
      app: codegen-nginx
  template:
    metadata:
      labels:
        app.kubernetes.io/name: codegen
        app.kubernetes.io/instance: codegen
        app: codegen-nginx
    spec:
      containers:
      - image: nginx:1.27.1
        imagePullPolicy: IfNotPresent
        name: nginx
        volumeMounts:
        - mountPath: /etc/nginx/conf.d
          name: nginx-config-volume
      securityContext: {}
      volumes:
      - configMap:
          defaultMode: 420
          name: codegen-nginx-config
        name: nginx-config-volume
