-
Notifications
You must be signed in to change notification settings - Fork 217
/
validation_id.go
79 lines (73 loc) · 4.95 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
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)
)
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:
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)
}