{{ if false }}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: solara
spec:
  replicas: 1
  selector:
    matchLabels:
      app: solara
  template:
    metadata:
      name: solara
      labels:
        app: solara
    spec:
      terminationGracePeriodSeconds: 60
      containers:
      - name: solara
        image: docker.io/goalprofit/solara:{{.Values.solara.version}}
        imagePullPolicy: Always
        env:
{{ if .Values.local_user_id }}
          - name: LOCAL_USER_ID
            value: "{{.Values.local_user_id}}"
{{ end }}
{{ if .Values.local_user_name }}
          - name: LOCAL_USER_NAME
            value: "{{.Values.local_user_name}}"
{{ end }}
          - name: OPENAI_API_KEY
            valueFrom:
              secretKeyRef:
                name: secret-openai
                key: key
                optional: true
          - name: TNL_API_KEY
            valueFrom:
              secretKeyRef:
                name: secret-tnl
                key: key
                optional: true
          - name: SERVICE_LOGIN
            valueFrom:
              secretKeyRef:
                name: secret-service
                key: username
                optional: false
          - name: SERVICE_PASSWORD
            valueFrom:
              secretKeyRef:
                name: secret-service
                key: password
                optional: false
          - name: JI_API_KEY
            valueFrom:
              secretKeyRef:
                name: secret-ji
                key: key
                optional: true
        ports:
          - containerPort: 8765

        volumeMounts:
          - mountPath: /data
            name: customer
            subPath: data/jupyter
          - mountPath: /downloads
            name: customer
            subPath: data/downloads


      imagePullSecrets:
      - name: regcred

      volumes:
      - name: customer
        {{ include "app.customer_volume" . | nindent 8}}
      {{ include "app.affinity" . | nindent 6}}
      
---
apiVersion: v1
kind: Service
metadata:
  name: solara
spec:
  type: ClusterIP
  selector:
    app: solara
  ports:
    - name: http
      protocol: TCP
      port: 8765
      targetPort: 8765
{{ end }}
