-
Notifications
You must be signed in to change notification settings - Fork 232
/
Copy pathnode_healthcheck_requirements.go
42 lines (38 loc) · 1.44 KB
/
node_healthcheck_requirements.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
package nodehealthcheck
import (
"context"
"github.com/openshift/assisted-service/internal/common"
"github.com/openshift/assisted-service/models"
)
// GetHostRequirements provides the requirements that the host needs to satisfy in order to be able to install the
// operator.
func (o *operator) GetHostRequirements(ctx context.Context, cluster *common.Cluster,
host *models.Host) (*models.ClusterHostRequirementsDetails, error) {
preflightRequirements, err := o.GetPreflightRequirements(ctx, cluster)
if err != nil {
o.log.WithError(err).Errorf("Cannot retrieve preflight requirements for cluster %s", cluster.ID)
return nil, err
}
return preflightRequirements.Requirements.Worker.Quantitative, nil
}
// GetPreflightRequirements returns operator hardware requirements that can be determined with cluster data only.
func (o *operator) GetPreflightRequirements(context context.Context,
cluster *common.Cluster) (result *models.OperatorHardwareRequirements, err error) {
dependencies, err := o.GetDependencies(cluster)
if err != nil {
return
}
result = &models.OperatorHardwareRequirements{
OperatorName: o.GetName(),
Dependencies: dependencies,
Requirements: &models.HostTypeHardwareRequirementsWrapper{
Master: &models.HostTypeHardwareRequirements{
Quantitative: &models.ClusterHostRequirementsDetails{},
},
Worker: &models.HostTypeHardwareRequirements{
Quantitative: &models.ClusterHostRequirementsDetails{},
},
},
}
return
}