diff --git a/Chart.yaml b/Chart.yaml index e2adc29..a4beeb4 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -name: demo-chart +name: ailab-demo description: A Helm chart for AILab Demo # A chart can be either an 'application' or a 'library' chart. diff --git a/gan.yml b/gan.yml new file mode 100644 index 0000000..08e9e7f --- /dev/null +++ b/gan.yml @@ -0,0 +1,81 @@ +# Default values for ailab-demo. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 +targetPendingRequests: 200 + +host: ailab-demo.xf-yun.com +pathType: prefix +pathPrefix: /demo +rewritePath: true + +# This is the namespace that the ingress should be installed +# into. It should be set to the same namespace as the +# KEDA HTTP componentry is installed in. Defaults to the Helm +# chart release namespace +ingressNamespace: +keda: + httpAddOnProxy: "keda-add-ons-http-interceptor-proxy" + httpAddOnPort: 8080 + +image: + repository: artifacts.iflytek.com/docker-private/atp/aicloud/hf_fully_body_anime_gan + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "1fc7e9b8c0" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 7860 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + http: + minReplicas: 0 + maxReplicas: 2 + +nodeSelector: + kubernetes.io/hostname: shanghai-autodl-master01 + +tolerations: [] + +affinity: {} + diff --git a/templates/NOTES.txt b/templates/NOTES.txt new file mode 100644 index 0000000..b94bf1f --- /dev/null +++ b/templates/NOTES.txt @@ -0,0 +1,16 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "ailab-demo.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "ailab-demo.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "ailab-demo.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "ailab-demo.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index d1571cd..15330b6 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "demo-chart.name" -}} +{{- define "ailab-demo.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} @@ -10,7 +10,7 @@ Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). If release name contains chart name it will be used as a full name. */}} -{{- define "demo-chart.fullname" -}} +{{- define "ailab-demo.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "demo-chart.chart" -}} +{{- define "ailab-demo.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "demo-chart.labels" -}} -helm.sh/chart: {{ include "demo-chart.chart" . }} -{{ include "demo-chart.selectorLabels" . }} +{{- define "ailab-demo.labels" -}} +helm.sh/chart: {{ include "ailab-demo.chart" . }} +{{ include "ailab-demo.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "demo-chart.selectorLabels" -}} -app.kubernetes.io/name: {{ include "demo-chart.name" . }} +{{- define "ailab-demo.selectorLabels" -}} +app.kubernetes.io/name: {{ include "ailab-demo.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "demo-chart.serviceAccountName" -}} +{{- define "ailab-demo.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "demo-chart.fullname" .) .Values.serviceAccount.name }} +{{- default (include "ailab-demo.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} @@ -64,21 +64,21 @@ Create the name of the service account to use {{/* Create the full host of demo */}} -{{- define "demo-chart.host" -}} +{{- define "ailab-demo.host" -}} {{ .Release.Name }}.{{ .Values.host }} {{- end }} {{/* Create the url path of service */}} -{{- define "demo-chart.path" -}} +{{- define "ailab-demo.path" -}} {{ .Values.pathPrefix }}/{{ .Release.Name }} {{- end }} {{/* Create the GPUNodeAffinity of service */}} -{{- define "demo-chart.GPUNodeAffinity" -}} +{{- define "ailab-demo.GPUNodeAffinity" -}} {{- if .Values.gpuResource.enable -}} nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: diff --git a/templates/deployment.yaml b/templates/deployment.yaml index e535bb7..1105e7d 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -1,14 +1,14 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "demo-chart.fullname" . }} + name: {{ include "ailab-demo.fullname" . }} labels: - {{- include "demo-chart.labels" . | nindent 4 }} + {{- include "ailab-demo.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: - {{- include "demo-chart.selectorLabels" . | nindent 6 }} + {{- include "ailab-demo.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} @@ -16,13 +16,13 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "demo-chart.selectorLabels" . | nindent 8 }} + {{- include "ailab-demo.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - serviceAccountName: {{ include "demo-chart.serviceAccountName" . }} + serviceAccountName: {{ include "ailab-demo.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: @@ -41,12 +41,19 @@ spec: {{- toYaml .Values.readinessProbe | nindent 12 }} resources: {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - mountPath: /mnt/atpdata/huggingface + name: huggingface + volumes: + - name: huggingface + hostPath: + path: {{ .Values.huggingface.path }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} affinity: - {{- include "demo-chart.GPUNodeAffinity" . | nindent 8 }} + {{- include "ailab-demo.GPUNodeAffinity" . | nindent 8 }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} diff --git a/templates/httpscaledobject.yaml b/templates/httpscaledobject.yaml index bf1f0c3..384c88e 100644 --- a/templates/httpscaledobject.yaml +++ b/templates/httpscaledobject.yaml @@ -1,13 +1,13 @@ kind: HTTPScaledObject apiVersion: http.keda.sh/v1alpha1 metadata: - name: {{ include "demo-chart.fullname" . }} + name: {{ include "ailab-demo.fullname" . }} spec: - host: {{ include "demo-chart.host" . }} + host: {{ include "ailab-demo.host" . }} targetPendingRequests: {{ .Values.targetPendingRequests }} scaleTargetRef: - deployment: {{ include "demo-chart.fullname" . }} - service: {{ include "demo-chart.fullname" . }} + deployment: {{ include "ailab-demo.fullname" . }} + service: {{ include "ailab-demo.fullname" . }} port: {{ .Values.service.port }} replicas: min: {{ .Values.autoscaling.http.minReplicas }} diff --git a/templates/ingress.yaml b/templates/ingress.yaml index a43444f..5e2f82d 100644 --- a/templates/ingress.yaml +++ b/templates/ingress.yaml @@ -1,13 +1,13 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: {{ include "demo-chart.fullname" . }} + name: {{ include "ailab-demo.fullname" . }} namespace: {{ .Values.ingressNamespace | default .Release.Namespace }} annotations: kubernetes.io/ingress.class: nginx spec: rules: - - host: {{ include "demo-chart.host" . }} + - host: {{ include "ailab-demo.host" . }} http: paths: - path: / diff --git a/templates/service.yaml b/templates/service.yaml index e1e1ee2..2494283 100644 --- a/templates/service.yaml +++ b/templates/service.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "demo-chart.fullname" . }} + name: {{ include "ailab-demo.fullname" . }} labels: - {{- include "demo-chart.labels" . | nindent 4 }} + {{- include "ailab-demo.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: @@ -12,4 +12,4 @@ spec: protocol: TCP name: http selector: - {{- include "demo-chart.selectorLabels" . | nindent 4 }} + {{- include "ailab-demo.selectorLabels" . | nindent 4 }} diff --git a/templates/serviceaccount.yaml b/templates/serviceaccount.yaml index ccfabdd..735bfb6 100644 --- a/templates/serviceaccount.yaml +++ b/templates/serviceaccount.yaml @@ -2,9 +2,9 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "demo-chart.serviceAccountName" . }} + name: {{ include "ailab-demo.serviceAccountName" . }} labels: - {{- include "demo-chart.labels" . | nindent 4 }} + {{- include "ailab-demo.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/templates/tests/test-connection.yaml b/templates/tests/test-connection.yaml index b897b06..dbbee3d 100644 --- a/templates/tests/test-connection.yaml +++ b/templates/tests/test-connection.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Pod metadata: - name: "{{ include "demo-chart.fullname" . }}-test-connection" + name: "{{ include "ailab-demo.fullname" . }}-test-connection" labels: - {{- include "demo-chart.labels" . | nindent 4 }} + {{- include "ailab-demo.labels" . | nindent 4 }} annotations: "helm.sh/hook": test spec: @@ -11,5 +11,5 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['{{ include "demo-chart.fullname" . }}:{{ .Values.service.port }}'] + args: ['{{ include "ailab-demo.fullname" . }}:{{ .Values.service.port }}'] restartPolicy: Never diff --git a/values.yaml b/values.yaml index 10d65b4..c48eecb 100644 --- a/values.yaml +++ b/values.yaml @@ -1,4 +1,4 @@ -# Default values for demo-chart. +# Default values for ailab-demo. # This is a YAML-formatted file. # Declare variables to be passed into your templates. @@ -84,6 +84,8 @@ autoscaling: nodeSelector: {} tolerations: [] +huggingface: + path: /mnt/atpdata/models_hub/huggingface # Temporarily unconfigurable # affinity: {} @@ -111,4 +113,4 @@ readinessProbe: # scheme: HTTP # periodSeconds: 10 # successThreshold: 1 -# timeoutSeconds: 1 \ No newline at end of file +# timeoutSeconds: 1