Skip to content

Commit 9bcee7f

Browse files
author
lamai93
committed
Clean up.
1 parent 341fc3b commit 9bcee7f

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

pkg/deployment/cluster_scaling_integration.go

+1-18
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ func newClusterScalingIntegration(depl *Deployment) *clusterScalingIntegration {
6565

6666
// SendUpdateToCluster records the given spec to be sended to the cluster.
6767
func (ci *clusterScalingIntegration) SendUpdateToCluster(spec api.DeploymentSpec) {
68-
ci.log.Debug().Msg("SendUpdateToCluster called")
6968
ci.pendingUpdate.mutex.Lock()
7069
defer ci.pendingUpdate.mutex.Unlock()
7170
ci.pendingUpdate.spec = &spec
@@ -76,7 +75,6 @@ func (ci *clusterScalingIntegration) ListenForClusterEvents(stopCh <-chan struct
7675
start := time.Now()
7776
goodInspections := 0
7877
for {
79-
ci.log.Debug().Msg("inspection loop for cluster int.")
8078
delay := time.Second * 2
8179

8280
// Is deployment in running state
@@ -99,8 +97,6 @@ func (ci *clusterScalingIntegration) ListenForClusterEvents(stopCh <-chan struct
9997
goodInspections++
10098
}
10199
}
102-
} else {
103-
ci.log.Debug().Msg("cluster Phase not Running")
104100
}
105101

106102
select {
@@ -116,7 +112,6 @@ func (ci *clusterScalingIntegration) ListenForClusterEvents(stopCh <-chan struct
116112
// Perform a single inspection of the cluster
117113
func (ci *clusterScalingIntegration) inspectCluster(ctx context.Context, expectSuccess bool) error {
118114
log := ci.log
119-
log.Debug().Msg("inspect cluster for scaling integration")
120115
c, err := ci.depl.clientCache.GetDatabase(ctx)
121116
if err != nil {
122117
return maskAny(err)
@@ -129,7 +124,6 @@ func (ci *clusterScalingIntegration) inspectCluster(ctx context.Context, expectS
129124
return maskAny(err)
130125
}
131126
if req.Coordinators == nil && req.DBServers == nil {
132-
log.Debug().Msg("Nothing to check")
133127
// Nothing to check
134128
return nil
135129
}
@@ -147,14 +141,11 @@ func (ci *clusterScalingIntegration) inspectCluster(ctx context.Context, expectS
147141
dbserversChanged = true
148142
}
149143
if !coordinatorsChanged && !dbserversChanged {
150-
// if there is nothing to change, check if we naver have asked the cluster before
144+
// if there is nothing to change, check if we never have asked the cluster before
151145
// if so, fill in the values for the first time.
152146
// This happens, when the operator is redeployed and there has not been any
153147
// update events yet.
154148
if desired.Coordinators == nil || desired.DBServers == nil {
155-
//ci.lastNumberOfServers.mutex.Lock()
156-
//defer ci.lastNumberOfServers.mutex.Unlock()
157-
ci.log.Debug().Msg("Some of desired is nil")
158149
if req.Coordinators != nil {
159150
ci.lastNumberOfServers.NumberOfServers.Coordinators = req.Coordinators
160151
}
@@ -163,15 +154,13 @@ func (ci *clusterScalingIntegration) inspectCluster(ctx context.Context, expectS
163154
}
164155
}
165156

166-
ci.log.Debug().Msg("Nothing has changed")
167157
// Nothing has changed
168158
return nil
169159
}
170160
// Let's update the spec
171161
apiObject := ci.depl.apiObject
172162
current, err := ci.depl.deps.DatabaseCRCli.DatabaseV1alpha().ArangoDeployments(apiObject.Namespace).Get(apiObject.Name, metav1.GetOptions{})
173163
if err != nil {
174-
log.Debug().Err(err).Msg("Failed to get current deployment")
175164
return maskAny(err)
176165
}
177166
newSpec := current.Spec.DeepCopy()
@@ -188,7 +177,6 @@ func (ci *clusterScalingIntegration) inspectCluster(ctx context.Context, expectS
188177
// Restore original spec in cluster
189178
ci.SendUpdateToCluster(current.Spec)
190179
} else {
191-
log.Debug().Msg("UpdatedCRSpec via agency")
192180
if err := ci.depl.updateCRSpec(*newSpec); err != nil {
193181
log.Warn().Err(err).Msg("Failed to update current deployment")
194182
return maskAny(err)
@@ -200,14 +188,12 @@ func (ci *clusterScalingIntegration) inspectCluster(ctx context.Context, expectS
200188
// updateClusterServerCount updates the intended number of servers of the cluster.
201189
// Returns true when it is safe to ask the cluster for updates.
202190
func (ci *clusterScalingIntegration) updateClusterServerCount(ctx context.Context, expectSuccess bool) (bool, error) {
203-
ci.log.Debug().Msg("updateClusterServerCount")
204191
// Any update needed?
205192
ci.pendingUpdate.mutex.Lock()
206193
spec := ci.pendingUpdate.spec
207194
ci.pendingUpdate.mutex.Unlock()
208195
if spec == nil {
209196
// Nothing pending
210-
ci.log.Debug().Msg("Nothing pending")
211197
return true, nil
212198
}
213199

@@ -225,15 +211,12 @@ func (ci *clusterScalingIntegration) updateClusterServerCount(ctx context.Contex
225211

226212
// This is to prevent unneseccary updates that may override some values written by the WebUI (in the case of a update loop)
227213
if coordinatorCount != lastNumberOfServers.GetCoordinators() || dbserverCount != lastNumberOfServers.GetDBServers() {
228-
ci.log.Debug().Msg("Set number of servers now")
229214
if err := arangod.SetNumberOfServers(ctx, c.Connection(), coordinatorCount, dbserverCount); err != nil {
230215
if expectSuccess {
231216
log.Debug().Err(err).Msg("Failed to set number of servers")
232217
}
233218
return false, maskAny(err)
234219
}
235-
} else {
236-
ci.log.Debug().Msg("Nothing has changed")
237220
}
238221

239222
// Success, now update internal state

0 commit comments

Comments
 (0)