Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(interactive): Add master-slave deployment of Interactive #4164

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions charts/graphscope-interactive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ $ kubectl describe svc {your-release-name} -graphscope-interactive-frontend | gr
#192.168.0.44:7687
# the first is the gremlin endpoint(currently not supported)
# the second is the cypher endpoint
$ kubectl describe svc {your-release-name} -graphscope-interactive-engine | grep "Endpoints:" | awk -F' ' '{print $2}'
# the first is the admin port
# the second is the query port
```

Delete the deployment via
Expand Down Expand Up @@ -105,3 +108,28 @@ hiactorWorkerNum: 1 # currently only support 1.
hiactorTimeout: 240000

```


## TODO

- TODO: Support cypher/gremlin queries.

## Installtion

```bash
helm install lei-test -f settings.yaml . --set odps.access.id="",odps.access.key="",odps.endpoint=""
export NODE_IP=$(ktl -n kubetask get pod lei-test-graphscope-interactive-primary-0 -o jsonpath="{.status.podIP}")
export ADMIN_PORT=$(ktl get pod lei-test-graphscope-interactive-primary-0 -ojsonpath='{.spec.containers[0].ports[0].containerPort}')
export QUERY_PORT=$(ktl get pod lei-test-graphscope-interactive-primary-0 -ojsonpath='{.spec.containers[1].ports[0].containerPort}')
export ADMIN_ENDPOINT=${NODE_IP}:${ADMIN_PORT}
export QUERY_ENDPOINT=${NODE_IP}:${QUERY_PORT}
echo "ADMIN_ENDPOINT: ${ADMIN_ENDPOINT}"
echo "QUERY_ENDPOINT: ${QUERY_ENDPOINT}"
```

```bash
export NODE_IP=$(118f -n kubetask get pod lei-test-graphscope-interactive-primary-0 -o jsonpath="{.status.podIP}")
export ADMIN_PORT=$(118f get pod lei-test-graphscope-interactive-primary-0 -ojsonpath='{.spec.containers[0].ports[0].containerPort}')
export QUERY_PORT=$(118f get pod lei-test-graphscope-interactive-primary-0 -ojsonpath='{.spec.containers[1].ports[0].containerPort}')
```

66 changes: 61 additions & 5 deletions charts/graphscope-interactive/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ If release name contains chart name it will be used as a full name.
{{- printf "%s-%s" (include "graphscope-interactive.fullname" .) "frontend" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "graphscope-interactive.engine.fullname" -}}
{{- printf "%s-%s" (include "graphscope-interactive.fullname" .) "engine" | trunc 63 | trimSuffix "-" -}}
{{- define "graphscope-interactive.primary.fullname" -}}
{{- printf "%s-%s" (include "graphscope-interactive.fullname" .) "primary" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "graphscope-interactive.secondary.fullname" -}}
{{- printf "%s-%s" (include "graphscope-interactive.fullname" .) "secondary" | trunc 63 | trimSuffix "-" -}}
{{- end -}}


Expand Down Expand Up @@ -77,11 +81,63 @@ Return the proper graphscope-interactive frontend image name
{{- end -}}

{{/*
Return the proper graphscope-interactive engine image name
Return the proper graphscope-interactive primary image name
*/}}
{{- define "graphscope-interactive.primary.image" -}}
{{- $tag := .Chart.AppVersion | toString -}}
{{- with .Values.primary.image -}}
{{- if .tag -}}
{{- $tag = .tag | toString -}}
{{- end -}}
{{- if .registry -}}
{{- printf "%s/%s:%s" .registry .repository $tag -}}
{{- else -}}
{{- printf "%s:%s" .repository $tag -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Return the proper graphscope-interactive primary image name
*/}}
{{- define "graphscope-interactive.nginx.image" -}}
{{- $tag := .Chart.AppVersion | toString -}}
{{- with .Values.nginx.image -}}
{{- if .tag -}}
{{- $tag = .tag | toString -}}
{{- end -}}
{{- if .registry -}}
{{- printf "%s/%s:%s" .registry .repository $tag -}}
{{- else -}}
{{- printf "%s:%s" .repository $tag -}}
{{- end -}}
{{- end -}}
{{- end -}}


{{/*
Return the proper graphscope-interactive secondary image name
*/}}
{{- define "graphscope-interactive.secondary.image" -}}
{{- $tag := .Chart.AppVersion | toString -}}
{{- with .Values.secondary.image -}}
{{- if .tag -}}
{{- $tag = .tag | toString -}}
{{- end -}}
{{- if .registry -}}
{{- printf "%s/%s:%s" .registry .repository $tag -}}
{{- else -}}
{{- printf "%s:%s" .repository $tag -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Return the proper graphscope-interactive cron job image name
*/}}
{{- define "graphscope-interactive.engine.image" -}}
{{- define "graphscope-interactive.cronjob.image" -}}
{{- $tag := .Chart.AppVersion | toString -}}
{{- with .Values.engine.image -}}
{{- with .Values.cronjob.image -}}
{{- if .tag -}}
{{- $tag = .tag | toString -}}
{{- end -}}
Expand Down
18 changes: 7 additions & 11 deletions charts/graphscope-interactive/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ data:
data: data
logs: logs
conf: conf
log_level: {{ .Values.engine.logLevel }}
log_level: {{ .Values.primary.logLevel }}
default_graph: {{ .Values.defaultGraph }}
compute_engine:
type: hiactor
workers:
- ENGINE_SERVICE_HOST:10000
thread_num_per_worker: {{ .Values.engine.threadNumPerWorker }}
- localhost:10000
thread_num_per_worker: {{ .Values.primary.threadNumPerWorker }}
compiler:
planner:
is_on: true
Expand All @@ -35,7 +35,7 @@ data:
- FilterMatchRule
- NotMatchToAntiJoinRule
endpoint:
default_listen_address: ENGINE_SERVICE_HOST
default_listen_address: localhost
bolt_connector:
disabled: false
port: {{ .Values.frontend.service.cypherPort }}
Expand All @@ -44,10 +44,6 @@ data:
port: {{ .Values.frontend.service.gremlinPort }}
query_timeout: {{ .Values.frontend.service.queryTimeout }}
http_service:
default_listen_address: ENGINE_SERVICE_HOST
admin_port: {{ .Values.engine.service.adminPort }}
query_port: {{ .Values.engine.service.queryPort }}
setup.sh: |-
#!/bin/bash
sudo sed -e "s/ENGINE_SERVICE_HOST/${ENGINE_SERVICE_HOST}/g" ${ENGINE_CONFIG_PATH} > ${REAL_ENGINE_CONFIG_PATH}
echo "Finish set ENGINE_SERVICE_HOST to ${ENGINE_SERVICE_HOST}"
default_listen_address: localhost
admin_port: {{ .Values.primary.service.adminPort }}
query_port: {{ .Values.primary.service.queryPort }}
40 changes: 40 additions & 0 deletions charts/graphscope-interactive/templates/nginx_conf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-nginx-config
namespace: {{ .Release.Namespace }}
labels: {{- include "graphscope-interactive.labels" . | nindent 4 }}
app.kubernetes.io/component: configmap
{{- if .Values.commonLabels }}
{{- include "graphscope-interactive.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "graphscope-interactive.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
nginx.conf: |
events {}
http {
upstream my_service_1 {
{{- $baseName := include "graphscope-interactive.secondary.fullname" . }}
{{- $replicaCount := .Values.backend.replicas }}
{{- $serviceName := printf "%s.%s.svc.%s" (include "graphscope-interactive.secondary.fullname" .) .Release.Namespace .Values.clusterDomain }}
{{- $port := .Values.secondary.service.queryPort }}
{{- range $i := until $replicaCount }}
server {{ printf "%s-%d.%s:%d" $baseName (add $i 1) $serviceName $port }};
{{- end }}
}

server {
listen 10000;
server_name localhost;

location / {
proxy_pass http://my_service_1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
Loading
Loading