Skip to content

Commit

Permalink
feat(charts/nd-common): Adding support for istio sidecar resource ove…
Browse files Browse the repository at this point in the history
…rride (#256)

**Motivation**
Due to an incident, we found out that once one of the values is set
through annotation. It overides the other values which is what led to
the incident.
This behaviour is not documents nor it makes sense in any ways.
**Description**
Once a value is set to any of the istio.(proxyCPU, proxyCPULimit,
proxyMemory, proxyMemoryLimit), all the 4 annotations will get created.
Fallbacking to the current implemented default resources for any
annotation that is not specifically set:
    Limits:
      cpu:                2
      memory:             1Gi
    Requests:
      cpu:                100m
      memory:             128Mi

The PR includes:
- Adding support for istio sidecar resource override in nd-common
istio-annotations.
- Updating dependant charts to use the new nd-common.
  • Loading branch information
scohen-nd authored Jan 10, 2024
1 parent 3e1e5d7 commit ed04d7a
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 17 deletions.
4 changes: 2 additions & 2 deletions charts/daemonset-app/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ apiVersion: v2
name: daemonset-app
description: Default DaemonSet Helm Chart
type: application
version: 0.15.0
version: 0.15.1
appVersion: latest
maintainers:
- name: diranged
email: [email protected]
dependencies:
- name: nd-common
version: 0.2.0
version: 0.3.0
repository: file://../nd-common
2 changes: 1 addition & 1 deletion charts/daemonset-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Default DaemonSet Helm Chart

![Version: 0.15.0](https://img.shields.io/badge/Version-0.15.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)
![Version: 0.15.1](https://img.shields.io/badge/Version-0.15.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)

[statefulsets]: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/
[hpa]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
Expand Down
2 changes: 1 addition & 1 deletion charts/nd-common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: nd-common
description: A helper chart used by most of our other charts
type: library
version: 0.2.0
version: 0.3.0
appVersion: latest
2 changes: 1 addition & 1 deletion charts/nd-common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A helper chart used by most of our other charts

![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)
![Version: 0.3.0](https://img.shields.io/badge/Version-0.3.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)

**This chart is a [Library Chart](https://helm.sh/docs/topics/library_charts/)** -
this means that the chart itself deploys no resources, and has no `.yaml`
Expand Down
29 changes: 29 additions & 0 deletions charts/nd-common/templates/_istio.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,35 @@ proxy.istio.io/overrides: >-
}
{{- end }}

{{- /*
Prepare the set of resource annotations for the istio-sidecar.
Motivation: Due to an incident, we found out that once one of the values is set through annotation. It overides the other values which is what led to the incident.
This behaviour is not documents nor it makes sense in any ways.
Description: Once a value is set to any of the istio.(proxyCPU, proxyCPULimit, proxyMemory, proxyMemoryLimit), all the 4 annotations will get created.
Fallbacking to the current implemented default resources for any annotation that is not specifically set:
Limits:
cpu: 2
memory: 1Gi
Requests:
cpu: 100m
memory: 128Mi
Usage: To setup the values follow the regular k8s resources structure under the istio key, like the bellow example:
istio:
resources:
requests:
cpu: 10m
memory: 10Mi
limits:
memory: 60Mi
*/ -}}
{{- with .Values.istio.resources }}
sidecar.istio.io/proxyCPU: {{ .requests.cpu | default "100m" | quote }}
sidecar.istio.io/proxyCPULimit: {{ .limits.cpu | default "2" | quote }}
sidecar.istio.io/proxyMemory: {{ .requests.memory | default "128Mi" | quote }}
sidecar.istio.io/proxyMemoryLimit: {{ .limits.memory | default "1Gi" | quote }}
{{- end }}

{{- end }}
{{- end }}

Expand Down
4 changes: 2 additions & 2 deletions charts/rollout-app/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: rollout-app
description: Argo Rollout-based Application Helm Chart
type: application
version: 0.7.0
version: 0.7.1
appVersion: latest
maintainers:
- name: diranged
Expand All @@ -13,5 +13,5 @@ dependencies:
repository: https://k8s-charts.nextdoor.com
condition: istio-alerts.enabled
- name: nd-common
version: 0.2.0
version: 0.3.0
repository: file://../nd-common
4 changes: 2 additions & 2 deletions charts/rollout-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Argo Rollout-based Application Helm Chart

![Version: 0.7.0](https://img.shields.io/badge/Version-0.7.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)
![Version: 0.7.1](https://img.shields.io/badge/Version-0.7.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)

[analysistemplate]: https://argoproj.github.io/argo-rollouts/features/analysis/?query=AnalysisTemplate#background-analysis
[argo_rollouts]: https://argoproj.github.io/argo-rollouts/
Expand Down Expand Up @@ -167,7 +167,7 @@ kmsSecretsRegion: us-west-2 (AWS region where the KMS key is located)

| Repository | Name | Version |
|------------|------|---------|
| file://../nd-common | nd-common | 0.2.0 |
| file://../nd-common | nd-common | 0.3.0 |
| https://k8s-charts.nextdoor.com | istio-alerts | 0.2.0 |

## Values
Expand Down
4 changes: 2 additions & 2 deletions charts/simple-app/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: simple-app
description: Default Microservice Helm Chart
type: application
version: 1.6.0
version: 1.6.1
appVersion: latest
maintainers:
- name: diranged
Expand All @@ -13,5 +13,5 @@ dependencies:
repository: https://k8s-charts.nextdoor.com
condition: istio-alerts.enabled
- name: nd-common
version: 0.2.0
version: 0.3.0
repository: file://../nd-common
4 changes: 2 additions & 2 deletions charts/simple-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Default Microservice Helm Chart

![Version: 1.6.0](https://img.shields.io/badge/Version-1.6.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)
![Version: 1.6.1](https://img.shields.io/badge/Version-1.6.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)

[deployments]: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
[hpa]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
Expand Down Expand Up @@ -312,7 +312,7 @@ kmsSecretsRegion: us-west-2 (AWS region where the KMS key is located)

| Repository | Name | Version |
|------------|------|---------|
| file://../nd-common | nd-common | 0.2.0 |
| file://../nd-common | nd-common | 0.3.0 |
| https://k8s-charts.nextdoor.com | istio-alerts | 0.2.0 |

## Values
Expand Down
4 changes: 2 additions & 2 deletions charts/stateful-app/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: stateful-app
description: Default StatefulSet Helm Chart
type: application
version: 0.16.0
version: 0.16.1
appVersion: latest
maintainers:
- name: diranged
Expand All @@ -13,5 +13,5 @@ dependencies:
repository: https://k8s-charts.nextdoor.com
condition: istio-alerts.enabled
- name: nd-common
version: 0.2.0
version: 0.3.0
repository: file://../nd-common
4 changes: 2 additions & 2 deletions charts/stateful-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Default StatefulSet Helm Chart

![Version: 0.16.0](https://img.shields.io/badge/Version-0.16.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)
![Version: 0.16.1](https://img.shields.io/badge/Version-0.16.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)

[statefulsets]: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/
[hpa]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
Expand Down Expand Up @@ -259,7 +259,7 @@ kmsSecretsRegion: us-west-2 (AWS region where the KMS key is located)

| Repository | Name | Version |
|------------|------|---------|
| file://../nd-common | nd-common | 0.2.0 |
| file://../nd-common | nd-common | 0.3.0 |
| https://k8s-charts.nextdoor.com | istio-alerts | 0.2.0 |

## Values
Expand Down

0 comments on commit ed04d7a

Please sign in to comment.