Skip to content

Commit

Permalink
feat(sysadvisor): add healthz check
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzzhhb committed Mar 27, 2024
1 parent 7737c2b commit 59c5375
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 3 additions & 1 deletion pkg/agent/sysadvisor/plugin/inference/inference.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ func NewInferencePlugin(pluginName string, conf *config.Configuration, extraConf
}

func (infp *InferencePlugin) Run(ctx context.Context) {
general.RegisterHeartbeatCheck(borweinfetcher.BorweinModelResultFetcherName, 3*infp.period, general.HealthzCheckStateNotReady, 3*infp.period)
if len(infp.modelsResultFetchers) > 0 {
general.RegisterHeartbeatCheck(borweinfetcher.BorweinModelResultFetcherName, 3*infp.period, general.HealthzCheckStateNotReady, 3*infp.period)
}
wait.UntilWithContext(ctx, infp.fetchModelResult, infp.period)
}

Expand Down
6 changes: 2 additions & 4 deletions pkg/agent/sysadvisor/plugin/metacache/metacache.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ func (mcp *MetaCachePlugin) periodicWork(_ context.Context) {
// Fill missing container metadata from metaserver
f := func(podUID string, containerName string, ci *types.ContainerInfo) bool {
spec, err := mcp.metaServer.GetContainerSpec(podUID, containerName)
defer func() {
_ = general.UpdateHealthzStateByError(mcp.name, err)
}()

if err != nil {
klog.Errorf("[metacache] get container spec failed: %v, %v/%v", err, podUID, containerName)
Expand All @@ -112,5 +109,6 @@ func (mcp *MetaCachePlugin) periodicWork(_ context.Context) {
}
return true
}
_ = mcp.MetaWriter.RangeAndUpdateContainer(f)
err := mcp.MetaWriter.RangeAndUpdateContainer(f)
_ = general.UpdateHealthzStateByError(mcp.name, err)
}

0 comments on commit 59c5375

Please sign in to comment.