File size: 3,832 Bytes
f870b34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# Kubernetes manifest for Yuga Planner
# Note: This file contains environment variable placeholders that need to be substituted before deployment
# Use the provided deploy script or substitute manually: envsubst < kubernetes.yaml | kubectl apply -f -
---
apiVersion: v1
kind: Secret
metadata:
  name: yuga-planner-secrets
  labels:
    app: yuga-planner
type: Opaque
stringData:
  # These values will be populated from environment variables during deployment
  NEBIUS_API_KEY: "${NEBIUS_API_KEY}"
  NEBIUS_MODEL: "${NEBIUS_MODEL}"
  MODAL_TOKEN_ID: "${MODAL_TOKEN_ID}"
  MODAL_TOKEN_SECRET: "${MODAL_TOKEN_SECRET}"
  HF_MODEL: "${HF_MODEL}"
  HF_TOKEN: "${HF_TOKEN}"

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: yuga-planner-config
  labels:
    app: yuga-planner
data:
  JAVA_HOME: "/usr/lib/jvm/temurin-21-jdk-amd64"
  PATH: "/usr/lib/jvm/temurin-21-jdk-amd64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: yuga-planner
  labels:
    app: yuga-planner
spec:
  replicas: 1
  selector:
    matchLabels:
      app: yuga-planner
  template:
    metadata:
      labels:
        app: yuga-planner
    spec:
      containers:
      - name: yuga-planner
        image: ghcr.io/blackopsrepl/yuga-planner-test:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 7860
          name: http
          protocol: TCP
        env:
        - name: JAVA_HOME
          valueFrom:
            configMapKeyRef:
              name: yuga-planner-config
              key: JAVA_HOME
        - name: PATH
          valueFrom:
            configMapKeyRef:
              name: yuga-planner-config
              key: PATH
        - name: NEBIUS_API_KEY
          valueFrom:
            secretKeyRef:
              name: yuga-planner-secrets
              key: NEBIUS_API_KEY
        - name: NEBIUS_MODEL
          valueFrom:
            secretKeyRef:
              name: yuga-planner-secrets
              key: NEBIUS_MODEL
        - name: MODAL_TOKEN_ID
          valueFrom:
            secretKeyRef:
              name: yuga-planner-secrets
              key: MODAL_TOKEN_ID
        - name: MODAL_TOKEN_SECRET
          valueFrom:
            secretKeyRef:
              name: yuga-planner-secrets
              key: MODAL_TOKEN_SECRET
        - name: HF_MODEL
          valueFrom:
            secretKeyRef:
              name: yuga-planner-secrets
              key: HF_MODEL
        - name: HF_TOKEN
          valueFrom:
            secretKeyRef:
              name: yuga-planner-secrets
              key: HF_TOKEN
        command: ["python", "src/app.py"]
        args:
        - "--server-name"
        - "0.0.0.0"
        - "--server-port"
        - "7860"
        resources:
          requests:
            memory: "512Mi"
            cpu: "250m"
          limits:
            memory: "2Gi"
            cpu: "1000m"
        livenessProbe:
          httpGet:
            path: /
            port: 7860
          initialDelaySeconds: 30
          periodSeconds: 10
          timeoutSeconds: 5
          failureThreshold: 3
        readinessProbe:
          httpGet:
            path: /
            port: 7860
          initialDelaySeconds: 10
          periodSeconds: 5
          timeoutSeconds: 3
          failureThreshold: 3
        securityContext:
          runAsNonRoot: true
          runAsUser: 1000
          runAsGroup: 1000
          allowPrivilegeEscalation: false
          readOnlyRootFilesystem: false
          capabilities:
            drop:
            - ALL

---
apiVersion: v1
kind: Service
metadata:
  name: yuga-planner-service
  labels:
    app: yuga-planner
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 7860
    nodePort: 30860
    protocol: TCP
    name: http
  selector:
    app: yuga-planner