Skip to content

Commit

Permalink
Add next possible schedules and upgrade window metrics (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastjan authored Oct 3, 2024
1 parent 2e9cc92 commit 86831b5
Show file tree
Hide file tree
Showing 17 changed files with 1,018 additions and 171 deletions.
9 changes: 9 additions & 0 deletions api/v1beta1/upgradeconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ type UpgradeConfigStatus struct {
// Also is increased when a job would have been created, but was not created due to the config being suspended.
// +optional
LastScheduledUpgrade *metav1.Time `json:"lastScheduledUpgrade,omitempty"`

// NextPossibleSchedules is a list of the next possible schedules for an upgrade.
NextPossibleSchedules []NextPossibleSchedule `json:"nextPossibleSchedules"`
}

// NextPossibleSchedule defines the next possible schedule for an upgrade
type NextPossibleSchedule struct {
// Time is the time of the next possible schedule
Time metav1.Time `json:"time"`
}

//+kubebuilder:object:root=true
Expand Down
8 changes: 8 additions & 0 deletions api/v1beta1/upgradesuspensionwindow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ type UpgradeSuspensionWindowSpec struct {

// UpgradeSuspensionWindowStatus defines the observed state of UpgradeSuspensionWindow
type UpgradeSuspensionWindowStatus struct {
// MatchingConfigs are the UpgradeConfigs that are matched by the ConfigSelector.
MatchingConfigs []UpgradeSuspensionWindowStatusMatchingObject `json:"matchingConfigs,omitempty"`
// MatchingJobs are the UpgradeJobs that are matched by the JobSelector.
MatchingJobs []UpgradeSuspensionWindowStatusMatchingObject `json:"matchingJobs,omitempty"`
}

type UpgradeSuspensionWindowStatusMatchingObject struct {
Name string `json:"name"`
}

//+kubebuilder:object:root=true
Expand Down
50 changes: 49 additions & 1 deletion api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions config/crd/bases/managedupgrade.appuio.io_upgradeconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,23 @@ spec:
Also is increased when a job would have been created, but was not created due to the config being suspended.
format: date-time
type: string
nextPossibleSchedules:
description: NextPossibleSchedules is a list of the next possible
schedules for an upgrade.
items:
description: NextPossibleSchedule defines the next possible schedule
for an upgrade
properties:
time:
description: Time is the time of the next possible schedule
format: date-time
type: string
required:
- time
type: object
type: array
required:
- nextPossibleSchedules
type: object
required:
- spec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,29 @@ spec:
status:
description: UpgradeSuspensionWindowStatus defines the observed state
of UpgradeSuspensionWindow
properties:
matchingConfigs:
description: MatchingConfigs are the UpgradeConfigs that are matched
by the ConfigSelector.
items:
properties:
name:
type: string
required:
- name
type: object
type: array
matchingJobs:
description: MatchingJobs are the UpgradeJobs that are matched by
the JobSelector.
items:
properties:
name:
type: string
required:
- name
type: object
type: array
type: object
type: object
served: true
Expand Down
2 changes: 2 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,5 @@ rules:
- upgradesuspensionwindows/status
verbs:
- get
- patch
- update
Loading

0 comments on commit 86831b5

Please sign in to comment.