Skip to content

Commit

Permalink
Added scheduling.minAvailable
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianeicher committed Sep 7, 2024
1 parent 95eb953 commit 9c99703
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion charts/generic-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ app:
| `rollout.flagger` | `false` | Use Flagger to control rollouts (`rollout.controller` must be `Deployment` or `StatefulSet`) |
| `rollout.analysis` | req. for Canary or Flagger | Flagger or Argo Rollouts analysis for automatic `Canary` or `BlueGreen` promotion |
| `rollout.revisionHistoryLimit` | `null` | Number of old ReplicaSets to retain (`rollout.controller` must be `Deployment` or `ArgoRollout`) |
| `replicas` | `1` | The number of instances of the service to run (set at least `2` for Pod Disruption Budget) |
| `replicas` | `1` | The number of instances of the service to run |
| `autoscaling.enabled` | `false` | Enables automatic starting of additional instances |
| `autoscaling.maxReplicas` | `3` | The maximum number of instances to run (must be larger than `replicas`) |
| `autoscaling.metric.type` | `Resource` | The type of metric to use for scaling (`Resource`, `Pods`, `Object` or `External`) |
Expand All @@ -86,6 +86,7 @@ app:
| `scheduling.podAffinity` | `{}` | Labels to select other pods this service should share nodes with if possible |
| `scheduling.podAntiAffinity` | `{}` | Labels to select other pods this service must not share nodes with |
| `scheduling.replicaSpread` | `BestEffort` | How to spread replicas across nodes (`BestEffort`, `Strict`, `None`) |
| `scheduling.minAvailable`  | `1` | Minimum number of instances to keep running during cluster maintenance (only if smaller than `replicas`) |
| `persistence.enabled` | `false` | Enables persistent storage for the service |
| `persistence.storageClass` | | The type of disk to use for storage instead of the cluster default |
| `persistence.accessModes` | `[ReadWriteOnce]` | The support access modes the volume can be mounted with |
Expand Down
3 changes: 3 additions & 0 deletions charts/generic-service/ci/scheduling-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ image:
repository: jwilder/whoami
tag: latest

replicas: 3

scheduling:
priority: system-cluster-critical
nodePreferences:
Expand All @@ -16,3 +18,4 @@ scheduling:
podAntiAffinity:
otherKey: otherValue
replicaSpread: Strict
minAvailable: 2
4 changes: 2 additions & 2 deletions charts/generic-service/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.ingress.enabled (gt .Values.replicas 1.0) }}
{{- if and (gt .Values.scheduling.minAvailable 0.0) (lt .Values.scheduling.minAvailable .Values.replicas) }}

apiVersion: policy/v1
kind: PodDisruptionBudget
Expand All @@ -7,7 +7,7 @@ metadata:
labels: {{- include "generic-service.top-level-labels" . | nindent 4 }}

spec:
minAvailable: 1
minAvailable: {{ .Values.scheduling.minAvailable }}

selector:
matchLabels: {{- include "generic-service.selector-labels" . | nindent 6 }}
Expand Down
7 changes: 6 additions & 1 deletion charts/generic-service/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@
"replicas": {
"type": "integer",
"default": 1,
"description": "The number of instances of the service to run (set at least 2 for Pod Disruption Budget)"
"description": "The number of instances of the service to run"
},
"autoscaling": {
"type": "object",
Expand Down Expand Up @@ -585,6 +585,11 @@
],
"default": "BestEffort",
"description": "How to spread replicas across nodes"
},
"minAvailable": {
"type": "integer",
"default": 1,
"description": "Minimum number of instances to keep running during cluster maintenance (only applied if this value is smaller than replicas)"
}
},
"additionalProperties": false
Expand Down
1 change: 1 addition & 0 deletions charts/generic-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ scheduling:
podAffinity: {}
podAntiAffinity: {}
replicaSpread: BestEffort
minAvailable: 1

persistence:
enabled: false
Expand Down

0 comments on commit 9c99703

Please sign in to comment.