Refactored ports to be looped over and be optional

Adapted install notes
Changed probes to support one of both ports as well
This commit is contained in:
Fabrizio Bonavita
2022-05-30 13:32:39 +02:00
parent 5bc310b4de
commit bdf0f1fbdf
5 changed files with 73 additions and 57 deletions

View File

@@ -1,16 +1,10 @@
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 "qdrant.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 "qdrant.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "qdrant.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 "qdrant.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:6333 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 6333:$CONTAINER_PORT
To forward Qdrant's ports execute one of the following commands:
export POD_NAME=$(kubectl get pods --namespace {{ $.Release.Namespace }} -l "app.kubernetes.io/name={{ include "qdrant.name" . }},app.kubernetes.io/instance={{ $.Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
{{- if contains "ClusterIP" .Values.service.type }}
{{- range .Values.service.ports }}
If you want to use Qdrant via {{ .name }} execute the following commands
kubectl --namespace {{ $.Release.Namespace }} port-forward $POD_NAME {{ .targetPort }}:{{ .targetPort }}
{{- end }}
{{- end }}

View File

@@ -8,9 +8,11 @@ spec:
type: {{ .Values.service.type }}
clusterIP: None
ports:
- name: {{ .Values.service.name }}
port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
protocol: {{ .Values.service.protocol | default "TCP" }}
{{- range .Values.service.ports }}
- name: {{ .name }}
port: {{ .port }}
targetPort: {{ .targetPort }}
protocol: {{ .protocol | default "TCP" }}
{{- end }}
selector:
{{- include "qdrant.selectorLabels" . | nindent 4 }}

View File

@@ -5,11 +5,13 @@ metadata:
labels:
{{- include "qdrant.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
type: {{ .Values.service.type | default "ClusterIP" }}
ports:
- name: {{ .Values.service.name }}
port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
protocol: {{ .Values.service.protocol | default "TCP" }}
{{- range .Values.service.ports }}
- name: {{ .name }}
port: {{ .port }}
targetPort: {{ .targetPort }}
protocol: {{ .protocol | default "TCP" }}
{{- end }}
selector:
{{- include "qdrant.selectorLabels" . | nindent 4 }}

View File

@@ -28,32 +28,48 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
{{- range .Values.ports }}
{{- range .Values.service.ports }}
- name: {{ .name }}
containerPort: {{ .containerPort }}
containerPort: {{ .targetPort }}
protocol: {{ .protocol }}
{{- end }}
{{- if .Values.livenessProbe.enabled }}
{{- $values := .Values -}}
{{- range .Values.service.ports }}
{{- if and $values.livenessProbe.enabled .checksEnabled }}
livenessProbe:
{{- if eq .name "grpc"}}
grpc:
port: {{ .targetPort }}
{{- end }}
{{- if eq .name "rest"}}
httpGet:
path: {{ .Values.livenessProbe.path }}
port: {{ .Values.livenessProbe.port }}
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
path: /
port: {{ .targetPort }}
{{- end }}
initialDelaySeconds: {{ $values.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ $values.livenessProbe.timeoutSeconds }}
periodSeconds: {{ $values.livenessProbe.periodSeconds }}
successThreshold: {{ $values.livenessProbe.successThreshold }}
failureThreshold: {{ $values.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
{{- if and $values.readinessProbe.enabled .checksEnabled }}
readinessProbe:
{{- if eq .name "grpc"}}
grpc:
port: {{ .targetPort }}
{{- end }}
{{- if eq .name "rest"}}
httpGet:
path: {{ .Values.readinessProbe.path }}
port: {{ .Values.readinessProbe.port }}
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
path: /
port: {{ .targetPort }}
{{- end }}
initialDelaySeconds: {{ $values.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ $values.readinessProbe.timeoutSeconds }}
periodSeconds: {{ $values.readinessProbe.periodSeconds }}
successThreshold: {{ $values.readinessProbe.successThreshold }}
failureThreshold: {{ $values.readinessProbe.failureThreshold }}
{{- end }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}

View File

@@ -9,15 +9,24 @@ imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
ports:
- name: http
containerPort: 6333
protocol: TCP
# checks - Readiness and liveness checks can only be enabled for either rest or grpc (multiple checks not supported)
# grpc checks are only available from k8s 1.24+ so as of per default we check rest
service:
type: ClusterIP
ports:
- name: rest
port: 6333
targetPort: 6333
protocol: TCP
checksEnabled: true
- name: grpc
port: 6334
targetPort: 6334
protocol: TCP
checksEnabled: false
livenessProbe:
enabled: true
path: /
port: 6333
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 1
@@ -26,8 +35,6 @@ livenessProbe:
readinessProbe:
enabled: true
path: /
port: 6333
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 1
@@ -36,12 +43,6 @@ readinessProbe:
podAnnotations: {}
service:
type: ClusterIP
name: http
port: 6333
targetPort: 6333
resources: {}
# limits:
# cpu: 100m
@@ -90,4 +91,5 @@ config:
max_workers: 0
host: 0.0.0.0
http_port: 6333
grpc_port: null
grpc_port: 6334
enable_cors: true