@@ -2,7 +2,8 @@ apiVersion: espejote.io/v1alpha1
22kind : ManagedResource
33metadata :
44 annotations :
5- syn.tools/description : ' TODO: add description'
5+ syn.tools/description : |
6+ Creates ConsoleNotifications to inform cluster users about scheduled minor OpenShift upgrades.
67 labels :
78 app.kubernetes.io/name : minor-upgrade-notification
89 name : minor-upgrade-notification
4041 local config = import 'minor-upgrade-notification/config.json';
4142 local dst = import 'minor-upgrade-notification/dst.json';
4243
44+ // Finds the next (i.e. "oldest") clusterversion overlay that sets a channel
45+ // higher than the current OpenShift minor version.
4346 local nextChannelOverlay =
4447 local overlays = esp.context().clusterversion_appuio[0].spec.overlays;
4548 local current_minor = std.split(esp.context().clusterversion_ocp[0].spec.desiredUpdate.version, '.')[1];
@@ -53,10 +56,15 @@ spec:
5356 local next = std.sort(pendingOverlays)[0];
5457 {date: next[0], channel: next[1]};
5558
59+ // Finds the first upgrade window after the overlay date. Upgradeconfigs only
60+ // display the next 10 maintenance windows, so it's not guaranteed to find one
61+ // if the overlay is far in the future.
5662 local upgradeWindow = if nextChannelOverlay != null then
5763 local possible = [t.time for t in esp.context().upgradeconfig[0].status.nextPossibleSchedules if t.time > nextChannelOverlay.date ];
5864 if std.length(possible) > 0 then possible[0];
5965
66+ // Custom format datetime and calculate Europe/Zurich time based on dates where
67+ // daylight saving times change.
6068 local formatDate(date) =
6169 local lastChange = std.reverse([t for t in std.objectFields(dst) if t < date])[0];
6270 local UTCOffset = dst[lastChange];
@@ -101,7 +109,6 @@ spec:
101109 };
102110
103111 if upgradeWindow != null then makeConsoleNotification('upgrade-%s' % replacementValues['$OVERLAY_VERSION'], config.notification, replacementValues)
104- #[nextChannelOverlay.date, formatDate(nextChannelOverlay.date)]
105112 triggers :
106113 - name : clusterversion_appuio
107114 watchContextResource :
0 commit comments