Skip to content

Commit

Permalink
handle old Infrastructure objects without PlatformStatus
Browse files Browse the repository at this point in the history
Older clusters that have been upgraded over time will have a corespondingly old verison of the Infrastructure CR where Status.PlatformStatus did not exist.

Detect that case, and return an empty region string. The AWS client code will just use the defaults, and the permissions simulations will simply not include the region as part of the simulation.
  • Loading branch information
Joel Diaz authored and openshift-cherrypick-robot committed Mar 24, 2020
1 parent 88c7f1b commit b4c7ff5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/controller/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ func LoadInfrastructureRegion(c client.Client, logger log.FieldLogger) (string,
logger.WithError(err).Error("error loading Infrastructure region")
return "", err
}
if infra.Status.PlatformStatus == nil {
// Older clusters may have an Infrastructure object without the PlatformStatus fields.
// Send back an empty region and the AWS client will use default settings.
// The permissions simulation will also simply not fill out the region for simulations.
return "", nil
}
return infra.Status.PlatformStatus.AWS.Region, nil
}

Expand Down

0 comments on commit b4c7ff5

Please sign in to comment.