sip/pkg/vbmh/errors.go
Drew Walters 00c45a4444 Add BMC authentication data to SIP machines
This change retrieves and stores BMC authentication information for each
BaremetalHost object represented as a machine. This will enable SIP's
Jump Host service to create a Secret with BMC information for each node
in a sub-cluster.

Signed-off-by: Drew Walters <andrew.walters@att.com>
Change-Id: Ie11fa95f694f050b4e61866aaf81ae6410147fc1
2021-02-18 19:00:51 +00:00

67 lines
1.9 KiB
Go

package vbmh
import (
"fmt"
metal3 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
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.VMRole
TargetFlavor string
}
func (e ErrorUnableToFullySchedule) Error() string {
return fmt.Sprintf("Unable to complete a schedule with a target of %v nodes, with a flavor of %v",
e.TargetNode, e.TargetFlavor)
}
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)
}
// ErrorUknownSpreadTopology is returned when wrong AuthType is provided
type ErrorUknownSpreadTopology struct {
Topology airshipv1.SpreadTopology
}
func (e ErrorUknownSpreadTopology) Error() string {
return fmt.Sprintf("Uknown spread topology '%s'", e.Topology)
}
// 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)
}