sip/pkg/bmh/errors.go
Sean Eagan 2659215b84 Support anti-affinity across arbitrary topology keys
Closes #10

Signed-off-by: Sean Eagan <seaneagan1@gmail.com>
Change-Id: Ie2dd2ac6c986c6802a0ddf8efee03854a76ea13e
2021-03-23 14:22:49 -05:00

59 lines
1.7 KiB
Go

package bmh
import (
"fmt"
metal3 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
airshipv1 "sipcluster/pkg/api/v1"
)
// ErrorConstraintNotFound is returned when wrong AuthType is provided
type ErrorConstraintNotFound struct {
}
func (e ErrorConstraintNotFound) Error() string {
return "Invalid or Not found Schedulign Constraint"
}
type ErrorUnableToFullySchedule struct {
TargetNode airshipv1.BMHRole
TargetLabelSelector metav1.LabelSelector
}
func (e ErrorUnableToFullySchedule) Error() string {
return fmt.Sprintf("Unable to complete a schedule with a target of %v nodes, with a label selector of %v",
e.TargetNode, e.TargetLabelSelector)
}
type ErrorHostIPNotFound struct {
HostName string
IPInterface string
Message string
}
func (e ErrorHostIPNotFound) Error() string {
return fmt.Sprintf("Unable to identify the vBMH Host %v IP address on interface %v required by "+
"Infrastructure Service %s", e.HostName, e.IPInterface, e.Message)
}
// ErrorNetworkDataNotFound is returned when NetworkData metadata is missing from BMH
type ErrorNetworkDataNotFound struct {
BMH metal3.BareMetalHost
}
func (e ErrorNetworkDataNotFound) Error() string {
return fmt.Sprintf("vBMH Host %v does not define NetworkData, but is required for scheduling.", e.BMH)
}
// ErrMalformedManagementCredentials occurs when a BMC credentials secret does not contain username and password fields.
type ErrMalformedManagementCredentials struct {
SecretName string
}
func (e ErrMalformedManagementCredentials) Error() string {
return fmt.Sprintf("secret %s contains malformed management credentials. Must contain '%s' and '%s' fields.",
e.SecretName, keyBMCUsername, keyBMCPassword)
}