Skip to content

Commit

Permalink
feat: support adding priority class to workloads (#334)
Browse files Browse the repository at this point in the history
Support adding priority class to workloads
  • Loading branch information
scohen-nd authored Sep 11, 2024
1 parent e6dca1d commit a338293
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 10 deletions.
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: 1.2.0
version: 1.2.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.3.1
version: 0.3.2
repository: file://../nd-common
5 changes: 3 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: 1.2.0](https://img.shields.io/badge/Version-1.2.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.2.1](https://img.shields.io/badge/Version-1.2.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 @@ -192,7 +192,7 @@ secretsEngine: sealed

| Repository | Name | Version |
|------------|------|---------|
| file://../nd-common | nd-common | 0.3.1 |
| file://../nd-common | nd-common | 0.3.2 |
| https://k8s-charts.nextdoor.com | istio-alerts | 0.5.2 |

## Values
Expand Down Expand Up @@ -293,6 +293,7 @@ secretsEngine: sealed
| podSecurityContext | object | `{}` | |
| ports | `ContainerPort[]` | `[{"containerPort":80,"name":"http","port":null,"protocol":"TCP"}]` | A list of Port objects that are exposed by the service. These ports are applied to the main container, or the proxySidecar container (if enabled). The port list is also used to generate Network Policies that allow ingress into the pods. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#containerport-v1-core for details. **Note: We have added an optional "port" field to this list that allows the user to override the Service Port (for example 80) that a client connects to, without altering the Container Port (say, 8080) that is listening for connections. |
| preStopCommand | list | `["/bin/sleep","10"]` | Before a pod gets terminated, Kubernetes sends a SIGTERM signal to every container and waits for period of time (10s by default) for all containers to exit gracefully. If your app doesn't handle the SIGTERM signal or if it doesn't exit within the grace period, Kubernetes will kill the container and any inflight requests that your app is processing will fail. Make sure you set this to SHORTER than the terminationGracePeriod (30s default) setting. https://docs.flagger.app/tutorials/zero-downtime-deployments#graceful-shutdown |
| priorityClassName | `string` | `nil` | Set a different priority class to the pods, by default the default priority class is given to pods. Priority class could be used to prioritize pods over others and allow them to evict other pods with lower priorities. |
| progressDeadlineSeconds | string | `nil` | https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#progress-deadline-seconds |
| prometheusRules.CPUThrottlingHigh | object | `{"for":"15m","severity":"warning","threshold":5}` | Container is being throttled by the CGroup - needs more resources. This value is appropriate for applications that are highly sensitive to request latency. Insensitive workloads might need to raise this percentage to avoid alert noise. |
| prometheusRules.ContainerWaiting | object | `{"for":"1h","severity":"warning"}` | Pod container waiting longer than threshold |
Expand Down
3 changes: 3 additions & 0 deletions charts/rollout-app/templates/rollout.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ spec:
{{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
spec:
{{- with .Values.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
nodeSelector:
{{- include "nd-common.nodeSelector" $ | nindent 8 }}
{{- with .Values.affinity }}
Expand Down
4 changes: 4 additions & 0 deletions charts/rollout-app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,10 @@ monitor:
# -- ServiceMonitor will use these tlsConfig settings to make the health check requests
tlsConfig: null

# -- (`string`) Set a different priority class to the pods, by default the default priority class is given to pods.
# Priority class could be used to prioritize pods over others and allow them to evict other pods with lower priorities.
priorityClassName: null

# Configuration that lets the chart know that it's operating inside of an Istio
# service mesh or not. If it is, certain defaults are applied to various Pod
# and other resource configurations.
Expand Down
2 changes: 1 addition & 1 deletion 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.10.1
version: 1.10.2
appVersion: latest
maintainers:
- name: diranged
Expand Down
3 changes: 2 additions & 1 deletion 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.10.1](https://img.shields.io/badge/Version-1.10.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)
![Version: 1.10.2](https://img.shields.io/badge/Version-1.10.2-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 @@ -428,6 +428,7 @@ secretsEngine: sealed
| podSecurityContext | object | `{}` | |
| ports | `ContainerPort[]` | `[{"containerPort":80,"name":"http","port":null,"protocol":"TCP"}]` | A list of Port objects that are exposed by the service. These ports are applied to the main container, or the proxySidecar container (if enabled). The port list is also used to generate Network Policies that allow ingress into the pods. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#containerport-v1-core for details. **Note: We have added an optional "port" field to this list that allows the user to override the Service Port (for example 80) that a client connects to, without altering the Container Port (say, 8080) that is listening for connections. |
| preStopCommand | list | `["/bin/sleep","10"]` | Before a pod gets terminated, Kubernetes sends a SIGTERM signal to every container and waits for period of time (10s by default) for all containers to exit gracefully. If your app doesn't handle the SIGTERM signal or if it doesn't exit within the grace period, Kubernetes will kill the container and any inflight requests that your app is processing will fail. Make sure you set this to SHORTER than the terminationGracePeriod (30s default) setting. https://docs.flagger.app/tutorials/zero-downtime-deployments#graceful-shutdown |
| priorityClassName | `string` | `nil` | Set a different priority class to the pods, by default the default priority class is given to pods. Priority class could be used to prioritize pods over others and allow them to evict other pods with lower priorities. |
| progressDeadlineSeconds | string | `nil` | https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#progress-deadline-seconds |
| prometheusRules.CPUThrottlingHigh | object | `{"for":"15m","severity":"warning","threshold":5}` | Container is being throttled by the CGroup - needs more resources. This value is appropriate for applications that are highly sensitive to request latency. Insensitive workloads might need to raise this percentage to avoid alert noise. |
| prometheusRules.ContainerWaiting | object | `{"for":"1h","severity":"warning"}` | Pod container waiting longer than threshold |
Expand Down
3 changes: 3 additions & 0 deletions charts/simple-app/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ spec:
{{ . }}
{{- end }}
spec:
{{- with $.Values.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
nodeSelector:
{{- include "nd-common.nodeSelector" $ | nindent 8 }}
{{- with $deploymentZoneLabel }}
Expand Down
4 changes: 4 additions & 0 deletions charts/simple-app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,10 @@ istio:
# metrics separate from Application metrics.
metricsMerging: false

# -- (`string`) Set a different priority class to the pods, by default the default priority class is given to pods.
# Priority class could be used to prioritize pods over others and allow them to evict other pods with lower priorities.
priorityClassName: null

# Network access controls for the Pods in this application
network:
# -- (`strings[]`) A list of namespaces that are allowed to access the Pods
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: 1.2.0
version: 1.2.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.3.1
version: 0.3.2
repository: file://../nd-common
5 changes: 3 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: 1.2.0](https://img.shields.io/badge/Version-1.2.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.2.1](https://img.shields.io/badge/Version-1.2.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 @@ -284,7 +284,7 @@ secretsEngine: sealed

| Repository | Name | Version |
|------------|------|---------|
| file://../nd-common | nd-common | 0.3.1 |
| file://../nd-common | nd-common | 0.3.2 |
| https://k8s-charts.nextdoor.com | istio-alerts | 0.5.2 |

## Values
Expand Down Expand Up @@ -355,6 +355,7 @@ secretsEngine: sealed
| podSecurityContext | object | `{}` | |
| ports | list | `[{"containerPort":80,"name":"http","protocol":"TCP"},{"containerPort":443,"name":"https","protocol":"TCP"}]` | A list of Port objects that are exposed by the service. These ports are applied to the main container, or the proxySidecar container (if enabled). The port list is also used to generate Network Policies that allow ingress into the pods. |
| preStopCommand | list | `["/bin/sleep","10"]` | Before a pod gets terminated, Kubernetes sends a SIGTERM signal to every container and waits for period of time (10s by default) for all containers to exit gracefully. If your app doesn't handle the SIGTERM signal or if it doesn't exit within the grace period, Kubernetes will kill the container and any inflight requests that your app is processing will fail. Make sure you set this to SHORTER than the terminationGracePeriod (30s default) setting. https://docs.flagger.app/tutorials/zero-downtime-deployments#graceful-shutdown |
| priorityClassName | `string` | `nil` | Set a different priority class to the pods, by default the default priority class is given to pods. Priority class could be used to prioritize pods over others and allow them to evict other pods with lower priorities. |
| prometheusRules.CPUThrottlingHigh | object | `{"for":"15m","severity":"warning","threshold":5}` | Container is being throttled by the CGroup - needs more resources. This value is appropriate for applications that are highly sensitive to request latency. Insensitive workloads might need to raise this percentage to avoid alert noise. |
| prometheusRules.ContainerWaiting | object | `{"for":"1h","severity":"warning"}` | Pod container waiting longer than threshold |
| prometheusRules.KubeStatefulSetGenerationMismatch | object | `{"for":"15m","severity":"warning"}` | StatefulSet generation mismatch due to possible roll-back |
Expand Down
3 changes: 3 additions & 0 deletions charts/stateful-app/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ spec:
{{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
spec:
{{- with .Values.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
nodeSelector:
{{- include "nd-common.nodeSelector" $ | nindent 8 }}
{{- with .Values.affinity }}
Expand Down
4 changes: 4 additions & 0 deletions charts/stateful-app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,10 @@ network:
# service-to-service communication grants.
allowedNamespaces: []

# -- (`string`) Set a different priority class to the pods, by default the default priority class is given to pods.
# Priority class could be used to prioritize pods over others and allow them to evict other pods with lower priorities.
priorityClassName: null

# Configures labels and other parameters assuming that the Datadog Agent is
# installed on the underlying hosts and is part of the Kubernetes cluster.
datadog:
Expand Down

0 comments on commit a338293

Please sign in to comment.