Spaces:
Running
Running
feat(infra): prod conf
Browse files- .github/workflows/deploy-prod.yml +76 -0
- app/api/healthcheck/route.ts +5 -0
- chart/Chart.yaml +5 -0
- chart/env/prod.yaml +53 -0
- chart/templates/_helpers.tpl +22 -0
- chart/templates/config.yaml +10 -0
- chart/templates/deployment.yaml +81 -0
- chart/templates/hpa.yaml +45 -0
- chart/templates/infisical.yaml +24 -0
- chart/templates/ingress-internal.yaml +32 -0
- chart/templates/ingress.yaml +32 -0
- chart/templates/network-policy.yaml +36 -0
- chart/templates/service-account.yaml +13 -0
- chart/templates/service-monitor.yaml +17 -0
- chart/templates/service.yaml +21 -0
- chart/values.yaml +81 -0
.github/workflows/deploy-prod.yml
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Deploy to k8s
|
| 2 |
+
on:
|
| 3 |
+
# run this workflow manually from the Actions tab
|
| 4 |
+
workflow_dispatch:
|
| 5 |
+
|
| 6 |
+
jobs:
|
| 7 |
+
build-and-publish:
|
| 8 |
+
runs-on:
|
| 9 |
+
group: cpu-high
|
| 10 |
+
steps:
|
| 11 |
+
- name: Checkout
|
| 12 |
+
uses: actions/checkout@v4
|
| 13 |
+
|
| 14 |
+
- name: Login to Registry
|
| 15 |
+
uses: docker/login-action@v3
|
| 16 |
+
with:
|
| 17 |
+
username: ${{ secrets.DOCKER_INTERNAL_USERNAME }}
|
| 18 |
+
password: ${{ secrets.DOCKER_INTERNAL_PASSWORD }}
|
| 19 |
+
|
| 20 |
+
- name: Docker metadata
|
| 21 |
+
id: meta
|
| 22 |
+
uses: docker/metadata-action@v5
|
| 23 |
+
with:
|
| 24 |
+
images: |
|
| 25 |
+
registry.internal.huggingface.tech/deepsite/deepsite
|
| 26 |
+
tags: |
|
| 27 |
+
type=raw,value=latest,enable={{is_default_branch}}
|
| 28 |
+
type=sha,enable=true,prefix=sha-,format=short,sha-len=8
|
| 29 |
+
|
| 30 |
+
- name: Set up Docker Buildx
|
| 31 |
+
uses: docker/setup-buildx-action@v3
|
| 32 |
+
|
| 33 |
+
- name: Inject slug/short variables
|
| 34 |
+
uses: rlespinasse/github-slug-action@v4.5.0
|
| 35 |
+
|
| 36 |
+
- name: Build and Publish image
|
| 37 |
+
uses: docker/build-push-action@v5
|
| 38 |
+
with:
|
| 39 |
+
context: .
|
| 40 |
+
file: Dockerfile
|
| 41 |
+
push: ${{ github.event_name != 'pull_request' }}
|
| 42 |
+
tags: ${{ steps.meta.outputs.tags }}
|
| 43 |
+
labels: ${{ steps.meta.outputs.labels }}
|
| 44 |
+
platforms: linux/amd64
|
| 45 |
+
cache-to: type=gha,mode=max,scope=amd64
|
| 46 |
+
cache-from: type=gha,scope=amd64
|
| 47 |
+
provenance: false
|
| 48 |
+
|
| 49 |
+
deploy:
|
| 50 |
+
name: Deploy on prod
|
| 51 |
+
runs-on: ubuntu-latest
|
| 52 |
+
needs: ["build-and-publish"]
|
| 53 |
+
steps:
|
| 54 |
+
- name: Inject slug/short variables
|
| 55 |
+
uses: rlespinasse/github-slug-action@v4.5.0
|
| 56 |
+
|
| 57 |
+
- name: Gen values
|
| 58 |
+
run: |
|
| 59 |
+
VALUES=$(cat <<-END
|
| 60 |
+
image:
|
| 61 |
+
tag: "sha-${{ env.GITHUB_SHA_SHORT }}"
|
| 62 |
+
END
|
| 63 |
+
)
|
| 64 |
+
echo "VALUES=$(echo "$VALUES" | yq -o=json | jq tostring)" >> $GITHUB_ENV
|
| 65 |
+
|
| 66 |
+
- name: Deploy on infra-deployments
|
| 67 |
+
uses: aurelien-baudet/workflow-dispatch@v2
|
| 68 |
+
with:
|
| 69 |
+
workflow: Update application single value
|
| 70 |
+
repo: huggingface/infra-deployments
|
| 71 |
+
wait-for-completion: true
|
| 72 |
+
wait-for-completion-interval: 10s
|
| 73 |
+
display-workflow-run-url-interval: 10s
|
| 74 |
+
ref: refs/heads/main
|
| 75 |
+
token: ${{ secrets.GIT_TOKEN_INFRA_DEPLOYMENT }}
|
| 76 |
+
inputs: '{"path": "hub/deepsite/deepsite.yaml", "value": ${{ env.VALUES }}, "url": "${{ github.event.head_commit.url }}"}'
|
app/api/healthcheck/route.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { NextResponse } from "next/server";
|
| 2 |
+
|
| 3 |
+
export async function GET() {
|
| 4 |
+
return NextResponse.json({ status: "ok" }, { status: 200 });
|
| 5 |
+
}
|
chart/Chart.yaml
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
apiVersion: v2
|
| 2 |
+
name: deepsite
|
| 3 |
+
version: 0.0.0-latest
|
| 4 |
+
type: application
|
| 5 |
+
icon: https://huggingface.co/front/assets/huggingface_logo-noborder.svg
|
chart/env/prod.yaml
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
nodeSelector:
|
| 2 |
+
role-deepsite: "true"
|
| 3 |
+
|
| 4 |
+
tolerations:
|
| 5 |
+
- key: "huggingface.co/deepsite"
|
| 6 |
+
operator: "Equal"
|
| 7 |
+
value: "true"
|
| 8 |
+
effect: "NoSchedule"
|
| 9 |
+
|
| 10 |
+
serviceAccount:
|
| 11 |
+
enabled: true
|
| 12 |
+
create: true
|
| 13 |
+
name: deepsite-prod
|
| 14 |
+
|
| 15 |
+
ingress:
|
| 16 |
+
path: "/"
|
| 17 |
+
annotations:
|
| 18 |
+
alb.ingress.kubernetes.io/healthcheck-path: "/healthcheck"
|
| 19 |
+
alb.ingress.kubernetes.io/listen-ports: "[{\"HTTP\": 80}, {\"HTTPS\": 443}]"
|
| 20 |
+
alb.ingress.kubernetes.io/load-balancer-name: "hub-utils-prod-cloudfront"
|
| 21 |
+
alb.ingress.kubernetes.io/group.name: "hub-utils-prod-cloudfront"
|
| 22 |
+
alb.ingress.kubernetes.io/scheme: "internal"
|
| 23 |
+
alb.ingress.kubernetes.io/ssl-redirect: "443"
|
| 24 |
+
alb.ingress.kubernetes.io/tags: "Env=prod,Project=hub,Terraform=true"
|
| 25 |
+
alb.ingress.kubernetes.io/target-group-attributes: deregistration_delay.timeout_seconds=30
|
| 26 |
+
alb.ingress.kubernetes.io/target-type: "ip"
|
| 27 |
+
alb.ingress.kubernetes.io/certificate-arn: "arn:aws:acm:us-east-1:707930574880:certificate/5b25b145-75db-4837-b9f3-7f238ba8a9c7,arn:aws:acm:us-east-1:707930574880:certificate/bfdf509c-f44b-400f-b9e1-6f7a861abe91"
|
| 28 |
+
kubernetes.io/ingress.class: "alb"
|
| 29 |
+
|
| 30 |
+
ingressInternal:
|
| 31 |
+
enabled: false
|
| 32 |
+
|
| 33 |
+
envVars:
|
| 34 |
+
NEXTAUTH_URL=https://deepsite.hf.co/api/auth
|
| 35 |
+
|
| 36 |
+
infisical:
|
| 37 |
+
enabled: true
|
| 38 |
+
env: "prod-us-east-1"
|
| 39 |
+
|
| 40 |
+
autoscaling:
|
| 41 |
+
enabled: true
|
| 42 |
+
minReplicas: 1
|
| 43 |
+
maxReplicas: 10
|
| 44 |
+
targetMemoryUtilizationPercentage: "50"
|
| 45 |
+
targetCPUUtilizationPercentage: "50"
|
| 46 |
+
|
| 47 |
+
resources:
|
| 48 |
+
requests:
|
| 49 |
+
cpu: 2
|
| 50 |
+
memory: 4Gi
|
| 51 |
+
limits:
|
| 52 |
+
cpu: 4
|
| 53 |
+
memory: 8Gi
|
chart/templates/_helpers.tpl
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{- define "name" -}}
|
| 2 |
+
{{- default $.Release.Name | trunc 63 | trimSuffix "-" -}}
|
| 3 |
+
{{- end -}}
|
| 4 |
+
|
| 5 |
+
{{- define "app.name" -}}
|
| 6 |
+
chat-ui
|
| 7 |
+
{{- end -}}
|
| 8 |
+
|
| 9 |
+
{{- define "labels.standard" -}}
|
| 10 |
+
release: {{ $.Release.Name | quote }}
|
| 11 |
+
heritage: {{ $.Release.Service | quote }}
|
| 12 |
+
chart: "{{ include "name" . }}"
|
| 13 |
+
app: "{{ include "app.name" . }}"
|
| 14 |
+
{{- end -}}
|
| 15 |
+
|
| 16 |
+
{{- define "labels.resolver" -}}
|
| 17 |
+
release: {{ $.Release.Name | quote }}
|
| 18 |
+
heritage: {{ $.Release.Service | quote }}
|
| 19 |
+
chart: "{{ include "name" . }}"
|
| 20 |
+
app: "{{ include "app.name" . }}-resolver"
|
| 21 |
+
{{- end -}}
|
| 22 |
+
|
chart/templates/config.yaml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
apiVersion: v1
|
| 2 |
+
kind: ConfigMap
|
| 3 |
+
metadata:
|
| 4 |
+
labels: {{ include "labels.standard" . | nindent 4 }}
|
| 5 |
+
name: {{ include "name" . }}
|
| 6 |
+
namespace: {{ .Release.Namespace }}
|
| 7 |
+
data:
|
| 8 |
+
{{- range $key, $value := $.Values.envVars }}
|
| 9 |
+
{{ $key }}: {{ $value | quote }}
|
| 10 |
+
{{- end }}
|
chart/templates/deployment.yaml
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
apiVersion: apps/v1
|
| 2 |
+
kind: Deployment
|
| 3 |
+
metadata:
|
| 4 |
+
labels: {{ include "labels.standard" . | nindent 4 }}
|
| 5 |
+
name: {{ include "name" . }}
|
| 6 |
+
namespace: {{ .Release.Namespace }}
|
| 7 |
+
{{- if .Values.infisical.enabled }}
|
| 8 |
+
annotations:
|
| 9 |
+
secrets.infisical.com/auto-reload: "true"
|
| 10 |
+
{{- end }}
|
| 11 |
+
spec:
|
| 12 |
+
progressDeadlineSeconds: 600
|
| 13 |
+
{{- if not $.Values.autoscaling.enabled }}
|
| 14 |
+
replicas: {{ .Values.replicas }}
|
| 15 |
+
{{- end }}
|
| 16 |
+
revisionHistoryLimit: 10
|
| 17 |
+
selector:
|
| 18 |
+
matchLabels: {{ include "labels.standard" . | nindent 6 }}
|
| 19 |
+
strategy:
|
| 20 |
+
rollingUpdate:
|
| 21 |
+
maxSurge: 25%
|
| 22 |
+
maxUnavailable: 25%
|
| 23 |
+
type: RollingUpdate
|
| 24 |
+
template:
|
| 25 |
+
metadata:
|
| 26 |
+
labels: {{ include "labels.standard" . | nindent 8 }}
|
| 27 |
+
annotations:
|
| 28 |
+
checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }}
|
| 29 |
+
{{- if $.Values.envVars.NODE_LOG_STRUCTURED_DATA }}
|
| 30 |
+
co.elastic.logs/json.expand_keys: "true"
|
| 31 |
+
{{- end }}
|
| 32 |
+
spec:
|
| 33 |
+
{{- if .Values.serviceAccount.enabled }}
|
| 34 |
+
serviceAccountName: "{{ .Values.serviceAccount.name | default (include "name" .) }}"
|
| 35 |
+
{{- end }}
|
| 36 |
+
containers:
|
| 37 |
+
- name: chat-ui
|
| 38 |
+
image: "{{ .Values.image.repository }}/{{ .Values.image.name }}:{{ .Values.image.tag }}"
|
| 39 |
+
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
| 40 |
+
readinessProbe:
|
| 41 |
+
failureThreshold: 30
|
| 42 |
+
periodSeconds: 10
|
| 43 |
+
httpGet:
|
| 44 |
+
path: {{ $.Values.envVars.APP_BASE | default "" }}/healthcheck
|
| 45 |
+
port: {{ $.Values.envVars.APP_PORT | default 3001 | int }}
|
| 46 |
+
livenessProbe:
|
| 47 |
+
failureThreshold: 30
|
| 48 |
+
periodSeconds: 10
|
| 49 |
+
httpGet:
|
| 50 |
+
path: {{ $.Values.envVars.APP_BASE | default "" }}/healthcheck
|
| 51 |
+
port: {{ $.Values.envVars.APP_PORT | default 3001 | int }}
|
| 52 |
+
ports:
|
| 53 |
+
- containerPort: {{ $.Values.envVars.APP_PORT | default 3001 | int }}
|
| 54 |
+
name: http
|
| 55 |
+
protocol: TCP
|
| 56 |
+
{{- if eq "true" $.Values.envVars.METRICS_ENABLED }}
|
| 57 |
+
- containerPort: {{ $.Values.envVars.METRICS_PORT | default 5565 | int }}
|
| 58 |
+
name: metrics
|
| 59 |
+
protocol: TCP
|
| 60 |
+
{{- end }}
|
| 61 |
+
resources: {{ toYaml .Values.resources | nindent 12 }}
|
| 62 |
+
{{- with $.Values.extraEnv }}
|
| 63 |
+
env:
|
| 64 |
+
{{- toYaml . | nindent 14 }}
|
| 65 |
+
{{- end }}
|
| 66 |
+
envFrom:
|
| 67 |
+
- configMapRef:
|
| 68 |
+
name: {{ include "name" . }}
|
| 69 |
+
{{- if $.Values.infisical.enabled }}
|
| 70 |
+
- secretRef:
|
| 71 |
+
name: {{ include "name" $ }}-secs
|
| 72 |
+
{{- end }}
|
| 73 |
+
{{- with $.Values.extraEnvFrom }}
|
| 74 |
+
{{- toYaml . | nindent 14 }}
|
| 75 |
+
{{- end }}
|
| 76 |
+
nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
|
| 77 |
+
tolerations: {{ toYaml .Values.tolerations | nindent 8 }}
|
| 78 |
+
volumes:
|
| 79 |
+
- name: config
|
| 80 |
+
configMap:
|
| 81 |
+
name: {{ include "name" . }}
|
chart/templates/hpa.yaml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{- if $.Values.autoscaling.enabled }}
|
| 2 |
+
apiVersion: autoscaling/v2
|
| 3 |
+
kind: HorizontalPodAutoscaler
|
| 4 |
+
metadata:
|
| 5 |
+
labels: {{ include "labels.standard" . | nindent 4 }}
|
| 6 |
+
name: {{ include "name" . }}
|
| 7 |
+
namespace: {{ .Release.Namespace }}
|
| 8 |
+
spec:
|
| 9 |
+
scaleTargetRef:
|
| 10 |
+
apiVersion: apps/v1
|
| 11 |
+
kind: Deployment
|
| 12 |
+
name: {{ include "name" . }}
|
| 13 |
+
minReplicas: {{ $.Values.autoscaling.minReplicas }}
|
| 14 |
+
maxReplicas: {{ $.Values.autoscaling.maxReplicas }}
|
| 15 |
+
metrics:
|
| 16 |
+
{{- if ne "" $.Values.autoscaling.targetMemoryUtilizationPercentage }}
|
| 17 |
+
- type: Resource
|
| 18 |
+
resource:
|
| 19 |
+
name: memory
|
| 20 |
+
target:
|
| 21 |
+
type: Utilization
|
| 22 |
+
averageUtilization: {{ $.Values.autoscaling.targetMemoryUtilizationPercentage | int }}
|
| 23 |
+
{{- end }}
|
| 24 |
+
{{- if ne "" $.Values.autoscaling.targetCPUUtilizationPercentage }}
|
| 25 |
+
- type: Resource
|
| 26 |
+
resource:
|
| 27 |
+
name: cpu
|
| 28 |
+
target:
|
| 29 |
+
type: Utilization
|
| 30 |
+
averageUtilization: {{ $.Values.autoscaling.targetCPUUtilizationPercentage | int }}
|
| 31 |
+
{{- end }}
|
| 32 |
+
behavior:
|
| 33 |
+
scaleDown:
|
| 34 |
+
stabilizationWindowSeconds: 600
|
| 35 |
+
policies:
|
| 36 |
+
- type: Percent
|
| 37 |
+
value: 10
|
| 38 |
+
periodSeconds: 60
|
| 39 |
+
scaleUp:
|
| 40 |
+
stabilizationWindowSeconds: 0
|
| 41 |
+
policies:
|
| 42 |
+
- type: Pods
|
| 43 |
+
value: 1
|
| 44 |
+
periodSeconds: 30
|
| 45 |
+
{{- end }}
|
chart/templates/infisical.yaml
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{- if .Values.infisical.enabled }}
|
| 2 |
+
apiVersion: secrets.infisical.com/v1alpha1
|
| 3 |
+
kind: InfisicalSecret
|
| 4 |
+
metadata:
|
| 5 |
+
name: {{ include "name" $ }}-infisical-secret
|
| 6 |
+
namespace: {{ $.Release.Namespace }}
|
| 7 |
+
spec:
|
| 8 |
+
authentication:
|
| 9 |
+
universalAuth:
|
| 10 |
+
credentialsRef:
|
| 11 |
+
secretName: {{ .Values.infisical.operatorSecretName | quote }}
|
| 12 |
+
secretNamespace: {{ .Values.infisical.operatorSecretNamespace | quote }}
|
| 13 |
+
secretsScope:
|
| 14 |
+
envSlug: {{ .Values.infisical.env | quote }}
|
| 15 |
+
projectSlug: {{ .Values.infisical.project | quote }}
|
| 16 |
+
secretsPath: /
|
| 17 |
+
hostAPI: {{ .Values.infisical.url | quote }}
|
| 18 |
+
managedSecretReference:
|
| 19 |
+
creationPolicy: Owner
|
| 20 |
+
secretName: {{ include "name" $ }}-secs
|
| 21 |
+
secretNamespace: {{ .Release.Namespace | quote }}
|
| 22 |
+
secretType: Opaque
|
| 23 |
+
resyncInterval: {{ .Values.infisical.resyncInterval }}
|
| 24 |
+
{{- end }}
|
chart/templates/ingress-internal.yaml
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{- if $.Values.ingressInternal.enabled }}
|
| 2 |
+
apiVersion: networking.k8s.io/v1
|
| 3 |
+
kind: Ingress
|
| 4 |
+
metadata:
|
| 5 |
+
annotations: {{ toYaml .Values.ingressInternal.annotations | nindent 4 }}
|
| 6 |
+
labels: {{ include "labels.standard" . | nindent 4 }}
|
| 7 |
+
name: {{ include "name" . }}-internal
|
| 8 |
+
namespace: {{ .Release.Namespace }}
|
| 9 |
+
spec:
|
| 10 |
+
{{ if $.Values.ingressInternal.className }}
|
| 11 |
+
ingressClassName: {{ .Values.ingressInternal.className }}
|
| 12 |
+
{{ end }}
|
| 13 |
+
{{- with .Values.ingressInternal.tls }}
|
| 14 |
+
tls:
|
| 15 |
+
- hosts:
|
| 16 |
+
- {{ $.Values.domain | quote }}
|
| 17 |
+
{{- with .secretName }}
|
| 18 |
+
secretName: {{ . }}
|
| 19 |
+
{{- end }}
|
| 20 |
+
{{- end }}
|
| 21 |
+
rules:
|
| 22 |
+
- host: {{ .Values.domain }}
|
| 23 |
+
http:
|
| 24 |
+
paths:
|
| 25 |
+
- backend:
|
| 26 |
+
service:
|
| 27 |
+
name: {{ include "name" . }}
|
| 28 |
+
port:
|
| 29 |
+
name: http
|
| 30 |
+
path: {{ $.Values.ingressInternal.path | default "/" }}
|
| 31 |
+
pathType: Prefix
|
| 32 |
+
{{- end }}
|
chart/templates/ingress.yaml
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{- if $.Values.ingress.enabled }}
|
| 2 |
+
apiVersion: networking.k8s.io/v1
|
| 3 |
+
kind: Ingress
|
| 4 |
+
metadata:
|
| 5 |
+
annotations: {{ toYaml .Values.ingress.annotations | nindent 4 }}
|
| 6 |
+
labels: {{ include "labels.standard" . | nindent 4 }}
|
| 7 |
+
name: {{ include "name" . }}
|
| 8 |
+
namespace: {{ .Release.Namespace }}
|
| 9 |
+
spec:
|
| 10 |
+
{{ if $.Values.ingress.className }}
|
| 11 |
+
ingressClassName: {{ .Values.ingress.className }}
|
| 12 |
+
{{ end }}
|
| 13 |
+
{{- with .Values.ingress.tls }}
|
| 14 |
+
tls:
|
| 15 |
+
- hosts:
|
| 16 |
+
- {{ $.Values.domain | quote }}
|
| 17 |
+
{{- with .secretName }}
|
| 18 |
+
secretName: {{ . }}
|
| 19 |
+
{{- end }}
|
| 20 |
+
{{- end }}
|
| 21 |
+
rules:
|
| 22 |
+
- host: {{ .Values.domain }}
|
| 23 |
+
http:
|
| 24 |
+
paths:
|
| 25 |
+
- backend:
|
| 26 |
+
service:
|
| 27 |
+
name: {{ include "name" . }}
|
| 28 |
+
port:
|
| 29 |
+
name: http
|
| 30 |
+
path: {{ $.Values.ingress.path | default "/" }}
|
| 31 |
+
pathType: Prefix
|
| 32 |
+
{{- end }}
|
chart/templates/network-policy.yaml
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{- if $.Values.networkPolicy.enabled }}
|
| 2 |
+
apiVersion: networking.k8s.io/v1
|
| 3 |
+
kind: NetworkPolicy
|
| 4 |
+
metadata:
|
| 5 |
+
name: {{ include "name" . }}
|
| 6 |
+
namespace: {{ .Release.Namespace }}
|
| 7 |
+
spec:
|
| 8 |
+
egress:
|
| 9 |
+
- ports:
|
| 10 |
+
- port: 53
|
| 11 |
+
protocol: UDP
|
| 12 |
+
to:
|
| 13 |
+
- namespaceSelector:
|
| 14 |
+
matchLabels:
|
| 15 |
+
kubernetes.io/metadata.name: kube-system
|
| 16 |
+
podSelector:
|
| 17 |
+
matchLabels:
|
| 18 |
+
k8s-app: kube-dns
|
| 19 |
+
- to:
|
| 20 |
+
{{- range $ip := .Values.networkPolicy.allowedBlocks }}
|
| 21 |
+
- ipBlock:
|
| 22 |
+
cidr: {{ $ip | quote }}
|
| 23 |
+
{{- end }}
|
| 24 |
+
- to:
|
| 25 |
+
- ipBlock:
|
| 26 |
+
cidr: 0.0.0.0/0
|
| 27 |
+
except:
|
| 28 |
+
- 10.0.0.0/8
|
| 29 |
+
- 172.16.0.0/12
|
| 30 |
+
- 192.168.0.0/16
|
| 31 |
+
- 169.254.169.254/32
|
| 32 |
+
podSelector:
|
| 33 |
+
matchLabels: {{ include "labels.standard" . | nindent 6 }}
|
| 34 |
+
policyTypes:
|
| 35 |
+
- Egress
|
| 36 |
+
{{- end }}
|
chart/templates/service-account.yaml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{- if and .Values.serviceAccount.enabled .Values.serviceAccount.create }}
|
| 2 |
+
apiVersion: v1
|
| 3 |
+
kind: ServiceAccount
|
| 4 |
+
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
|
| 5 |
+
metadata:
|
| 6 |
+
name: "{{ .Values.serviceAccount.name | default (include "name" .) }}"
|
| 7 |
+
namespace: {{ .Release.Namespace }}
|
| 8 |
+
labels: {{ include "labels.standard" . | nindent 4 }}
|
| 9 |
+
{{- with .Values.serviceAccount.annotations }}
|
| 10 |
+
annotations:
|
| 11 |
+
{{- toYaml . | nindent 4 }}
|
| 12 |
+
{{- end }}
|
| 13 |
+
{{- end }}
|
chart/templates/service-monitor.yaml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{- if eq "true" $.Values.envVars.METRICS_ENABLED }}
|
| 2 |
+
apiVersion: monitoring.coreos.com/v1
|
| 3 |
+
kind: ServiceMonitor
|
| 4 |
+
metadata:
|
| 5 |
+
labels: {{ include "labels.standard" . | nindent 4 }}
|
| 6 |
+
name: {{ include "name" . }}
|
| 7 |
+
namespace: {{ .Release.Namespace }}
|
| 8 |
+
spec:
|
| 9 |
+
selector:
|
| 10 |
+
matchLabels: {{ include "labels.standard" . | nindent 6 }}
|
| 11 |
+
endpoints:
|
| 12 |
+
- port: metrics
|
| 13 |
+
path: /metrics
|
| 14 |
+
interval: 10s
|
| 15 |
+
scheme: http
|
| 16 |
+
scrapeTimeout: 10s
|
| 17 |
+
{{- end }}
|
chart/templates/service.yaml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
apiVersion: v1
|
| 2 |
+
kind: Service
|
| 3 |
+
metadata:
|
| 4 |
+
name: "{{ include "name" . }}"
|
| 5 |
+
annotations: {{ toYaml .Values.service.annotations | nindent 4 }}
|
| 6 |
+
namespace: {{ .Release.Namespace }}
|
| 7 |
+
labels: {{ include "labels.standard" . | nindent 4 }}
|
| 8 |
+
spec:
|
| 9 |
+
ports:
|
| 10 |
+
- name: http
|
| 11 |
+
port: 80
|
| 12 |
+
protocol: TCP
|
| 13 |
+
targetPort: http
|
| 14 |
+
{{- if eq "true" $.Values.envVars.METRICS_ENABLED }}
|
| 15 |
+
- name: metrics
|
| 16 |
+
port: {{ $.Values.envVars.METRICS_PORT | default 5565 | int }}
|
| 17 |
+
protocol: TCP
|
| 18 |
+
targetPort: metrics
|
| 19 |
+
{{- end }}
|
| 20 |
+
selector: {{ include "labels.standard" . | nindent 4 }}
|
| 21 |
+
type: {{.Values.service.type}}
|
chart/values.yaml
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
image:
|
| 2 |
+
repository: registry.internal.huggingface.tech/deepsite
|
| 3 |
+
name: deepsite
|
| 4 |
+
tag: 0.0.0-latest
|
| 5 |
+
pullPolicy: IfNotPresent
|
| 6 |
+
|
| 7 |
+
replicas: 1
|
| 8 |
+
|
| 9 |
+
domain: deepsite.hf.co
|
| 10 |
+
|
| 11 |
+
networkPolicy:
|
| 12 |
+
enabled: true
|
| 13 |
+
allowedBlocks: []
|
| 14 |
+
# allowedBlocks:
|
| 15 |
+
# - 10.0.240.0/24
|
| 16 |
+
# - 10.0.241.0/24
|
| 17 |
+
# - 10.0.242.0/24
|
| 18 |
+
# - 10.0.243.0/24
|
| 19 |
+
# - 10.0.244.0/24
|
| 20 |
+
# - 10.240.0.0/24
|
| 21 |
+
# - 10.16.0.0/16
|
| 22 |
+
|
| 23 |
+
service:
|
| 24 |
+
type: NodePort
|
| 25 |
+
annotations: { }
|
| 26 |
+
|
| 27 |
+
serviceAccount:
|
| 28 |
+
enabled: false
|
| 29 |
+
create: false
|
| 30 |
+
name: ""
|
| 31 |
+
automountServiceAccountToken: true
|
| 32 |
+
annotations: { }
|
| 33 |
+
|
| 34 |
+
ingress:
|
| 35 |
+
enabled: true
|
| 36 |
+
path: "/"
|
| 37 |
+
annotations: { }
|
| 38 |
+
# className: "nginx"
|
| 39 |
+
tls: { }
|
| 40 |
+
# secretName: XXX
|
| 41 |
+
|
| 42 |
+
ingressInternal:
|
| 43 |
+
enabled: false
|
| 44 |
+
path: "/"
|
| 45 |
+
annotations: { }
|
| 46 |
+
# className: "nginx"
|
| 47 |
+
tls: { }
|
| 48 |
+
|
| 49 |
+
resources:
|
| 50 |
+
requests:
|
| 51 |
+
cpu: 2
|
| 52 |
+
memory: 4Gi
|
| 53 |
+
limits:
|
| 54 |
+
cpu: 2
|
| 55 |
+
memory: 4Gi
|
| 56 |
+
nodeSelector: {}
|
| 57 |
+
tolerations: []
|
| 58 |
+
|
| 59 |
+
envVars: { }
|
| 60 |
+
|
| 61 |
+
infisical:
|
| 62 |
+
enabled: false
|
| 63 |
+
env: ""
|
| 64 |
+
project: "deepsite-f-hvj"
|
| 65 |
+
url: ""
|
| 66 |
+
resyncInterval: 60
|
| 67 |
+
operatorSecretName: "deepsite-operator-secrets"
|
| 68 |
+
operatorSecretNamespace: "hub-utils"
|
| 69 |
+
|
| 70 |
+
# Allow to environment injections on top or instead of infisical
|
| 71 |
+
extraEnvFrom: []
|
| 72 |
+
extraEnv: []
|
| 73 |
+
|
| 74 |
+
autoscaling:
|
| 75 |
+
enabled: false
|
| 76 |
+
minReplicas: 1
|
| 77 |
+
maxReplicas: 2
|
| 78 |
+
targetMemoryUtilizationPercentage: ""
|
| 79 |
+
targetCPUUtilizationPercentage: ""
|
| 80 |
+
|
| 81 |
+
## Metrics removed; monitoring configuration no longer used
|