-
Notifications
You must be signed in to change notification settings - Fork 232
/
Copy pathfeatures_misc.go
365 lines (294 loc) · 11.9 KB
/
features_misc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
package featuresupport
import (
"github.com/go-openapi/swag"
"github.com/openshift/assisted-service/internal/common"
"github.com/openshift/assisted-service/models"
)
// SnoFeature
type SnoFeature struct{}
func (feature *SnoFeature) New() SupportLevelFeature {
return &SnoFeature{}
}
func (feature *SnoFeature) getId() models.FeatureSupportLevelID {
return models.FeatureSupportLevelIDSNO
}
func (feature *SnoFeature) GetName() string {
return "Single Node OpenShift"
}
func (feature *SnoFeature) getSupportLevel(filters SupportLevelFilters) models.SupportLevel {
if !isFeatureCompatibleWithArchitecture(feature, filters.OpenshiftVersion, swag.StringValue(filters.CPUArchitecture)) {
return models.SupportLevelUnavailable
}
// Sno is not available with Nutanix / Vsphere platforms
if filters.PlatformType != nil && (*filters.PlatformType == models.PlatformTypeNutanix || *filters.PlatformType == models.PlatformTypeVsphere) {
return models.SupportLevelUnavailable
}
if swag.StringValue(filters.CPUArchitecture) == models.ClusterCPUArchitectureS390x || swag.StringValue(filters.CPUArchitecture) == models.ClusterCPUArchitecturePpc64le {
if isEqual, _ := common.BaseVersionEqual("4.13", filters.OpenshiftVersion); isEqual {
return models.SupportLevelDevPreview
}
}
return models.SupportLevelSupported
}
func (feature *SnoFeature) getIncompatibleFeatures(string) *[]models.FeatureSupportLevelID {
return &[]models.FeatureSupportLevelID{
models.FeatureSupportLevelIDODF,
models.FeatureSupportLevelIDNUTANIXINTEGRATION,
models.FeatureSupportLevelIDVSPHEREINTEGRATION,
models.FeatureSupportLevelIDCLUSTERMANAGEDNETWORKING,
models.FeatureSupportLevelIDVIPAUTOALLOC,
models.FeatureSupportLevelIDOPENSHIFTAI,
models.FeatureSupportLevelIDUSERMANAGEDLOADBALANCER,
models.FeatureSupportLevelIDNODEHEALTHCHECK,
models.FeatureSupportLevelIDSELFNODEREMEDIATION,
models.FeatureSupportLevelIDFENCEAGENTSREMEDIATION,
models.FeatureSupportLevelIDNODEMAINTENANCE,
models.FeatureSupportLevelIDKUBEDESCHEDULER,
}
}
func (feature *SnoFeature) getIncompatibleArchitectures(openshiftVersion *string) *[]models.ArchitectureSupportLevelID {
if isGreater, _ := common.BaseVersionGreaterOrEqual("4.13", *openshiftVersion); isGreater {
return nil
}
// Not supported when OCP version is less than 4.13
return &[]models.ArchitectureSupportLevelID{
models.ArchitectureSupportLevelIDS390XARCHITECTURE,
models.ArchitectureSupportLevelIDPPC64LEARCHITECTURE,
}
}
func (feature *SnoFeature) getFeatureActiveLevel(cluster *common.Cluster, _ *models.InfraEnv, _ *models.V2ClusterUpdateParams, _ *models.InfraEnvUpdateParams) featureActiveLevel {
if cluster != nil && cluster.ControlPlaneCount == 1 {
return activeLevelActive
}
return activeLevelNotActive
}
// CustomManifestFeature
type CustomManifestFeature struct{}
func (feature *CustomManifestFeature) New() SupportLevelFeature {
return &CustomManifestFeature{}
}
func (feature *CustomManifestFeature) getId() models.FeatureSupportLevelID {
return models.FeatureSupportLevelIDCUSTOMMANIFEST
}
func (feature *CustomManifestFeature) GetName() string {
return "Custom Manifest"
}
func (feature *CustomManifestFeature) getSupportLevel(_ SupportLevelFilters) models.SupportLevel {
return models.SupportLevelSupported
}
func (feature *CustomManifestFeature) getIncompatibleFeatures(string) *[]models.FeatureSupportLevelID {
return nil
}
func (feature *CustomManifestFeature) getIncompatibleArchitectures(_ *string) *[]models.ArchitectureSupportLevelID {
return nil
}
func (feature *CustomManifestFeature) getFeatureActiveLevel(_ *common.Cluster, _ *models.InfraEnv, _ *models.V2ClusterUpdateParams, _ *models.InfraEnvUpdateParams) featureActiveLevel {
return activeLeveNotRelevant
}
// SingleNodeExpansionFeature
type SingleNodeExpansionFeature struct {
snoFeature SnoFeature
}
func (feature *SingleNodeExpansionFeature) New() SupportLevelFeature {
return &SingleNodeExpansionFeature{
SnoFeature{},
}
}
func (feature *SingleNodeExpansionFeature) getId() models.FeatureSupportLevelID {
return models.FeatureSupportLevelIDSINGLENODEEXPANSION
}
func (feature *SingleNodeExpansionFeature) GetName() string {
return "Single Node Expansion"
}
func (feature *SingleNodeExpansionFeature) getSupportLevel(filters SupportLevelFilters) models.SupportLevel {
isNotSupported, err := common.BaseVersionLessThan("4.11", filters.OpenshiftVersion)
if isNotSupported || err != nil {
return models.SupportLevelUnavailable
}
return feature.snoFeature.getSupportLevel(filters)
}
func (feature *SingleNodeExpansionFeature) getFeatureActiveLevel(_ *common.Cluster, _ *models.InfraEnv, _ *models.V2ClusterUpdateParams, _ *models.InfraEnvUpdateParams) featureActiveLevel {
return activeLeveNotRelevant
}
func (feature *SingleNodeExpansionFeature) getIncompatibleFeatures(string) *[]models.FeatureSupportLevelID {
return nil
}
func (feature *SingleNodeExpansionFeature) getIncompatibleArchitectures(openshiftVersion *string) *[]models.ArchitectureSupportLevelID {
return feature.snoFeature.getIncompatibleArchitectures(openshiftVersion)
}
// MinimalIso
type MinimalIso struct{}
func (feature *MinimalIso) New() SupportLevelFeature {
return &MinimalIso{}
}
func (feature *MinimalIso) getId() models.FeatureSupportLevelID {
return models.FeatureSupportLevelIDMINIMALISO
}
func (feature *MinimalIso) GetName() string {
return "Minimal ISO"
}
func (feature *MinimalIso) getSupportLevel(filters SupportLevelFilters) models.SupportLevel {
if !isFeatureCompatibleWithArchitecture(feature, filters.OpenshiftVersion, swag.StringValue(filters.CPUArchitecture)) {
return models.SupportLevelUnavailable
}
return models.SupportLevelSupported
}
func (feature *MinimalIso) getIncompatibleFeatures(string) *[]models.FeatureSupportLevelID {
return nil
}
func (feature *MinimalIso) getIncompatibleArchitectures(_ *string) *[]models.ArchitectureSupportLevelID {
return &[]models.ArchitectureSupportLevelID{
models.ArchitectureSupportLevelIDS390XARCHITECTURE,
}
}
func (feature *MinimalIso) getFeatureActiveLevel(_ *common.Cluster, infraEnv *models.InfraEnv, _ *models.V2ClusterUpdateParams, infraenvUpdateParams *models.InfraEnvUpdateParams) featureActiveLevel {
if infraEnv == nil || infraEnv.Type == nil {
return activeLevelNotActive
}
if infraenvUpdateParams != nil {
if string(infraenvUpdateParams.ImageType) == string(models.ImageTypeMinimalIso) {
return activeLevelActive
} else if string(infraenvUpdateParams.ImageType) == string(models.ImageTypeFullIso) {
return activeLevelNotActive
}
}
if string(*infraEnv.Type) == string(models.ImageTypeMinimalIso) {
return activeLevelActive
}
if string(*infraEnv.Type) == string(models.ImageTypeFullIso) {
return activeLevelNotActive
}
return activeLevelNotActive
}
// FullIso
type FullIso struct{}
func (feature *FullIso) New() SupportLevelFeature {
return &FullIso{}
}
func (feature *FullIso) getId() models.FeatureSupportLevelID {
return models.FeatureSupportLevelIDFULLISO
}
func (feature *FullIso) GetName() string {
return "Full ISO"
}
func (feature *FullIso) getSupportLevel(filters SupportLevelFilters) models.SupportLevel {
platform := &models.Platform{
Type: filters.PlatformType,
External: &models.PlatformExternal{
PlatformName: filters.ExternalPlatformName,
},
}
if common.IsOciExternalIntegrationEnabled(platform) {
return models.SupportLevelUnavailable
}
return models.SupportLevelSupported
}
func (feature *FullIso) getIncompatibleFeatures(string) *[]models.FeatureSupportLevelID {
return &[]models.FeatureSupportLevelID{
models.FeatureSupportLevelIDEXTERNALPLATFORMOCI,
}
}
func (feature *FullIso) getIncompatibleArchitectures(_ *string) *[]models.ArchitectureSupportLevelID {
return nil
}
func (feature *FullIso) getFeatureActiveLevel(_ *common.Cluster, infraEnv *models.InfraEnv, _ *models.V2ClusterUpdateParams, infraenvUpdateParams *models.InfraEnvUpdateParams) featureActiveLevel {
if infraEnv == nil || infraEnv.Type == nil {
return activeLevelNotActive
}
if infraenvUpdateParams != nil {
if string(infraenvUpdateParams.ImageType) == string(models.ImageTypeFullIso) {
return activeLevelActive
} else if string(infraenvUpdateParams.ImageType) == string(models.ImageTypeMinimalIso) {
return activeLevelNotActive
}
}
if string(*infraEnv.Type) == string(models.ImageTypeFullIso) {
return activeLevelActive
}
if string(*infraEnv.Type) == string(models.ImageTypeMinimalIso) {
return activeLevelNotActive
}
return activeLevelNotActive
}
// Skip MCO reboot
type skipMcoReboot struct{}
func (f *skipMcoReboot) New() SupportLevelFeature {
return &skipMcoReboot{}
}
func (f *skipMcoReboot) getId() models.FeatureSupportLevelID {
return models.FeatureSupportLevelIDSKIPMCOREBOOT
}
func (f *skipMcoReboot) GetName() string {
return "Skip MCO reboot"
}
func (f *skipMcoReboot) getSupportLevel(filters SupportLevelFilters) models.SupportLevel {
if !isFeatureCompatibleWithArchitecture(f, filters.OpenshiftVersion, swag.StringValue(filters.CPUArchitecture)) {
return models.SupportLevelUnavailable
}
enableSkipMcoReboot, err := common.BaseVersionGreaterOrEqual("4.15.0", filters.OpenshiftVersion)
if !enableSkipMcoReboot || err != nil {
return models.SupportLevelUnavailable
}
return models.SupportLevelSupported
}
func (f *skipMcoReboot) getIncompatibleFeatures(openshiftVersion string) *[]models.FeatureSupportLevelID {
return nil
}
func (f *skipMcoReboot) getIncompatibleArchitectures(openshiftVersion *string) *[]models.ArchitectureSupportLevelID {
return nil
}
func (f *skipMcoReboot) getFeatureActiveLevel(cluster *common.Cluster, infraEnv *models.InfraEnv,
clusterUpdateParams *models.V2ClusterUpdateParams, infraenvUpdateParams *models.InfraEnvUpdateParams) featureActiveLevel {
if cluster != nil {
activeForVersion, err := common.BaseVersionGreaterOrEqual("4.15.0", cluster.OpenshiftVersion)
if err != nil || !activeForVersion {
return activeLevelNotActive
}
}
return activeLevelActive
}
// Non-standard HA OCP Control Plane
type NonStandardHAControlPlane struct{}
func (f *NonStandardHAControlPlane) New() SupportLevelFeature {
return &NonStandardHAControlPlane{}
}
func (f *NonStandardHAControlPlane) getId() models.FeatureSupportLevelID {
return models.FeatureSupportLevelIDNONSTANDARDHACONTROLPLANE
}
func (f *NonStandardHAControlPlane) GetName() string {
return "Non-standard HA OCP Control Plane"
}
func (f *NonStandardHAControlPlane) getSupportLevel(filters SupportLevelFilters) models.SupportLevel {
supported, err := common.BaseVersionGreaterOrEqual(common.MinimumVersionForNonStandardHAOCPControlPlane, filters.OpenshiftVersion)
if !supported || err != nil {
return models.SupportLevelUnavailable
}
if filters.PlatformType != nil &&
(*filters.PlatformType != models.PlatformTypeBaremetal && *filters.PlatformType != models.PlatformTypeNone) {
return models.SupportLevelUnavailable
}
return models.SupportLevelSupported
}
func (f *NonStandardHAControlPlane) getIncompatibleFeatures(openshiftVersion string) *[]models.FeatureSupportLevelID {
return &[]models.FeatureSupportLevelID{
models.FeatureSupportLevelIDEXTERNALPLATFORM,
models.FeatureSupportLevelIDNUTANIXINTEGRATION,
models.FeatureSupportLevelIDVSPHEREINTEGRATION,
models.FeatureSupportLevelIDEXTERNALPLATFORMOCI,
}
}
func (f *NonStandardHAControlPlane) getIncompatibleArchitectures(openshiftVersion *string) *[]models.ArchitectureSupportLevelID {
return &[]models.ArchitectureSupportLevelID{
models.ArchitectureSupportLevelIDARM64ARCHITECTURE,
models.ArchitectureSupportLevelIDS390XARCHITECTURE,
models.ArchitectureSupportLevelIDPPC64LEARCHITECTURE,
models.ArchitectureSupportLevelIDMULTIARCHRELEASEIMAGE,
}
}
func (f *NonStandardHAControlPlane) getFeatureActiveLevel(cluster *common.Cluster, infraEnv *models.InfraEnv,
clusterUpdateParams *models.V2ClusterUpdateParams, infraenvUpdateParams *models.InfraEnvUpdateParams) featureActiveLevel {
if cluster != nil && cluster.ControlPlaneCount > 3 {
return activeLevelActive
}
return activeLevelNotActive
}