Skip to content

Commit 2bd69db

Browse files
authored
Merge pull request kubernetes#116351 from vinaykul/restart-free-pod-vertical-scaling-kubelet-fix-followup
Initialize pod resource allocation checkpoint manager to noop
2 parents 4f76e4a + 1e01358 commit 2bd69db

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

pkg/kubelet/status/state/state_checkpoint.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,50 @@ func (sc *stateCheckpoint) ClearState() error {
177177
sc.cache.ClearState()
178178
return sc.storeState()
179179
}
180+
181+
type noopStateCheckpoint struct{}
182+
183+
// NewNoopStateCheckpoint creates a dummy state checkpoint manager
184+
func NewNoopStateCheckpoint() State {
185+
return &noopStateCheckpoint{}
186+
}
187+
188+
func (sc *noopStateCheckpoint) GetContainerResourceAllocation(_ string, _ string) (v1.ResourceList, bool) {
189+
return nil, false
190+
}
191+
192+
func (sc *noopStateCheckpoint) GetPodResourceAllocation() PodResourceAllocation {
193+
return nil
194+
}
195+
196+
func (sc *noopStateCheckpoint) GetPodResizeStatus(_ string) (v1.PodResizeStatus, bool) {
197+
return "", false
198+
}
199+
200+
func (sc *noopStateCheckpoint) GetResizeStatus() PodResizeStatus {
201+
return nil
202+
}
203+
204+
func (sc *noopStateCheckpoint) SetContainerResourceAllocation(_ string, _ string, _ v1.ResourceList) error {
205+
return nil
206+
}
207+
208+
func (sc *noopStateCheckpoint) SetPodResourceAllocation(_ PodResourceAllocation) error {
209+
return nil
210+
}
211+
212+
func (sc *noopStateCheckpoint) SetPodResizeStatus(_ string, _ v1.PodResizeStatus) error {
213+
return nil
214+
}
215+
216+
func (sc *noopStateCheckpoint) SetResizeStatus(_ PodResizeStatus) error {
217+
return nil
218+
}
219+
220+
func (sc *noopStateCheckpoint) Delete(_ string, _ string) error {
221+
return nil
222+
}
223+
224+
func (sc *noopStateCheckpoint) ClearState() error {
225+
return nil
226+
}

pkg/kubelet/status/status_manager.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ func isPodStatusByKubeletEqual(oldStatus, status *v1.PodStatus) bool {
186186
}
187187

188188
func (m *manager) Start() {
189+
// Initialize m.state to no-op state checkpoint manager
190+
m.state = state.NewNoopStateCheckpoint()
191+
189192
// Create pod allocation checkpoint manager even if client is nil so as to allow local get/set of AllocatedResources & Resize
190193
if utilfeature.DefaultFeatureGate.Enabled(features.InPlacePodVerticalScaling) {
191194
stateImpl, err := state.NewStateCheckpoint(m.stateFileDirectory, podStatusManagerStateFile)

0 commit comments

Comments
 (0)