Skip to content

Commit

Permalink
Update jobset chart
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Chen <[email protected]>
  • Loading branch information
ChenYi015 committed Feb 17, 2025
1 parent e4cf89d commit 3a3e55f
Show file tree
Hide file tree
Showing 47 changed files with 3,110 additions and 1,266 deletions.
113 changes: 82 additions & 31 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 master --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_VERSION)
HELM_DOCS ?= $(ARTIFACTS)/helm-docs-$(HELM_DOCS_VERSION)

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
Expand Down Expand Up @@ -282,32 +331,34 @@ 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)
$(call go-install-tool,$(HELM),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)
$(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
36 changes: 30 additions & 6 deletions charts/jobset/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
#
# 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 JobSet Controller

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

type: application

version: 0.1.0
appVersion: "0.7.2"

appVersion: 0.7.3

keywords:
- kubernetes
- jobset
- batch
- kubernetes
- batch
- jobset

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

maintainers:
- name: Kubernetes SIG Batch
- name: Kubernetes SIG Batch
172 changes: 104 additions & 68 deletions charts/jobset/README.md
Original file line number Diff line number Diff line change
@@ -1,74 +1,110 @@
# JobSet Helm Chart
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square)
# jobset

This Helm chart installs the JobSet Controller in your Kubernetes cluster. JobSet is a Kubernetes controller that manages groups of related Jobs as a single unit.
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.7.3](https://img.shields.io/badge/AppVersion-0.7.3-informational?style=flat-square)

## Installing the Chart
A Helm chart for deploying JobSet controller and webhook on Kubernetes.

To install the chart with the release name `jobset`:
**Homepage:** <https://github.com/kubernetes-sigs/jobset>

```bash
helm install jobset ./charts/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.20

## Usage

### Install the chart

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

## Configuration

| Key | Type | Default | Description |
|-------------------------------------------|--------|------------------------------|-------------|
| affinity | object | `{}` | |
| certManager.certificate.duration | string | `"8760h"` | |
| certManager.certificate.renewBefore | string | `"720h"` | |
| certManager.enabled | bool | `true` | |
| crds.enabled | bool | `true` | |
| crds.install | bool | `true` | |
| fullnameOverride | string | `""` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"jobset-controller"` | |
| image.tag | string | `""` | |
| imagePullSecrets | list | `[]` | |
| leaderElection.enabled | bool | `true` | |
| leaderElection.resourceName | string | `"jobset-leader-election"` | |
| manager.healthProbe.livenessInitialDelay | int | `15` | |
| manager.healthProbe.livenessPath | string | `"/healthz"` | |
| manager.healthProbe.livenessTimeout | int | `30` | |
| manager.healthProbe.port | int | `8081` | |
| manager.healthProbe.readinessInitialDelay | int | `5` | |
| manager.healthProbe.readinessPath | string | `"/readyz"` | |
| manager.healthProbe.readinessTimeout | int | `30` | |
| metrics.enabled | bool | `true` | |
| metrics.service.port | int | `8443` | |
| metrics.service.type | string | `"ClusterIP"` | |
| metrics.serviceMonitor.enabled | bool | `false` | |
| metrics.serviceMonitor.interval | string | `"30s"` | |
| metrics.serviceMonitor.labels | object | `{}` | |
| metrics.serviceMonitor.scrapeTimeout | string | `"10s"` | |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | |
| podSecurityContext.runAsNonRoot | bool | `true` | |
| podSecurityContext.seccompProfile.type | string | `"RuntimeDefault"` | |
| rbac.create | bool | `true` | |
| rbac.createAggregateRoles | bool | `true` | |
| replicaCount | int | `1` | |
| resources.limits.cpu | int | `2` | |
| resources.limits.memory | string | `"512Mi"` | |
| resources.requests.cpu | string | `"500m"` | |
| resources.requests.memory | string | `"128Mi"` | |
| securityContext.allowPrivilegeEscalation | bool | `false` | |
| securityContext.capabilities.drop[0] | string | `"ALL"` | |
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `""` | |
| tolerations | list | `[]` | |
| webhook.certManager.enabled | bool | `true` | |
| webhook.certManager.issuerGroup | string | `"cert-manager.io"` | |
| webhook.certManager.issuerKind | string | `"Issuer"` | |
| webhook.certManager.issuerName | string | `"jobset-selfsigned-issuer"` | |
| webhook.enabled | bool | `true` | |
| webhook.mutatingWebhook.failurePolicy | string | `"Fail"` | |
| webhook.mutatingWebhook.timeoutSeconds | int | `10` | |
| webhook.port | int | `9443` | |
| webhook.service.port | int | `443` | |
| webhook.service.type | string | `"ClusterIP"` | |
| webhook.validatingWebhook.failurePolicy | string | `"Fail"` | |
| webhook.validatingWebhook.timeoutSeconds | int | `10` | |
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 appVersion 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.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":"512Mi"},"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.labels | object | `{}` | Common labels of the jobset controller resources. |
| controller.annotations | object | `{}` | Common annotations of the jobset controller resources. |
| 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. |
| controller.serviceAccount.create | bool | `true` | Whether to create a service account for the jobset controller. |
| controller.serviceAccount.name | string | `""` | |
| controller.serviceAccount.annotations | object | `{}` | |
| controller.rbac.create | bool | `true` | Whether to create RBAC resources for the jobset controller. |
| controller.rbac.createAggregateRoles | bool | `true` | |
| webhook.enable | bool | `true` | Specifies whether to enable jobset webhook. |
| webhook.service.type | string | `"ClusterIP"` | Specifies the type of the jobset webhook service. |
| webhook.service.port | int | `443` | Specifies the port of the jobset webhook service. |
| webhook.mutate.timeoutSeconds | int | `10` | Specifies the timeout seconds of the jobset mutating webhook. |
| webhook.mutate.failurePolicy | string | `"Fail"` | Specifies the failure policy of the jobset mutating webhook. |
| webhook.validate.timeoutSeconds | int | `10` | Specifies the timeout seconds of the jobset validating webhook. |
| webhook.validate.failurePolicy | string | `"Fail"` | Specifies the failure policy of the jobset validating webhook. |
| webhook.certManager.enable | bool | `false` | Whether to use cert-manager to generate certificates for the jobset webhook. |
| webhook.certManager.issuerRef | object | `{}` | The reference to the issuer. |
| webhook.certManager.duration | string | `"8760h"` | The duration of the certificate validity. |
| webhook.certManager.renewBefore | string | `"720h"` | The duration before the certificate expiration to renew the certificate. |
| metrics.enable | bool | `true` | Specifies whether to enable Prometheus metrics exporting. |
| metrics.service.type | string | `"ClusterIP"` | Specifies the type of the Prometheus metrics service. |
| metrics.service.port | int | `8443` | Specifies the port of the Prometheus metrics service. |
| metrics.serviceMonitor.enable | bool | `false` | Specifies whether to create a Prometheus ServiceMonitor. |
| metrics.serviceMonitor.interval | string | `"30s"` | |
| metrics.serviceMonitor.scrapeTimeout | string | `"10s"` | |
| metrics.serviceMonitor.labels | object | `{}` | |

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| Kubernetes SIG Batch | | |
Loading

0 comments on commit 3a3e55f

Please sign in to comment.