Skip to content

Commit 23edcf6

Browse files
author
wwanarif
committed
initial fix to enable studio in proxy network
Signed-off-by: wwanarif <[email protected]>
1 parent 62a35ea commit 23edcf6

File tree

13 files changed

+98
-73
lines changed

13 files changed

+98
-73
lines changed

setup-scripts/setup-genai-studio/manifests/studio-manifest-aws-ecr.yaml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ rules:
256256
- apiGroups: [""]
257257
resources: ["nodes"]
258258
verbs: ["list", "get"]
259+
- apiGroups: [""]
260+
resources: ["persistentvolumeclaims"]
261+
verbs: ["get", "create", "list", "watch"]
259262
---
260263
apiVersion: rbac.authorization.k8s.io/v1
261264
kind: ClusterRoleBinding
@@ -290,6 +293,20 @@ spec:
290293
containers:
291294
- name: studio-backend
292295
image: ${REGISTRY}/studio-backend:${TAG}
296+
imagePullPolicy: Always
297+
env:
298+
- name: APP_FRONTEND_IMAGE
299+
value: ${REGISTRY}/app-frontend:${TAG}
300+
- name: APP_BACKEND_IMAGE
301+
value: ${REGISTRY}/app-backend:${TAG}
302+
- name: REGISTRY
303+
value: opea
304+
- name: TAG
305+
value: latest
306+
- name: SBX_HTTP_PROXY
307+
value: ${HTTP_PROXY}
308+
- name: SBX_NO_PROXY
309+
value: ${NO_PROXY}
293310
ports:
294311
- containerPort: 5000
295312
resources:
@@ -347,12 +364,7 @@ spec:
347364
containers:
348365
- name: studio-frontend
349366
securityContext: {}
350-
image: ${REGISTRY}/studio-backend:${TAG}
351-
env:
352-
- name: APP_FRONTEND_IMAGE
353-
value: ${REGISTRY}/app-frontend:${TAG}
354-
- name: APP_BACKEND_IMAGE
355-
value: ${REGISTRY}/app-backend:${TAG}
367+
image: ${REGISTRY}/studio-frontend:${TAG}
356368
ports:
357369
- name: studio-frontend
358370
containerPort: 8080

setup-scripts/setup-genai-studio/manifests/studio-manifest.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ rules:
246246
- apiGroups: [""]
247247
resources: ["nodes"]
248248
verbs: ["list", "get"]
249+
- apiGroups: [""]
250+
resources: ["persistentvolumeclaims"]
251+
verbs: ["get", "create", "list", "watch"]
249252
---
250253
apiVersion: rbac.authorization.k8s.io/v1
251254
kind: ClusterRoleBinding
@@ -280,6 +283,7 @@ spec:
280283
containers:
281284
- name: studio-backend
282285
image: ${REGISTRY}/studio-backend:${TAG}
286+
imagePullPolicy: Always
283287
env:
284288
- name: APP_FRONTEND_IMAGE
285289
value: ${REGISTRY}/app-frontend:${TAG}
@@ -289,6 +293,10 @@ spec:
289293
value: opea
290294
- name: TAG
291295
value: latest
296+
- name: SBX_HTTP_PROXY
297+
value: ${HTTP_PROXY}
298+
- name: SBX_NO_PROXY
299+
value: ${NO_PROXY}
292300
ports:
293301
- containerPort: 5000
294302
resources:

setup-scripts/setup-genai-studio/playbooks/deploy-studio.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
vars_files:
44
- ../vars.yml
55
tasks:
6-
- name: Create directory for OPEA models
7-
file:
8-
path: /mnt/opea-models
9-
state: directory
10-
mode: '0777'
11-
become: yes
12-
6+
137
- name: Create studio namespace
148
command: kubectl create namespace studio
159
ignore_errors: yes
@@ -25,7 +19,9 @@
2519
when: coredns_check.stdout != ''
2620

2721
- name: Apply customized studio manifest
28-
shell: "envsubst '${REGISTRY} ${TAG}' < ../manifests/studio-manifest.yaml | kubectl apply -f -"
22+
shell: "envsubst '${REGISTRY} ${TAG} ${HTTP_PROXY} ${NO_PROXY}' < ../manifests/studio-manifest.yaml | kubectl apply -f -"
2923
environment:
3024
REGISTRY: "{{ container_registry }}"
31-
TAG: "{{ container_tag }}"
25+
TAG: "{{ container_tag }}"
26+
HTTP_PROXY: "{{ http_proxy }}"
27+
NO_PROXY: "{{ no_proxy }}"
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
container_registry: 'opea'
2-
container_tag: 'latest'
2+
container_tag: 'latest'
3+
http_proxy: ''
4+
no_proxy: ''

setup-scripts/setup-onpremise-kubernetes/playbooks/install-requirements.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,6 @@
77
- ../vars.yml
88

99
tasks:
10-
11-
- name: Configure APT proxy settings
12-
block:
13-
- file:
14-
path: /etc/apt/apt.conf.d/
15-
state: directory
16-
- copy:
17-
dest: /etc/apt/apt.conf.d/proxy.conf
18-
content: |
19-
Acquire::http::Proxy "{{ http_proxy }}";
20-
Acquire::https::Proxy "{{ http_proxy }}";
2110

2211
- name: Download Docker's official GPG key
2312
get_url:
@@ -26,6 +15,7 @@
2615
environment:
2716
http_proxy: "{{ http_proxy }}"
2817
https_proxy: "{{ http_proxy }}"
18+
no_proxy: "{{ no_proxy }}"
2919

3020
- name: Add Docker's official GPG key
3121
command: gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg /tmp/docker.gpg
@@ -34,6 +24,7 @@
3424
environment:
3525
http_proxy: "{{ http_proxy }}"
3626
https_proxy: "{{ http_proxy }}"
27+
no_proxy: "{{ no_proxy }}"
3728

3829
- name: Set up the Docker stable repository
3930
lineinfile:
@@ -48,6 +39,7 @@
4839
environment:
4940
http_proxy: "{{ http_proxy }}"
5041
https_proxy: "{{ http_proxy }}"
42+
no_proxy: "{{ no_proxy }}"
5143

5244
- name: Add Kubernetes GPG apt Key
5345
shell: gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/kubernetes.gpg --import /tmp/kubernetes.gpg
@@ -56,6 +48,7 @@
5648
environment:
5749
http_proxy: "{{ http_proxy }}"
5850
https_proxy: "{{ http_proxy }}"
51+
no_proxy: "{{ no_proxy }}"
5952

6053
- name: Set permissions for kubernetes.gpg
6154
ansible.builtin.file:
@@ -69,6 +62,7 @@
6962
environment:
7063
http_proxy: "{{ http_proxy }}"
7164
https_proxy: "{{ http_proxy }}"
65+
no_proxy: "{{ no_proxy }}"
7266

7367
- name: Update apt package list
7468
command: apt-get update
@@ -77,6 +71,7 @@
7771
environment:
7872
http_proxy: "{{ http_proxy }}"
7973
https_proxy: "{{ http_proxy }}"
74+
no_proxy: "{{ no_proxy }}"
8075
register: apt_update
8176
failed_when: "'W:' in apt_update.stdout or 'W:' in apt_update.stderr"
8277

@@ -92,6 +87,7 @@
9287
environment:
9388
http_proxy: "{{ http_proxy }}"
9489
https_proxy: "{{ http_proxy }}"
90+
no_proxy: "{{ no_proxy }}"
9591

9692
- name: Install Docker and related packages
9793
apt:
@@ -105,6 +101,7 @@
105101
environment:
106102
http_proxy: "{{ http_proxy }}"
107103
https_proxy: "{{ http_proxy }}"
104+
no_proxy: "{{ no_proxy }}"
108105

109106
- name: Restart Docker service
110107
systemd:
@@ -279,6 +276,4 @@
279276
path: /etc/default/kubelet
280277
line: 'KUBELET_EXTRA_ARGS="--cgroup-driver=cgroupfs"'
281278
- command: systemctl daemon-reload
282-
- command: systemctl restart kubelet
283-
284-
279+
- command: systemctl restart kubelet

setup-scripts/setup-onpremise-kubernetes/playbooks/setup-k8-cluster.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
environment:
4242
http_proxy: "{{ http_proxy }}"
4343
https_proxy: "{{ http_proxy }}"
44+
no_proxy: "{{ no_proxy }}"
4445

4546
- name: Extract CNI plugins
4647
unarchive:
@@ -149,6 +150,7 @@
149150
environment:
150151
http_proxy: "{{ http_proxy }}"
151152
https_proxy: "{{ http_proxy }}"
153+
no_proxy: "{{ no_proxy }}"
152154

153155
- name: Extract token and cert hash
154156
set_fact:
@@ -177,11 +179,13 @@
177179

178180
- name: Get current kube-proxy config
179181
shell: kubectl get configmap kube-proxy -n kube-system -o yaml > kube-proxy-config.yaml
182+
become_user: "{{ ansible_user }}"
180183
register: kube_proxy_config
181184
environment:
182185
KUBECONFIG: "/home/{{ ansible_user }}/.kube/config"
183186
http_proxy: "{{ http_proxy }}"
184187
https_proxy: "{{ http_proxy }}"
188+
no_proxy: "{{ no_proxy }}"
185189

186190
- name: Update strictARP field
187191
replace:
@@ -197,6 +201,7 @@
197201
KUBECONFIG: "/home/{{ ansible_user }}/.kube/config"
198202
http_proxy: "{{ http_proxy }}"
199203
https_proxy: "{{ http_proxy }}"
204+
no_proxy: "{{ no_proxy }}"
200205

201206
- name: Get cluster info
202207
become: yes
@@ -207,18 +212,20 @@
207212
KUBECONFIG: "/home/{{ ansible_user }}/.kube/config"
208213
http_proxy: "{{ http_proxy }}"
209214
https_proxy: "{{ http_proxy }}"
215+
no_proxy: "{{ no_proxy }}"
210216

211217
- name: Display the cluster-info
212218
debug:
213219
var: cluster_info.stdout_lines
214220

215-
- name: Use kubectl to install Flannel
221+
- name: Download Flannel manifest
216222
get_url:
217223
url: https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
218224
dest: /tmp/kube-flannel.yml
219225
environment:
220226
http_proxy: "{{ http_proxy }}"
221227
https_proxy: "{{ http_proxy }}"
228+
no_proxy: "{{ no_proxy }}"
222229

223230
- name: Replace pod network cidr in Flannel manifest
224231
replace:
@@ -234,6 +241,7 @@
234241
KUBECONFIG: "/home/{{ ansible_user }}/.kube/config"
235242
http_proxy: "{{ http_proxy }}"
236243
https_proxy: "{{ http_proxy }}"
244+
no_proxy: "{{ no_proxy }}"
237245

238246
- name: Taint master node for scheduling apps
239247
become: yes
@@ -243,6 +251,7 @@
243251
KUBECONFIG: "/home/{{ ansible_user }}/.kube/config"
244252
http_proxy: "{{ http_proxy }}"
245253
https_proxy: "{{ http_proxy }}"
254+
no_proxy: "{{ no_proxy }}"
246255

247256
- hosts: k8_worker
248257
gather_facts: yes
@@ -316,6 +325,7 @@
316325
environment:
317326
http_proxy: "{{ http_proxy }}"
318327
https_proxy: "{{ http_proxy }}"
328+
no_proxy: "{{ no_proxy }}"
319329

320330

321331
- hosts: k8_master
@@ -332,6 +342,7 @@
332342
KUBECONFIG: "/home/{{ ansible_user }}/.kube/config"
333343
http_proxy: "{{ http_proxy }}"
334344
https_proxy: "{{ http_proxy }}"
345+
no_proxy: "{{ no_proxy }}"
335346

336347
- name: Display the cluster-info
337348
debug:
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ## cluster configuration
2-
# ## if proxy not needed, replace parameter values to empty strings
3-
ansible_user: 'some_user'
4-
ansible_become_password: 'some_password'
5-
http_proxy: ''
6-
no_proxy: ''
2+
# ## if proxy needed, ensure no_proxy contains {{ groups['k8_master'][0] }}
3+
ansible_user: "some_user"
4+
ansible_become_password: "some_password"
5+
http_proxy: ""
6+
no_proxy: "localhost,127.0.0.1,{{ groups['k8_master'][0] }}"

studio-backend/app/services/namespace_service.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def deploy_manifest_in_namespace(core_v1_api, apps_v1_api, proj_info):
5656
apps_v1_api.create_namespaced_deployment(namespace=namespace_name, body=manifest)
5757
elif kind == "Secret":
5858
core_v1_api.create_namespaced_secret(namespace=namespace_name, body=manifest)
59+
elif kind == "PersistentVolumeClaim":
60+
core_v1_api.create_namespaced_persistent_volume_claim(namespace=namespace_name, body=manifest)
5961
else:
6062
deployment_status.append({
6163
"kind": kind,

studio-backend/app/templates/app/app.manifest.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,16 @@ spec:
214214
- configMap:
215215
defaultMode: 420
216216
name: app-nginx-config
217-
name: nginx-config-volume
217+
name: nginx-config-volume
218+
---
219+
apiVersion: v1
220+
kind: PersistentVolumeClaim
221+
metadata:
222+
name: model-pvc
223+
spec:
224+
accessModes:
225+
- ReadWriteOnce
226+
resources:
227+
requests:
228+
storage: 50Gi
229+
storageClassName: local-path

studio-backend/app/templates/microsvc-manifests/llm-uservice.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ data:
1111
TGI_LLM_ENDPOINT: "http://{tgi_endpoint}"
1212
HUGGINGFACEHUB_API_TOKEN: "{tgi_huggingFaceToken}"
1313
HF_HOME: "/tmp/.cache/huggingface"
14-
http_proxy: ""
15-
https_proxy: ""
16-
no_proxy: ""
14+
http_proxy: "${HTTP_PROXY}"
15+
https_proxy: "${HTTP_PROXY}"
16+
no_proxy: "${NO_PROXY}"
1717
LOGFLAG: ""
1818
---
1919
# Source: llm-uservice/templates/service.yaml

0 commit comments

Comments
 (0)