Skip to content

Commit

Permalink
Adding proxy user tls cert and key files upport.
Browse files Browse the repository at this point in the history
impl #22

Signed-off-by: Vincent Du <[email protected]>
  • Loading branch information
Vincent Du committed Oct 8, 2023
1 parent e0cbc1a commit 491289b
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/milvus/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: milvus
appVersion: "2.3.1"
kubeVersion: "^1.10.0-0"
description: Milvus is an open-source vector database built to power AI applications and vector similarity search.
version: 4.1.3
version: 4.1.5
keywords:
- milvus
- elastic
Expand Down
51 changes: 49 additions & 2 deletions charts/milvus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,52 @@ helm install my-release milvus/milvus --set log.persistence.enabled=true --set l

It will output log to `/milvus/logs/` directory.

### Enable proxy tls connection
By default the TLS connection to proxy service is false, to enable TLS with users' own certificate and privatge key, it can be specified in `extraConfigFiles` like this:

```bash
extraConfigFiles:
user.yaml: |+
# Enable tlsMode and set the tls cert and key
tls:
serverPemPath: /etc/milvus/certs/tls.crt
serverKeyPath: /etc/milvus/certs/tls.key
common:
security:
tlsMode: 1

```
The path specified above are TLS secret data mounted inside the proxy pod as files. To create a TLS secret, set `proxy.tls.enabled` to `true` then provide base64-encoded values for your certificate and private key files in values.yaml:

```bash
proxy:
enabled: true
tls:
enabled: true
secretName: milvus-tls
#expecting base64 encoded values here: i.e. $(cat tls.crt | base64 -w 0) and $(cat tls.key | base64 -w 0)
key: LS0tLS1C....
crt: LS0tLS1CR...
```
or in cli using --set:

```bash
--set proxy.tls.enabled=true \
--set prox.tls.key=$(cat /path/to/private_key_file | base64 -w 0) \
--set prox.tls.crt=$(cat /path/to/certificate_file | base64 -w 0)
```
In case you want to use a different `secretName` or mount path inside pod, modify `prox.tls.secretName` above, and `serverPemPath` and `serverPemPath` in `extraConfigFles `accordingly, then in the `volume` and `volumeMounts` sections in values.yaml

```bash
volumes:
- secret:
secretName: Your-tls-secret-name
name: milvus-tls
volumeMounts:
- mountPath: /Your/tls/files/path/
name: milvus-tls
```

## Uninstall the Chart

```bash
Expand Down Expand Up @@ -269,8 +315,9 @@ The following table lists the configurable parameters of the Milvus Proxy compon
| `proxy.heaptrack.enabled` | Whether to enable heaptrack | `false` |
| `proxy.profiling.enabled` | Whether to enable live profiling | `false` |
| `proxy.extraEnv` | Additional Milvus Proxy container environment variables | `[]` |
| `proxy.http.enabled` | Enable rest api for Milvus Proxy | `true` |
| `proxy.http.debugMode.enabled` | Enable debug mode for rest api | `false` |
| `proxy.http.enabled` | Enable rest api for Milvus Proxy | `true` |
| `proxy.http.debugMode.enabled` | Enable debug mode for rest api | `false` |
| `proxy.tls.enabled` | Enable porxy tls connection | `false` |

### Milvus Root Coordinator Deployment Configuration

Expand Down
28 changes: 28 additions & 0 deletions charts/milvus/ci/cluster-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,31 @@ pulsar:
-XX:+DisableExplicitGC
-XX:-ResizePLAB
-XX:+ExitOnOutOfMemoryError
extraConfigFiles:
user.yaml: |+
# For example enable rest http for milvus proxy
# proxy:
# http:
# enabled: true
# Enable tlsMode and set the tls cert and key
tls:
serverPemPath: /etc/milvus/certs/tls.crt
serverKeyPath: /etc/milvus/certs/tls.key
common:
security:
tlsMode: 1
proxy:
# Mount a TLS secret into proxy pod
tls:
enabled: true
secretName: milvus-tls
#expecting base64 encoded values here: i.e. $(cat tls.crt | base64 -w 0) and $(cat tls.key | base64 -w 0)
key: LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUV2QUlCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQktZd2dnU2lBZ0VBQW9JQkFRQ3lJN2Qvbmk1RnhaeGQKTWNsSnRqTUlMMktqeDI0WFRIR2NjZ1NSN3V5Wmc0QVdZME93ZXVMLzNqVGxRMjNOeWxxY3g5cEp5VFZ4Lzg0egptUE1ka1BJTzhyZGF4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R2h2YzNTQ0Rpb3VjbTl1WlhSb2FXNW5MbU51Z2c4cUxuSnYKYm1WMGFHbHVaeTVqYjIwd0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFHMThzczNzTkpqTFhNdjlXbStkQnZNUQpla0dGdW5aM3VuTjY0MVJ4R3BVV2piVWo5NjN3b1h4OGVpTDZsSkZLaVU1MmFYckZSNCs2QlowdGJSc0x6NGU0CnBtQ2RPejRtQ2xtTlNrNm1TU3o3Vzh0bmh6K2gxanFVenA1d2hBaDFHajVRZGF1VHpnY0xGeEJ3M1BXVHQ4dHAKNHhHSXVad0FXeUI5TUhYTWtCdHNkaVAvb1VFb1ZYWUMyU0ErbzdkV3IwZDl3MEs2QkEwMFRaUitPSHNjZnBHUwprMGFEMUN1OGZ4aWNjblk3amNCTXovMnZWZzNMem9lVXFMN1RaYnBhbi9qek81RkFNVm9pMjFVRndFUWJCWU1iCnlVYlBlaTA2MEpRL3U3SDZDUjlPQ0NIS3NEdnRwSWZncGVBbWpjdUZTQ0YrUTNjSFRBc3RIcmxaV2FPQ05PND0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
volumes:
- secret:
secretName: milvus-tls
name: milvus-tls
volumeMounts:
- mountPath: /etc/milvus/certs/
name: milvus-tls
7 changes: 7 additions & 0 deletions charts/milvus/templates/proxy-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ spec:
{{- end }}
- mountPath: /milvus/tools
name: tools
{{- if .Values.proxy.volumeMounts }}
{{- toYaml .Values.proxy.volumeMounts | nindent 8 }}
{{- end}}

{{- if and (.Values.nodeSelector) (not .Values.proxy.nodeSelector) }}
nodeSelector:
Expand Down Expand Up @@ -163,4 +166,8 @@ spec:
{{- end }}
- name: tools
emptyDir: {}
{{- if .Values.proxy.volumes }}
{{ toYaml .Values.proxy.volumes | indent 6 }}
{{- end}}

{{- end }}
16 changes: 16 additions & 0 deletions charts/milvus/templates/proxy-tls-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if and (.Values.proxy.tls) (.Values.proxy.tls.enabled) }}

{{- if and (.Values.proxy.tls.crt) (.Values.proxy.tls.key) }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.proxy.tls.secretName }}
data:
tls.crt: {{ .Values.proxy.tls.crt }}
tls.key: {{ .Values.proxy.tls.key }}
type: kubernetes.io/tls
{{- end }}

{{- end -}}

23 changes: 23 additions & 0 deletions charts/milvus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ extraConfigFiles:
# proxy:
# http:
# enabled: true
## Enable tlsMode and set the tls cert and key
# tls:
# serverPemPath: /etc/milvus/certs/tls.crt
# serverKeyPath: /etc/milvus/certs/tls.key
# common:
# security:
# tlsMode: 1
## Expose the Milvus service to be accessed from outside the cluster (LoadBalancer service).
## or access it from within the cluster (ClusterIP service). Set the service type and the port to serve it.
Expand Down Expand Up @@ -229,6 +236,22 @@ proxy:
enabled: true # whether to enable http rest server
debugMode:
enabled: false
# Mount a TLS secret into proxy pod
tls:
enabled: false
## when enabling proxy.tls, all items below should be uncommented and the key and crt values should be populated.
# enabled: true
# secretName: milvus-tls
## expecting base64 encoded values here: i.e. $(cat tls.crt | base64 -w 0) and $(cat tls.key | base64 -w 0)
# key: LS0tLS1CRUdJTiBQU--REDUCT
# crt: LS0tLS1CRUdJTiBDR--REDUCT
# volumes:
# - secret:
# secretName: milvus-tls
# name: milvus-tls
# volumeMounts:
# - mountPath: /etc/milvus/certs/
# name: milvus-tls

rootCoordinator:
enabled: true
Expand Down

0 comments on commit 491289b

Please sign in to comment.