diff --git a/charts/generic-service/README.md b/charts/generic-service/README.md index c5bb2e0..7568e66 100644 --- a/charts/generic-service/README.md +++ b/charts/generic-service/README.md @@ -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`) | @@ -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 | diff --git a/charts/generic-service/ci/scheduling-values.yaml b/charts/generic-service/ci/scheduling-values.yaml index c2d668c..8c6d4a9 100644 --- a/charts/generic-service/ci/scheduling-values.yaml +++ b/charts/generic-service/ci/scheduling-values.yaml @@ -4,6 +4,8 @@ image: repository: jwilder/whoami tag: latest +replicas: 3 + scheduling: priority: system-cluster-critical nodePreferences: @@ -16,3 +18,4 @@ scheduling: podAntiAffinity: otherKey: otherValue replicaSpread: Strict + minAvailable: 2 diff --git a/charts/generic-service/templates/pdb.yaml b/charts/generic-service/templates/pdb.yaml index 995a907..4846cec 100644 --- a/charts/generic-service/templates/pdb.yaml +++ b/charts/generic-service/templates/pdb.yaml @@ -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 @@ -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 }} diff --git a/charts/generic-service/values.schema.json b/charts/generic-service/values.schema.json index dd50ac7..1b5c796 100644 --- a/charts/generic-service/values.schema.json +++ b/charts/generic-service/values.schema.json @@ -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", @@ -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 diff --git a/charts/generic-service/values.yaml b/charts/generic-service/values.yaml index 3c2b733..09d1026 100644 --- a/charts/generic-service/values.yaml +++ b/charts/generic-service/values.yaml @@ -90,6 +90,7 @@ scheduling: podAffinity: {} podAntiAffinity: {} replicaSpread: BestEffort + minAvailable: 1 persistence: enabled: false