Skip to content

Commit a010ce9

Browse files
committed
gen-golden
1 parent 57fadb9 commit a010ce9

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

tests/golden/upgrade-notification/openshift4-console/openshift4-console/30_notification_rbac.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRole
33
metadata:
44
labels:
5-
name: appuio-upgrade-notification-editor
6-
name: appuio:upgrade-notification-editor
5+
name: appuio-notification-manager
6+
name: appuio:notification-manager
77
rules:
88
- apiGroups:
99
- console.openshift.io
@@ -48,12 +48,12 @@ apiVersion: rbac.authorization.k8s.io/v1
4848
kind: ClusterRoleBinding
4949
metadata:
5050
labels:
51-
name: appuio-upgrade-notification-manager
52-
name: appuio:upgrade-notification-manager
51+
name: appuio-notification-manager
52+
name: appuio:notification-manager
5353
roleRef:
5454
apiGroup: rbac.authorization.k8s.io
5555
kind: ClusterRole
56-
name: appuio:upgrade-notification-editor
56+
name: appuio:notification-manager
5757
subjects:
5858
- kind: ServiceAccount
5959
name: notification-manager

tests/golden/upgrade-notification/openshift4-console/openshift4-console/31_upgrade_notification.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ apiVersion: espejote.io/v1alpha1
22
kind: ManagedResource
33
metadata:
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
@@ -40,6 +41,8 @@ spec:
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

Comments
 (0)