Skip to content
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
1 change: 0 additions & 1 deletion controller/utils/slow_start.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
Copyright 2016 The Kubernetes Authors.
Copyright 2024-2025 The KusionStack Authors.

Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
22 changes: 12 additions & 10 deletions xset/opslifecycle/label_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,22 @@
package opslifecycle

import (
appsv1alpha1 "kusionstack.io/kube-api/apps/v1alpha1"

"kusionstack.io/kube-utils/xset/api"
)

// OpsLifecycle default labels
var (
defaultOperatingLabelPrefix = "operating.opslifecycle.kusionstack.io"
defaultOperationTypeLabelPrefix = "operation-type.opslifecycle.kusionstack.io"
defaultOperateLabelPrefix = "operate.opslifecycle.kusionstack.io"
defaultUndoOperationTypeLabelPrefix = "undo-operation-type.opslifecycle.kusionstack.io"
defaultServiceAvailableLabel = "opslifecycle.kusionstack.io/service-available"
defaultPreparingDeleteLabel = "opslifecycle.kusionstack.io/preparing-to-delete"
defaultOperatingLabelPrefix = appsv1alpha1.PodOperatingLabelPrefix
defaultOperationTypeLabelPrefix = appsv1alpha1.PodOperationTypeLabelPrefix
defaultOperateLabelPrefix = appsv1alpha1.PodOperateLabelPrefix
defaultUndoOperationTypeLabelPrefix = appsv1alpha1.PodUndoOperationTypeLabelPrefix
defaultServiceAvailableLabel = appsv1alpha1.PodServiceAvailableLabel
defaultPreparingDeleteLabel = appsv1alpha1.PodPreparingDeleteLabel
)

var defaultLables = map[api.OperationLabelEnum]string{
var defaultLabels = map[api.OperationLabelEnum]string{
api.OperatingLabelPrefix: defaultOperatingLabelPrefix,
api.OperationTypeLabelPrefix: defaultOperationTypeLabelPrefix,
api.OperateLabelPrefix: defaultOperateLabelPrefix,
Expand All @@ -46,7 +48,7 @@ type LabelManagerImpl struct {

func NewLabelManager(overwrite map[api.OperationLabelEnum]string) api.LifeCycleLabelManager {
labelKeys := make(map[api.OperationLabelEnum]string)
for k, v := range defaultLables {
for k, v := range defaultLabels {
labelKeys[k] = v
}
if len(overwrite) > 0 {
Expand All @@ -55,15 +57,15 @@ func NewLabelManager(overwrite map[api.OperationLabelEnum]string) api.LifeCycleL
}
}

wellKnownLabelPrefilxesWithID := []string{
wellKnownLabelPrefixesWithID := []string{
labelKeys[api.OperatingLabelPrefix],
labelKeys[api.OperationTypeLabelPrefix],
labelKeys[api.UndoOperationTypeLabelPrefix],
labelKeys[api.OperatingLabelPrefix],
}
return &LabelManagerImpl{
labels: labelKeys,
wellKnownLabelPrefixesWithID: wellKnownLabelPrefilxesWithID,
wellKnownLabelPrefixesWithID: wellKnownLabelPrefixesWithID,
}
}

Expand Down
10 changes: 5 additions & 5 deletions xset/synccontrols/sync_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ func NewRealSyncControl(reconcileMixIn *mixin.ReconcilerMixin,
if lifeCycleLabelManager == nil {
lifeCycleLabelManager = opslifecycle.NewLabelManager(nil)
}
scaleInOpsLicecycleAdapter := xsetController.GetScaleInOpsLifecycleAdapter()
if scaleInOpsLicecycleAdapter == nil {
scaleInOpsLicecycleAdapter = &opslifecycle.DefaultScaleInLifecycleAdapter{LabelManager: lifeCycleLabelManager}
scaleInOpsLifecycleAdapter := xsetController.GetScaleInOpsLifecycleAdapter()
if scaleInOpsLifecycleAdapter == nil {
scaleInOpsLifecycleAdapter = &opslifecycle.DefaultScaleInLifecycleAdapter{LabelManager: lifeCycleLabelManager}
}
updateLifecycleAdapter := xsetController.GetUpdateOpsLifecycleAdapter()
if updateLifecycleAdapter == nil {
Expand All @@ -86,7 +86,7 @@ func NewRealSyncControl(reconcileMixIn *mixin.ReconcilerMixin,
recorder: reconcileMixIn.Recorder,

opsLifecycleMgr: lifeCycleLabelManager,
scaleInLifecycleAdapter: scaleInOpsLicecycleAdapter,
scaleInLifecycleAdapter: scaleInOpsLifecycleAdapter,
updateLifecycleAdapter: updateLifecycleAdapter,
cacheExpectation: cacheExpectation,
targetGVK: targetGVK,
Expand All @@ -101,7 +101,7 @@ func NewRealSyncControl(reconcileMixIn *mixin.ReconcilerMixin,
xsetGVK: xsetGVK,
targetGVK: targetGVK,

scaleInLifecycleAdapter: scaleInOpsLicecycleAdapter,
scaleInLifecycleAdapter: scaleInOpsLifecycleAdapter,
updateLifecycleAdapter: updateLifecycleAdapter,
}
}
Expand Down