Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/helm_lib/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
type: library
name: deckhouse_lib_helm
version: 1.72.16
version: 1.72.17
description: "Helm utils template definitions for Deckhouse modules."
6 changes: 3 additions & 3 deletions charts/helm_lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ list:

#### Usage

`{{ include "helm_lib_tolerations" (tuple . "any-node" "with-uninitialized" "without-storage-problems") }} `
`{{ include "helm_lib_tolerations" (tuple . "any-node" "with-uninitialized") }} `

#### Arguments

Expand Down Expand Up @@ -1704,11 +1704,11 @@ list:

### _helm_lib_additional_tolerations_storage_problems

Additional strategy "storage-problems" - used for shedule critical components on nodes with drbd problems. This additional strategy enabled by default in any base strategy except "wildcard".
Additional strategy "storage-problems" - deprecated, renders nothing. It used to tolerate the DRBD taints drbd.linbit.com/lost-quorum, drbd.linbit.com/force-io-error and drbd.linbit.com/ignore-fail-over on every base strategy except "wildcard". Nothing sets those taints anymore, so the strategy is kept as a no-op to let existing "with-storage-problems" and "without-storage-problems" call sites keep rendering, and will be removed once they are gone.

#### Usage

`{{ include "helm_lib_tolerations" (tuple . "any-node" "without-storage-problems") }} `
`{{ include "helm_lib_tolerations" (tuple . "any-node" "with-storage-problems") }} `



Expand Down
11 changes: 3 additions & 8 deletions charts/helm_lib/templates/_node_affinity.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ nodeSelector:


{{- /* Returns tolerations for workloads depend on strategy. */ -}}
{{- /* Usage: {{ include "helm_lib_tolerations" (tuple . "any-node" "with-uninitialized" "without-storage-problems") }} */ -}}
{{- /* Usage: {{ include "helm_lib_tolerations" (tuple . "any-node" "with-uninitialized") }} */ -}}
{{- define "helm_lib_tolerations" }}
{{- $context := index . 0 }} {{- /* Template context with .Values, .Chart, etc */ -}}
{{- $strategy := index . 1 | include "helm_lib_internal_check_tolerations_strategy" }} {{- /* base strategy, one of "frontend" "monitoring" "system" any-node" "wildcard" */ -}}
Expand All @@ -68,8 +68,6 @@ nodeSelector:
{{ if lt (len .) 3 }}
{{- fail (print "additional strategies is required") }}
{{- end }}
{{- else }}
{{- $additionalStrategies = tuple "storage-problems" }}
{{- end }}
{{- $module_values := (index $context.Values (include "helm_lib_module_camelcase_name" $context)) }}
{{- if gt (len .) 2 }}
Expand Down Expand Up @@ -234,12 +232,9 @@ tolerations:
- key: node.kubernetes.io/network-unavailable
{{- end }}

{{- /* Additional strategy "storage-problems" - used for shedule critical components on nodes with drbd problems. This additional strategy enabled by default in any base strategy except "wildcard". */ -}}
{{- /* Usage: {{ include "helm_lib_tolerations" (tuple . "any-node" "without-storage-problems") }} */ -}}
{{- /* Additional strategy "storage-problems" - deprecated, renders nothing. It used to tolerate the DRBD taints drbd.linbit.com/lost-quorum, drbd.linbit.com/force-io-error and drbd.linbit.com/ignore-fail-over on every base strategy except "wildcard". Nothing sets those taints anymore, so the strategy is kept as a no-op to let existing "with-storage-problems" and "without-storage-problems" call sites keep rendering, and will be removed once they are gone. */ -}}
{{- /* Usage: {{ include "helm_lib_tolerations" (tuple . "any-node" "with-storage-problems") }} */ -}}
{{- define "_helm_lib_additional_tolerations_storage_problems" }}
- key: drbd.linbit.com/lost-quorum
- key: drbd.linbit.com/force-io-error
- key: drbd.linbit.com/ignore-fail-over
{{- end }}

{{- /* Additional strategy "no-csi" - used for any node with no CSI: any node, which was initialized by deckhouse, but have no csi-node driver registered on it. */ -}}
Expand Down
1 change: 1 addition & 0 deletions tests/templates/helm_lib_tolerations_base_strategy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ include "helm_lib_tolerations" (concat (list . .Values.baseStrategy) (.Values.additionalStrategies | default list)) }}
109 changes: 109 additions & 0 deletions tests/tests/helm_lib_tolerations_base_strategy_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
suite: helm_lib_tolerations definition with a base strategy
templates:
- helm_lib_tolerations_base_strategy.yaml
tests:
- it: should render base strategy tolerations without the deprecated storage-problems ones

set:
baseStrategy: "any-node"
global:
modules:
placement: {}
discovery:
clusterControlPlaneIsHighlyAvailable: true
modulesImages:
registry:
base: "deckhouse.io/deckhouse/ce"
digests:
testModule:
testContainer: sha256
internal:
modules:
kubeRBACProxyCA:
cert: cert

asserts:
- equal:
path: "tolerations"
value:
- key: node-role.kubernetes.io/master
- key: node-role.kubernetes.io/control-plane
- key: node.deckhouse.io/etcd-arbiter
- key: dedicated.deckhouse.io
operator: Exists
- key: dedicated
operator: Exists
- key: DeletionCandidateOfClusterAutoscaler
- key: ToBeDeletedByClusterAutoscaler

- it: should keep rendering when the deprecated storage-problems strategy is requested explicitly

set:
baseStrategy: "any-node"
additionalStrategies:
- "with-storage-problems"
global:
modules:
placement: {}
discovery:
clusterControlPlaneIsHighlyAvailable: true
modulesImages:
registry:
base: "deckhouse.io/deckhouse/ce"
digests:
testModule:
testContainer: sha256
internal:
modules:
kubeRBACProxyCA:
cert: cert

asserts:
- equal:
path: "tolerations"
value:
- key: node-role.kubernetes.io/master
- key: node-role.kubernetes.io/control-plane
- key: node.deckhouse.io/etcd-arbiter
- key: dedicated.deckhouse.io
operator: Exists
- key: dedicated
operator: Exists
- key: DeletionCandidateOfClusterAutoscaler
- key: ToBeDeletedByClusterAutoscaler

- it: should keep accepting the without- prefix for the deprecated storage-problems strategy

set:
baseStrategy: "any-node"
additionalStrategies:
- "without-storage-problems"
global:
modules:
placement: {}
discovery:
clusterControlPlaneIsHighlyAvailable: true
modulesImages:
registry:
base: "deckhouse.io/deckhouse/ce"
digests:
testModule:
testContainer: sha256
internal:
modules:
kubeRBACProxyCA:
cert: cert

asserts:
- equal:
path: "tolerations"
value:
- key: node-role.kubernetes.io/master
- key: node-role.kubernetes.io/control-plane
- key: node.deckhouse.io/etcd-arbiter
- key: dedicated.deckhouse.io
operator: Exists
- key: dedicated
operator: Exists
- key: DeletionCandidateOfClusterAutoscaler
- key: ToBeDeletedByClusterAutoscaler
Loading