From 5567cafd093e3ed1d25e7ea3183a5980b28a9852 Mon Sep 17 00:00:00 2001 From: quicksilver Date: Fri, 9 Jul 2021 16:24:32 +0800 Subject: [PATCH] HorizontalPodAutoscaler support (#194) Signed-off-by: quicksilver --- charts/milvus/Chart.yaml | 2 +- charts/milvus/README.md | 4 ++ charts/milvus/templates/hpa.yaml | 79 ++++++++++++++++++++++++++++++++ charts/milvus/values.yaml | 76 ++++++++++++++++++++++++++++++ 4 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 charts/milvus/templates/hpa.yaml diff --git a/charts/milvus/Chart.yaml b/charts/milvus/Chart.yaml index b136d49..d3e1d61 100644 --- a/charts/milvus/Chart.yaml +++ b/charts/milvus/Chart.yaml @@ -3,7 +3,7 @@ name: milvus appVersion: "2.0.0-rc.1" kubeVersion: "^1.10.0-0" description: Milvus is an open-source vector database built to power AI applications and vector similarity search. -version: 2.0.4 +version: 2.0.5 keywords: - milvus - elastic diff --git a/charts/milvus/README.md b/charts/milvus/README.md index 6f2b8ef..623bcb6 100644 --- a/charts/milvus/README.md +++ b/charts/milvus/README.md @@ -149,6 +149,7 @@ The following table lists the configurable parameters of the Milvus Proxy compon | `proxy.affinity` | Affinity settings for Milvus Proxy pods assignment | `{}` | | `proxy.tolerations` | Toleration labels for Milvus Proxy pods assignment | `[]` | | `proxy.extraEnv` | Additional Milvus Proxy container environment variables | `[]` | +| `proxy.autoscaling.*` | Configs for the HorizontalPodAutoscaler of the Proxy Pods | `` | ### Milvus Root Coordinator Deployment Configuration @@ -207,6 +208,7 @@ The following table lists the configurable parameters of the Milvus Query Node c | `queryNode.affinity` | Affinity settings for Milvus Query Node pods assignment | `{}` | | `queryNode.tolerations` | Toleration labels for Milvus Query Node pods assignment | `[]` | | `queryNode.extraEnv` | Additional Milvus Query Node container environment variables | `[]` | +| `queryNode.autoscaling.*` | Configs for the HorizontalPodAutoscaler of the Query Node Pods | `` | ### Milvus Index Coordinator Deployment Configuration @@ -243,6 +245,7 @@ The following table lists the configurable parameters of the Milvus Index Node c | `indexNode.affinity` | Affinity settings for Milvus Index Node pods assignment | `{}` | | `indexNode.tolerations` | Toleration labels for Milvus Index Node pods assignment | `[]` | | `indexNode.extraEnv` | Additional Milvus Index Node container environment variables | `[]` | +| `indexNode.autoscaling.*` | Configs for the HorizontalPodAutoscaler of the Index Node Pods | `` | ### Milvus Data Coordinator Deployment Configuration @@ -279,6 +282,7 @@ The following table lists the configurable parameters of the Milvus Data Node co | `dataNode.affinity` | Affinity settings for Milvus Data Node pods assignment | `{}` | | `dataNode.tolerations` | Toleration labels for Milvus Data Node pods assignment | `[]` | | `dataNode.extraEnv` | Additional Milvus Data Node container environment variables | `[]` | +| `dataNode.autoscaling.*` | Configs for the HorizontalPodAutoscaler of the Data Node Pods | `` | ### Pulsar Standalone Deployment Configuration diff --git a/charts/milvus/templates/hpa.yaml b/charts/milvus/templates/hpa.yaml new file mode 100644 index 0000000..24ddaa6 --- /dev/null +++ b/charts/milvus/templates/hpa.yaml @@ -0,0 +1,79 @@ +{{- if and (.Values.proxy.enabled) (.Values.proxy.autoscaling.enabled) }} +--- +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ template "milvus.proxy.fullname" . }} + labels: + {{ include "milvus.labels" . | indent 4 }} + component: "proxy" +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ template "milvus.proxy.fullname" . }} + minReplicas: {{ .Values.proxy.autoscaling.minReplicas }} + maxReplicas: {{ .Values.proxy.autoscaling.maxReplicas }} + metrics: +{{ toYaml .Values.proxy.autoscaling.metrics | indent 4 }} +{{- end }} + +{{- if and (.Values.queryNode.enabled) (.Values.queryNode.autoscaling.enabled) }} +--- +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ template "milvus.querynode.fullname" . }} + labels: + {{ include "milvus.labels" . | indent 4 }} + component: "querynode" +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ template "milvus.querynode.fullname" . }} + minReplicas: {{ .Values.queryNode.autoscaling.minReplicas }} + maxReplicas: {{ .Values.queryNode.autoscaling.maxReplicas }} + metrics: +{{ toYaml .Values.queryNode.autoscaling.metrics | indent 4 }} +{{- end }} + +{{- if and (.Values.indexNode.enabled) (.Values.indexNode.autoscaling.enabled) }} +--- +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ template "milvus.indexnode.fullname" . }} + labels: + {{ include "milvus.labels" . | indent 4 }} + component: "indexnode" +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ template "milvus.indexnode.fullname" . }} + minReplicas: {{ .Values.indexNode.autoscaling.minReplicas }} + maxReplicas: {{ .Values.indexNode.autoscaling.maxReplicas }} + metrics: +{{ toYaml .Values.indexNode.autoscaling.metrics | indent 4 }} +{{- end }} + +{{- if and (.Values.dataNode.enabled) (.Values.dataNode.autoscaling.enabled) }} +--- +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ template "milvus.datanode.fullname" . }} + labels: + {{ include "milvus.labels" . | indent 4 }} + component: "datanode" +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ template "milvus.datanode.fullname" . }} + minReplicas: {{ .Values.dataNode.autoscaling.minReplicas }} + maxReplicas: {{ .Values.dataNode.autoscaling.maxReplicas }} + metrics: +{{ toYaml .Values.dataNode.autoscaling.metrics | indent 4 }} +{{- end }} \ No newline at end of file diff --git a/charts/milvus/values.yaml b/charts/milvus/values.yaml index a3a5b7a..26fe92b 100644 --- a/charts/milvus/values.yaml +++ b/charts/milvus/values.yaml @@ -108,6 +108,25 @@ proxy: tolerations: [] extraEnv: [] + # Enable autoscaling using HorizontalPodAutoscaler + autoscaling: + enabled: false + minReplicas: 2 + maxReplicas: 5 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 60 + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: 60 + rootCoordinator: enabled: true replicas: 1 # Run Root Coordinator mode with replication disabled @@ -147,6 +166,25 @@ queryNode: tolerations: [] extraEnv: [] + # Enable autoscaling using HorizontalPodAutoscaler + autoscaling: + enabled: false + minReplicas: 2 + maxReplicas: 5 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 60 + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: 60 + indexCoordinator: enabled: true replicas: 1 # Run Index Coordinator mode with replication disabled @@ -171,6 +209,25 @@ indexNode: tolerations: [] extraEnv: [] + # Enable autoscaling using HorizontalPodAutoscaler + autoscaling: + enabled: false + minReplicas: 2 + maxReplicas: 5 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 60 + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: 60 + dataCoordinator: enabled: true replicas: 1 # Run Data Coordinator mode with replication disabled @@ -195,6 +252,25 @@ dataNode: tolerations: [] extraEnv: [] + # Enable autoscaling using HorizontalPodAutoscaler + autoscaling: + enabled: false + minReplicas: 2 + maxReplicas: 5 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 60 + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: 60 + pulsarStandalone: image: repository: apachepulsar/pulsar