Skip to content

Commit 1987415

Browse files
authored
[dgraph] feat: allow namespace override (#116)
Signed-off-by: Artem Chubar <[email protected]>
1 parent 1a3ce27 commit 1987415

27 files changed

+46
-12
lines changed

charts/dgraph/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ The following table lists the configurable parameters of the `dgraph` chart and
6464
| `image.tag` | Container image tag | `v23.0.1` |
6565
| `image.pullPolicy` | Container pull policy | `IfNotPresent` |
6666
| `nameOverride` | Deployment name override (will append the release name) | `nil` |
67+
| `namespaceOverride` | Deployment namespace override if specified. | `nil` |
6768
| `fullnameOverride` | Deployment full name override (the release name is ignored) | `nil` |
6869
| `serviceAccount.create` | Create ServiceAccount | `true` |
6970
| `serviceAccount.annotations` | ServiceAccount annotations | `{}` |

charts/dgraph/templates/NOTES.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@
2121

2222
{{- else if contains "NodePort" .Values.alpha.service.type }}
2323

24-
export ALPHA_NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[?(@.name=='http-alpha')].nodePort}" services {{ include "dgraph.alpha.fullname" . }})
25-
export ALPHA_NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
24+
export ALPHA_NODE_PORT=$(kubectl get --namespace {{ include "dgraph.namespace" . }} -o jsonpath="{.spec.ports[?(@.name=='http-alpha')].nodePort}" services {{ include "dgraph.alpha.fullname" . }})
25+
export ALPHA_NODE_IP=$(kubectl get nodes --namespace {{ include "dgraph.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
2626
echo "Access Alpha HTTP/S service using http://$ALPHA_NODE_IP:$ALPHA_NODE_PORT"
2727
{{- else if contains "LoadBalancer" .Values.alpha.service.type }}
2828
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
29-
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} service --watch {{ include "dgraph.alpha.fullname" . }}'
29+
You can watch the status of by running 'kubectl get --namespace {{ include "dgraph.namespace" . }} service --watch {{ include "dgraph.alpha.fullname" . }}'
3030

31-
export ALPHA_SERVICE_IP=$(kubectl get service --namespace {{ .Release.Namespace }} {{ include "dgraph.alpha.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
31+
export ALPHA_SERVICE_IP=$(kubectl get service --namespace {{ include "dgraph.namespace" . }} {{ include "dgraph.alpha.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
3232
echo "Access Alpha HTTP/S service using http://$ALPHA_SERVICE_IP:8080"
3333

3434
{{- else if contains "ClusterIP" .Values.alpha.service.type }}
3535

36-
export ALPHA_POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} --selector "statefulset.kubernetes.io/pod-name={{ include "dgraph.alpha.fullname" . }}-0,release={{ .Release.Name }}" --output jsonpath="{.items[0].metadata.name}")
36+
export ALPHA_POD_NAME=$(kubectl get pods --namespace {{ include "dgraph.namespace" . }} --selector "statefulset.kubernetes.io/pod-name={{ include "dgraph.alpha.fullname" . }}-0,release={{ .Release.Name }}" --output jsonpath="{.items[0].metadata.name}")
3737
echo "Access Alpha HTTP/S using http://localhost:8080"
38-
kubectl --namespace {{ .Release.Namespace }} port-forward $ALPHA_POD_NAME 8080:8080
38+
kubectl --namespace {{ include "dgraph.namespace" . }} port-forward $ALPHA_POD_NAME 8080:8080
3939

4040
{{- end }}
4141

@@ -54,21 +54,21 @@
5454

5555
{{- else if contains "NodePort" .Values.ratel.service.type }}
5656

57-
export RATEL_NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[?(@.name=='http-ratel')].nodePort}" services {{ include "dgraph.ratel.fullname" . }})
58-
export RATEL_NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
57+
export RATEL_NODE_PORT=$(kubectl get --namespace {{ include "dgraph.namespace" . }} -o jsonpath="{.spec.ports[?(@.name=='http-ratel')].nodePort}" services {{ include "dgraph.ratel.fullname" . }})
58+
export RATEL_NODE_IP=$(kubectl get nodes --namespace {{ include "dgraph.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
5959
echo "Access Ratel HTTP/S service using http://$RATEL_NODE_IP:$RATEL_NODE_PORT"
6060
{{- else if contains "LoadBalancer" .Values.ratel.service.type }}
6161
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
62-
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} service --watch {{ include "dgraph.ratel.fullname" . }}'
62+
You can watch the status of by running 'kubectl get --namespace {{ include "dgraph.namespace" . }} service --watch {{ include "dgraph.ratel.fullname" . }}'
6363

64-
export RATEL_SERVICE_IP=$(kubectl get service --namespace {{ .Release.Namespace }} {{ include "dgraph.ratel.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
64+
export RATEL_SERVICE_IP=$(kubectl get service --namespace {{ include "dgraph.namespace" . }} {{ include "dgraph.ratel.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
6565
echo "Access Ratel HTTP/S service using http://$RATEL_SERVICE_IP"
6666

6767
{{- else if contains "ClusterIP" .Values.ratel.service.type }}
6868

69-
export RATEL_POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} --selector "component={{ .Values.ratel.name }},release={{ .Release.Name }}" --output jsonpath="{.items[0].metadata.name}")
69+
export RATEL_POD_NAME=$(kubectl get pods --namespace {{ include "dgraph.namespace" . }} --selector "component={{ .Values.ratel.name }},release={{ .Release.Name }}" --output jsonpath="{.items[0].metadata.name}")
7070
echo "Access Ratel HTTP/S using http://localhost:8000"
71-
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NARATEL_POD_NAMEME 8000:8000
71+
kubectl --namespace {{ include "dgraph.namespace" . }} port-forward $POD_NARATEL_POD_NAMEME 8000:8000
7272

7373
{{- end }}
7474

charts/dgraph/templates/_helpers.tpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,10 @@ Create a default fully qualified ratel name.
186186
{{- define "dgraph.ratel.fullname" -}}
187187
{{ template "dgraph.fullname" . }}-{{ .Values.ratel.name }}
188188
{{- end -}}
189+
190+
{{/*
191+
Allow overriding namespace
192+
*/}}
193+
{{- define "dgraph.namespace" -}}
194+
{{- default .Release.Namespace .Values.namespaceOverride -}}
195+
{{- end -}}

charts/dgraph/templates/alpha/configs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: v1
33
kind: ConfigMap
44
metadata:
55
name: {{ template "dgraph.alpha.fullname" . }}-config
6+
namespace: {{ include "dgraph.namespace" . }}
67
labels:
78
app: {{ template "dgraph.name" . }}
89
chart: {{ template "dgraph.chart" . }}

charts/dgraph/templates/alpha/ingress.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ apiVersion: networking.k8s.io/v1
2222
kind: Ingress
2323
metadata:
2424
name: {{ template "dgraph.alpha.fullname" . }}-ingress
25+
namespace: {{ include "dgraph.namespace" . }}
2526
labels:
2627
app: {{ template "dgraph.name" . }}
2728
chart: {{ template "dgraph.chart" . }}
@@ -67,6 +68,7 @@ apiVersion: networking.k8s.io/v1
6768
kind: Ingress
6869
metadata:
6970
name: {{ template "dgraph.alpha.fullname" . }}-ingress-grpc
71+
namespace: {{ include "dgraph.namespace" . }}
7072
labels:
7173
app: {{ template "dgraph.name" . }}
7274
chart: {{ template "dgraph.chart" . }}

charts/dgraph/templates/alpha/secret-acl.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: v1
33
kind: Secret
44
metadata:
55
name: {{ template "dgraph.alpha.fullname" . }}-acl-secret
6+
namespace: {{ include "dgraph.namespace" . }}
67
labels:
78
app: {{ template "dgraph.name" . }}
89
chart: {{ template "dgraph.chart" . }}

charts/dgraph/templates/alpha/secret-enc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: v1
33
kind: Secret
44
metadata:
55
name: {{ template "dgraph.alpha.fullname" . }}-encryption-secret
6+
namespace: {{ include "dgraph.namespace" . }}
67
labels:
78
app: {{ template "dgraph.name" . }}
89
chart: {{ template "dgraph.chart" . }}

charts/dgraph/templates/alpha/secret-tls.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: v1
33
kind: Secret
44
metadata:
55
name: {{ template "dgraph.alpha.fullname" . }}-tls-secret
6+
namespace: {{ include "dgraph.namespace" . }}
67
labels:
78
app: {{ template "dgraph.name" . }}
89
chart: {{ template "dgraph.chart" . }}

charts/dgraph/templates/alpha/statefulset.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ apiVersion: apps/v1
3030
kind: StatefulSet
3131
metadata:
3232
name: {{ template "dgraph.alpha.fullname" . }}
33+
namespace: {{ include "dgraph.namespace" . }}
3334
labels:
3435
app: {{ template "dgraph.name" . }}
3536
chart: {{ template "dgraph.chart" . }}

charts/dgraph/templates/alpha/svc-headless.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apiVersion: v1
22
kind: Service
33
metadata:
44
name: {{ template "dgraph.alpha.fullname" . }}-headless
5+
namespace: {{ include "dgraph.namespace" . }}
56
labels:
67
app: {{ template "dgraph.name" . }}
78
chart: {{ template "dgraph.chart" . }}

0 commit comments

Comments
 (0)