From 9adeb7d555d92a5986ba91547047ddf169895020 Mon Sep 17 00:00:00 2001 From: Charlie Haley Date: Wed, 6 Apr 2022 14:18:04 +0100 Subject: [PATCH 1/2] feat: add support for deployment annotations to helm chart --- charts/cluster-autoscaler/Chart.yaml | 2 +- charts/cluster-autoscaler/README.md | 1 + charts/cluster-autoscaler/templates/deployment.yaml | 2 ++ charts/cluster-autoscaler/values.yaml | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/charts/cluster-autoscaler/Chart.yaml b/charts/cluster-autoscaler/Chart.yaml index b0ff4d599aab..97e97b86f86f 100644 --- a/charts/cluster-autoscaler/Chart.yaml +++ b/charts/cluster-autoscaler/Chart.yaml @@ -17,4 +17,4 @@ name: cluster-autoscaler sources: - https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler type: application -version: 9.16.2 +version: 9.17.0 diff --git a/charts/cluster-autoscaler/README.md b/charts/cluster-autoscaler/README.md index d21b6352994a..dc16f30c794a 100644 --- a/charts/cluster-autoscaler/README.md +++ b/charts/cluster-autoscaler/README.md @@ -287,6 +287,7 @@ Though enough for the majority of installations, the default PodSecurityPolicy _ |-----|------|---------|-------------| | additionalLabels | object | `{}` | Labels to add to each object of the chart. | | affinity | object | `{}` | Affinity for pod assignment | +| annotations | object | `{}` | Annotations to add to the Deployment object. | | autoDiscovery.clusterName | string | `nil` | Enable autodiscovery for `cloudProvider=aws`, for groups matching `autoDiscovery.tags`. Enable autodiscovery for `cloudProvider=clusterapi`, for groups matching `autoDiscovery.labels`. Enable autodiscovery for `cloudProvider=gce`, but no MIG tagging required. Enable autodiscovery for `cloudProvider=magnum`, for groups matching `autoDiscovery.roles`. | | autoDiscovery.labels | list | `[]` | Cluster-API labels to match https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/clusterapi/README.md#configuring-node-group-auto-discovery | | autoDiscovery.roles | list | `["worker"]` | Magnum node group roles to match. | diff --git a/charts/cluster-autoscaler/templates/deployment.yaml b/charts/cluster-autoscaler/templates/deployment.yaml index 043b98bda83e..dbb9493fd909 100644 --- a/charts/cluster-autoscaler/templates/deployment.yaml +++ b/charts/cluster-autoscaler/templates/deployment.yaml @@ -3,6 +3,8 @@ apiVersion: {{ template "deployment.apiVersion" . }} kind: Deployment metadata: + annotations: +{{ toYaml .Values.annotations | indent 4 }} labels: {{ include "cluster-autoscaler.labels" . | indent 4 }} name: {{ template "cluster-autoscaler.fullname" . }} diff --git a/charts/cluster-autoscaler/values.yaml b/charts/cluster-autoscaler/values.yaml index a701456cc6a9..f75f7ed684a8 100644 --- a/charts/cluster-autoscaler/values.yaml +++ b/charts/cluster-autoscaler/values.yaml @@ -2,6 +2,8 @@ # affinity -- Affinity for pod assignment affinity: {} +annotations: [] + autoDiscovery: # cloudProviders `aws`, `gce`, `magnum` and `clusterapi` are supported by auto-discovery at this time # AWS: Set tags as described in https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/aws/README.md#auto-discovery-setup From 18285452b35e9e4ba8a5573689f6d5cb2b282a24 Mon Sep 17 00:00:00 2001 From: Charlie Haley Date: Mon, 11 Apr 2022 11:05:42 +0100 Subject: [PATCH 2/2] fix: pr feedback --- charts/cluster-autoscaler/README.md | 2 +- charts/cluster-autoscaler/templates/deployment.yaml | 2 +- charts/cluster-autoscaler/values.yaml | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/charts/cluster-autoscaler/README.md b/charts/cluster-autoscaler/README.md index dc16f30c794a..d6f142332740 100644 --- a/charts/cluster-autoscaler/README.md +++ b/charts/cluster-autoscaler/README.md @@ -287,7 +287,6 @@ Though enough for the majority of installations, the default PodSecurityPolicy _ |-----|------|---------|-------------| | additionalLabels | object | `{}` | Labels to add to each object of the chart. | | affinity | object | `{}` | Affinity for pod assignment | -| annotations | object | `{}` | Annotations to add to the Deployment object. | | autoDiscovery.clusterName | string | `nil` | Enable autodiscovery for `cloudProvider=aws`, for groups matching `autoDiscovery.tags`. Enable autodiscovery for `cloudProvider=clusterapi`, for groups matching `autoDiscovery.labels`. Enable autodiscovery for `cloudProvider=gce`, but no MIG tagging required. Enable autodiscovery for `cloudProvider=magnum`, for groups matching `autoDiscovery.roles`. | | autoDiscovery.labels | list | `[]` | Cluster-API labels to match https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/clusterapi/README.md#configuring-node-group-auto-discovery | | autoDiscovery.roles | list | `["worker"]` | Magnum node group roles to match. | @@ -314,6 +313,7 @@ Though enough for the majority of installations, the default PodSecurityPolicy _ | clusterAPIMode | string | `"incluster-incluster"` | Cluster API mode, see https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/clusterapi/README.md#connecting-cluster-autoscaler-to-cluster-api-management-and-workload-clusters Syntax: workloadClusterMode-ManagementClusterMode for `kubeconfig-kubeconfig`, `incluster-kubeconfig` and `single-kubeconfig` you always must mount the external kubeconfig using either `extraVolumeSecrets` or `extraMounts` and `extraVolumes` if you dont set `clusterAPIKubeconfigSecret`and thus use an in-cluster config or want to use a non capi generated kubeconfig you must do so for the workload kubeconfig as well | | clusterAPIWorkloadKubeconfigPath | string | `"/etc/kubernetes/value"` | Path to kubeconfig for connecting to Cluster API managed workloadcluster, only used if `clusterAPIMode=kubeconfig-kubeconfig or kubeconfig-incluster` | | containerSecurityContext | object | `{}` | [Security context for container](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) | +| deployment.annotations | object | `{}` | Annotations to add to the Deployment object. | | 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`. | | envFromConfigMap | string | `""` | ConfigMap name to use as envFrom. | | envFromSecret | string | `""` | Secret name to use as envFrom. | diff --git a/charts/cluster-autoscaler/templates/deployment.yaml b/charts/cluster-autoscaler/templates/deployment.yaml index dbb9493fd909..94954279e6e9 100644 --- a/charts/cluster-autoscaler/templates/deployment.yaml +++ b/charts/cluster-autoscaler/templates/deployment.yaml @@ -4,7 +4,7 @@ apiVersion: {{ template "deployment.apiVersion" . }} kind: Deployment metadata: annotations: -{{ toYaml .Values.annotations | indent 4 }} +{{ toYaml .Values.deployment.annotations | indent 4 }} labels: {{ include "cluster-autoscaler.labels" . | indent 4 }} name: {{ template "cluster-autoscaler.fullname" . }} diff --git a/charts/cluster-autoscaler/values.yaml b/charts/cluster-autoscaler/values.yaml index f75f7ed684a8..def598d9904a 100644 --- a/charts/cluster-autoscaler/values.yaml +++ b/charts/cluster-autoscaler/values.yaml @@ -2,8 +2,6 @@ # affinity -- Affinity for pod assignment affinity: {} -annotations: [] - autoDiscovery: # cloudProviders `aws`, `gce`, `magnum` and `clusterapi` are supported by auto-discovery at this time # AWS: Set tags as described in https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/aws/README.md#auto-discovery-setup @@ -140,6 +138,10 @@ containerSecurityContext: {} # drop: # - ALL +deployment: + # deployment.annotations -- Annotations to add to the Deployment object. + annotations: {} + # dnsPolicy -- 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`.