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

[#6594] feat(deploy): Provide gravitino chart for deploying different storage backend on K8S #6599

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
85 changes: 85 additions & 0 deletions .github/workflows/chart-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Test Charts

# Controls when the workflow will run
on:
pull_request:
branches: [ "main", "branch-*" ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
source_changes:
- .github/workflows/**
- dev/charts/**
outputs:
source_changes: ${{ steps.filter.outputs.source_changes }}

lint-test:
needs: changes
if: needs.changes.outputs.source_changes == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/[email protected]

- uses: actions/[email protected]
with:
python-version: '3.x'
check-latest: true

- name: Install yamale
run: pip install yamale

- name: Install chart-testing
run: |
curl -LO https://github.com/helm/chart-testing/releases/download/v3.12.0/chart-testing_3.12.0_linux_amd64.tar.gz
tar -xzf chart-testing_3.12.0_linux_amd64.tar.gz
sudo mv ct /usr/local/bin/
ct version

- name: List changed
id: list-changed
run: |
changed=$(ct list-changed --chart-dirs=dev/charts --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Lint
if: steps.list-changed.outputs.changed == 'true'
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
ct lint --chart-dirs=dev/charts --target-branch ${{ github.event.repository.default_branch }} --chart-yaml-schema=dev/ci/chart_schema.yaml --lint-conf=dev/ci/lintconf.yaml

- name: Set up kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: container-tools/kind-action@v2
with:
version: v0.27.0
cluster_name: helm-test-cluster

- name: Set up kubectl
uses: azure/setup-kubectl@v4

- name: Run chart-testing (install default)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --chart-dirs=dev/charts --target-branch ${{ github.event.repository.default_branch }}

- name: Run chart-testing (install mysql enable)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --chart-dirs=dev/charts --helm-extra-set-args "--set=mysql.enabled=true" --target-branch ${{ github.event.repository.default_branch }}
4 changes: 4 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@
./authorizations/authorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/reference/VXUser.java
./authorizations/authorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/reference/VXUserList.java

Helm chart-testing
./dev/ci/chart_schema.yaml
./dev/ci/lintconf.yaml

This product bundles a third-party component under the
MIT License.

Expand Down
40 changes: 40 additions & 0 deletions dev/charts/gravitino/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
38 changes: 38 additions & 0 deletions dev/charts/gravitino/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
apiVersion: v2
appVersion: "0.9.0-incubating-SNAPSHOT"
description: Gravitino is a high-performance, geo-distributed, and federated metadata lake. It manages the metadata directly in different sources, types, and regions. It also provides users with unified metadata access for data and AI assets.
home: https://gravitino.apache.org
annotations:
licenses: Apache-2.0
dependencies:
- condition: mysql.enabled
name: mysql
repository: https://charts.bitnami.com/bitnami
version: 10.2.1
kubeVersion: '>=1.23.0-0'
maintainers:
- name: Gravitino
email: [email protected]
url: https://gravitino.apache.org
name: gravitino
sources:
- https://github.com/apache/gravitino
version: 0.1.0
112 changes: 112 additions & 0 deletions dev/charts/gravitino/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# gravitino

Gravitino is a high-performance, geo-distributed, and federated metadata lake. It manages the
metadata directly in
different sources, types, and regions. It also provides users with unified metadata access
for data and AI assets.

**Homepage:** <https://gravitino.apache.org/>

## Source Code

* <https://github.com/apache/gravitino>
* <https://github.com/apache/gravitino-playground>

## Values

| Key | Default | Description |
|---------------------|-------------------------------|-----------------------------------------------------------------------|
| image.repository | `"apache/gravitino"` | |
| image.tag | `"0.9.0-incubating-SNAPSHOT"` | |
| image.pullPolicy | `"IfNotPresent"` | |
| image.pullSecrets | `[] ` | Optionally specify secrets for pulling images from a private registry |
| mysql.enabled | `false` | Flag to enable MySQL as the storage backend for Gravitino |
| entity.jdbcUrl | `"jdbc:h2"` | The JDBC URL for the database |
| entity.jdbcDriver | `"org.h2.Driver"` | The JDBC driver class name |
| entity.jdbcUser | `"gravitino"` | The username for the JDBC connection |
| entity.jdbcPassword | `"gravitino"` | The password for the JDBC connection |
| env | `HADOOP_USER_NAME: hdfs ` | Environment variables to pass to the container |
| resources | `{} ` | esource requests and limits for the container |

## Deploy gravitino to your cluster

### Update chart dependency

```bash
cd charts/gravitino
helm dependency update
```

### Deploy with default config

```bash
helm upgrade --install gravitino ./gravitino -n gravitino --create-namespace
```

### Deploy with custom config

```bash
helm upgrade --install gravitino ./gravitino -n gravitino --create-namespace --set "key1=val1,key2=val2,..."
```

## Deploy gravitino and MySQL, MySQL is the gravitino storage backend

```bash
helm upgrade --install gravitino ./gravitino -n gravitino --create-namespace --set mysql.enabled=true
```

To disable dynamic provisioning (The default STORAGECLASS is local-path)

```bash
helm upgrade --install gravitino ./gravitino -n gravitino --create-namespace --set mysql.enabled=true --set global.defaultStorageClass="-"
```

## Deploy gravitino, use the existed MySQL as the gravitino storage backend

```bash
helm upgrade --install gravitino ./gravitino -n gravitino --create-namespace --set entity.jdbcUrl="jdbc:mysql://database-1.***.***.rds.amazonaws.com:3306/gravitino" --set entity.jdbcDriver="com.mysql.cj.jdbc.Driver" --set entity.jdbcUser=admin --set entity.jdbcPassword=admin123
```

## Others

To init the existed MySQL, run the following command:

```bash
mysql -h database-1.***.***.rds.amazonaws.com -P 3306 -u <YOUR-USERNAME> -p <YOUR-PASSWORD> < schema-0.*.0-mysql.sql
```

To see the "gravitino.conf", run the following command:

```bash
kubectl get cm gravitino -n gravitino -o json | jq -r '.data["gravitino.conf"]'
```

To uninstall the gravitino, run the following command:

```bash
helm uninstall gravitino -n gravitino
```

To package chart

```bash
helm package gravitino
```
33 changes: 33 additions & 0 deletions dev/charts/gravitino/resources/config/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

echo "Start to download the jar package of JDBC"
wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.27/mysql-connector-java-8.0.27.jar -O /root/gravitino/catalogs/jdbc-mysql/libs/mysql-connector-java-8.0.27.jar
wget https://jdbc.postgresql.org/download/postgresql-42.7.0.jar -O /root/gravitino/catalogs/jdbc-postgresql/libs/postgresql-42.7.0.jar
cp /root/gravitino/catalogs/jdbc-postgresql/libs/postgresql-42.7.0.jar /root/gravitino/catalogs/lakehouse-iceberg/libs
cp /root/gravitino/catalogs/jdbc-mysql/libs/mysql-connector-java-8.0.27.jar /root/gravitino/catalogs/lakehouse-iceberg/libs
cp /root/gravitino/catalogs/jdbc-mysql/libs/mysql-connector-java-8.0.27.jar /root/gravitino/libs
echo "Finish downloading"
cp /root/gravitino/tmp/conf/* /root/gravitino/conf
# Redirect log files to container stdout and stderr
ln -sf /dev/stdout /root/gravitino/logs/gravitino-server.log
ln -sf /dev/stderr /root/gravitino/logs/gravitino-server.out
echo "Start the Gravitino Server"
/bin/bash /root/gravitino/bin/gravitino.sh start
1 change: 1 addition & 0 deletions dev/charts/gravitino/resources/files/mysql
19 changes: 19 additions & 0 deletions dev/charts/gravitino/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- /*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/}}
The gravitino has been deployed to your cluster.
Loading