Skip to content

Commit

Permalink
k8 deployment setup
Browse files Browse the repository at this point in the history
  • Loading branch information
blackwhitehere committed Jan 3, 2025
1 parent 7f5b5a9 commit 206df81
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 0 deletions.
66 changes: 66 additions & 0 deletions infra/k8/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Adopted from helm template at: https://github.com/outerbounds/metaflow-tools/blob/master/k8s/helm/metaflow/charts/metaflow-service/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: acme-metaflow-service-deployment
namespace: acme-metaflow
#labels
spec:
replicas: 1
selector:
matchLabels:
app: acme-metaflow-service
template:
metadata:
#annotations:
labels:
app: acme-metaflow-service
spec:
#imagePullSecrets:
#securityContext:
#serviceAccountName
initContainers:
- name: db-migrations
image: public.ecr.aws/outerbounds/metaflow_metadata_service:2.4.13
command:
- "/opt/latest/bin/python3"
- "/root/run_goose.py"
- "--only-if-empty-db"
#env:
envFrom:
- secretRef:
name: service-db-auth
containers:
- name: acme-metaflow-service
image: public.ecr.aws/outerbounds/metaflow_metadata_service:2.4.13
imagePullPolicy: IfNotPresent
#imagePullSecrets:
#securityContext:
command: ["/opt/latest/bin/python3", "-m", "services.metadata_service.server" ]
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /ping
port: http
initialDelaySeconds: 60
periodSeconds: 60
readinessProbe:
httpGet:
path: /ping
port: http
initialDelaySeconds: 60
periodSeconds: 60
resources:
limits:
memory: "128Mi"
cpu: "200m"
# env:
envFrom:
- secretRef:
name: service-db-auth
#nodeSelector:
#affinity:
#tolerations:
21 changes: 21 additions & 0 deletions infra/k8/kustomization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: acme-metaflow

resources:
- namespace.yml
- deployment.yml
- service.yml

images:
- name: metaflow_metadata_service
newTag: "2.4.13"

secretGenerator:
- name: service-db-auth
envs:
- db.env
- name: k8-job-auth
envs:
- k8job.env
4 changes: 4 additions & 0 deletions infra/k8/namespace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: acme-metaflow
22 changes: 22 additions & 0 deletions infra/k8/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# adopted from helm at: https://github.com/outerbounds/metaflow-tools/blob/master/k8s/helm/metaflow/charts/metaflow-service/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
name: acme-metaflow-service-k8-service
namespace: acme-metaflow
#labels:
#annotations:
spec:
type: ClusterIP
ports:
- name: metadata
port: 8080
protocol: TCP
targetPort: 8080
# todo: is this section needed?
- name: upgrades
port: 8082
protocol: TCP
targetPort: 8082
selector:
app: acme-metaflow-service

0 comments on commit 206df81

Please sign in to comment.