Skip to content

Commit

Permalink
Add postprocessing filter to keep supporting `driver_daemonset_tolera…
Browse files Browse the repository at this point in the history
…tions` parameter

We can't simply pass the parameter to the `node.tolerations` Helm value,
since that value expects an array of regular tolerations while the
component parameter is structured to allow users to overwrite
tolerations.

Note that the postprocessing filter will retain tolerations configured
through the Helm value and will simply append any tolerations configured
in `driver_daemonset_tolerations`.
  • Loading branch information
simu committed Aug 25, 2023
1 parent 8b393fe commit 3e95d46
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
6 changes: 6 additions & 0 deletions class/csi-cloudscale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ parameters:
- ${_base_directory}/component/main.jsonnet
input_type: jsonnet
output_path: csi-cloudscale/
commodore:
postprocess:
filters:
- type: jsonnet
filter: postprocess/driver_daemonset_tolerations.jsonnet
path: csi-cloudscale/01_helm_chart/csi-cloudscale/templates
29 changes: 29 additions & 0 deletions postprocess/driver_daemonset_tolerations.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
local com = import 'lib/commodore.libjsonnet';

local inv = com.inventory();
local params = inv.parameters.csi_cloudscale;
local tolerations = params.driver_daemonset_tolerations;

local chartDir = std.extVar('output_path');

com.fixupDir(
chartDir,
function(obj)
if obj.kind == 'DaemonSet' then
obj {
spec+: {
template+: {
spec+: {
[if std.length(tolerations) > 0 then 'tolerations']+: [
tolerations[name] {
key: name,
}
for name in std.objectFields(tolerations)
],
},
},
},
}
else
obj
)
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ spec:
hostNetwork: true
priorityClassName: system-node-critical
serviceAccount: csi-cloudscale-node-sa
tolerations:
- effect: NoSchedule
key: storagenode
operator: Exists
volumes:
- hostPath:
path: /var/lib/kubelet/plugins_registry/
Expand Down
6 changes: 6 additions & 0 deletions tests/openshift4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ parameters:

facts:
distribution: openshift4

csi_cloudscale:
driver_daemonset_tolerations:
storagenode:
operator: Exists
effect: NoSchedule

0 comments on commit 3e95d46

Please sign in to comment.