-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle the review comments in PR 4407
- changed the function to retrieveDeviceNodeName() and call it only at the start of domainmgr Run() - remove the ctx.hvTypeKube and status.IsDNidNode checks in the domainmgr.go code; also remove the status.DomainConfigDeleted. we now rely on normal domain handling of delete/cleanup work flow - fixed a bug where nodeName with underscore, which is not allowed in kubernetes names - changed the zedmanager/handleclusterstatus.go code to PoC code base, and commented out one line for later PR to handle - implemented the scheme when kubevirt can not contact kubernetes API-server or the cluster does not have the POD/VMI being scheduled yet, we return the 'Unknown' status now. It keeps a starting 'unknown' timestamp per application - also if the 'unknown' status lasts longer than 5 minutes, it changes into 'Halt' status back to domainmgr - updated 'zedkube.md' section 'Handle Domain Apps Status in domainmgr' for the above behavior Signed-off-by: Naiming Shen <[email protected]>
- Loading branch information
1 parent
7db2529
commit 3e80fde
Showing
7 changed files
with
134 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,57 @@ | ||
// Copyright (c) 2024 Zededa, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package zedmanager | ||
|
||
import "github.com/lf-edge/eve/pkg/pillar/types" | ||
|
||
func handleENClusterAppStatusCreate(ctxArg interface{}, key string, configArg interface{}) { | ||
log.Functionf("handleENClusterAppStatusCreate(%s)", key) | ||
log.Noticef("handleENClusterAppStatusCreate(%s)", key) | ||
ctx := ctxArg.(*zedmanagerContext) | ||
status := configArg.(types.ENClusterAppStatus) | ||
handleENClusterAppStatusImpl(ctx, key, &status) | ||
} | ||
|
||
func handleENClusterAppStatusModify(ctxArg interface{}, key string, configArg interface{}, oldConfigArg interface{}) { | ||
log.Functionf("handleENClusterAppStatusModify(%s)", key) | ||
log.Noticef("handleENClusterAppStatusModify(%s)", key) | ||
ctx := ctxArg.(*zedmanagerContext) | ||
status := configArg.(types.ENClusterAppStatus) | ||
handleENClusterAppStatusImpl(ctx, key, &status) | ||
} | ||
|
||
func handleENClusterAppStatusDelete(ctxArg interface{}, key string, configArg interface{}) { | ||
log.Functionf("handleENClusterAppStatusDelete(%s)", key) | ||
log.Noticef("handleENClusterAppStatusDelete(%s)", key) | ||
ctx := ctxArg.(*zedmanagerContext) | ||
//status := configArg.(types.ENClusterAppStatus) | ||
handleENClusterAppStatusImpl(ctx, key, nil) | ||
status := configArg.(types.ENClusterAppStatus) | ||
handleENClusterAppStatusImpl(ctx, key, &status) | ||
} | ||
|
||
func handleENClusterAppStatusImpl(ctx *zedmanagerContext, key string, status *types.ENClusterAppStatus) { | ||
|
||
log.Functionf("handleENClusterAppStatusImpl(%s) for app-status %v", key, status) | ||
pub := ctx.pubAppInstanceStatus | ||
items := pub.GetAll() | ||
for _, st := range items { | ||
aiStatus := st.(types.AppInstanceStatus) | ||
if aiStatus.UUIDandVersion.UUID.String() == key { | ||
log.Functionf("handleENClusterAppStatusImpl(%s) found ai status, update", key) | ||
aiStatus := lookupAppInstanceStatus(ctx, key) | ||
log.Noticef("handleENClusterAppStatusImpl(%s) for app-status %v aiStatus %v", key, status, aiStatus) | ||
|
||
if status.ScheduledOnThisNode { | ||
if aiStatus == nil { | ||
// This could happen if app failover to other node and failing back to this designated node. | ||
// One scenario is node reboot. Kubernetes told us that app is scheduled on this node. | ||
aiConfig := lookupAppInstanceConfig(ctx, key, false) | ||
if aiConfig == nil { | ||
log.Errorf("handleENClusterAppStatusImpl(%s) AppInstanceConfig missing for app", key) | ||
return | ||
} | ||
// XXX this will be handled in later PR in clustering and zedmanager code | ||
//handleCreateAppInstanceStatus(ctx, *aiConfig) | ||
} else { | ||
// Nothing to do, we already have aiStatus | ||
log.Functionf("handleENClusterAppStatusImpl(%s) for app-status %v aiStatus %v", key, status, aiStatus) | ||
return | ||
} | ||
} else { // not scheduled here. | ||
|
||
updateAIStatusUUID(ctx, aiStatus.UUIDandVersion.UUID.String()) | ||
break | ||
// if aiStatus is not present, nothing to do | ||
if aiStatus != nil { | ||
// If I am not scheduled here, just unpublish the AIStatus. | ||
// We probably had app running on this node earlier before failover. | ||
unpublishAppInstanceStatus(ctx, aiStatus) | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.