Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add status as a condition for searching registercenter #6455

Merged
merged 2 commits into from
Oct 23, 2024
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: 1 addition & 0 deletions internal/tools/orchestrator/dbclient/addon_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
if err := db.Where("addon_name = ?", addonName).
Where("az = ?", cluster).
Where("is_deleted = ?", apistructs.AddonNotDeleted).
Where("status = ?", apistructs.AddonAttached).

Check warning on line 122 in internal/tools/orchestrator/dbclient/addon_instance.go

View check run for this annotation

Codecov / codecov/patch

internal/tools/orchestrator/dbclient/addon_instance.go#L122

Added line #L122 was not covered by tests
First(&instance).Error; err != nil {
if gorm.IsRecordNotFoundError(err) {
return nil, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ func updatePodAndInstance(dbclient *instanceinfo.Client, podlist *corev1.PodList
mainContainer := getMainContainerStatus(pod.Status.ContainerStatuses, container.Name)
terminatedContainer := mainContainer.LastTerminationState.Terminated
if terminatedContainer != nil {
logrus.Infof("get [prevContainerID] from terminatedContainer")
if len(strings.Split(terminatedContainer.ContainerID, "://")) == 2 {
runtimeAndId := strings.Split(terminatedContainer.ContainerID, "://")
prevContainerID = runtimeAndId[1]
Expand All @@ -476,7 +475,6 @@ func updatePodAndInstance(dbclient *instanceinfo.Client, podlist *corev1.PodList
}
currentContainer := mainContainer.State.Running
if currentContainer != nil {
logrus.Infof("get [currentContainerID] from currentContainer")
if len(strings.Split(mainContainer.ContainerID, "://")) == 2 {
runtimeAndId := strings.Split(mainContainer.ContainerID, "://")
currentContainerID = runtimeAndId[1]
Expand Down Expand Up @@ -614,8 +612,6 @@ func updatePodAndInstance(dbclient *instanceinfo.Client, podlist *corev1.PodList
}
logrus.Infof("latest instance id %v , others cleared by [prevContainerID]", instances[0].ID)
}
} else {
logrus.Infof("[prevContainerID] is empty, skip create or update")
}
if currentContainerID != "" {
instances, err := r.ByContainerID(currentContainerID).ByRuntimeID(runtimeID).ByApplicationID(applicationID).Do()
Expand Down
Loading