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
47 changes: 47 additions & 0 deletions pkg/kubelet/status/state/state_checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,50 @@ func (sc *stateCheckpoint) ClearState() error {
sc.cache.ClearState()
return sc.storeState()
}

type noopStateCheckpoint struct{}

// NewNoopStateCheckpoint creates a dummy state checkpoint manager
func NewNoopStateCheckpoint() State {
return &noopStateCheckpoint{}
}

func (sc *noopStateCheckpoint) GetContainerResourceAllocation(_ string, _ string) (v1.ResourceList, bool) {
return nil, false
}

func (sc *noopStateCheckpoint) GetPodResourceAllocation() PodResourceAllocation {
return nil
}

func (sc *noopStateCheckpoint) GetPodResizeStatus(_ string) (v1.PodResizeStatus, bool) {
return "", false
}

func (sc *noopStateCheckpoint) GetResizeStatus() PodResizeStatus {
return nil
}

func (sc *noopStateCheckpoint) SetContainerResourceAllocation(_ string, _ string, _ v1.ResourceList) error {
return nil
}

func (sc *noopStateCheckpoint) SetPodResourceAllocation(_ PodResourceAllocation) error {
return nil
}

func (sc *noopStateCheckpoint) SetPodResizeStatus(_ string, _ v1.PodResizeStatus) error {
return nil
}

func (sc *noopStateCheckpoint) SetResizeStatus(_ PodResizeStatus) error {
return nil
}

func (sc *noopStateCheckpoint) Delete(_ string, _ string) error {
return nil
}

func (sc *noopStateCheckpoint) ClearState() error {
return nil
}
3 changes: 3 additions & 0 deletions pkg/kubelet/status/status_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ func isPodStatusByKubeletEqual(oldStatus, status *v1.PodStatus) bool {
}

func (m *manager) Start() {
// Initialize m.state to no-op state checkpoint manager
m.state = state.NewNoopStateCheckpoint()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if we uncover more like this, it can be easier to put this in the else block below so when the feature graduates, we can be sure we just remove the else block.


// Create pod allocation checkpoint manager even if client is nil so as to allow local get/set of AllocatedResources & Resize
if utilfeature.DefaultFeatureGate.Enabled(features.InPlacePodVerticalScaling) {
stateImpl, err := state.NewStateCheckpoint(m.stateFileDirectory, podStatusManagerStateFile)
Expand Down