Skip to content

Commit b3d1a89

Browse files
author
Quentin Brosse
authored
feat(k8s): add maintenance and upgrade features (#258)
1 parent 4f9744e commit b3d1a89

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

api/k8s/v1beta3/k8s_sdk.go

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,50 @@ func (enum *ListPoolsRequestOrderBy) UnmarshalJSON(data []byte) error {
223223
return nil
224224
}
225225

226+
type MaintenanceWindowDayOfTheWeek string
227+
228+
const (
229+
// MaintenanceWindowDayOfTheWeekAny is [insert doc].
230+
MaintenanceWindowDayOfTheWeekAny = MaintenanceWindowDayOfTheWeek("any")
231+
// MaintenanceWindowDayOfTheWeekMonday is [insert doc].
232+
MaintenanceWindowDayOfTheWeekMonday = MaintenanceWindowDayOfTheWeek("monday")
233+
// MaintenanceWindowDayOfTheWeekTuesday is [insert doc].
234+
MaintenanceWindowDayOfTheWeekTuesday = MaintenanceWindowDayOfTheWeek("tuesday")
235+
// MaintenanceWindowDayOfTheWeekWednesday is [insert doc].
236+
MaintenanceWindowDayOfTheWeekWednesday = MaintenanceWindowDayOfTheWeek("wednesday")
237+
// MaintenanceWindowDayOfTheWeekThursday is [insert doc].
238+
MaintenanceWindowDayOfTheWeekThursday = MaintenanceWindowDayOfTheWeek("thursday")
239+
// MaintenanceWindowDayOfTheWeekFriday is [insert doc].
240+
MaintenanceWindowDayOfTheWeekFriday = MaintenanceWindowDayOfTheWeek("friday")
241+
// MaintenanceWindowDayOfTheWeekSaturday is [insert doc].
242+
MaintenanceWindowDayOfTheWeekSaturday = MaintenanceWindowDayOfTheWeek("saturday")
243+
// MaintenanceWindowDayOfTheWeekSunday is [insert doc].
244+
MaintenanceWindowDayOfTheWeekSunday = MaintenanceWindowDayOfTheWeek("sunday")
245+
)
246+
247+
func (enum MaintenanceWindowDayOfTheWeek) String() string {
248+
if enum == "" {
249+
// return default value if empty
250+
return "any"
251+
}
252+
return string(enum)
253+
}
254+
255+
func (enum MaintenanceWindowDayOfTheWeek) MarshalJSON() ([]byte, error) {
256+
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
257+
}
258+
259+
func (enum *MaintenanceWindowDayOfTheWeek) UnmarshalJSON(data []byte) error {
260+
tmp := ""
261+
262+
if err := json.Unmarshal(data, &tmp); err != nil {
263+
return err
264+
}
265+
266+
*enum = MaintenanceWindowDayOfTheWeek(MaintenanceWindowDayOfTheWeek(tmp).String())
267+
return nil
268+
}
269+
226270
type NodeStatus string
227271

228272
const (
@@ -363,6 +407,14 @@ type Cluster struct {
363407
DashboardEnabled bool `json:"dashboard_enabled"`
364408
// Ingress display which ingress is deployed
365409
Ingress string `json:"ingress"`
410+
411+
AutoUpgrade *ClusterAutoUpgrade `json:"auto_upgrade"`
412+
}
413+
414+
type ClusterAutoUpgrade struct {
415+
Enabled bool `json:"enabled"`
416+
417+
MaintenanceWindow *MaintenanceWindow `json:"maintenance_window"`
366418
}
367419

368420
type ClusterAutoscalerConfig struct {
@@ -381,6 +433,12 @@ type ClusterAutoscalerConfig struct {
381433
ExpendablePodsPriorityCutoff int32 `json:"expendable_pods_priority_cutoff"`
382434
}
383435

436+
type CreateClusterRequestAutoUpgrade struct {
437+
Enable bool `json:"enable"`
438+
439+
MaintenanceWindow *MaintenanceWindow `json:"maintenance_window"`
440+
}
441+
384442
type CreateClusterRequestAutoscalerConfig struct {
385443
ScaleDownDisabled *bool `json:"scale_down_disabled"`
386444

@@ -448,6 +506,14 @@ type ListVersionsResponse struct {
448506
Versions []*Version `json:"versions"`
449507
}
450508

509+
type MaintenanceWindow struct {
510+
StartHour uint32 `json:"start_hour"`
511+
// Day
512+
//
513+
// Default value: any
514+
Day MaintenanceWindowDayOfTheWeek `json:"day"`
515+
}
516+
451517
// Node node
452518
type Node struct {
453519
// ID display node unique ID
@@ -526,6 +592,12 @@ type Pool struct {
526592
type ResetClusterAdminTokenResponse struct {
527593
}
528594

595+
type UpdateClusterRequestAutoUpgrade struct {
596+
Enable *bool `json:"enable"`
597+
598+
MaintenanceWindow *MaintenanceWindow `json:"maintenance_window"`
599+
}
600+
529601
type UpdateClusterRequestAutoscalerConfig struct {
530602
ScaleDownDisabled *bool `json:"scale_down_disabled"`
531603

@@ -664,6 +736,8 @@ type CreateClusterRequest struct {
664736
DefaultPoolConfig *CreateClusterRequestDefaultPoolConfig `json:"default_pool_config"`
665737

666738
AutoscalerConfig *CreateClusterRequestAutoscalerConfig `json:"autoscaler_config"`
739+
740+
AutoUpgrade *CreateClusterRequestAutoUpgrade `json:"auto_upgrade"`
667741
}
668742

669743
// CreateCluster create a new cluster
@@ -760,6 +834,8 @@ type UpdateClusterRequest struct {
760834
EnableDashboard *bool `json:"enable_dashboard"`
761835
// Ingress select a Kubernetes Ingress Controller
762836
Ingress *string `json:"ingress"`
837+
838+
AutoUpgrade *UpdateClusterRequestAutoUpgrade `json:"auto_upgrade"`
763839
}
764840

765841
// UpdateCluster update an existing cluster

0 commit comments

Comments
 (0)