Skip to content

Commit 91d66b9

Browse files
authored
Merge pull request #6232 from apricote/clusterclass-enabledIf-semverCompare
📖 Use semverCompare to enable patches based on k8s version
2 parents 0958869 + 71ae7e6 commit 91d66b9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

docs/book/src/tasks/experimental-features/cluster-class/write-clusterclass.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,12 @@ Of course the same is possible by adding a boolean variable to a configuration o
643643

644644
Builtin variables can be leveraged to apply a patch only for a specific Kubernetes version.
645645
```yaml
646-
enabledIf: "{{ if eq "v1.21.1" .builtin.controlPlane.version }}true{{end}}"
646+
enabledIf: '{{ semverCompare "1.21.1" .builtin.controlPlane.version }}'
647+
```
648+
649+
With `semverCompare` and `coalesce` a feature can be enabled in newer versions of Kubernetes for both KubeadmConfigTemplate and KubeadmControlPlane.
650+
```yaml
651+
enabledIf: '{{ semverCompare "^1.22.0" (coalesce .builtin.controlPlane.version .builtin.machineDeployment.version )}}'
647652
```
648653

649654
<!-- links -->

0 commit comments

Comments
 (0)