@@ -39,7 +39,7 @@ const (
39
39
HealthReduceAvailabilityMessage = "Reduced Availability"
40
40
)
41
41
42
- func (c * Controller ) updateHealthStatusForTenant (tenant * miniov2.Tenant ) error {
42
+ func (c * Controller ) updateHealthStatusForTenant (tenant * miniov2.Tenant ) ( * miniov2. Tenant , error ) {
43
43
// don't get the tenant cluster health if it doesn't have at least 1 pool initialized
44
44
oneInitialized := false
45
45
for _ , pool := range tenant .Status .Pools {
@@ -49,25 +49,25 @@ func (c *Controller) updateHealthStatusForTenant(tenant *miniov2.Tenant) error {
49
49
}
50
50
if ! oneInitialized {
51
51
klog .Infof ("'%s/%s' no pool is initialized" , tenant .Namespace , tenant .Name )
52
- return nil
52
+ return tenant , nil
53
53
}
54
54
55
55
tenantConfiguration , err := c .getTenantCredentials (context .Background (), tenant )
56
56
if err != nil {
57
- return err
57
+ return nil , err
58
58
}
59
59
60
60
adminClnt , err := tenant .NewMinIOAdmin (tenantConfiguration , c .getTransport ())
61
61
if err != nil {
62
62
klog .Errorf ("Error instantiating adminClnt '%s/%s': %v" , tenant .Namespace , tenant .Name , err )
63
- return err
63
+ return nil , err
64
64
}
65
65
66
66
aClnt , err := madmin .NewAnonymousClient (tenant .MinIOServerHostAddress (), tenant .TLS ())
67
67
if err != nil {
68
68
// show the error and continue
69
69
klog .Infof ("'%s/%s': %v" , tenant .Namespace , tenant .Name , err )
70
- return nil
70
+ return tenant , nil
71
71
}
72
72
aClnt .SetCustomTransport (c .getTransport ())
73
73
@@ -79,7 +79,7 @@ func (c *Controller) updateHealthStatusForTenant(tenant *miniov2.Tenant) error {
79
79
if err != nil {
80
80
// show the error and continue
81
81
klog .Infof ("'%s/%s' Failed to get cluster health: %v" , tenant .Namespace , tenant .Name , err )
82
- return nil
82
+ return tenant , nil
83
83
}
84
84
85
85
tenant .Status .DrivesHealing = int32 (healthResult .HealingDrives )
@@ -98,7 +98,7 @@ func (c *Controller) updateHealthStatusForTenant(tenant *miniov2.Tenant) error {
98
98
LabelSelector : fmt .Sprintf ("%s=%s" , miniov2 .TenantLabel , tenant .Name ),
99
99
})
100
100
if err != nil {
101
- return err
101
+ return nil , err
102
102
}
103
103
104
104
allPodsRunning := true
@@ -122,7 +122,7 @@ func (c *Controller) updateHealthStatusForTenant(tenant *miniov2.Tenant) error {
122
122
if err != nil {
123
123
// show the error and continue
124
124
klog .Infof ("'%s/%s' Failed to get storage info: %v" , tenant .Namespace , tenant .Name , err )
125
- return nil
125
+ return tenant , nil
126
126
}
127
127
128
128
// Add back "Usable Capacity" & "Internal" values in Tenant Status and in the UI
@@ -205,13 +205,8 @@ func (c *Controller) updateHealthStatusForTenant(tenant *miniov2.Tenant) error {
205
205
klog .Infof ("'%s/%s' Can't update tenant status with tiers: %v" , tenant .Namespace , tenant .Name , err )
206
206
}
207
207
}
208
- // Add tenant to the health check queue again until is green again
209
- if tenant .Status .HealthStatus != miniov2 .HealthStatusGreen {
210
- key := fmt .Sprintf ("%s/%s" , tenant .GetNamespace (), tenant .Name )
211
- c .healthCheckQueue .Add (key )
212
- }
213
208
214
- return nil
209
+ return tenant , nil
215
210
}
216
211
217
212
// HealthResult holds the results from cluster/health query into MinIO
@@ -244,10 +239,16 @@ func (c *Controller) syncHealthCheckHandler(key string) (Result, error) {
244
239
245
240
tenant .EnsureDefaults ()
246
241
247
- if err = c .updateHealthStatusForTenant (tenant ); err != nil {
242
+ tenant , err = c .updateHealthStatusForTenant (tenant )
243
+ if err != nil {
248
244
klog .Errorf ("%v" , err )
249
245
return WrapResult (Result {}, err )
250
246
}
251
247
248
+ // Add tenant to the health check queue again until is green again
249
+ if tenant != nil && tenant .Status .HealthStatus != miniov2 .HealthStatusGreen {
250
+ c .healthCheckQueue .Add (key )
251
+ }
252
+
252
253
return WrapResult (Result {}, nil )
253
254
}
0 commit comments