Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
worryg0d committed Feb 21, 2024
1 parent fdb8868 commit 701225e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apis/clusters/v1beta1/generic_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func (s *GenericDataCentreSpec) cloudProviderSettingsFromInstAPI(instaModel *mod
}

switch {
case len(instaModel.AWSSettings) > 0:
case len(instaModel.AWSSettings) > 0 && instaModel.HasAWSCloudProviderSettings():
setting := instaModel.AWSSettings[0]
s.AWSSettings = []*AWSSettings{{
DiskEncryptionKey: setting.EBSEncryptionKey,
Expand Down
15 changes: 15 additions & 0 deletions pkg/models/apiv2_generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,18 @@ type GenericDataCentreFields struct {

*CloudProviderSettings `json:",inline"`
}

func (dc *CloudProviderSettings) HasAWSCloudProviderSettings() bool {
if dc == nil {
return false
}

zero := AWSSetting{}
for _, s := range dc.AWSSettings {
if *s == zero {
return false
}
}

return true
}

0 comments on commit 701225e

Please sign in to comment.