Skip to content

Commit

Permalink
not send the spec in UpdateStatus (#1506)
Browse files Browse the repository at this point in the history
by not sending the spec field in UpdateStatus
  • Loading branch information
pjuarezd committed Mar 15, 2023
1 parent dcadf84 commit 0b748d9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/controller/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func (c *Controller) updateTenantStatusWithRetry(ctx context.Context, tenant *mi
// You can use DeepCopy() to make a deep copy of original object and modify this copy
// Or create a copy manually for better performance
tenantCopy := tenant.DeepCopy()
tenantCopy.Spec = miniov2.TenantSpec{}
tenantCopy.Status.AvailableReplicas = availableReplicas
tenantCopy.Status.CurrentState = currentState
// If the CustomResourceSubresources feature gate is not enabled,
Expand Down Expand Up @@ -72,6 +73,7 @@ func (c *Controller) updatePoolStatusWithRetry(ctx context.Context, tenant *mini
// You can use DeepCopy() to make a deep copy of original object and modify this copy
// Or create a copy manually for better performance
tenantCopy := tenant.DeepCopy()
tenantCopy.Spec = miniov2.TenantSpec{}
tenantCopy.Status = *tenant.Status.DeepCopy()
tenantCopy.Status.Pools = tenant.Status.Pools
// If the CustomResourceSubresources feature gate is not enabled,
Expand Down Expand Up @@ -105,6 +107,7 @@ func (c *Controller) updateCertificatesWithRetry(ctx context.Context, tenant *mi
// You can use DeepCopy() to make a deep copy of original object and modify this copy
// Or create a copy manually for better performance
tenantCopy := tenant.DeepCopy()
tenantCopy.Spec = miniov2.TenantSpec{}
tenantCopy.Status = *tenant.Status.DeepCopy()
tenantCopy.Status.Certificates.AutoCertEnabled = &autoCertEnabled
// If the CustomResourceSubresources feature gate is not enabled,
Expand Down Expand Up @@ -134,6 +137,7 @@ func (c *Controller) updateCustomCertificatesStatus(ctx context.Context, tenant
// You can use DeepCopy() to make a deep copy of original object and modify this copy
// Or create a copy manually for better performance
tenantCopy := tenant.DeepCopy()
tenantCopy.Spec = miniov2.TenantSpec{}
tenantCopy.Status.Certificates.CustomCertificates = customCertificates

// If the CustomResourceSubresources feature gate is not enabled,
Expand All @@ -156,6 +160,7 @@ func (c *Controller) updateProvisionedUsersStatus(ctx context.Context, tenant *m

func (c *Controller) updateProvisionedUsersWithRetry(ctx context.Context, tenant *miniov2.Tenant, provisionedUsers bool, retry bool) (*miniov2.Tenant, error) {
tenantCopy := tenant.DeepCopy()
tenantCopy.Spec = miniov2.TenantSpec{}
tenantCopy.Status = *tenant.Status.DeepCopy()
tenantCopy.Status.ProvisionedUsers = provisionedUsers
opts := metav1.UpdateOptions{}
Expand All @@ -181,6 +186,7 @@ func (c *Controller) updateProvisionedBucketStatus(ctx context.Context, tenant *

func (c *Controller) updateProvisionedBucketsWithRetry(ctx context.Context, tenant *miniov2.Tenant, provisionedBuckets bool, retry bool) (*miniov2.Tenant, error) {
tenantCopy := tenant.DeepCopy()
tenantCopy.Spec = miniov2.TenantSpec{}
tenantCopy.Status = *tenant.Status.DeepCopy()
tenantCopy.Status.ProvisionedBuckets = provisionedBuckets
opts := metav1.UpdateOptions{}
Expand Down Expand Up @@ -214,6 +220,7 @@ func (c *Controller) updateTenantSyncVersionWithRetry(ctx context.Context, tenan
// You can use DeepCopy() to make a deep copy of original object and modify this copy
// Or create a copy manually for better performance
tenantCopy := tenant.DeepCopy()
tenantCopy.Spec = miniov2.TenantSpec{}
tenantCopy.Status.SyncVersion = syncVersion
// If the CustomResourceSubresources feature gate is not enabled,
// we must use Update instead of UpdateStatus to update the Status block of the Tenant resource.
Expand Down

0 comments on commit 0b748d9

Please sign in to comment.