Skip to content

Commit

Permalink
feat(cdl): add helm charts support
Browse files Browse the repository at this point in the history
  • Loading branch information
HoKim98 committed Nov 15, 2024
1 parent 71235a3 commit ec788cd
Show file tree
Hide file tree
Showing 22 changed files with 520 additions and 2 deletions.
23 changes: 23 additions & 0 deletions charts/cdl-dataset/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
13 changes: 13 additions & 0 deletions charts/cdl-dataset/.schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
input:
- values.yaml

draft: 2020
indent: 2
output: values.schema.json

schemaRoot:
id: https://smartx-team.github.io/mobilex-api/charts/nvidia-isaac-sim
title: NVIDIA Issac-Sim Schema
description: Schema for NVIDIA Issac-Sim Helm Chart
additionalProperties: true
25 changes: 25 additions & 0 deletions charts/cdl-dataset/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
apiVersion: v2
name: cdl-dataset
description: Convenient Connected Data Lake Dataset instance deployment tool

# 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.1.0

# 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: "latest-devel"
30 changes: 30 additions & 0 deletions charts/cdl-dataset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Connected Data Lake Dataset instance Helm Chart

## Usage

```bash
# Register the MobileX API repository
helm repo add mobilex "https://smartx-team.github.io/mobilex-api"

# Deploy a Connected Data Lake Dataset instance
NAME="my-dataset-hoya-123" # TODO: Change it to your unique app name
helm install $NAME "mobilex/cdl-dataset" \
--namespace "name-twin"
```

## Uninstall

```bash
NAME="my-dataset-hoya-123" # TODO: Change it to your app name
helm uninstall $NAME --namespace "name-twin"
```

## Validating

```bash
# Install json schema generator
helm plugin install "https://github.com/losisin/helm-values-schema-json.git"

# Create a json schema
helm schema
```
1 change: 1 addition & 0 deletions charts/cdl-dataset/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Installed!
51 changes: 51 additions & 0 deletions charts/cdl-dataset/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "cdl-dataset.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 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 "cdl-dataset.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "cdl-dataset.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "cdl-dataset.labels" -}}
helm.sh/chart: {{ include "cdl-dataset.chart" . }}
{{ include "cdl-dataset.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "cdl-dataset.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cdl-dataset.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
11 changes: 11 additions & 0 deletions charts/cdl-dataset/templates/model.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if eq .Values.claim.enabled false }}
---
apiVersion: dash.ulagbulag.io/v1alpha1
kind: Model
metadata:
name: {{ .Release.Name }}
labels:
{{- include "cdl-dataset.labels" . | nindent 4 }}
spec:
dynamic: {}
{{- end }}
23 changes: 23 additions & 0 deletions charts/cdl-dataset/templates/model_claim.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if eq .Values.claim.enabled true }}
---
apiVersion: dash.ulagbulag.io/v1alpha1
kind: ModelClaim
metadata:
name: {{ .Release.Name }}
labels:
{{- include "cdl-dataset.labels" . | nindent 4 }}
spec:
affinity:
{{- toYaml .Values.claim.affinity | nindent 4 }}
allowReplacement:
{{- toYaml .Values.claim.allowReplacement | nindent 4 }}
bindingPolicy:
{{- toYaml .Values.claim.bindingPolicy | nindent 4 }}
deletionPolicy:
{{- toYaml .Values.deletionPolicy | nindent 4 }}
resources:
{{- toYaml .Values.claim.resources | nindent 4 }}
storage: ObjectStorage
storageName:
{{- toYaml .Values.static.targetStorageName | nindent 4 }}
{{- end }}
36 changes: 36 additions & 0 deletions charts/cdl-dataset/templates/model_storage_binding.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{{- if eq .Values.claim.enabled false }}
---
apiVersion: dash.ulagbulag.io/v1alpha1
kind: ModelStorageBinding
metadata:
name: {{ .Release.Name }}
labels:
{{- include "cdl-dataset.labels" . | nindent 4 }}
spec:
deletionPolicy:
{{- toYaml .Values.deletionPolicy | nindent 4 }}
model: {{ .Release.Name }}
resources:
{{- toYaml .Values.claim.resources | nindent 4 }}
storage:
{{- if .Values.static.sourceStorageName }}
cloned:
{{- else }}
owned:
{{- end }}
{{- if .Values.static.sourceStorageName }}
source:
{{- toYaml .Values.static.sourceStorageName | nindent 8 }}
sourceBindingName:
{{- toYaml .Values.static.sourceBindingName | nindent 8 }}
{{- end }}
target:
{{- toYaml .Values.static.targetStorageName | nindent 8 }}
{{- if .Values.static.sourceStorageName }}
syncPolicy:
pull:
{{- toYaml .Values.static.syncPolicy.pull | nindent 10 }}
push:
{{- toYaml .Values.static.syncPolicy.push | nindent 10 }}
{{- end }}
{{- end }}
47 changes: 47 additions & 0 deletions charts/cdl-dataset/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
# Default values for cdl-dataset.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

clusterName: ops.openark
nameOverride: ""
fullnameOverride: ""

claim:
# whether to enable connected data lake's auto-select feature
enabled: true

affinity:
placementAffinity:
preferred: []
required: []
replacementAffinity:
preferred: []
required: []

allowReplacement: true

# binding policy presets
# options: ["Balanced", "LowestCopy", "LowestLatency"]
bindingPolicy: LowestCopy

# options: ["Retain", "Delete"]
deletionPolicy: Delete

resources:
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
requests:
storage: 1Ti

static:
sourceBindingName: null
sourceStorageName: null
targetStorageName: null
syncPolicy:
# options: ["Always", "OnCreate", "Never"]
pull: Never
# options: ["Always", "OnDelete", "Never"]
push: Never
23 changes: 23 additions & 0 deletions charts/data-pond/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
13 changes: 13 additions & 0 deletions charts/data-pond/.schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
input:
- values.yaml

draft: 2020
indent: 2
output: values.schema.json

schemaRoot:
id: https://smartx-team.github.io/mobilex-api/charts/nvidia-isaac-sim
title: NVIDIA Issac-Sim Schema
description: Schema for NVIDIA Issac-Sim Helm Chart
additionalProperties: true
25 changes: 25 additions & 0 deletions charts/data-pond/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
apiVersion: v2
name: data-pond
description: Convenient Data Pond instance deployment tool

# 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.1.0

# 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: "latest-devel"
30 changes: 30 additions & 0 deletions charts/data-pond/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Data Pond instance Helm Chart

## Usage

```bash
# Register the MobileX API repository
helm repo add mobilex "https://smartx-team.github.io/mobilex-api"

# Deploy a Data Pond storage instance
NAME="my-storage-hoya-123" # TODO: Change it to your unique app name
helm install $NAME "mobilex/data-pond" \
--namespace "name-twin"
```

## Uninstall

```bash
NAME="my-storage-hoya-123" # TODO: Change it to your app name
helm uninstall $NAME --namespace "name-twin"
```

## Validating

```bash
# Install json schema generator
helm plugin install "https://github.com/losisin/helm-values-schema-json.git"

# Create a json schema
helm schema
```
1 change: 1 addition & 0 deletions charts/data-pond/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Installed!
Loading

0 comments on commit ec788cd

Please sign in to comment.