File size: 3,626 Bytes
c8ebe28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
apiVersion: apps/v1
kind: Deployment
metadata:
  name: langchain-streamlit-demo-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: langchain-streamlit-demo
  template:
    metadata:
      labels:
        app: langchain-streamlit-demo
    spec:
      containers:
      - name: langchain-streamlit-demo
        image: joshuasundance/langchain-streamlit-demo:2.1.4
        imagePullPolicy: Always
        resources:
          requests:
            cpu: "100m"
            memory: "200Mi"
          limits:
            cpu: "500m"
            memory: "500Mi"
        env:
          - name: AZURE_OPENAI_BASE_URL
            valueFrom:
              secretKeyRef:
                name: langchain-streamlit-demo-secret
                key: AZURE_OPENAI_BASE_URL
          - name: AZURE_OPENAI_API_VERSION
            valueFrom:
              secretKeyRef:
                name: langchain-streamlit-demo-secret
                key: AZURE_OPENAI_API_VERSION
          - name: AZURE_OPENAI_DEPLOYMENT_NAME
            valueFrom:
              secretKeyRef:
                name: langchain-streamlit-demo-secret
                key: AZURE_OPENAI_DEPLOYMENT_NAME
          - name: AZURE_OPENAI_EMB_DEPLOYMENT_NAME
            valueFrom:
              secretKeyRef:
                name: langchain-streamlit-demo-secret
                key: AZURE_OPENAI_EMB_DEPLOYMENT_NAME
          - name: AZURE_OPENAI_API_KEY
            valueFrom:
              secretKeyRef:
                name: langchain-streamlit-demo-secret
                key: AZURE_OPENAI_API_KEY
          - name: AZURE_OPENAI_MODEL_VERSION
            valueFrom:
              secretKeyRef:
                name: langchain-streamlit-demo-secret
                key: AZURE_OPENAI_MODEL_VERSION
          - name: OPENAI_API_KEY
            valueFrom:
              secretKeyRef:
                name: langchain-streamlit-demo-secret
                key: OPENAI_API_KEY
          - name: ANTHROPIC_API_KEY
            valueFrom:
              secretKeyRef:
                name: langchain-streamlit-demo-secret
                key: ANTHROPIC_API_KEY
          - name: ANYSCALE_API_KEY
            valueFrom:
              secretKeyRef:
                name: langchain-streamlit-demo-secret
                key: ANYSCALE_API_KEY
          - name: LANGCHAIN_API_KEY
            valueFrom:
              secretKeyRef:
                name: langchain-streamlit-demo-secret
                key: LANGCHAIN_API_KEY
          - name: LANGCHAIN_PROJECT
            value: "langchain-streamlit-demo"
          - name: SHOW_LANGSMITH_OPTIONS
            value: "False"
          - name: SHOW_AZURE_OPTIONS
            value: "False"
        securityContext:
          runAsNonRoot: true
---
apiVersion: v1
kind: Service
metadata:
  name: langchain-streamlit-demo-service
  # configure on Azure and uncomment below to use a vnet
#  annotations:
#    service.beta.kubernetes.io/azure-load-balancer-internal: "true"
#    service.beta.kubernetes.io/azure-load-balancer-ipv4: vnet.ip.goes.here
#    service.beta.kubernetes.io/azure-dns-label-name: "langchain-streamlit-demo"
spec:
  selector:
    app: langchain-streamlit-demo
  ports:
    - protocol: TCP
      port: 80
      targetPort: 7860
  type: LoadBalancer
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: langchain-streamlit-demo-network-policy
spec:
  podSelector:
    matchLabels:
      app: langchain-streamlit-demo
  policyTypes:
  - Ingress
  ingress:
  - from: []  # An empty array here means it will allow traffic from all sources.
    ports:
    - protocol: TCP
      port: 7860