Skip to content

Commit

Permalink
cluster-autoscaler: initial commit (#496)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhrabovcin authored Mar 9, 2020
1 parent 01ec810 commit 8bbdb54
Show file tree
Hide file tree
Showing 18 changed files with 1,238 additions and 0 deletions.
21 changes: 21 additions & 0 deletions stable/cluster-autoscaler/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
14 changes: 14 additions & 0 deletions stable/cluster-autoscaler/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
description: Scales worker nodes within autoscaling groups.
icon: https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png
name: cluster-autoscaler
version: 7.1.0
appVersion: 1.17.1
home: https://github.com/kubernetes/autoscaler
sources:
- https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler
- https://github.com/spotinst/kubernetes-autoscaler/tree/master/cluster-autoscaler
maintainers:
- name: mhrabovcin
email: [email protected]
engine: gotpl
4 changes: 4 additions & 0 deletions stable/cluster-autoscaler/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
approvers:
- yurrriq
reviewers:
- yurrriq
331 changes: 331 additions & 0 deletions stable/cluster-autoscaler/README.md

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions stable/cluster-autoscaler/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if or .Values.autoDiscovery.clusterName .Values.autoscalingGroups -}}

To verify that cluster-autoscaler has started, run:

kubectl --namespace={{ .Release.Namespace }} get pods -l "app={{ template "cluster-autoscaler.name" . }},release={{ .Release.Name }}"

{{- else -}}

##############################################################################
#### ERROR: You must specify values for either ####
#### autoDiscovery.clusterName or autoscalingGroups[] ####
##############################################################################

The deployment and pod will not be created and the installation is not functional
See README:
open https://github.com/kubernetes/charts/tree/master/stable/cluster-autoscaler

{{- end -}}
84 changes: 84 additions & 0 deletions stable/cluster-autoscaler/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "cluster-autoscaler.name" -}}
{{- default (printf "%s-%s" .Values.cloudProvider .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).
*/}}
{{- define "cluster-autoscaler.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default (printf "%s-%s" .Values.cloudProvider .Chart.Name) .Values.nameOverride -}}
{{- if ne $name .Release.Name -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s" $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

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

{{/*
Return instance and name labels.
*/}}
{{- define "cluster-autoscaler.instance-name" -}}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/name: {{ include "cluster-autoscaler.name" . | quote }}
{{- end -}}


{{/*
Return labels, including instance and name.
*/}}
{{- define "cluster-autoscaler.labels" -}}
{{ include "cluster-autoscaler.instance-name" . }}
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
helm.sh/chart: {{ include "cluster-autoscaler.chart" . | quote }}
{{- end -}}

{{/*
Return the appropriate apiVersion for deployment.
*/}}
{{- define "deployment.apiVersion" -}}
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
{{- if semverCompare "<1.9-0" $kubeTargetVersion -}}
{{- print "apps/v1beta2" -}}
{{- else -}}
{{- print "apps/v1" -}}
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for podsecuritypolicy.
*/}}
{{- define "podsecuritypolicy.apiVersion" -}}
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
{{- if semverCompare "<1.10-0" $kubeTargetVersion -}}
{{- print "extensions/v1beta1" -}}
{{- else -}}
{{- print "policy/v1beta1" -}}
{{- end -}}
{{- end -}}

{{/*
Return the service account name used by the pod.
*/}}
{{- define "serviceaccount.name" -}}
{{- if and .Values.rbac.create .Values.rbac.serviceAccount.create -}}
{{ include "cluster-autoscaler.fullname" . }}
{{- else -}}
{{ .Values.rbac.serviceAccount.name }}
{{- end -}}
{{- end -}}
146 changes: 146 additions & 0 deletions stable/cluster-autoscaler/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
labels:
{{ include "cluster-autoscaler.labels" . | indent 4 }}
name: {{ template "cluster-autoscaler.fullname" . }}
rules:
- apiGroups:
- ""
resources:
- events
- endpoints
verbs:
- create
- patch
- apiGroups:
- ""
resources:
- pods/eviction
verbs:
- create
- apiGroups:
- ""
resources:
- pods/status
verbs:
- update
- apiGroups:
- ""
resources:
- endpoints
resourceNames:
- cluster-autoscaler
verbs:
- get
- update
- apiGroups:
- ""
resources:
- nodes
verbs:
- watch
- list
- get
- update
- apiGroups:
- ""
resources:
- pods
- services
- replicationcontrollers
- persistentvolumeclaims
- persistentvolumes
verbs:
- watch
- list
- get
- apiGroups:
- batch
resources:
- jobs
- cronjobs
verbs:
- watch
- list
- get
- apiGroups:
- batch
- extensions
resources:
- jobs
verbs:
- get
- list
- patch
- watch
- apiGroups:
- extensions
resources:
- replicasets
- daemonsets
verbs:
- watch
- list
- get
- apiGroups:
- policy
resources:
- poddisruptionbudgets
verbs:
- watch
- list
- apiGroups:
- apps
resources:
- daemonsets
- replicasets
- statefulsets
verbs:
- watch
- list
- get
- apiGroups:
- storage.k8s.io
resources:
- storageclasses
- csinodes
verbs:
- watch
- list
- get
- apiGroups:
- ""
resources:
- configmaps
verbs:
- list
- watch
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- apiGroups:
- coordination.k8s.io
resourceNames:
- cluster-autoscaler
resources:
- leases
verbs:
- get
- update
{{- if .Values.rbac.pspEnabled }}
- apiGroups:
- extensions
resources:
- podsecuritypolicies
resourceNames:
- {{ template "cluster-autoscaler.fullname" . }}
verbs:
- use
{{- end -}}

{{- end -}}
16 changes: 16 additions & 0 deletions stable/cluster-autoscaler/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
labels:
{{ include "cluster-autoscaler.labels" . | indent 4 }}
name: {{ template "cluster-autoscaler.fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "cluster-autoscaler.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "serviceaccount.name" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
Loading

0 comments on commit 8bbdb54

Please sign in to comment.