Skip to content

Commit

Permalink
Include resources from previous default version
Browse files Browse the repository at this point in the history
Before considering the resources marked for removal, if the resource version was in the previous default version, ensure we include it.

Only enable this for the v3 release because it will add a lot more explicit versions.
  • Loading branch information
danielrbradley committed Dec 6, 2024
1 parent bae90fa commit a02ce56
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions provider/pkg/versioning/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ func (v VersionMetadata) ShouldInclude(provider string, version openapi.ApiVersi
}
}
}
// Keep any resources in the previous version lock for easier migration
if v.MajorVersion >= 3 {
if resources, ok := v.PreviousLock[provider]; ok {
if previousDefaultResourceVersion, ok := resources[typeName]; ok {
if previousDefaultResourceVersion == version {
return true
}
}
}
}
// Exclude versions from removed versions
if versions, ok := v.RemovedVersions[provider]; ok {
for _, removedVersion := range versions {
Expand Down Expand Up @@ -130,11 +140,12 @@ type VersionSources struct {
MajorVersion int
ProviderList providerlist.ProviderList
requiredExplicitResources []string
PreviousLock openapi.DefaultVersionLock
RemovedVersions openapi.ProviderVersionList
Spec Spec
Config Curations
ConfigPath string
// map[ProviderName]map[DefinitionName]ApiVersion
PreviousLock openapi.DefaultVersionLock
RemovedVersions openapi.ProviderVersionList
Spec Spec
Config Curations
ConfigPath string
// provider->version->[]resource
AllResourcesByVersion ProvidersVersionResources
// map[TokenToRemove]TokenReplacedWith
Expand Down

0 comments on commit a02ce56

Please sign in to comment.