ce7cb702218693d08ea6d83464d2457c9250027c
This commit is contained in:
commit
34c5f8963c
4 changed files with 145336 additions and 0 deletions
77
services/vertex-batch/k8s/deployment.yaml
Normal file
77
services/vertex-batch/k8s/deployment.yaml
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: vertex-batch
|
||||
namespace: agentgateway-system
|
||||
spec:
|
||||
replicas: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: vertex-batch
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: vertex-batch
|
||||
app.kubernetes.io/instance: vertex-batch
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 75
|
||||
automountServiceAccountToken: false
|
||||
imagePullSecrets:
|
||||
- name: quay-cluster-pull
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 65532
|
||||
runAsGroup: 65532
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
containers:
|
||||
- name: batch
|
||||
image: registry.quorate.internal/quorate/vertex-batch@sha256:a1416b98cc57ae27dde41df27ad696c933d6bad6906f241bc698fc48cf4c7a35
|
||||
args:
|
||||
- -gateway-url=http://agentgateway-proxy.agentgateway-system.svc.cluster.local/v1/chat/completions
|
||||
- -project=ms2k-personal
|
||||
- -bucket=ms2k-personal-vertex-batch
|
||||
- -credentials=/credentials/credentials.json
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: http
|
||||
lifecycle:
|
||||
preStop:
|
||||
sleep:
|
||||
seconds: 5
|
||||
resources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 32Mi
|
||||
limits:
|
||||
memory: 128Mi
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities:
|
||||
drop: [ALL]
|
||||
volumeMounts:
|
||||
- name: credentials
|
||||
mountPath: /credentials
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: credentials
|
||||
secret:
|
||||
secretName: agentgateway-vertex-ai
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: vertex-batch
|
||||
namespace: agentgateway-system
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/name: vertex-batch
|
||||
ports:
|
||||
- name: http
|
||||
port: 8080
|
||||
targetPort: http
|
||||
6
services/vertex-batch/k8s/kustomization.yaml
Normal file
6
services/vertex-batch/k8s/kustomization.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- deployment.yaml
|
||||
- routes.yaml
|
||||
- network-policy.yaml
|
||||
91
services/vertex-batch/k8s/network-policy.yaml
Normal file
91
services/vertex-batch/k8s/network-policy.yaml
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
apiVersion: cilium.io/v2
|
||||
kind: CiliumNetworkPolicy
|
||||
metadata:
|
||||
name: vertex-batch
|
||||
namespace: agentgateway-system
|
||||
spec:
|
||||
endpointSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: vertex-batch
|
||||
ingress:
|
||||
- fromEntities: [host]
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "8080"
|
||||
protocol: TCP
|
||||
- fromEndpoints:
|
||||
- matchLabels:
|
||||
gateway.networking.k8s.io/gateway-name: agentgateway-proxy
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "8080"
|
||||
protocol: TCP
|
||||
egress:
|
||||
- toEndpoints:
|
||||
- matchLabels:
|
||||
gateway.networking.k8s.io/gateway-name: agentgateway-proxy
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "80"
|
||||
protocol: TCP
|
||||
- toEndpoints:
|
||||
- matchLabels:
|
||||
k8s:io.kubernetes.pod.namespace: kube-system
|
||||
k8s-app: kube-dns
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "53"
|
||||
protocol: UDP
|
||||
- port: "53"
|
||||
protocol: TCP
|
||||
- toEntities: [world]
|
||||
toPorts:
|
||||
- serverNames:
|
||||
- oauth2.googleapis.com
|
||||
- aiplatform.googleapis.com
|
||||
- storage.googleapis.com
|
||||
ports:
|
||||
- port: "443"
|
||||
protocol: TCP
|
||||
---
|
||||
apiVersion: cilium.io/v2
|
||||
kind: CiliumNetworkPolicy
|
||||
metadata:
|
||||
name: batch-gateway
|
||||
namespace: agentgateway-system
|
||||
spec:
|
||||
endpointSelector:
|
||||
matchLabels:
|
||||
gateway.networking.k8s.io/gateway-name: agentgateway-proxy
|
||||
ingress:
|
||||
- fromEndpoints:
|
||||
- matchLabels:
|
||||
app.kubernetes.io/name: vertex-batch
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "80"
|
||||
protocol: TCP
|
||||
egress:
|
||||
- toEndpoints:
|
||||
- matchLabels:
|
||||
app.kubernetes.io/name: vertex-batch
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "8080"
|
||||
protocol: TCP
|
||||
---
|
||||
apiVersion: cilium.io/v2
|
||||
kind: CiliumClusterwideNetworkPolicy
|
||||
metadata:
|
||||
name: host-vertex-batch
|
||||
spec:
|
||||
nodeSelector: {}
|
||||
egress:
|
||||
- toEndpoints:
|
||||
- matchLabels:
|
||||
k8s:io.kubernetes.pod.namespace: agentgateway-system
|
||||
app.kubernetes.io/name: vertex-batch
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "8080"
|
||||
protocol: TCP
|
||||
88
services/vertex-batch/k8s/routes.yaml
Normal file
88
services/vertex-batch/k8s/routes.yaml
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayBackend
|
||||
metadata:
|
||||
name: vertex-batch
|
||||
namespace: agentgateway-system
|
||||
spec:
|
||||
ai:
|
||||
provider:
|
||||
vertexai:
|
||||
projectId: ms2k-personal
|
||||
region: global
|
||||
host: vertex-batch.agentgateway-system.svc.cluster.local
|
||||
port: 8080
|
||||
---
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: batch-front
|
||||
namespace: agentgateway-system
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: agentgateway-proxy
|
||||
rules:
|
||||
- matches:
|
||||
- method: POST
|
||||
path:
|
||||
type: Exact
|
||||
value: /v1/chat/completions
|
||||
headers:
|
||||
- name: x-model
|
||||
type: RegularExpression
|
||||
value: ^vertex_ai_batch/.+
|
||||
filters:
|
||||
- type: URLRewrite
|
||||
urlRewrite:
|
||||
path:
|
||||
type: ReplaceFullPath
|
||||
replaceFullPath: /front
|
||||
backendRefs:
|
||||
- name: vertex-batch
|
||||
port: 8080
|
||||
---
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: batch-native
|
||||
namespace: agentgateway-system
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: agentgateway-proxy
|
||||
rules:
|
||||
- matches:
|
||||
- method: POST
|
||||
path:
|
||||
type: Exact
|
||||
value: /v1/chat/completions
|
||||
headers:
|
||||
- name: x-model
|
||||
type: RegularExpression
|
||||
value: ^vertex_batch/.+
|
||||
backendRefs:
|
||||
- group: agentgateway.dev
|
||||
kind: AgentgatewayBackend
|
||||
name: vertex-batch
|
||||
---
|
||||
apiVersion: agentgateway.dev/v1alpha1
|
||||
kind: AgentgatewayPolicy
|
||||
metadata:
|
||||
name: batch-native
|
||||
namespace: agentgateway-system
|
||||
spec:
|
||||
targetRefs:
|
||||
- group: gateway.networking.k8s.io
|
||||
kind: HTTPRoute
|
||||
name: batch-native
|
||||
traffic:
|
||||
transformation:
|
||||
request:
|
||||
set:
|
||||
- name: x-batch-stream
|
||||
value: 'string(has(json(request.body).stream) ? json(request.body).stream : false)'
|
||||
- name: x-batch-model
|
||||
value: 'json(request.body).model.stripPrefix("vertex_batch/")'
|
||||
backend:
|
||||
ai:
|
||||
transformations:
|
||||
- field: model
|
||||
expression: llmRequest.model.stripPrefix("vertex_batch/")
|
||||
Loading…
Reference in a new issue