-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Augment conversions for UpgradeOverrideSettings (#3634)
* Fix IsStoragePackageReference() bug * Reduce allocations when merging TypeNameSets * Use unreferenced objects as roots for package file allocation * Regenerate compat package * Code gardening * Augment conversion for UpgradeOverrideSettings * Update golden files * Clean up property bag * Avoid double values * Check assignments succeed
- Loading branch information
1 parent
38ef44f
commit 7301356
Showing
35 changed files
with
2,064 additions
and
1,771 deletions.
There are no files selected for viewing
132 changes: 132 additions & 0 deletions
132
...ontainerservice/v1api20230201/storage/compat/cluster_upgrade_settings_status_types_gen.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
104 changes: 104 additions & 0 deletions
104
...nerservice/v1api20230201/storage/compat/cluster_upgrade_settings_status_types_gen_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
v2/api/containerservice/v1api20230201/storage/compat/cluster_upgrade_settings_types.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (c) Microsoft Corporation. | ||
* Licensed under the MIT license. | ||
*/ | ||
|
||
package compat | ||
|
||
import ( | ||
"golang.org/x/exp/slices" | ||
|
||
v20231001s "github.com/Azure/azure-service-operator/v2/api/containerservice/v1api20231001/storage" | ||
"github.com/Azure/azure-service-operator/v2/internal/util/to" | ||
) | ||
|
||
var _ augmentConversionForUpgradeOverrideSettings = &UpgradeOverrideSettings{} | ||
|
||
const ignoreKubernetesDeprecations = "IgnoreKubernetesDeprecations" | ||
|
||
func (settings *UpgradeOverrideSettings) AssignPropertiesFrom(src *v20231001s.UpgradeOverrideSettings) error { | ||
// If the GA version has ForceUpgrade true, the preview version needs to add "IgnoreKubernetesDeprecations" | ||
if src.ForceUpgrade != nil && *src.ForceUpgrade { | ||
if !slices.Contains(settings.ControlPlaneOverrides, ignoreKubernetesDeprecations) { | ||
settings.ControlPlaneOverrides = append(settings.ControlPlaneOverrides, ignoreKubernetesDeprecations) | ||
} | ||
} | ||
|
||
settings.PropertyBag.Remove("ForceUpgrade") | ||
|
||
return nil | ||
} | ||
|
||
func (settings *UpgradeOverrideSettings) AssignPropertiesTo(dest *v20231001s.UpgradeOverrideSettings) error { | ||
// If the preview version has "IgnoreKubernetesDeprecations" in ControlPlaneOverrides, the GA version needs to have | ||
// ForceUpgrade true, otherwise false. | ||
dest.ForceUpgrade = to.Ptr(false) | ||
for _, override := range settings.ControlPlaneOverrides { | ||
if override == ignoreKubernetesDeprecations { | ||
dest.ForceUpgrade = to.Ptr(true) | ||
break | ||
} | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.