Skip to content

Commit 3587312

Browse files
authored
Merge pull request #9144 from hligit/cluster-autoscaler-overwrite-selectors-and-annotations
cluster-autoscaler/chart: add more annotations and allow selector ove…
2 parents 83e6f13 + 5894790 commit 3587312

File tree

11 files changed

+62
-6
lines changed

11 files changed

+62
-6
lines changed

cluster-autoscaler/charts/cluster-autoscaler/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ name: cluster-autoscaler
1111
sources:
1212
- https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler
1313
type: application
14-
version: 9.54.1
14+
version: 9.55.0

cluster-autoscaler/charts/cluster-autoscaler/README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ rbac:
339339

340340
### Azure - Using azure workload identity
341341

342-
You can use the project [Azure workload identity](https://github.com/Azure/azure-workload-identity), to automatically configure the correct setup for your pods to used federated identity with Azure.
342+
You can use the project [Azure workload identity](https://github.com/Azure/azure-workload-identity), to automatically configure the correct setup for your pods to use federated identity with Azure.
343343

344344
You can also set the correct settings yourself instead of relying on this project.
345345

@@ -463,6 +463,7 @@ vpa:
463463
| containerSecurityContext | object | `{}` | [Security context for container](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) |
464464
| customArgs | list | `[]` | Additional custom container arguments. Refer to https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-the-parameters-to-ca for the full list of cluster autoscaler parameters and their default values. List of arguments as strings. |
465465
| deployment.annotations | object | `{}` | Annotations to add to the Deployment object. |
466+
| deployment.selector | object | `{}` | Labels for Deployment `spec.selector.matchLabels`. |
466467
| dnsConfig | object | `{}` | [Pod's DNS Config](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-dns-config) |
467468
| dnsPolicy | string | `"ClusterFirst"` | Defaults to `ClusterFirst`. Valid values are: `ClusterFirstWithHostNet`, `ClusterFirst`, `Default` or `None`. If autoscaler does not depend on cluster DNS, recommended to set this to `Default`. |
468469
| envFromConfigMap | string | `""` | ConfigMap name to use as envFrom. |
@@ -490,7 +491,9 @@ vpa:
490491
| nameOverride | string | `""` | String to partially override `cluster-autoscaler.fullname` template (will maintain the release name) |
491492
| nodeSelector | object | `{}` | Node labels for pod assignment. Ref: https://kubernetes.io/docs/user-guide/node-selection/. |
492493
| podAnnotations | object | `{}` | Annotations to add to each pod. |
493-
| podDisruptionBudget | object | `{"maxUnavailable":1}` | Pod disruption budget. |
494+
| podDisruptionBudget | object | `{"annotations":{},"maxUnavailable":1,"selector":{}}` | Pod disruption budget. |
495+
| podDisruptionBudget.annotations | object | `{}` | Annotations to add to the PodDisruptionBudget. |
496+
| podDisruptionBudget.selector | object | `{}` | Override labels for PodDisruptionBudget `spec.selector.matchLabels`. |
494497
| podLabels | object | `{}` | Labels to add to each pod. |
495498
| priorityClassName | string | `"system-cluster-critical"` | priorityClassName |
496499
| priorityConfigMapAnnotations | object | `{}` | Annotations to add to `cluster-autoscaler-priority-expander` ConfigMap. |
@@ -500,6 +503,7 @@ vpa:
500503
| prometheusRule.namespace | string | `"monitoring"` | Namespace which Prometheus is running in. |
501504
| prometheusRule.rules | list | `[]` | Rules spec template (see https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#rule). |
502505
| rbac.additionalRules | list | `[]` | Additional rules for role/clusterrole |
506+
| rbac.annotations | object | `{}` | Additional annotations to add to RBAC resources (Role/RoleBinding/ClusterRole/ClusterRoleBinding). |
503507
| rbac.clusterScoped | bool | `true` | if set to false will only provision RBAC to alter resources in the current namespace. Most useful for Cluster-API |
504508
| rbac.create | bool | `true` | If `true`, create and use RBAC resources. |
505509
| rbac.pspEnabled | bool | `false` | If `true`, creates and uses RBAC resources required in the cluster with [Pod Security Policies](https://kubernetes.io/docs/concepts/policy/pod-security-policy/) enabled. Must be used with `rbac.create` set to `true`. |
@@ -520,6 +524,7 @@ vpa:
520524
| service.loadBalancerIP | string | `""` | IP address to assign to load balancer (if supported). |
521525
| service.loadBalancerSourceRanges | list | `[]` | List of IP CIDRs allowed access to load balancer (if supported). |
522526
| service.portName | string | `"http"` | Name for service port. |
527+
| service.selector | object | `{}` | Override labels for Service `spec.selector`. |
523528
| service.servicePort | int | `8085` | Service port to expose. |
524529
| service.type | string | `"ClusterIP"` | Type of service to create. |
525530
| serviceMonitor.annotations | object | `{}` | Annotations to add to service monitor |
@@ -534,7 +539,7 @@ vpa:
534539
| topologySpreadConstraints | list | `[]` | You can use topology spread constraints to control how Pods are spread across your cluster among failure-domains such as regions, zones, nodes, and other user-defined topology domains. (requires Kubernetes >= 1.19). |
535540
| updateStrategy | object | `{}` | [Deployment update strategy](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy) |
536541
| vpa | object | `{"containerPolicy":{},"enabled":false,"recommender":"default","updateMode":"Auto"}` | Configure a VerticalPodAutoscaler for the cluster-autoscaler Deployment. |
537-
| vpa.containerPolicy | object | `{}` | [ContainerResourcePolicy](https://github.com/kubernetes/autoscaler/blob/vertical-pod-autoscaler/v0.13.0/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go#L159). The containerName is always et to the deployment's container name. This value is required if VPA is enabled. |
542+
| vpa.containerPolicy | object | `{}` | [ContainerResourcePolicy](https://github.com/kubernetes/autoscaler/blob/vertical-pod-autoscaler/v0.13.0/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go#L159). The containerName is always set to the deployment's container name. This value is required if VPA is enabled. |
538543
| vpa.enabled | bool | `false` | If true, creates a VerticalPodAutoscaler. |
539544
| vpa.recommender | string | `"default"` | Name of the VPA recommender that will provide recommendations for vertical scaling. |
540545
| vpa.updateMode | string | `"Auto"` | [UpdateMode](https://github.com/kubernetes/autoscaler/blob/vertical-pod-autoscaler/v0.13.0/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go#L124) |

cluster-autoscaler/charts/cluster-autoscaler/README.md.gotmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ rbac:
339339

340340
### Azure - Using azure workload identity
341341

342-
You can use the project [Azure workload identity](https://github.com/Azure/azure-workload-identity), to automatically configure the correct setup for your pods to used federated identity with Azure.
342+
You can use the project [Azure workload identity](https://github.com/Azure/azure-workload-identity), to automatically configure the correct setup for your pods to use federated identity with Azure.
343343

344344
You can also set the correct settings yourself instead of relying on this project.
345345

cluster-autoscaler/charts/cluster-autoscaler/templates/clusterrole.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRole
44
metadata:
5+
{{- with .Values.rbac.annotations }}
6+
annotations:
7+
{{- range $k, $v := . }}
8+
{{- printf "%s: %s" (tpl $k $) (tpl $v $) | nindent 4 }}
9+
{{- end }}
10+
{{- end }}
511
labels:
612
{{ include "cluster-autoscaler.labels" . | indent 4 }}
713
name: {{ template "cluster-autoscaler.fullname" . }}

cluster-autoscaler/charts/cluster-autoscaler/templates/clusterrolebinding.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRoleBinding
44
metadata:
5+
{{- with .Values.rbac.annotations }}
6+
annotations:
7+
{{- range $k, $v := . }}
8+
{{- printf "%s: %s" (tpl $k $) (tpl $v $) | nindent 4 }}
9+
{{- end }}
10+
{{- end }}
511
labels:
612
{{ include "cluster-autoscaler.labels" . | indent 4 }}
713
name: {{ template "cluster-autoscaler.fullname" . }}

cluster-autoscaler/charts/cluster-autoscaler/templates/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@ spec:
1414
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
1515
selector:
1616
matchLabels:
17+
{{- if .Values.deployment.selector }}
18+
{{ toYaml .Values.deployment.selector | indent 6 }}
19+
{{- else }}
1720
{{ include "cluster-autoscaler.instance-name" . | indent 6 }}
1821
{{- if .Values.podLabels }}
1922
{{ toYaml .Values.podLabels | indent 6 }}
2023
{{- end }}
24+
{{- end }}
2125
{{- if .Values.updateStrategy }}
2226
strategy:
2327
{{ toYaml .Values.updateStrategy | nindent 4 | trim }}

cluster-autoscaler/charts/cluster-autoscaler/templates/pdb.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,20 @@
44
{{- end }}apiVersion: {{ template "podDisruptionBudget.apiVersion" . }}
55
kind: PodDisruptionBudget
66
metadata:
7+
{{- if .Values.podDisruptionBudget.annotations }}
8+
annotations:
9+
{{ toYaml .Values.podDisruptionBudget.annotations | indent 4 }}
10+
{{- end }}
711
labels:
812
{{ include "cluster-autoscaler.labels" . | indent 4 }}
913
name: {{ template "cluster-autoscaler.fullname" . }}
1014
namespace: {{ .Release.Namespace }}
1115
spec:
1216
selector:
1317
matchLabels:
18+
{{- if .Values.podDisruptionBudget.selector }}
19+
{{ toYaml .Values.podDisruptionBudget.selector | indent 6 }}
20+
{{- else }}
1421
{{ include "cluster-autoscaler.instance-name" . | indent 6 }}
1522
{{- if and .Values.podDisruptionBudget.minAvailable (not .Values.podDisruptionBudget.maxUnavailable) }}
1623
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
@@ -19,3 +26,4 @@ spec:
1926
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
2027
{{- end }}
2128
{{- end -}}
29+
{{- end }}

cluster-autoscaler/charts/cluster-autoscaler/templates/role.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: Role
44
metadata:
5+
{{- with .Values.rbac.annotations }}
6+
annotations:
7+
{{- range $k, $v := . }}
8+
{{- printf "%s: %s" (tpl $k $) (tpl $v $) | nindent 4 }}
9+
{{- end }}
10+
{{- end }}
511
labels:
612
{{ include "cluster-autoscaler.labels" . | indent 4 }}
713
name: {{ template "cluster-autoscaler.fullname" . }}

cluster-autoscaler/charts/cluster-autoscaler/templates/rolebinding.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: RoleBinding
44
metadata:
5+
{{- with .Values.rbac.annotations }}
6+
annotations:
7+
{{- range $k, $v := . }}
8+
{{- printf "%s: %s" (tpl $k $) (tpl $v $) | nindent 4 }}
9+
{{- end }}
10+
{{- end }}
511
labels:
612
{{ include "cluster-autoscaler.labels" . | indent 4 }}
713
name: {{ template "cluster-autoscaler.fullname" . }}

cluster-autoscaler/charts/cluster-autoscaler/templates/service.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ spec:
3434
targetPort: 8085
3535
name: {{ .Values.service.portName }}
3636
selector:
37+
{{- if .Values.service.selector }}
38+
{{ toYaml .Values.service.selector | indent 4 }}
39+
{{- else }}
3740
{{ include "cluster-autoscaler.instance-name" . | indent 4 }}
41+
{{- end }}
3842
type: "{{ .Values.service.type }}"
3943
{{- end }}

0 commit comments

Comments
 (0)