Skip to content

Commit

Permalink
fix crash on upgrade from v4.2.9 to v4.4.7 (#1014)
Browse files Browse the repository at this point in the history
every pointer must be checked separately

Fixes #1011
  • Loading branch information
harshavardhana authored Feb 14, 2022
1 parent c8758c2 commit ee1da23
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions pkg/controller/cluster/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,15 @@ func (c *Controller) upgrade429(ctx context.Context, tenant *miniov2.Tenant) (*m
if atLeastOnePoolInitialized {
for i, pool := range tenant.Spec.Pools {
// if they have a security context, and is having them run as root
if pool.SecurityContext != nil && !*pool.SecurityContext.RunAsNonRoot && *pool.SecurityContext.RunAsUser == 0 {
// Report the pool is now Legacy Security Context
tenant.Status.Pools[i].LegacySecurityContext = true
// push updates to status
if tenant, err = c.updatePoolStatus(ctx, tenant); err != nil {
klog.Errorf("'%s/%s' Error upgrading implicit tenant security context, MinIO may not start: %v", tenant.Namespace, tenant.Name, err)
scontext := pool.SecurityContext
if scontext != nil && scontext.RunAsNonRoot != nil && scontext.RunAsUser != nil {
if !*scontext.RunAsNonRoot && *scontext.RunAsUser == 0 {
// Report the pool is now Legacy Security Context
tenant.Status.Pools[i].LegacySecurityContext = true
// push updates to status
if tenant, err = c.updatePoolStatus(ctx, tenant); err != nil {
klog.Errorf("'%s/%s' Error upgrading implicit tenant security context, MinIO may not start: %v", tenant.Namespace, tenant.Name, err)
}
}
}
}
Expand Down

0 comments on commit ee1da23

Please sign in to comment.