Skip to content

Commit

Permalink
Helm integration of GraphScope (#184)
Browse files Browse the repository at this point in the history
* Helm integration of GraphScope

* Rich comments and documentation of Helm.
  • Loading branch information
lidongze0629 authored Mar 12, 2021
1 parent a232871 commit 6c0efef
Show file tree
Hide file tree
Showing 24 changed files with 713 additions and 46 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0
0.2.1
4 changes: 2 additions & 2 deletions analytical_engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 2.8)

if ("${GRAPHSCOPE_VERSION}" STREQUAL "")
set(GRAPHSCOPE_ANALYTICAL_MAJOR_VERSION 0)
set(GRAPHSCOPE_ANALYTICAL_MINOR_VERSION 1)
set(GRAPHSCOPE_ANALYTICAL_PATCH_VERSION 3)
set(GRAPHSCOPE_ANALYTICAL_MINOR_VERSION 2)
set(GRAPHSCOPE_ANALYTICAL_PATCH_VERSION 1)
set(GRAPHSCOPE_ANALYTICAL_VERSION ${GRAPHSCOPE_ANALYTICAL_MAJOR_VERSION}.${GRAPHSCOPE_ANALYTICAL_MINOR_VERSION}.${GRAPHSCOPE_ANALYTICAL_PATCH_VERSION})
else ()
set(GRAPHSCOPE_ANALYTICAL_MAJOR_VERSION ${GRAPHSCOPE_MAJOR_VERSION})
Expand Down
2 changes: 2 additions & 0 deletions charts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
index.yaml
*.tgz
35 changes: 35 additions & 0 deletions charts/graphscope/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: v2
name: graphscope
description: A One-Stop Large-Scale Graph Computing System from Alibaba

home: https://graphscope.io

sources:
- https://github.com/alibaba/GraphScope

keywords:
- GraphScope
- Distributed Graph Computing
- Graph Learning
- Graph Analytics

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.2.1"
118 changes: 118 additions & 0 deletions charts/graphscope/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
GraphScope charts
=================

[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/graphscope)](https://artifacthub.io/packages/helm/graphscope/graphscope)

[GraphScope](https://graphscope.io) is a unified distributed graph computing platform that provides a one-stop environment for performing diverse graph operations on a cluster of computers through a user-friendly Python interface. GraphScope makes multi-staged processing of large-scale graph data on compute clusters simple by combining several important pieces of Alibaba technology: including GRAPE, MaxGraph, and Graph-Learn (GL) for analytics, interactive, and graph neural networks (GNN) computation, respectively, and the [vineyard store](https://v6d.io/) that offers efficient in-memory data transfers.

## Get Repo Info

```shell
$ helm repo add graphscope https://dl.bintray.com/graphscope/charts/
$ helm update
```
See [*helm repo*](https://helm.sh/docs/helm/helm_repo/) for command documentation.

## Install Chart

```shell
# Helm 3
$ helm install [RELEASE_NAME] graphscope/graphscope

# Helm 2
$ helm install --name [RELEASE_NAME] graphscope/graphscope
```
See configuration below.
See [*helm install*](https://helm.sh/docs/helm/helm_install/) for command documentation.


## Get GraphScope Service Endpoint

```shell
# Helm 3 or 2
# After installation, you can check service availability by:
$ helm test [RELEASE_NAME]

# Default, with kubernetes `NodePort` service type, you can get service endpoint by:
$ export NODE_IP=$(kubectl --namespace [NAMESPACE] get pod -o jsonpath="{.status.hostIP}" [GRAPHSCOPE-FULLNAME]-coordinator)
$ export NODE_PORT=$(kubectl --namespace [NAMESPACE] get services -o jsonpath="{.spec.ports[0].nodePort}" [GRAPHSCOPE-FULLNAME]-coordinator-service)
$ echo "GraphScope service listen on ${NODE_IP}:${NODE_PORT}"
```

## An Example to (Re)connect service by Python Client.

```python
import graphscope
graphscope.set_option(show_log=True)
sess = graphscope.session(addr='<ip>:<port>')
```

The param `addr` is an endpoint for connecting a pre-launched service. Note that only one session can be connected to the service at the same time, but you can reconnect the same service after session close.

```python
# sess1 = graphscope.session(addr='<ip>:<port>')
sess1.close()
sess2 = graphscope.session(addr='<ip>:<port>')
```

See [*create a session*](https://graphscope.io/docs/reference/session.html) for command documentation.


## Uninstall Chart

```shell
# Helm 3
$ helm uninstall [RELEASE_NAME]

# Helm 2
$ helm delete --purge [RELEASE_NAME]
```
This removes all the Kubernetes components associated with the chart and deletes the release.
See [*helm uninstall*](https://helm.sh/docs/helm/helm_uninstall/) for command documentation.


## Upgrading Chart

```shell
# Helm 3 or 2
$ helm upgrade [RELEASE_NAME] [CHART] --install
```
Sess [*helm upgrade*](https://helm.sh/docs/helm/helm_upgrade/) for command documentation.


## Configuration

See [*Customizing the Chart Before Installing*](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing). To see all configurable options with detailed comments, visit the chart's [values.yaml](https://github.com/alibaba/GraphScope/blob/main/charts/graphscope/values.yaml), or run these configuration commands:
```shell
# Helm 2
$ helm inspect values graphscope/graphscope

# Helm 3
$ helm show values graphscope/graphscope
```
In most cases, you want to mount volumes into GraphScope's pod for loading graph. Here is an example to do it:

```yaml
# Mount hostpath `/testingdata` to `/tmp/testingdata` in pod.
# cat values.yaml
#
volumes:
enabled: true
items:
data:
type: hostPath
field:
type: Directory
path: /testingdata
mounts:
- mountPath: /tmp/testingdata

# pass that values file during installation.
$ helm install -f values.yaml graphscope/graphscope --generate-name
```

## Useful links

- https://graphscope.io/
- https://github.com/alibaba/GraphScope
- https://try.graphscope.app/
19 changes: 19 additions & 0 deletions charts/graphscope/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
The GraphScope has been deployed.

{{- if contains "NodePort" .Values.coordinator.service.type }}
Get service address by:
export NODE_IP=$(kubectl --namespace {{ .Release.Namespace }} get pod -o jsonpath="{.status.hostIP}" {{ template "graphscope.fullname" .}}-coordinator)
export NODE_PORT=$(kubectl --namespace {{ .Release.Namespace }} get services -o jsonpath="{.spec.ports[0].nodePort}" {{ template "graphscope.fullname" . }}-coordinator-service)
echo "GraphScope service listen on ${NODE_IP}:${NODE_PORT}"
{{- else if contains "LoadBalancer" .Values.coordinator.service.type }}
It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status by running 'kubectl --namespace {{ .Release.Namespace }} get services -o wide -w {{ template "graphscope.fullname" . }}-coordinator-service'
{{- end }}

An example to connect service in python.

```python
import graphscope
graphscope.set_option(show_log=True)
sess = graphscope.session(addr='<ip>:<port>')
```
79 changes: 79 additions & 0 deletions charts/graphscope/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{{/*
Create a default full qualified app name.
We truncate at 30 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "graphscope.fullname" -}}
{{- if contains .Chart.Name .Release.Name }}
{{- .Release.Name | trunc 30 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 30 | trimSuffix "-" }}
{{- end }}
{{- end }}


{{/*
Create description information of chart as used by the label.
*/}}
{{- define "graphscope.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}


{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "graphscope.imagePullSecrets" -}}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{- range .Values.imagePullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
{{- end }}


{{/*
Transform the Docker Image Registry Secret Names to string with comma separated.
*/}}
{{- define "graphscope.imagePullSecretsStr" -}}
{{- if .Values.imagePullSecrets }}
{{ join "," .Values.imagePullSecrets }}
{{- end }}
{{- end }}


{{/*
Kubernetes Selector labels of GraphScope Coordinator.
*/}}
{{- define "graphscope.coordinator.selectorLabels" -}}
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}


{{/*
Kubernetes labels of GraphScope Coordinator.
*/}}
{{- define "graphscope.coordinator.labels" -}}
graphscope.components: coordinator
helm.sh/chart: {{ include "graphscope.chart" . }}
{{ include "graphscope.coordinator.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}


{{/*
Return Service Annotations.
*/}}
{{- define "graphscope.service.annotations" -}}
annotations:
"service.beta.kubernetes.io/alibaba-cloud-loadbalancer-health-check-type": "tcp"
"service.beta.kubernetes.io/alibaba-cloud-loadbalancer-health-check-connect-timeout": "8"
"service.beta.kubernetes.io/alibaba-cloud-loadbalancer-healthy-threshold": "2"
"service.beta.kubernetes.io/alibaba-cloud-loadbalancer-unhealthy-threshold": "2"
"service.beta.kubernetes.io/alibaba-cloud-loadbalancer-health-check-interval": "1"
{{- end }}
Loading

0 comments on commit 6c0efef

Please sign in to comment.