Skip to content

Commit

Permalink
feature: add Helm chart for jobset (#785)
Browse files Browse the repository at this point in the history
* [Helm] add helm chart for jobset

* Update jobset Helm chart

Signed-off-by: Yi Chen <[email protected]>

* Use jobset config api

Signed-off-by: Yi Chen <[email protected]>

* Simplify values to keep a min of set of params

Signed-off-by: Yi Chen <[email protected]>

* Update jobset Helm chart

Signed-off-by: Yi Chen <[email protected]>

* Update license

Signed-off-by: Yi Chen <[email protected]>

---------

Signed-off-by: Yi Chen <[email protected]>
Co-authored-by: Simo Lin <[email protected]>
  • Loading branch information
ChenYi015 and slin1237 authored Feb 19, 2025
1 parent 943da8b commit 9308c01
Show file tree
Hide file tree
Showing 33 changed files with 11,224 additions and 32 deletions.
100 changes: 68 additions & 32 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ SHELL = /usr/bin/env bash -o pipefail
INTEGRATION_TARGET ?= ./test/integration/...

PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
JOBSET_CHART_DIR := charts/jobset

E2E_TARGET ?= ./test/e2e/...
E2E_KIND_VERSION ?= kindest/node:v1.30.0
Expand Down Expand Up @@ -199,21 +200,69 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f -

##@ Build Dependencies
##@ Helm
.PHONY: helm-unittest
helm-unittest: helm-unittest-plugin ## Run Helm chart unittests.
$(HELM) unittest $(JOBSET_CHART_DIR) --strict --file "tests/**/*_test.yaml"

.PHONY: helm-lint
helm-lint: ## Run Helm chart lint test.
docker run --rm --workdir /workspace --volume "$$(pwd):/workspace" quay.io/helmpack/chart-testing:latest ct lint --target-branch main --validate-maintainers=false

.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

##@ Release
.PHONY: artifacts
artifacts: kustomize
cd config/components/manager && $(KUSTOMIZE) edit set image controller=${IMAGE_TAG}
if [ -d artifacts ]; then rm -rf artifacts; fi
mkdir -p artifacts
$(KUSTOMIZE) build config/default -o artifacts/manifests.yaml
$(KUSTOMIZE) build config/prometheus -o artifacts/prometheus.yaml
@$(call clean-manifests)

GOLANGCI_LINT = $(PROJECT_DIR)/bin/golangci-lint
.PHONY: golangci-lint
golangci-lint: ## Download golangci-lint locally if necessary.
@GOBIN=$(PROJECT_DIR)/bin GO111MODULE=on $(GO_CMD) install github.com/golangci/golangci-lint/cmd/[email protected]

GOTESTSUM = $(shell pwd)/bin/gotestsum
.PHONY: gotestsum
gotestsum: ## Download gotestsum locally if necessary.
@GOBIN=$(PROJECT_DIR)/bin GO111MODULE=on $(GO_CMD) install gotest.tools/[email protected]


.PHONY: generate-apiref
generate-apiref: genref
cd $(PROJECT_DIR)/hack/genref/ && $(GENREF) -o $(PROJECT_DIR)/site/content/en/docs/reference

GENREF = $(PROJECT_DIR)/bin/genref
.PHONY: genref
genref: ## Download genref locally if necessary.
@GOBIN=$(PROJECT_DIR)/bin $(GO_CMD) install github.com/kubernetes-sigs/reference-docs/[email protected]

##@ Dependencies

## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)

## Tool Versions
KUSTOMIZE_VERSION ?= v3.8.7
CONTROLLER_TOOLS_VERSION ?= v0.16.2
HELM_VERSION ?= v3.17.1
HELM_UNITTEST_VERSION ?= 0.7.2
HELM_DOCS_VERSION ?= v1.14.2

## Tool Binaries
KUSTOMIZE ?= $(LOCALBIN)/kustomize
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest

## Tool Versions
KUSTOMIZE_VERSION ?= v3.8.7
CONTROLLER_TOOLS_VERSION ?= v0.16.2
HELM ?= $(ARTIFACTS)/helm
HELM_DOCS ?= $(ARTIFACTS)/helm-docs

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
Expand Down Expand Up @@ -282,32 +331,19 @@ test-e2e-kind: manifests kustomize fmt vet envtest ginkgo kind-image-build
prometheus:
kubectl apply --server-side -k config/prometheus

##@ Release
.PHONY: artifacts
artifacts: kustomize
cd config/components/manager && $(KUSTOMIZE) edit set image controller=${IMAGE_TAG}
if [ -d artifacts ]; then rm -rf artifacts; fi
mkdir -p artifacts
$(KUSTOMIZE) build config/default -o artifacts/manifests.yaml
$(KUSTOMIZE) build config/prometheus -o artifacts/prometheus.yaml
@$(call clean-manifests)

GOLANGCI_LINT = $(PROJECT_DIR)/bin/golangci-lint
.PHONY: golangci-lint
golangci-lint: ## Download golangci-lint locally if necessary.
@GOBIN=$(PROJECT_DIR)/bin GO111MODULE=on $(GO_CMD) install github.com/golangci/golangci-lint/cmd/[email protected]

GOTESTSUM = $(shell pwd)/bin/gotestsum
.PHONY: gotestsum
gotestsum: ## Download gotestsum locally if necessary.
@GOBIN=$(PROJECT_DIR)/bin GO111MODULE=on $(GO_CMD) install gotest.tools/[email protected]

.PHONY: helm
helm: $(HELM) ## Download helm locally if necessary.
$(HELM): $(LOCALBIN)
GOBIN=$(LOCALBIN) $(GO_CMD) install helm.sh/helm/v3/cmd/helm@$(HELM_VERSION)

.PHONY: generate-apiref
generate-apiref: genref
cd $(PROJECT_DIR)/hack/genref/ && $(GENREF) -o $(PROJECT_DIR)/site/content/en/docs/reference
.PHONY: helm-unittest-plugin
helm-unittest-plugin: helm ## Download helm unittest plugin locally if necessary.
if [ -z "$(shell $(HELM) plugin list | grep unittest)" ]; then \
echo "Installing helm unittest plugin"; \
$(HELM) plugin install https://github.com/helm-unittest/helm-unittest.git --version $(HELM_UNITTEST_VERSION); \
fi

GENREF = $(PROJECT_DIR)/bin/genref
.PHONY: genref
genref: ## Download genref locally if necessary.
@GOBIN=$(PROJECT_DIR)/bin $(GO_CMD) install github.com/kubernetes-sigs/reference-docs/[email protected]
.PHONY: helm-docs-plugin
helm-docs-plugin: $(HELM_DOCS) ## Download helm-docs plugin locally if necessary.
$(HELM_DOCS): $(LOCALBIN)
GOBIN=$(LOCALBIN) $(GO_CMD) install github.com/norwoodj/helm-docs/cmd/helm-docs@$(HELM_DOCS_VERSION)
39 changes: 39 additions & 0 deletions charts/jobset/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#
# Copyright 2025 The Kubernetes 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: jobset

description: A Helm chart for deploying JobSet controller and webhook on Kubernetes.

type: application

version: 0.7.3

keywords:
- kubernetes
- batch
- jobset

home: https://github.com/kubernetes-sigs/jobset

maintainers:
- name: ahg-g
url: https://github.com/ahg-g
- name: danielvegamyhre
url: https://github.com/danielvegamyhre
- name: kannon92
url: https://github.com/kannon92
92 changes: 92 additions & 0 deletions charts/jobset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# jobset

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

A Helm chart for deploying JobSet controller and webhook on Kubernetes.

**Homepage:** <https://github.com/kubernetes-sigs/jobset>

## Introduction

This Helm chart installs the JobSet controller and webhook to your Kubernetes cluster. JobSet is a Kubernetes controller that manages groups of related Jobs as a single unit.

## Prerequisites

- Helm >= 3
- Kubernetes >= 1.27

## Usage

### Install the chart

```shell
helm install [RELEASE_NAME] charts/jobset
```

For example, if you want to create a release with name `jobset` in the `jobset-system` namespace:

```shell
helm install jobset charts/jobset \
--namespace jobset-system \
--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 [RELEASE_NAME] charts/jobset-system [flags]
```

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

### Uninstall the chart

```shell
helm uninstall [RELEASE_NAME]
```

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 jobset resources. |
| image.registry | string | `"registry.k8s.io"` | Image registry. |
| image.repository | string | `"jobset/jobset"` | Image repository. |
| image.tag | string | If not set, the chart version will be used. | Image tag. |
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy. |
| image.pullSecrets | list | `[]` | Image pull secrets for private image registry. |
| controller.replicas | int | `1` | Replicas of the jobset controller deployment. |
| controller.leaderElection.enable | bool | `true` | Whether to enable leader election for jobset controller. |
| controller.clientConnection.qps | int | `500` | QPS is the number of queries per second allowed for K8S api server connection. |
| controller.clientConnection.burst | int | `500` | Burst allows extra queries to accumulate when a client is exceeding its rate. |
| controller.env | list | `[]` | Environment variables of the jobset controller container. |
| controller.envFrom | list | `[]` | Environment variable sources of the jobset controller container. |
| controller.volumeMounts | list | `[]` | Volume mounts of the jobset controller container. |
| controller.resources | object | `{"limits":{"cpu":2,"memory":"4Gi"},"requests":{"cpu":"500m","memory":"128Mi"}}` | Resources of the jobset controller container. |
| controller.securityContext | object | `{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]}}` | Security context of the jobset controller container. |
| controller.volumes | list | `[]` | Volumes of the jobset controller pods. |
| controller.nodeSelector | object | `{}` | Node selector of the jobset controller pods. |
| controller.affinity | object | `{}` | Affinity of the jobset controller pods. |
| controller.tolerations | list | `[]` | Tolerations of the jobset controller pods. |
| controller.podSecurityContext | object | `{"runAsNonRoot":true,"seccompProfile":{"type":"RuntimeDefault"}}` | Security context of the jobset controller pods. |
| certManager.enable | bool | `false` | Whether to use cert-manager to generate certificates for the jobset webhook. |
| certManager.issuerRef | object | `{}` | The reference to the issuer. If empty, self-signed issuer will be created and used. |
| prometheus.enable | bool | `true` | Whether to enable Prometheus metrics exporting. |

## Maintainers

| Name | Url |
| ---- | --- |
| ahg-g | <https://github.com/ahg-g> |
| danielvegamyhre | <https://github.com/danielvegamyhre> |
| kannon92 | <https://github.com/kannon92> |
85 changes: 85 additions & 0 deletions charts/jobset/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{{- /*
Copyright 2025 The Kubernetes 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.
*/ -}}

{{ template "chart.header" . }}

{{ template "chart.deprecationWarning" . }}

{{ template "chart.badgesSection" . }}

{{ template "chart.description" . }}

{{ template "chart.homepageLine" . }}

## Introduction

This Helm chart installs the JobSet controller and webhook to your Kubernetes cluster. JobSet is a Kubernetes controller that manages groups of related Jobs as a single unit.


## Prerequisites

- Helm >= 3
- Kubernetes >= 1.27

## Usage

### Install the chart

```shell
helm install [RELEASE_NAME] charts/jobset
```

For example, if you want to create a release with name `jobset` in the `jobset-system` namespace:

```shell
helm install jobset charts/jobset \
--namespace jobset-system \
--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 [RELEASE_NAME] charts/jobset-system [flags]
```

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

### Uninstall the chart

```shell
helm uninstall [RELEASE_NAME]
```

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" . }}

{{- define "chart.maintainersTable" -}}
| Name | Url |
| ---- | --- |
{{- range .Maintainers }}
| {{ .Name }} | {{ if .Url }}<{{ .Url }}>{{ end }} |
{{- end }}
{{- end }}

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

0 comments on commit 9308c01

Please sign in to comment.