Skip to content

Commit

Permalink
feat: add kube-scheduler helm chart (#6)
Browse files Browse the repository at this point in the history
* feat: add kube-scheduler helm chart

* fix: remove service
  • Loading branch information
rohank-deepsource authored Aug 16, 2023
1 parent aa6d704 commit 26763e4
Show file tree
Hide file tree
Showing 14 changed files with 631 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/kube-scheduler/.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/
24 changes: 24 additions & 0 deletions charts/kube-scheduler/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: kube-scheduler
description: Helm Chart for the Kubernetes Scheduler

# 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: 1.0.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: "v1.24.13"
32 changes: 32 additions & 0 deletions charts/kube-scheduler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Parameters

### kube-scheduler configuration parameters

| Name | Description | Value |
| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| `config` | The configuration values for kube-scheduler. Ref: https://kubernetes.io/docs/reference/config-api/kube-scheduler-config.v1beta3/ | `nil` |
| `replicaCount` | Number of kube-scheduler pods to run (if running in HA mode, enable `leaderElection` in config) | `1` |
| `image.repository` | The repository to use for the kube-scheduler image | `registry.k8s.io/kube-scheduler` |
| `image.pullPolicy` | The pull policy for the kube-scheduler image | `IfNotPresent` |
| `image.tag` | The tag for the kube-scheduler image | `v1.24.13` |
| `imagePullSecrets` | Specify docker-registry secret names as an array | `[]` |
| `nameOverride` | String to partially override kube-scheduler.name | `""` |
| `fullnameOverride` | String to partially override kube-scheduler.name | `""` |
| `serviceAccount.create` | Specifies whether a ServiceAccount should be created | `true` |
| `serviceAccount.annotations` | Annotations for service account. Evaluated as a template. Only used if `create` is `true`. | `{}` |
| `serviceAccount.name` | Name of the service account to use. If not set and create is true, a name is generated using the fullname template. | `""` |
| `podAnnotations` | Annotations for the kube-scheduler pods | `{}` |
| `podSecurityContext` | Security context policies to add to the kube-scheduler pods | `{}` |
| `securityContext` | Security context policies to add to the containers | `{}` |
| `resources.limits.cpu` | The resources limits for the kube-scheduler containers | `100m` |
| `resources.limits.memory` | The resources limits for the kube-scheduler containers | `128Mi` |
| `resources.requests.cpu` | The requested cpu for the kube-scheduler containers | `100m` |
| `resources.requests.memory` | The requested memory for the kube-scheduler containers | `128Mi` |
| `autoscaling.enabled` | Enable Horizontal POD autoscaling for kube-scheduler, make sure to enable `leaderElection` in config | `false` |
| `autoscaling.minReplicas` | Minimum number of kube-scheduler replicas | `1` |
| `autoscaling.maxReplicas` | Maximum number of kube-scheduler replicas | `100` |
| `autoscaling.targetCPUUtilizationPercentage` | Target CPU utilization percentage | `80` |
| `autoscaling.targetMemoryUtilizationPercentage` | Target Memory utilization percentage | `80` |
| `nodeSelector` | Node labels for kube-scheduler pods assignment | `{}` |
| `tolerations` | Tolerations for kube-scheduler pods assignment | `[]` |
| `affinity` | Affinity for kube-scheduler pods assignment | `{}` |
3 changes: 3 additions & 0 deletions charts/kube-scheduler/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CHART NAME: {{ .Chart.Name }}
CHART VERSION: {{ .Chart.Version }}
APP VERSION: {{ .Chart.AppVersion }}
66 changes: 66 additions & 0 deletions charts/kube-scheduler/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "kube-scheduler.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 "kube-scheduler.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 "kube-scheduler.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "kube-scheduler.labels" -}}
component: scheduler
tier: control-plane
helm.sh/chart: {{ include "kube-scheduler.chart" . }}
{{ include "kube-scheduler.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "kube-scheduler.selectorLabels" -}}
component: scheduler
tier: control-plane
app.kubernetes.io/name: {{ include "kube-scheduler.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "kube-scheduler.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "kube-scheduler.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
192 changes: 192 additions & 0 deletions charts/kube-scheduler/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "kube-scheduler.fullname" . }}
rules:
- apiGroups:
- ""
- events.k8s.io
resources:
- events
verbs:
- create
- patch
- update
- apiGroups:
- ""
resources:
- endpoints
verbs:
- create
- apiGroups:
- ""
resourceNames:
- {{ include "kube-scheduler.fullname" . }}
resources:
- endpoints
verbs:
- delete
- get
- patch
- update
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- pods
verbs:
- delete
- get
- list
- watch
- apiGroups:
- ""
resources:
- bindings
- pods/binding
verbs:
- create
- apiGroups:
- ""
resources:
- pods/status
verbs:
- patch
- update
- apiGroups:
- ""
resources:
- replicationcontrollers
- services
verbs:
- get
- list
- watch
- apiGroups:
- apps
- extensions
resources:
- replicasets
verbs:
- get
- list
- watch
- apiGroups:
- apps
resources:
- statefulsets
verbs:
- get
- list
- watch
- apiGroups:
- policy
resources:
- poddisruptionbudgets
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- persistentvolumeclaims
- persistentvolumes
verbs:
- get
- list
- watch
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
- apiGroups:
- storage.k8s.io
resources:
- csinodes
verbs:
- get
- list
- watch
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- apiGroups:
- coordination.k8s.io
resourceNames:
- {{ include "kube-scheduler.fullname" . }}
resources:
- leases
verbs:
- get
- update
- apiGroups:
- ""
resources:
- namespaces
verbs:
- get
- list
- watch
- apiGroups:
- storage.k8s.io
resources:
- csidrivers
verbs:
- get
- list
- watch
- apiGroups:
- storage.k8s.io
resources:
- csistoragecapacities
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- persistentvolumes
verbs:
- get
- list
- patch
- update
- watch
- apiGroups:
- storage.k8s.io
resources:
- storageclasses
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- persistentvolumeclaims
verbs:
- get
- list
- patch
- update
- watch
12 changes: 12 additions & 0 deletions charts/kube-scheduler/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "kube-scheduler.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ include "kube-scheduler.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ include "kube-scheduler.fullname" . }}
apiGroup: rbac.authorization.k8s.io
9 changes: 9 additions & 0 deletions charts/kube-scheduler/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "kube-scheduler.fullname" . }}
labels:
{{- include "kube-scheduler.labels" . | nindent 4 }}
data:
config.yaml: |
{{ .Values.config | toYaml | toString | indent 4 }}
Loading

0 comments on commit 26763e4

Please sign in to comment.