-
Notifications
You must be signed in to change notification settings - Fork 232
/
Copy pathvalidation_id.go
95 lines (89 loc) · 6.33 KB
/
validation_id.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
package cluster
import (
"net/http"
"github.com/openshift/assisted-service/internal/common"
"github.com/openshift/assisted-service/models"
"github.com/pkg/errors"
)
type ValidationID models.ClusterValidationID
const (
isClusterCidrDefined = ValidationID(models.ClusterValidationIDClusterCidrDefined)
isServiceCidrDefined = ValidationID(models.ClusterValidationIDServiceCidrDefined)
noCidrOverlapping = ValidationID(models.ClusterValidationIDNoCidrsOverlapping)
networkPrefixValid = ValidationID(models.ClusterValidationIDNetworkPrefixValid)
IsMachineCidrDefined = ValidationID(models.ClusterValidationIDMachineCidrDefined)
IsMachineCidrEqualsToCalculatedCidr = ValidationID(models.ClusterValidationIDMachineCidrEqualsToCalculatedCidr)
NetworksSameAddressFamilies = ValidationID(models.ClusterValidationIDNetworksSameAddressFamilies)
AreApiVipsDefined = ValidationID(models.ClusterValidationIDAPIVipsDefined)
AreApiVipsValid = ValidationID(models.ClusterValidationIDAPIVipsValid)
isNetworkTypeValid = ValidationID(models.ClusterValidationIDNetworkTypeValid)
AreIngressVipsDefined = ValidationID(models.ClusterValidationIDIngressVipsDefined)
AreIngressVipsValid = ValidationID(models.ClusterValidationIDIngressVipsValid)
AllHostsAreReadyToInstall = ValidationID(models.ClusterValidationIDAllHostsAreReadyToInstall)
SufficientMastersCount = ValidationID(models.ClusterValidationIDSufficientMastersCount)
IsDNSDomainDefined = ValidationID(models.ClusterValidationIDDNSDomainDefined)
IsPullSecretSet = ValidationID(models.ClusterValidationIDPullSecretSet)
IsNtpServerConfigured = ValidationID(models.ClusterValidationIDNtpServerConfigured)
IsOdfRequirementsSatisfied = ValidationID(models.ClusterValidationIDOdfRequirementsSatisfied)
IsLsoRequirementsSatisfied = ValidationID(models.ClusterValidationIDLsoRequirementsSatisfied)
IsCnvRequirementsSatisfied = ValidationID(models.ClusterValidationIDCnvRequirementsSatisfied)
IsLvmRequirementsSatisfied = ValidationID(models.ClusterValidationIDLvmRequirementsSatisfied)
IsMceRequirementsSatisfied = ValidationID(models.ClusterValidationIDMceRequirementsSatisfied)
IsMtvRequirementsSatisfied = ValidationID(models.ClusterValidationIDMtvRequirementsSatisfied)
IsOscRequirementsSatisfied = ValidationID(models.ClusterValidationIDOscRequirementsSatisfied)
PlatformRequirementsSatisfied = ValidationID(models.ClusterValidationIDPlatformRequirementsSatisfied)
IsNodeFeatureDiscoveryRequirementsSatisfied = ValidationID(models.ClusterValidationIDNodeFeatureDiscoveryRequirementsSatisfied)
IsNvidiaGPURequirementsSatisfied = ValidationID(models.ClusterValidationIDNvidiaGpuRequirementsSatisfied)
IsPipelinesRequirementsSatisfied = ValidationID(models.ClusterValidationIDPipelinesRequirementsSatisfied)
IsServiceMeshRequirementsSatisfied = ValidationID(models.ClusterValidationIDServicemeshRequirementsSatisfied)
IsServerLessRequirementsSatisfied = ValidationID(models.ClusterValidationIDServerlessRequirementsSatisfied)
IsOpenShiftAIRequirementsSatisfied = ValidationID(models.ClusterValidationIDOpenshiftAiRequirementsSatisfied)
IsAuthorinoRequirementsSatisfied = ValidationID(models.ClusterValidationIDAuthorinoRequirementsSatisfied)
IsNmstateRequirementsSatisfied = ValidationID(models.ClusterValidationIDNmstateRequirementsSatisfied)
IsAMDGPURequirementsSatisfied = ValidationID(models.ClusterValidationIDAmdGpuRequirementsSatisfied)
IsKMMRequirementsSatisfied = ValidationID(models.ClusterValidationIDKmmRequirementsSatisfied)
AreNodeHealthcheckRequirementsSatisfied = ValidationID(models.ClusterValidationIDNodeHealthcheckRequirementsSatisfied)
AreSelfNodeRemediationRequirementsSatisfied = ValidationID(models.ClusterValidationIDSelfNodeRemediationRequirementsSatisfied)
AreFenceAgentsRemediationRequirementsSatisfied = ValidationID(models.ClusterValidationIDFenceAgentsRemediationRequirementsSatisfied)
AreNodeMaintenanceRequirementsSatisfied = ValidationID(models.ClusterValidationIDNodeMaintenanceRequirementsSatisfied)
AreKubeDeschedulerRequirementsSatisfied = ValidationID(models.ClusterValidationIDKubeDeschedulerRequirementsSatisfied)
)
func (v ValidationID) Category() (string, error) {
switch v {
case IsMachineCidrDefined, IsMachineCidrEqualsToCalculatedCidr, AreApiVipsDefined, AreApiVipsValid, AreIngressVipsDefined,
AreIngressVipsValid, isClusterCidrDefined, isServiceCidrDefined, noCidrOverlapping, networkPrefixValid,
IsDNSDomainDefined, IsNtpServerConfigured, isNetworkTypeValid, NetworksSameAddressFamilies:
return "network", nil
case AllHostsAreReadyToInstall, SufficientMastersCount:
return "hosts-data", nil
case IsPullSecretSet, PlatformRequirementsSatisfied:
return "configuration", nil
case IsOdfRequirementsSatisfied,
IsLsoRequirementsSatisfied,
IsCnvRequirementsSatisfied,
IsLvmRequirementsSatisfied,
IsMceRequirementsSatisfied,
IsMtvRequirementsSatisfied,
IsOscRequirementsSatisfied,
IsNodeFeatureDiscoveryRequirementsSatisfied,
IsNvidiaGPURequirementsSatisfied,
IsPipelinesRequirementsSatisfied,
IsServiceMeshRequirementsSatisfied,
IsServerLessRequirementsSatisfied,
IsOpenShiftAIRequirementsSatisfied,
IsAuthorinoRequirementsSatisfied,
IsNmstateRequirementsSatisfied,
IsAMDGPURequirementsSatisfied,
IsKMMRequirementsSatisfied,
AreNodeHealthcheckRequirementsSatisfied,
AreSelfNodeRemediationRequirementsSatisfied,
AreFenceAgentsRemediationRequirementsSatisfied,
AreNodeMaintenanceRequirementsSatisfied,
AreKubeDeschedulerRequirementsSatisfied:
return "operators", nil
}
return "", common.NewApiError(http.StatusInternalServerError, errors.Errorf("Unexpected cluster validation id %s", string(v)))
}
func (v ValidationID) String() string {
return string(v)
}