-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
1,055 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v1 | ||
appVersion: "0.1" | ||
description: A Helm chart for Python Model Deployment | ||
name: python-model-deployment | ||
version: 0.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ .Values.appname }} | ||
namespace: {{ .Values.namespace }} | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
release: {{ .Release.Name }} | ||
app: {{ .Values.appname }} | ||
project: {{ .Values.project.slug }} | ||
type: app | ||
pod: {{ .Values.appname }} | ||
template: | ||
metadata: | ||
annotations: | ||
prometheus.io/scrape: "true" | ||
prometheus.io/path: /metrics | ||
prometheus.io/port: "8501" | ||
labels: | ||
release: {{ $.Release.Name }} | ||
app: {{ .Values.appname }} | ||
project: {{ $.Values.project.slug }} | ||
networking/allow-internet-egress: "true" | ||
networking/allow-egress-to-studio-web: "true" | ||
type: app | ||
pod: {{ .Values.appname }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
automountServiceAccountToken: false | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
volumes: | ||
- name: rp-conf | ||
configMap: | ||
name: {{ .Release.Name }}-rp-config | ||
{{ if .Values.apps.volumeK8s }} | ||
{{- range $key, $value := .Values.apps.volumeK8s }} | ||
- name: model-vol | ||
persistentVolumeClaim: | ||
claimName: {{ $value.release }} | ||
{{- end }} | ||
{{- end }} | ||
containers: | ||
- name: reverse-proxy | ||
image: nginx:alpine | ||
imagePullPolicy: Always | ||
volumeMounts: | ||
- name: rp-conf | ||
mountPath: /etc/nginx | ||
resources: | ||
limits: | ||
cpu: 200m | ||
memory: 256Mi | ||
requests: | ||
cpu: 100m | ||
memory: 128Mi | ||
|
||
- name: serve | ||
securityContext: | ||
{{- toYaml .Values.securityContext | nindent 10 }} | ||
resources: | ||
{{- toYaml .Values.flavor | nindent 10 }} | ||
volumeMounts: | ||
- name: model-vol | ||
mountPath: /home/user/models | ||
env: | ||
- name: GUNICORN_CMD_ARGS | ||
value: "--limit-request-field_size 0" | ||
{{- with .Values.extraEnv }} | ||
{{- tpl . $ | nindent 10 }} | ||
{{- end }} | ||
- name: PYTHONPATH | ||
value: "/home/user/models" | ||
- name: STACKN_MODEL_PATH | ||
value: "/home/user/models" | ||
image: {{ .Values.environment.repository }}/{{ .Values.environment.image }} | ||
imagePullPolicy: Always | ||
ports: | ||
- containerPort: {{ .Values.appconfig.port }} | ||
terminationGracePeriodSeconds: 30 | ||
dnsPolicy: ClusterFirst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ .Release.Name }}-ingress | ||
namespace: {{ .Values.namespace }} | ||
labels: | ||
io.kompose.service: {{ .Release.Name }}-ingress | ||
annotations: | ||
nginx.ingress.kubernetes.io/proxy-body-size: 50m | ||
{{ if ne .Values.permission "public" }} | ||
nginx.ingress.kubernetes.io/auth-url: "{{ .Values.global.protocol }}://{{ .Values.global.auth_domain }}:8080/auth/?release={{ .Values.release }}" | ||
nginx.ingress.kubernetes.io/auth-signin: "https://{{ .Values.global.domain }}/accounts/login/?next=$scheme%3A%2F%2F$host" | ||
{{- end }} | ||
spec: | ||
rules: | ||
- host: {{ .Release.Name }}.{{ .Values.global.domain }} | ||
http: | ||
paths: | ||
- path: / | ||
backend: | ||
service: | ||
name: {{ .Values.service.name }} | ||
port: | ||
number: {{ .Values.service.port }} | ||
pathType: ImplementationSpecific | ||
tls: | ||
- secretName: {{ .Values.ingress.secretName }} | ||
hosts: | ||
- {{ .Values.global.domain }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ .Release.Name }}-rp-config | ||
namespace: {{ .Values.namespace }} | ||
data: | ||
# Configuration values can be set as key-value properties | ||
nginx.conf: |- | ||
worker_processes 1; | ||
events { worker_connections 1024; } | ||
http { | ||
server { | ||
listen 1234; | ||
client_max_body_size 500M; | ||
large_client_header_buffers 4 128k; | ||
location / { | ||
proxy_pass http://127.0.0.1:{{ .Values.appconfig.port }}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ .Values.service.name }} | ||
namespace: {{ .Values.namespace }} | ||
labels: | ||
run: {{ .Values.appname }}-python-serve | ||
spec: | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: {{ .Values.appconfig.port }} | ||
protocol: TCP | ||
selector: | ||
release: {{ .Release.Name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
namespace: default | ||
appname: python-serve | ||
project: | ||
name: project | ||
slug: project-slug | ||
|
||
global: | ||
protocol: TCP | ||
|
||
apps: | ||
volumek8s: | ||
|
||
appconfig: | ||
port: 8000 | ||
|
||
service: | ||
name: pythonserve-svc | ||
|
||
imagePullSecrets: | ||
- name: regcred | ||
|
||
ingress: | ||
secretName: prod-ingress | ||
|
||
podSecurityContext: | ||
seccompProfile: | ||
type: RuntimeDefault | ||
fsGroup: 1000 | ||
|
||
securityContext: | ||
runAsNonRoot: true | ||
runAsUser: 1000 | ||
runAsGroup: 1000 | ||
allowPrivilegeEscalation: false | ||
privileged: false | ||
capabilities: | ||
drop: | ||
- all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"category": "serve", | ||
"description": "", | ||
"name": "Python Model Deployment", | ||
"priority": "200", | ||
"settings": { | ||
"default_values": { | ||
"port": "80", | ||
"targetport": "8080" | ||
}, | ||
"env_variables": { | ||
"{{ app_name }}_URL": "https://{{ release }}.{{ global.domain }}/predict/" | ||
}, | ||
"environment": { | ||
"name": "from", | ||
"quantity": "one", | ||
"title": "Environment", | ||
"type": "match" | ||
}, | ||
"flavor": "one", | ||
"logs": [ | ||
"serve" | ||
], | ||
"model": { | ||
"object_type": "python-model" | ||
}, | ||
"permissions": { | ||
"private": { | ||
"option": "true", | ||
"value": "false" | ||
}, | ||
"project": { | ||
"option": "true", | ||
"value": "true" | ||
}, | ||
"public": { | ||
"option": "true", | ||
"value": "false" | ||
} | ||
} | ||
}, | ||
"slug": "python-serve", | ||
"table_field": { | ||
"url": "https://{{ release }}.{{ global.domain }}/predict/" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 4.2.5 on 2023-11-24 13:27 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
("common", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="EmailVerificationTable", | ||
fields=[ | ||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
("token", models.CharField(max_length=100)), | ||
( | ||
"user", | ||
models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), | ||
), | ||
], | ||
), | ||
] |
Oops, something went wrong.