@@ -80,42 +80,17 @@ func (f *frontend) updateOcpVersions(docs []*api.OpenShiftVersionDocument) {
8080 f .ocpVersionsMu .Lock ()
8181 defer f .ocpVersionsMu .Unlock ()
8282
83- hadCachedDefaultVersionBefore := f .defaultOcpVersion != ""
84- foundDefaultInUpdate := false
85-
8683 for _ , doc := range docs {
8784 if doc .OpenShiftVersion .Deleting || ! doc .OpenShiftVersion .Properties .Enabled {
8885 // https://docs.microsoft.com/en-us/azure/cosmos-db/change-feed-design-patterns#deletes
8986 delete (f .enabledOcpVersions , doc .OpenShiftVersion .Properties .Version )
90- // If we're deleting the current default version, clear it
91- if doc .OpenShiftVersion .Properties .Version == f .defaultOcpVersion {
92- if f .baseLog != nil {
93- f .baseLog .Errorf ("Default OpenShift version '%s' is being deleted from enabled versions" , f .defaultOcpVersion )
94- }
95- f .defaultOcpVersion = ""
96- }
9787 } else {
9888 f .enabledOcpVersions [doc .OpenShiftVersion .Properties .Version ] = doc .OpenShiftVersion
9989 if doc .OpenShiftVersion .Properties .Default {
100- if f .defaultOcpVersion != "" && f .defaultOcpVersion != doc .OpenShiftVersion .Properties .Version {
101- if f .baseLog != nil {
102- f .baseLog .Warnf ("Default OpenShift version changed from '%s' to '%s'" , f .defaultOcpVersion , doc .OpenShiftVersion .Properties .Version )
103- }
104- }
10590 f .defaultOcpVersion = doc .OpenShiftVersion .Properties .Version
106- foundDefaultInUpdate = true
10791 }
10892 }
10993 }
110-
111- // After processing all documents, check if we have a valid default version
112- if f .baseLog != nil {
113- if len (f .enabledOcpVersions ) > 0 && f .defaultOcpVersion == "" {
114- f .baseLog .Errorf ("No default OpenShift version is set in CosmosDB. %d enabled version(s) available but none marked as default. Clusters created without --version parameter will fail." , len (f .enabledOcpVersions ))
115- } else if hadCachedDefaultVersionBefore && ! foundDefaultInUpdate && f .defaultOcpVersion == "" {
116- f .baseLog .Error ("Default OpenShift version was removed and no replacement was set. Clusters created without --version parameter will fail." )
117- }
118- }
11994}
12095
12196func (f * frontend ) updateFromIteratorRoleSets (ctx context.Context , ticker * time.Ticker , frontendIterator cosmosdb.PlatformWorkloadIdentityRoleSetDocumentIterator ) {
0 commit comments