Skip to content

Commit

Permalink
Merge pull request #10 from ggiovanejr/main
Browse files Browse the repository at this point in the history
k8s and skaffold manifests migration
  • Loading branch information
smithpatrick12 authored Jan 24, 2024
2 parents fbdf186 + 9a032d2 commit 6fb6723
Show file tree
Hide file tree
Showing 25 changed files with 1,333 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ If you’re using this project, please ★Star this repository to show your inte

| Folder | Description |
|-------------------------------|-------------------------------|
| [infra](./infra) | Infrastructure deployment scripts based on Terraform |
| [quickstarts](./quickstarts) | Individual quickstarts that can be tested and deployed based on your use case |
| [terraform](./terraform) | Infrastructure deployment scripts based on Terraform |
| [examples](./examples) | Individual quickstarts that can be tested and deployed based on your use case |
| [src](./src) | Core source code that is used as part of our quickstarts |

## Architecture
Expand All @@ -36,9 +36,9 @@ The following steps below will walk you through the setup guide for *GenAI Quick
### 1) Clone this git repository

```
git clone git@github.com:zaratsian/GenAI-quickstart-dev.git
git clone https://github.com/googleforgames/GenAI-quickstart.git
cd GenAI-quickstart-dev
cd GenAI-quickstart
```

### 2) Set ENV variable
Expand Down
79 changes: 79 additions & 0 deletions examples/friendschat/k8s.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Copyright 2023 Google LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-friendschat
namespace: genai
labels:
name: demo-friendschat
spec:
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 40%
maxUnavailable: 0
selector:
matchLabels:
name: demo-friendschat
template:
metadata:
labels:
name: demo-friendschat
version: stable
annotations:
instrumentation.opentelemetry.io/inject-python: "genai-instrumentation"
spec:
restartPolicy: Always
containers:
- image: demo-friendschat
name: demo-friendschat
imagePullPolicy: Always
ports:
- name: http
containerPort: 8080
protocol: TCP
env:
- name: ENV
value: dev
# TODO: Update prior to deployment
- name: GENAI_API_ENDPOINT
value: http://genai-api.genai.svc
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
labels:
name: demo-friendschat
name: demo-friendschat
namespace: genai
spec:
ports:
- name: http
port: 80
targetPort: 8080
protocol: TCP
selector:
name: demo-friendschat
sessionAffinity: None
type: LoadBalancer

50 changes: 50 additions & 0 deletions examples/friendschat/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 2023 Google LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Copyright 2023 Google LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: skaffold/v3
kind: Config
metadata:
name: demo-friendschat
build:
googleCloudBuild: {}
tagPolicy:
sha256: {}
artifacts:
- image: demo-friendschat
context: .
manifests:
rawYaml:
- ./k8s.yaml
deploy:
kubectl:
flags:
global:
- --namespace=genai
requires:
- configs: ["common-k8s-cfg","common-otel-cfg"]
path: ../../genai/common/skaffold.yaml
94 changes: 94 additions & 0 deletions genai/api/genai_api/k8s.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: genai-api
labels:
name: genai-api
spec:
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 40%
maxUnavailable: 0
selector:
matchLabels:
name: genai-api
template:
metadata:
labels:
name: genai-api
version: stable
annotations:
instrumentation.opentelemetry.io/inject-python: "genai-instrumentation"
spec:
restartPolicy: Always
containers:
- image: genai-api
name: genai-api
imagePullPolicy: Always
ports:
- name: http
containerPort: 8080
protocol: TCP
# readinessProbe:
# httpGet:
# path: /health
# port: http-front
# initialDelaySeconds: 5
# periodSeconds: 5
# livenessProbe:
# tcpSocket:
# port: http-front
# initialDelaySeconds: 5
# periodSeconds: 5
env:
- name: ENV
value: dev
# TODO: Update prior to deployment
- name: GENAI_GEMINI_ENDPOINT
value: http://vertex-gemini-api.genai.svc
- name: GENAI_TEXT_ENDPOINT
value: http://vertex-text-api.genai.svc
- name: GENAI_CHAT_ENDPOINT
value: http://vertex-chat-api.genai.svc
- name: GENAI_CODE_ENDPOINT
value: http://vertex-code-api.genai.svc
- name: GENAI_IMAGE_ENDPOINT
value: http://vertex-image-api.genai.svc
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
labels:
name: genai-api
name: genai-api
spec:
ports:
- name: http
port: 80
targetPort: 8080
protocol: TCP
selector:
name: genai-api
sessionAffinity: None
type: LoadBalancer
# ---
# apiVersion: autoscaling/v1
# kind: HorizontalPodAutoscaler
# metadata:
# name: genai-api
# spec:
# scaleTargetRef:
# apiVersion: apps/v1
# kind: Deployment
# name: genai-api
# minReplicas: 5
# maxReplicas: 30
# targetCPUUtilizationPercentage: 50
36 changes: 36 additions & 0 deletions genai/api/genai_api/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2024 Google LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: skaffold/v3
kind: Config
metadata:
name: genai-api-cfg
build:
googleCloudBuild: {}
tagPolicy:
sha256: {}
artifacts:
- image: genai-api
context: .
manifests:
rawYaml:
- ./k8s.yaml
deploy:
kubectl:
flags:
global:
- --namespace=genai
requires:
- configs: ["common-k8s-cfg","common-otel-cfg"]
path: ../../common/skaffold.yaml
85 changes: 85 additions & 0 deletions genai/api/stable_diffusion_api/k8s.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: stable-diffusion-api
labels:
name: stable-diffusion-api
spec:
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 40%
maxUnavailable: 0
selector:
matchLabels:
name: stable-diffusion-api
template:
metadata:
labels:
name: stable-diffusion-api
version: stable
annotations:
instrumentation.opentelemetry.io/inject-python: "genai-instrumentation"
spec:
restartPolicy: Always
containers:
- image: stable-diffusion-api
name: stable-diffusion-api
imagePullPolicy: Always
ports:
- name: http
containerPort: 8080
protocol: TCP
# readinessProbe:
# httpGet:
# path: /health
# port: http-front
# initialDelaySeconds: 5
# periodSeconds: 5
# livenessProbe:
# tcpSocket:
# port: http-front
# initialDelaySeconds: 5
# periodSeconds: 5
env:
- name: ENV
value: dev
- name: STABLE_DIFFUSION_ENDPOINT
value: http://stable-diffusion-endpt.genai.svc
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
labels:
name: stable-diffusion-api
name: stable-diffusion-api
spec:
ports:
- name: http
port: 80
targetPort: 8080
protocol: TCP
selector:
name: stable-diffusion-api
sessionAffinity: None
type: ClusterIP
# ---
# apiVersion: autoscaling/v1
# kind: HorizontalPodAutoscaler
# metadata:
# name: stable-diffusion-api
# spec:
# scaleTargetRef:
# apiVersion: apps/v1
# kind: Deployment
# name: stable-diffusion-api
# minReplicas: 5
# maxReplicas: 30
# targetCPUUtilizationPercentage: 50
Loading

0 comments on commit 6fb6723

Please sign in to comment.