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

Add helm charts for training operator #2263

Open
wants to merge 2 commits into
base: master
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
46 changes: 46 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ endif
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec

## Location to install binaries
LOCALBIN ?= $(shell pwd)/bin

## Versions
HELM_VERSION ?= v3.15.3
HELM_DOCS_VERSION ?= v1.14.2

## Binaries
HELM ?= $(LOCALBIN)/helm-$(HELM_VERSION)
HELM_DOCS ?= $(LOCALBIN)/helm-docs-$(HELM_DOCS_VERSION)

all: build

##@ General
Expand Down Expand Up @@ -99,6 +110,12 @@ docker-build: test ## Build docker image with the manager.
docker-push: ## Push docker image with the manager.
docker push ${IMG}

##@ Helm

.PHONY: helm-docs
helm-docs: helm-docs-plugin ## Generates markdown documentation for helm charts from requirements and values files.
$(HELM_DOCS) --sort-values-order=file

##@ Deployment

install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
Expand All @@ -114,12 +131,41 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build manifests/overlays/standalone | kubectl delete -f -

##@ Dependencies

PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))

$(LOCALBIN):
mkdir -p $(LOCALBIN)

CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
GOBIN=$(PROJECT_DIR)/bin go install sigs.k8s.io/controller-tools/cmd/[email protected]

KUSTOMIZE = $(shell pwd)/bin/kustomize
kustomize: ## Download kustomize locally if necessary.
GOBIN=$(PROJECT_DIR)/bin go install sigs.k8s.io/kustomize/kustomize/[email protected]

.PHONY: helm
helm: $(HELM) ## Download helm locally if necessary.
$(HELM): $(LOCALBIN)
$(call go-install-tool,$(HELM),helm.sh/helm/v3/cmd/helm,$(HELM_VERSION))

.PHONY: helm-docs-plugin
helm-docs-plugin: $(HELM_DOCS) ## Download helm-docs plugin locally if necessary.
$(HELM_DOCS): $(LOCALBIN)
$(call go-install-tool,$(HELM_DOCS),github.com/norwoodj/helm-docs/cmd/helm-docs,$(HELM_DOCS_VERSION))

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary (ideally with version)
# $2 - package url which can be installed
# $3 - specific version of package
define go-install-tool
@[ -f $(1) ] || { \
set -e; \
package=$(2)@$(3) ;\
echo "Downloading $${package}" ;\
GOBIN=$(LOCALBIN) go install $${package} ;\
mv "$$(echo "$(1)" | sed "s/-$(3)$$//")" $(1) ;\
}
endef
39 changes: 39 additions & 0 deletions charts/training-operator/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.

ci/
.helmignore

# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/

# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~

# Various IDEs
*.tmproj
.project
.idea/
.vscode/

# MacOS
.DS_Store

# helm-unittest
tests
.debug
__snapshot__

# helm-docs
README.md.gotmpl
31 changes: 31 additions & 0 deletions charts/training-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Copyright 2024 The Kubeflow authors.
#
# Licensed 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
#
# https://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

name: training-operator

description: A Helm chart for deploying Kubeflow Training Operator on Kubernetes.

version: 1.8.1

appVersion: 1.8.1

keywords:
- kubeflow
- training operator

home: https://github.com/kubeflow/training-operator
94 changes: 94 additions & 0 deletions charts/training-operator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# training-operator

![Version: 1.8.1](https://img.shields.io/badge/Version-1.8.1-informational?style=flat-square) ![AppVersion: 1.8.1](https://img.shields.io/badge/AppVersion-1.8.1-informational?style=flat-square)

A Helm chart for deploying Kubeflow Training Operator on Kubernetes.

**Homepage:** <https://github.com/kubeflow/training-operator>

## Introduction

This chart bootstraps a [Kubeflow Training Operator](https://github.com/kubeflow/training-operator) deployment using the [Helm](https://helm.sh) package manager.

## Prerequisites

- Helm >= 3
- Kubernetes >= 1.20

## Usage

### Add Helm Repo

```shell
helm repo add training-operator https://kubeflow.github.io/training-operator

helm repo update
```

See [helm repo](https://helm.sh/docs/helm/helm_repo) for command documentation.

### Install the chart

```shell
helm install training-operator training-operator/training-operator \
--namespace kubeflow \
--create-namespace
```

Note that by passing the `--create-namespace` flag to the `helm install` command, `helm` will create the release namespace if it does not exist.

See [helm install](https://helm.sh/docs/helm/helm_install) for command documentation.

### Upgrade the chart

```shell
helm upgrade training-operator training-operator/training-operator [flags]
```

See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade) for command documentation.

### Uninstall the chart

```shell
helm uninstall training-operator --namespace kubeflow
```

This removes all the Kubernetes resources associated with the chart and deletes the release, except for the `crds`, those will have to be removed manually.

See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall) for command documentation.

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| nameOverride | string | `""` | String to partially override release name. |
| fullnameOverride | string | `""` | String to fully override release name. |
| commonLabels | object | `{}` | Common labels to add to the resources. |
| image.registry | string | `"docker.io"` | Image registry. |
| image.repository | string | `"kubeflow/training-operator"` | Image repository. |
| image.tag | string | If not set, the chart appVersion will be used. | Image tag. |
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy. |
| image.pullSecrets | list | `[]` | Image pull secrets for private image registry. |
| replicas | int | `1` | Number of replicas of training operator. |
| serviceAccount.create | bool | `true` | Specifies whether to create a service account for the training operator. |
| serviceAccount.name | string | `""` | Optional name for the training operator service account. |
| serviceAccount.annotations | object | `{}` | Extra annotations for the training operator service account. |
| rbac.create | bool | `true` | Specifies whether to create RBAC resources for the training operator. |
| rbac.annotations | object | `{}` | Extra annotations for the training operator RBAC resources. |
| service.type | string | `"ClusterIP"` | Service type. |
| service.port | int | `80` | Service port. |
| labels | object | `{}` | Extra labels for training operator pods. |
| annotations | object | `{}` | Extra annotations for training operator pods. |
| sidecars | list | `[]` | Sidecar containers for training operator pods. |
| volumes | list | `[]` | Volumes for training operator pods. |
| nodeSelector | object | `{}` | Node selector for training operator pods. |
| affinity | object | `{}` | Affinity for training operator pods. |
| tolerations | list | `[]` | List of node taints to tolerate for training operator pods. |
| priorityClassName | string | `""` | Priority class for training operator pods. |
| podSecurityContext | object | `{}` | Security context for training operator pods. |
| env | list | `[]` | Environment variables for training operator containers. |
| envFrom | list | `[]` | Environment variable sources for training operator containers. |
| volumeMounts | list | `[]` | Volume mounts for training operator containers. |
| resources | object | `{}` | Pod resource requests and limits for training operator pods. |
| securityContext | object | `{"allowPrivilegeEscalation":false}` | Security context for training operator containers. |

64 changes: 64 additions & 0 deletions charts/training-operator/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{{ template "chart.header" . }}

{{ template "chart.deprecationWarning" . }}

{{ template "chart.badgesSection" . }}

{{ template "chart.description" . }}

{{ template "chart.homepageLine" . }}

## Introduction

This chart bootstraps a [Kubeflow Training Operator]({{template "chart.homepage" . }}) deployment using the [Helm](https://helm.sh) package manager.

## Prerequisites

- Helm >= 3
- Kubernetes >= 1.20

## Usage

### Add Helm Repo

```shell
helm repo add training-operator https://kubeflow.github.io/training-operator

helm repo update
```

See [helm repo](https://helm.sh/docs/helm/helm_repo) for command documentation.

### Install the chart

```shell
helm install training-operator training-operator/training-operator \
--namespace kubeflow \
--create-namespace
```

Note that by passing the `--create-namespace` flag to the `helm install` command, `helm` will create the release namespace if it does not exist.

See [helm install](https://helm.sh/docs/helm/helm_install) for command documentation.

### Upgrade the chart

```shell
helm upgrade training-operator training-operator/training-operator [flags]
```

See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade) for command documentation.

### Uninstall the chart

```shell
helm uninstall training-operator --namespace kubeflow
```

This removes all the Kubernetes resources associated with the chart and deletes the release, except for the `crds`, those will have to be removed manually.

See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall) for command documentation.

{{ template "chart.valuesSection" . }}

{{ template "chart.maintainersSection" . }}
Loading
Loading