Skip to content

Commit

Permalink
Improve log message for possibly crafted CloudProfile from Namespaced…
Browse files Browse the repository at this point in the history
…CloudProfile in Cluster resource
  • Loading branch information
LucaBernstein committed Aug 13, 2024
1 parent 6b9d758 commit 29fc5b8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/apis/aws/helper/scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ func init() {
func CloudProfileConfigFromCluster(cluster *controller.Cluster) (*api.CloudProfileConfig, error) {
var cloudProfileConfig *api.CloudProfileConfig
if cluster != nil && cluster.CloudProfile != nil && cluster.CloudProfile.Spec.ProviderConfig != nil && cluster.CloudProfile.Spec.ProviderConfig.Raw != nil {
cloudProfileName := fmt.Sprintf("cloudProfile '%q'", client.ObjectKeyFromObject(cluster.CloudProfile))
if cluster.Shoot != nil && cluster.Shoot.Spec.CloudProfile != nil {
cloudProfileName = fmt.Sprintf("%s '%s/%s'", cluster.Shoot.Spec.CloudProfile.Kind, cluster.Shoot.Namespace, cluster.Shoot.Spec.CloudProfile.Name)
}
cloudProfileConfig = &api.CloudProfileConfig{}
if _, _, err := decoder.Decode(cluster.CloudProfile.Spec.ProviderConfig.Raw, nil, cloudProfileConfig); err != nil {
return nil, fmt.Errorf("could not decode providerConfig of cloudProfile for '%s': %w", client.ObjectKeyFromObject(cluster.CloudProfile), err)
return nil, fmt.Errorf("could not decode providerConfig of %s: %w", cloudProfileName, err)
}
}
return cloudProfileConfig, nil
Expand Down

0 comments on commit 29fc5b8

Please sign in to comment.