cube
by lvauvillier
A Helm chart for Cube
About this chart
Cube Chart
Table of Contents
- Get Started
- Install Chart
- Uninstall Chart
- Upgrading Chart
- Configuration
- Injecting schema
- Injecting javascript config
- Fix duplicate schemas issue
- Examples
- Reference
- Global parameters
- Image parameters
- Config parameters
- JWT parameters
- Datasources configuration
- Common parameters
- Athena parameters
- Bigquery parameters
- Databricks parameters
- DuckDB parameters
- ClickHouse parameters
- Firebolt parameters
- Hive parameters
- Materialize parameters
- Presto parameters
- Snowflake parameters
- Trino parameters
- ksqlDB parameters
- MSSQL parameters
- MySQL parameters
- Pinot parameters
- Redshift parameters
- Api instance parameters
- Refresh worker parameters
- Ingress parameters
Get Started
helm repo add gadsme https://gadsme.github.io/charts
helm repo update
See helm repo for command documentation.
Install Chart
helm install [RELEASE_NAME] gadsme/cube --set [CONFIGURATION]
The command deploys Cube on the Kubernetes cluster using the default configuration.
See configuration below.
See helm install for command documentation.
Uninstall Chart
helm uninstall [RELEASE_NAME]
This removes all the Kubernetes components associated with the chart and deletes the release.
See helm uninstall for command documentation.
Upgrading Chart
helm upgrade [RELEASE_NAME] gadsme/cube --install
Configuration
By default an api instance and one worker will be deployed. You can customize the deployment using helm values.
Refer to the official documentation for more information: https://cube.dev/docs/reference/environment-variables
Injecting schema
To inject your schema files in the deployment you have to use config.volumes and config.volumeMounts values.
Mount path is /cube/conf/schema by default and can be customized with the config.schemaPath value.
A good practice is to use a ConfigMap to store your all the cube definition files:
apiVersion: v1
kind: ConfigMap
metadata:
name: cube-schema
data:
Cube1.js: |
cube(`Cube1`, {
sql: `SELECT * FROM cube1_data`,
measures: {
count: {
type: `count`,
},
},
});
Cube2.js: |
cube(`Cube2`, {
sql: `SELECT * FROM cube2_data`,
measures: {
count: {
type: `count`,
},
},
});
or using a template:
apiVersion: v1
kind: ConfigMap
metadata:
name: cube-schema
data:
{{ (.Files.Glob "schema/**.js").AsConfig | indent 2 }}
Injecting javascript config
To inject a javascript config in the deployment you can use config.volumes and config.volumeMounts values.
Mount path is /cube/conf/
Fix duplicate schemas issue
When you mount a secret or configmap as volume, the path at which Kubernetes will mount it will contain the root level items symlinking the same names into a ..data directory, which is symlink to real mountpoint.
As cube will recursively browse the schema folder, it will found duplicate schemas.
To fix this issue you can mount each schema files using a subPath or change the default behavior using your own repositoryFactory:
const path = require("path");
const fs = require("fs");
module.exports = {
repositoryFactory: () => ({
dataSchemaFiles: async () => {
const files = await fs.promises.readdir(
path.join(process.cwd(), "schema")
);
return await Promise.all(
files
.filter((file) => file.endsWith(".js") || file.endsWith(".yaml"))
.map(async (file) => ({
fileName: file,
content: await fs.promises.readFile(
path.join(process.cwd(), "schema", file),
"utf-8"
),
}))
);
},
}),
};
Examples
Deployment with:
- BigQuery db with export Bucket on GCS
- Schema located in a
cube-schemaConfigMap - Cubestore
$ helm install my-release -f values.yaml gadsme/cube
# values.yaml
config:
volumes:
- name: schema
configMap:
name: cube-schema
volumeMounts:
- name: schema
readOnly: true
mountPath: /cube/conf/schema
datasources:
default:
type: bigquery
export:
type: gcp
name: <bucket-name>
gcsCredentialsFromSecret:
name: <service-account-secret-name>
key: <service-account-secret-key>
bigquery:
projectId: <project-id>
credentialsFromSecret:
name: <service-account-secret-name>
key: <service-account-secret-key>
cubestore:
host: <cubestore-host>
Multiple datasources sample:
# values.yaml
config:
volumes:
- name: schema
configMap:
name: cube-schema
volumeMounts:
- name: schema
readOnly: true
mountPath: /cube/conf/schema
datasources:
default:
type: bigquery
export:
type: gcp
name: <bucket-name>
gcsCredentialsFromSecret:
name: <service-account-secret-name>
key: <service-account-secret-key>
bigquery:
projectId: <project-id>
credentialsFromSecret:
name: <service-account-secret-name>
key: <service-account-secret-key>
postgres:
type: postgres
host: <postgres-host>
name: <postgres-database>
user: <postgres-user>
passFromSecret:
name: <postgres-password-secret-name>
key: <postgres-password-secret-key>
cubestore:
host: <cubestore-host>
Reference
Global parameters
| Name | Description | Value |
|---|---|---|
nameOverride | Override the name | "" |
fullnameOverride | Provide a name to substitute for the full names of resources | "" |
commonLabels | Labels to add to all deployed objects | {} |
commonAnnotations | Annotations to add to all deployed objects | {} |
extraEnvVars | Extra environment variables to pass on to all pods. The value is evaluated as a template | [] |
extraEnvVarsFromConfigMap | Name of a Config Map containing extra environment variables to pass on to all pods | |
extraEnvVarsFromSecret | Name of a Secret containing extra environment variables to pass on to all pods |
Image parameters
| Name | Description | Value |
|---|---|---|
image.repository | Cube image repository | cubejs/cube |
image.tag | Cube image tag (immutable tags are recommended) | 1.2.0 |
image.pullPolicy | Cube image pull policy | IfNotPresent |
image.pullSecrets | If defined, uses a Secret to pull an image from a private Docker registry or repository | [] |
Config parameters
| Name | Description | Value |
|---|---|---|
config.apiPort | The port for a Cube deployment to listen to API connections on | 4000 |
config.pgSqlPort | The port to listen to Postgres-compatible connections on | |
config.sqlSuperUser | The superuser name to access the SQL api | |
config.sqlUser | The username to access the SQL api | |
config.sqlPassword | The password to access the SQL api | |
config.sqlPasswordFromSecret.name | The password to access the SQL api (using secret) | |
config.sqlPasswordFromSecret.key | The password to access the SQL api (using secret) | |
config.devMode | If true, enables development mode | false |
config.debug | If true, enables debug logging | false |
config.logLevel | The logging level for Cube | warn |
config.telemetry | If true, then send telemetry to Cube | false |
config.apiSecret | The secret key used to sign and verify JWTs. Generated on project scaffold | |
config.apiSecretFromSecret.name | The secret key used to sign and verify JWTs. Generated on project scaffold (using secret) | |
config.apiSecretFromSecret.key | The secret key used to sign and verify JWTs. Generated on project scaffold (using secret) | |
config.defaultApiScopes | API scopes used to allow or disallow access to REST API endpoints. | |
config.Values.config.playgroundAuthSecret | The secret key used to enable system APIs | |
config.Values.config.playgroundAuthSecretFromSecret.name | The secret key used to enable system APIs (using secret) | |
config.Values.config.playgroundAuthSecretFromSecret.key | The secret key used to enable system APIs (using secret) | |
config.schemaPath | The path where Cube loads schemas from. Defaults to schema | |
config.app | An application ID used to uniquely identify the Cube deployment. Can be different for multitenant setups. Defaults to cubejs | |
config.rollupOnly | If true, this instance of Cube will only query rollup pre-aggregations. Defaults to false | |
config.scheduledRefreshTimezones | A comma-separated list of timezones to schedule refreshes for | |
config.scheduledRefreshQueriesPerAppId |
Deploy cube with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has cube on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartcube is pinned at v4.0.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply