Skip to content

deploy: add deployment yaml #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions deploy/base/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: connect-python
spec:
progressDeadlineSeconds: 600
selector:
matchLabels:
app: connect-python
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: connect-python
spec:
containers:
- name: connect-python
command:
- "uv"
- "run"
- "hypercorn"
- "main:app"
- "--bind"
- "0.0.0.0"
imagePullPolicy: Always
ports:
- containerPort: 8000
name: http2
protocol: TCP
resources:
limits:
cpu: "1"
memory: 512Mi
requests:
cpu: 800m
memory: 400Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
serviceAccountName: connect-python
terminationGracePeriodSeconds: 30
18 changes: 18 additions & 0 deletions deploy/base/horizontal_pod_autoscaler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: connect-python
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: connect-python
minReplicas: 1
maxReplicas: 2
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 60
11 changes: 11 additions & 0 deletions deploy/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: connect-python

resources:
- deployment.yaml
- horizontal_pod_autoscaler.yaml
- namespace.yaml
- service_account.yaml
- service.yaml
4 changes: 4 additions & 0 deletions deploy/base/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: connect-python
12 changes: 12 additions & 0 deletions deploy/base/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: connect-python
spec:
ports:
- name: http2
port: 8000
protocol: TCP
selector:
app: connect-python
type: ClusterIP
4 changes: 4 additions & 0 deletions deploy/base/service_account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: connect-python
10 changes: 10 additions & 0 deletions deploy/dev/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: connect-python
spec:
template:
spec:
containers:
- name: connect-python
image: asia-northeast1-docker.pkg.dev/gaudiy-containers/connect/connect-python
18 changes: 18 additions & 0 deletions deploy/dev/horizontal_pod_autoscaler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: connect-python
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: connect-python
minReplicas: 1
maxReplicas: 2
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 60
12 changes: 12 additions & 0 deletions deploy/dev/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: connect-python
resources:
- ../base
patches:
- path: deployment.yaml
- path: horizontal_pod_autoscaler.yaml
- path: service_account.yaml
images:
- name: asia-northeast1-docker.pkg.dev/gaudiy-containers/connect/connect-python
newTag: latest
4 changes: 4 additions & 0 deletions deploy/dev/service_account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: connect-python