Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(upgrades): add support for cluster upgrade rescheduling #38

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/acloudapi/admin_scheduledclusterupgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (c *adminClientImpl) UpdateScheduledClusterUpgrade(ctx context.Context, req
SetContext(ctx).
SetResult(&scheduledClusterUpgrade).
SetBody(&request).
Put(fmt.Sprintf("/admin/v1/scheduled-cluster-upgrades/%s", request.Identity))
Patch(fmt.Sprintf("/admin/v1/scheduled-cluster-upgrades/%s", request.Identity))
if err := c.CheckResponse(response, err); err != nil {
return nil, err
}
Expand Down
41 changes: 24 additions & 17 deletions pkg/acloudapi/apitypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,21 +388,29 @@ type SilenceMatcher struct {
}

type ScheduledClusterUpgrade struct {
Identity string `json:"identity" yaml:"Identity"`
ClusterIdentity string `json:"clusterIdentity" yaml:"ClusterIdentity"`
CreatedAt time.Time `json:"createdAt" yaml:"CreatedAt"`
ModifiedAt time.Time `json:"modifiedAt" yaml:"ModifiedAt"`
WindowStart time.Time `json:"windowStart" yaml:"WindowStart"`
WindowEnd time.Time `json:"windowEnd" yaml:"WindowEnd"`
FromClusterVersion string `json:"fromClusterVersion" yaml:"FromClusterVersion"`
ToClusterVersion string `json:"toClusterVersion" yaml:"ToClusterVersion"`
Status ScheduledClusterUpgradeStatus `json:"status" yaml:"Status"`
Reason string `json:"reason" yaml:"Reason"`
Identity string `json:"identity" yaml:"Identity"`
ClusterIdentity string `json:"clusterIdentity" yaml:"ClusterIdentity"`
CreatedAt time.Time `json:"createdAt" yaml:"CreatedAt"`
ModifiedAt time.Time `json:"modifiedAt" yaml:"ModifiedAt"`
WindowStart time.Time `json:"windowStart" yaml:"WindowStart"`
WindowEnd time.Time `json:"windowEnd" yaml:"WindowEnd"`
FromClusterVersion string `json:"fromClusterVersion" yaml:"FromClusterVersion"`
ToClusterVersion string `json:"toClusterVersion" yaml:"ToClusterVersion"`
Status ScheduledClusterUpgradeStatus `json:"status" yaml:"Status"`
Reason string `json:"reason" yaml:"Reason"`
ScheduleRequestDate time.Time `json:"scheduleRequestDate" yaml:"ScheduleRequestDate"`
IgnoreMaintenanceSchedule bool `json:"ignoreMaintenanceSchedule" yaml:"IgnoreMaintenanceSchedule"`
}

type ScheduledClusterUpgradeStatus string

const (
// Requested represents the status where a cluster upgrade
// has been explicitly requested but not yet scheduled.
// This status is used to indicate that a new scheduled
// cluster upgrade has been initiated by the user or system.
Requested ScheduledClusterUpgradeStatus = "REQUESTED"

// Scheduled indicates that this cluster upgrade has been scheduled
// and is pending execution.
Scheduled ScheduledClusterUpgradeStatus = "SCHEDULED"
Expand All @@ -418,10 +426,6 @@ const (
// Succeeded indicates that the cluster upgrade has been completed successfully.
Succeeded ScheduledClusterUpgradeStatus = "SUCCEEDED"

// Skipped indicates that this version of the cluster upgrade has been skipped.
// The automatic upgrade process will not attempt to upgrade to a skipped version.
Skipped ScheduledClusterUpgradeStatus = "SKIPPED"

// Superseded means that this scheduled cluster upgrade has been superseded
// due to external factors, such as a change in the update channel version
// or a change in the cluster's status.
Expand All @@ -445,9 +449,12 @@ type CreateScheduledClusterUpgradeRequest struct {
}

type UpdateScheduledClusterUpgradeRequest struct {
Identity string `json:"identity"`
Status ScheduledClusterUpgradeStatus `json:"status"`
Reason string `json:"reason" yaml:"Reason"`
Identity string `json:"identity"`
Status ScheduledClusterUpgradeStatus `json:"status,omitempty"`
Reason string `json:"reason,omitempty"`
WindowStart *time.Time `json:"windowStart,omitempty"`
WindowEnd *time.Time `json:"windowEnd,omitempty"`
Version string `json:"version,omitempty"`
}

type ListScheduledClusterUpgradesOpts struct {
Expand Down
Loading