Skip to content

Commit

Permalink
add log print to reconcile
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-lss committed Mar 18, 2024
1 parent 49d4e44 commit 7ef5e13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions pkg/controllers/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,24 +389,24 @@ func (c MilvusComponent) GetDependencies(spec v1beta1.MilvusSpec) []MilvusCompon
}

// IsImageUpdated returns whether the image of the component is updated
func (c MilvusComponent) IsImageUpdated(m *v1beta1.Milvus) bool {
func (c MilvusComponent) IsImageUpdated(m *v1beta1.Milvus, mc MilvusComponent) bool {
//Done:
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

logger := ctrl.LoggerFrom(ctx)
logger.Info("IsImageUpdated", "ComponentsDeployStatus", len(m.Status.ComponentsDeployStatus), "name", c.GetName(), "component", m.Status.Endpoint, "component", m.Spec)
logger.Info("IsImageUpdated", "ComponentsDeployStatus", len(m.Status.ComponentsDeployStatus), "name", c.GetName(), "component", mc.Name)

if m.Status.ComponentsDeployStatus == nil {
return false
}
deployStatus := m.Status.ComponentsDeployStatus[c.GetName()]
logger.Info("IsImageUpdated", "m.Spec.Com.Image", m.Spec.Com.Image, "deployStatus.Image", deployStatus.Image, "name", c.GetName(), "component", m.Status.Endpoint, "component", m.Spec)
logger.Info("IsImageUpdated", "m.Spec.Com.Image", m.Spec.Com.Image, "deployStatus.Image", deployStatus.Image, "name", c.GetName(), "component", mc.Name)
if m.Spec.Com.Image != deployStatus.Image {
return false
}

logger.Info("IsImageUpdated", "deployStatus.GetState()", deployStatus.GetState(), "name", c.GetName(), "component", m.Status.Endpoint, "component", m.Spec)
logger.Info("IsImageUpdated", "deployStatus.GetState()", deployStatus.GetState(), "name", c.GetName(), "component", m.Status.Endpoint, "component", mc.Name)
if deployStatus.GetState() != v1beta1.DeploymentComplete {
return false
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/deployment_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ func (m milvusDeploymentUpdater) RollingUpdateImageDependencyReady() bool {

for _, dep := range deps {
logger.Info("RollingUpdateImageDependencyReady", "dep", fmt.Sprintf("%s:%s", dep.Name, dep.FieldName), "component", m.component)
if !dep.IsImageUpdated(m.GetMilvus()) {
if !dep.IsImageUpdated(m.GetMilvus(), m.component) {
return false
}
}
Expand Down

0 comments on commit 7ef5e13

Please sign in to comment.