rollingup defaults

This commit is contained in:
Stavros kois
2023-02-13 14:35:36 +02:00
parent 8b3816f201
commit 73d592a2ed
10 changed files with 105 additions and 48 deletions

View File

@@ -25,6 +25,30 @@ tests:
updateStrategy:
type: RollingUpdate
- it: should apply defaults to rollingUpdate
set:
workload:
workload-name:
enabled: true
primary: true
type: DaemonSet
replicas: 2
revisionHistoryLimit: 4
strategy: RollingUpdate
podSpec: {}
asserts:
- documentIndex: *daemonSetDoc
isSubset:
path: spec
content:
replicas: 2
revisionHistoryLimit: 4
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
- it: should apply spec correctly
set:
workload:

View File

@@ -26,6 +26,30 @@ tests:
strategy:
type: Recreate
- it: should apply defaults to rollingUpdate
set:
workload:
workload-name:
enabled: true
primary: true
type: Deployment
replicas: 2
revisionHistoryLimit: 4
strategy: RollingUpdate
podSpec: {}
asserts:
- documentIndex: *deploymentDoc
isSubset:
path: spec
content:
replicas: 2
revisionHistoryLimit: 4
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
- it: should apply spec correctly
set:
workload:

View File

@@ -25,6 +25,30 @@ tests:
updateStrategy:
type: RollingUpdate
- it: should apply defaults to rollingUpdate
set:
workload:
workload-name:
enabled: true
primary: true
type: DaemonSet
replicas: 2
revisionHistoryLimit: 4
strategy: RollingUpdate
podSpec: {}
asserts:
- documentIndex: *statefulSetDoc
isSubset:
path: spec
content:
replicas: 2
revisionHistoryLimit: 4
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
partition: 1
- it: should apply spec correctly
set:
workload:

View File

@@ -1,11 +1,11 @@
# DaemonSet
| Key | Type | Required | Helm Template | Default | Description |
| :---------------------------------------------------- | :------: | :------: | :-----------: | :-------------: | :------------------------------------------------------------------- |
| workload.[workload-name].strategy | `string` | ❌ | ❌ | `RollingUpdate` | Define the strategy of the workload (OnDelete, RollingUpdate) |
| workload.[workload-name].rollingUpdate | `dict` | ❌ | ❌ | `{}` | Holds the rollingUpdate options, Only when strategy is RollingUpdate |
| workload.[workload-name].rollingUpdate.maxUnavailable | `int` | ❌ | ❌ | | Define the maxUnavailable, Only when strategy is RollingUpdate |
| workload.[workload-name].rollingUpdate.maxSurge | `int` | ❌ | ❌ | | Define the maxSurge, Only when strategy is RollingUpdate |
| Key | Type | Required | Helm Template | Default | Description |
| :---------------------------------------------------- | :------: | :------: | :-----------: | :---------------------------------------------: | :------------------------------------------------------------------- |
| workload.[workload-name].strategy | `string` | ❌ | ❌ | `RollingUpdate` | Define the strategy of the workload (OnDelete, RollingUpdate) |
| workload.[workload-name].rollingUpdate | `dict` | ❌ | ❌ | `{}` | Holds the rollingUpdate options, Only when strategy is RollingUpdate |
| workload.[workload-name].rollingUpdate.maxUnavailable | `int` | ❌ | ❌ | `{{ .Values.fallbackDefaults.maxUnavailable }}` | Define the maxUnavailable, Only when strategy is RollingUpdate |
| workload.[workload-name].rollingUpdate.maxSurge | `int` | ❌ | ❌ | `{{ .Values.fallbackDefaults.maxSurge }}` | Define the maxSurge, Only when strategy is RollingUpdate |
---

View File

@@ -1,11 +1,11 @@
# Deployment
| Key | Type | Required | Helm Template | Default | Description |
| :---------------------------------------------------- | :------: | :------: | :-----------: | :--------: | :------------------------------------------------------------------- |
| workload.[workload-name].strategy | `string` | ❌ | ❌ | `Recreate` | Define the strategy of the workload (Recreate, RollingUpdate) |
| workload.[workload-name].rollingUpdate | `dict` | ❌ | ❌ | `{}` | Holds the rollingUpdate options, Only when strategy is RollingUpdate |
| workload.[workload-name].rollingUpdate.maxUnavailable | `int` | ❌ | ❌ | | Define the maxUnavailable, Only when strategy is RollingUpdate |
| workload.[workload-name].rollingUpdate.maxSurge | `int` | ❌ | ❌ | | Define the maxSurge, Only when strategy is RollingUpdate |
| Key | Type | Required | Helm Template | Default | Description |
| :---------------------------------------------------- | :------: | :------: | :-----------: | :---------------------------------------------: | :------------------------------------------------------------------- |
| workload.[workload-name].strategy | `string` | ❌ | ❌ | `Recreate` | Define the strategy of the workload (Recreate, RollingUpdate) |
| workload.[workload-name].rollingUpdate | `dict` | ❌ | ❌ | `{}` | Holds the rollingUpdate options, Only when strategy is RollingUpdate |
| workload.[workload-name].rollingUpdate.maxUnavailable | `int` | ❌ | ❌ | `{{ .Values.fallbackDefaults.maxUnavailable }}` | Define the maxUnavailable, Only when strategy is RollingUpdate |
| workload.[workload-name].rollingUpdate.maxSurge | `int` | ❌ | ❌ | `{{ .Values.fallbackDefaults.maxSurge }}` | Define the maxSurge, Only when strategy is RollingUpdate |
---

View File

@@ -1,11 +1,11 @@
# DaemonSet
| Key | Type | Required | Helm Template | Default | Description |
| :---------------------------------------------------- | :------: | :------: | :-----------: | :-------------: | :------------------------------------------------------------------- |
| workload.[workload-name].strategy | `string` | ❌ | ❌ | `RollingUpdate` | Define the strategy of the workload (OnDelete, RollingUpdate) |
| workload.[workload-name].rollingUpdate | `dict` | ❌ | ❌ | `{}` | Holds the rollingUpdate options, Only when strategy is RollingUpdate |
| workload.[workload-name].rollingUpdate.maxUnavailable | `int` | ❌ | ❌ | | Define the maxUnavailable, Only when strategy is RollingUpdate |
| workload.[workload-name].rollingUpdate.partition | `int` | ❌ | ❌ | | Define the partition, Only when strategy is RollingUpdate |
| Key | Type | Required | Helm Template | Default | Description |
| :---------------------------------------------------- | :------: | :------: | :-----------: | :---------------------------------------------: | :------------------------------------------------------------------- |
| workload.[workload-name].strategy | `string` | ❌ | ❌ | `RollingUpdate` | Define the strategy of the workload (OnDelete, RollingUpdate) |
| workload.[workload-name].rollingUpdate | `dict` | ❌ | ❌ | `{}` | Holds the rollingUpdate options, Only when strategy is RollingUpdate |
| workload.[workload-name].rollingUpdate.maxUnavailable | `int` | ❌ | ❌ | `{{ .Values.fallbackDefaults.maxUnavailable }}` | Define the maxUnavailable, Only when strategy is RollingUpdate |
| workload.[workload-name].rollingUpdate.partition | `int` | ❌ | ❌ | `{{ .Values.fallbackDefaults.partition }}` | Define the partition, Only when strategy is RollingUpdate |
---

View File

@@ -13,16 +13,9 @@ objectData:
revisionHistoryLimit: {{ $objectData.revisionHistoryLimit | default 3 }}
updateStrategy:
type: {{ $objectData.strategy | default "RollingUpdate" }}
{{- if and
(eq $objectData.strategy "RollingUpdate")
$objectData.rollingUpdate
(or $objectData.rollingUpdate.maxUnavailable $objectData.rollingUpdate.maxSurge) }}
{{- if eq $objectData.strategy "RollingUpdate" }}
rollingUpdate:
{{- with $objectData.rollingUpdate.maxUnavailable }}
maxUnavailable: {{ .}}
{{- end -}}
{{- with $objectData.rollingUpdate.maxSurge }}
maxSurge: {{ . }}
{{- end -}}
maxUnavailable: {{ $objectData.rollingUpdate.maxUnavailable | default $rootCtx.Values.fallbackDefaults.maxUnavailable }}
maxSurge: {{ $objectData.rollingUpdate.maxSurge | default $rootCtx.Values.fallbackDefaults.maxSurge }}
{{- end -}}
{{- end -}}

View File

@@ -14,16 +14,9 @@ replicas: {{ $objectData.replicas | default 1 }}
revisionHistoryLimit: {{ $objectData.revisionHistoryLimit | default 3 }}
strategy:
type: {{ $objectData.strategy | default "Recreate" }}
{{- if and
(eq $objectData.strategy "RollingUpdate")
$objectData.rollingUpdate
(or $objectData.rollingUpdate.maxUnavailable $objectData.rollingUpdate.maxSurge) }}
{{- if eq $objectData.strategy "RollingUpdate" }}
rollingUpdate:
{{- with $objectData.rollingUpdate.maxUnavailable }}
maxUnavailable: {{ .}}
{{- end -}}
{{- with $objectData.rollingUpdate.maxSurge }}
maxSurge: {{ . }}
{{- end -}}
maxUnavailable: {{ $objectData.rollingUpdate.maxUnavailable | default $rootCtx.Values.fallbackDefaults.maxUnavailable }}
maxSurge: {{ $objectData.rollingUpdate.maxSurge | default $rootCtx.Values.fallbackDefaults.maxSurge }}
{{- end -}}
{{- end -}}

View File

@@ -15,16 +15,9 @@ revisionHistoryLimit: {{ $objectData.revisionHistoryLimit | default 3 }}
serviceName: {{ $objectData.name }}
updateStrategy:
type: {{ $objectData.strategy | default "RollingUpdate" }}
{{- if and
(eq $objectData.strategy "RollingUpdate")
$objectData.rollingUpdate
(or $objectData.rollingUpdate.maxUnavailable $objectData.rollingUpdate.partition) }}
{{- if eq $objectData.strategy "RollingUpdate" }}
rollingUpdate:
{{- with $objectData.rollingUpdate.maxUnavailable }}
maxUnavailable: {{ .}}
{{- end -}}
{{- with $objectData.rollingUpdate.partition }}
partition: {{ . }}
{{- end -}}
maxUnavailable: {{ $objectData.rollingUpdate.maxUnavailable | default $rootCtx.Values.fallbackDefaults.maxUnavailable }}
partition: {{ $objectData.rollingUpdate.partition | default $rootCtx.Values.fallbackDefaults.partition }}
{{- end -}}
{{- end -}}

View File

@@ -17,6 +17,12 @@ fallbackDefaults:
# -- Define a storageClassName that will be used for all PVCs
# Can be overruled per PVC
storageClass:
# -- Default maxUnavailable
maxUnavailable: 1
# -- Default maxSurge
maxSurge: 1
# -- Default partition (StatefulSet only)
partition: 1
# -- Default Service Protocol
serviceProtocol: TCP
# -- Default Service Type