Documentation ¶
Index ¶
- Constants
- func Sign(challenge string, logger logr.Logger) (result string, err error)
- func ValidateServerDataRequest(serverValues ServerRequest) error
- func Verify(challenge string, signature string, logger logr.Logger) (err error)
- type Account
- type AuthRequest
- type Baremetal
- type Broker
- func (b *Broker) AddAnnotation(baremetalId string, namespace string, poolId string, serverId string, ...) error
- func (b *Broker) BaremetalFound(name string) bool
- func (b *Broker) BookOne(pool *Pool) bool
- func (b *Broker) CountUsage(user *User)
- func (b *Broker) CreateNewPool(pool Pool)
- func (b *Broker) CreateNewServer(poolId string, serverId string, baremetalName string, schema string)
- func (b *Broker) CreatePool(w http.ResponseWriter, r *http.Request)
- func (b *Broker) DeleteBaremetal(name string)
- func (b *Broker) DeletePool(poolId string, logger logr.Logger)
- func (b *Broker) DeleteServer(serverId string, poolId string)
- func (b *Broker) DeleteUser(userId string, logger logr.Logger)
- func (b *Broker) GetBaremetal(name string) *Baremetal
- func (b *Broker) GetPoolResponse(poolId string) *PoolResponse
- func (b *Broker) GetServerResponse(name string, poolid string) *ServerResponse
- func (b *Broker) HandleBrokerApiRequests()
- func (b *Broker) InitBrokerData(setupLog logr.Logger) error
- func (b *Broker) IsBrokerDataEmpty() bool
- func (b *Broker) PoolFound(name string) bool
- func (b *Broker) ReleaseOne(pool *Pool)
- func (b *Broker) RetrieveAllBaremetals() []Baremetal
- func (b *Broker) RetrieveAllPools() []PoolResponse
- func (b *Broker) RetrieveAllServers(poolId string) []ServerResponse
- func (b *Broker) ServerFound(name string, poolid string) bool
- func (b *Broker) UpdatePoolValues(name string, poolValues Pool)
- func (b *Broker) VerifyPoolAuthent(username string, password string, poolId string) bool
- func (b *Broker) VerifySignature(w http.ResponseWriter, r *http.Request)
- func (b *Broker) VerifyUserAuthent(username string, password string) bool
- type BrokerAuth
- func (bp *BrokerAuth) BookServer(pool *Pool, server *Baremetal) error
- func (ba *BrokerAuth) CreateAccount(bmh *Baremetal, username string, password string) error
- func (ba *BrokerAuth) FindAccount(redfishClient *RedfishClient, username string) (string, error)
- func (ba *BrokerAuth) GetComponents(client *RedfishClient, target string) ([]string, error)
- func (ba *BrokerAuth) GetRedfishClient(bmh *Baremetal) (*RedfishClient, error)
- func (bp *BrokerAuth) Init(b *Broker, r *mux.Router)
- func (bp *BrokerAuth) ReleaseServer(pool *Pool, server *Baremetal) error
- func (ba *BrokerAuth) RemoveAccount(bmh *Baremetal, username string) error
- func (bp *BrokerAuth) ServerResponse(name string, poolid string) *ServerResponse
- type BrokerData
- type BrokerImplem
- type BrokerProxy
- type ChallengeRequest
- type ChallengeResponse
- type ErrorCode
- type ErrorResponse
- type ErrorResponseNetdef
- type Member
- type PasswordData
- type PatchSpec
- type Pool
- type PoolLimit
- type PoolRequest
- type PoolResponse
- type RedfishClient
- type RedfishCollection
- type ServerData
- type ServerRequest
- type ServerResponse
- type SignatureRequest
- type SignatureResponse
- type User
Constants ¶
const ( // KanodPoolnameAnnotation is the annotation containing the poolname value KanodPoolnameAnnotation string = "kanod.io/poolname" // KanodServernameAnnotation is the annotation containing the servername value KanodServernameAnnotation string = "kanod.io/servername" // KanodRedfishSchemaAnnotation is the annotation containing the redfish-schema value KanodRedfishSchemaAnnotation string = "kanod.io/redfish-schema" // NO_ERROR is given back when network assocation succeeds NO_ERROR ErrorCode = iota // CHECK_CERTIFICATE_ERROR is given back when certificate is wrong CHECK_CERTIFICATE_ERROR // OTHER_ERROR is an internal error OTHER_ERROR )
const (
ACCOUNTS_PATH = "/redfish/v1/AccountService/Accounts"
)
Variables ¶
This section is empty.
Functions ¶
func ValidateServerDataRequest ¶
func ValidateServerDataRequest(serverValues ServerRequest) error
Types ¶
type Account ¶ added in v0.1.10
type Account struct { Id string `json:"Id"` Name string `json:"Name"` Password string `json:"Password"` UserName string `json:"UserName"` RoleId string `json:"RoleId"` Locked bool `json:"Locked"` Enabled bool `json:"Enabled"` }
Account is the go representation of a Redfish account
type AuthRequest ¶
type Baremetal ¶
type Baremetal struct { Id string `json:"id"` Url string `json:"url"` Username string `json:"username"` Password string `json:"password"` MacAddress string `json:"macAddress"` K8sLabels map[string]string `json:"k8slabels"` K8sAnnotations map[string]string `json:"k8sannotations"` RootDeviceHints *bmh.RootDeviceHints `json:"rootDeviceHints,omitempty"` DisableCertificateVerification bool `json:"disablecertificateverification"` }
type Broker ¶ added in v0.1.10
type Broker struct { Client client.Client Log logr.Logger Scheme *runtime.Scheme Baremetals map[string]*Baremetal Pools map[string]*Pool Users map[string]*User Mutex sync.Mutex Namespace string BrokerImplem BrokerImplem }
Broker implements a broker server that is used as a backend by BaremetalPools to retrieve access to servers
func NewBroker ¶ added in v0.1.10
func NewBroker(client client.Client, logr logr.Logger, scheme *runtime.Scheme, brokerImplem BrokerImplem) *Broker
NewBroker creates the structure associated to a redfish broker server.
func (*Broker) AddAnnotation ¶ added in v0.1.10
func (*Broker) BaremetalFound ¶ added in v0.1.10
func (*Broker) CountUsage ¶ added in v0.1.10
func (*Broker) CreateNewPool ¶ added in v0.1.10
func (*Broker) CreateNewServer ¶ added in v0.1.10
func (*Broker) CreatePool ¶ added in v0.1.10
func (b *Broker) CreatePool(w http.ResponseWriter, r *http.Request)
func (*Broker) DeleteBaremetal ¶ added in v0.1.10
func (*Broker) DeletePool ¶ added in v0.1.10
func (*Broker) DeleteServer ¶ added in v0.1.10
func (*Broker) DeleteUser ¶ added in v0.1.10
func (*Broker) GetBaremetal ¶ added in v0.1.10
func (*Broker) GetPoolResponse ¶ added in v0.1.10
func (b *Broker) GetPoolResponse(poolId string) *PoolResponse
func (*Broker) GetServerResponse ¶ added in v0.1.10
func (b *Broker) GetServerResponse(name string, poolid string) *ServerResponse
func (*Broker) HandleBrokerApiRequests ¶ added in v0.1.10
func (b *Broker) HandleBrokerApiRequests()
func (*Broker) InitBrokerData ¶ added in v0.1.10
func (*Broker) IsBrokerDataEmpty ¶ added in v0.1.10
func (*Broker) ReleaseOne ¶ added in v0.1.10
func (*Broker) RetrieveAllBaremetals ¶ added in v0.1.10
func (*Broker) RetrieveAllPools ¶ added in v0.1.10
func (b *Broker) RetrieveAllPools() []PoolResponse
func (*Broker) RetrieveAllServers ¶ added in v0.1.10
func (b *Broker) RetrieveAllServers(poolId string) []ServerResponse
func (*Broker) ServerFound ¶ added in v0.1.10
func (*Broker) UpdatePoolValues ¶ added in v0.1.10
func (*Broker) VerifyPoolAuthent ¶ added in v0.1.10
func (*Broker) VerifySignature ¶ added in v0.1.10
func (b *Broker) VerifySignature(w http.ResponseWriter, r *http.Request)
type BrokerAuth ¶ added in v0.1.10
type BrokerAuth struct {
Broker *Broker
}
BrokerAuth is the type of the implementation of a Redfish broker using ephemeral accounts to virtualize the BMC of a server.
func (*BrokerAuth) BookServer ¶ added in v0.1.10
func (bp *BrokerAuth) BookServer(pool *Pool, server *Baremetal) error
func (*BrokerAuth) CreateAccount ¶ added in v0.1.10
func (ba *BrokerAuth) CreateAccount(bmh *Baremetal, username string, password string) error
CreateAccount creates an account on a baremetal host. username and password are the credentials of the newly created account.
func (*BrokerAuth) FindAccount ¶ added in v0.1.10
func (ba *BrokerAuth) FindAccount(redfishClient *RedfishClient, username string) (string, error)
FindAccount
func (*BrokerAuth) GetComponents ¶ added in v0.1.10
func (ba *BrokerAuth) GetComponents(client *RedfishClient, target string) ([]string, error)
GetComponents gives back all the paths of a redfish collection.
func (*BrokerAuth) GetRedfishClient ¶ added in v0.1.10
func (ba *BrokerAuth) GetRedfishClient(bmh *Baremetal) (*RedfishClient, error)
GetRedfishClient builds a redfish client from a baremetalhost specification.
func (*BrokerAuth) ReleaseServer ¶ added in v0.1.10
func (bp *BrokerAuth) ReleaseServer(pool *Pool, server *Baremetal) error
func (*BrokerAuth) RemoveAccount ¶ added in v0.1.10
func (ba *BrokerAuth) RemoveAccount(bmh *Baremetal, username string) error
RemoveAccount removes a redfish account on a baremetal host knowing the username of the account.
func (*BrokerAuth) ServerResponse ¶ added in v0.1.10
func (bp *BrokerAuth) ServerResponse(name string, poolid string) *ServerResponse
type BrokerData ¶
type BrokerImplem ¶ added in v0.1.10
type BrokerImplem interface { // Init initializes the specific implementation with the broker structure // and the base router so that new function can be provided. Init(b *Broker, r *mux.Router) // Synthesize the specific response for a given implementation. ServerResponse(serverId string, poolid string) *ServerResponse // Operations specific to an implementation performed when baremetal is booked. BookServer(pool *Pool, server *Baremetal) error // Operations specific to an implementation performed when baremetal is released ReleaseServer(pool *Pool, server *Baremetal) error }
BrokerImplem is the inteface that hides the specific implementation of the proxy or the authentication back-end that creates accounts.
type BrokerProxy ¶ added in v0.1.10
BrokerProxy is the type of the implementation of a Redfish broker using a proxy to virtualize the BMC of servers.
func (*BrokerProxy) BookServer ¶ added in v0.1.10
func (bp *BrokerProxy) BookServer(pool *Pool, server *Baremetal) error
func (*BrokerProxy) ReleaseServer ¶ added in v0.1.10
func (bp *BrokerProxy) ReleaseServer(pool *Pool, server *Baremetal) error
func (*BrokerProxy) ServerResponse ¶ added in v0.1.10
func (bp *BrokerProxy) ServerResponse(name string, poolid string) *ServerResponse
type ChallengeRequest ¶ added in v0.1.5
type ChallengeRequest struct {
Challenge string `json:"challenge"`
}
type ChallengeResponse ¶ added in v0.1.5
type ErrorResponse ¶
type ErrorResponse struct {
Message string `json:"message"`
}
ErrorResponse is the standard error given back
type ErrorResponseNetdef ¶ added in v0.1.5
ErrorResponseNetDef is the error message for network assocation
type Member ¶ added in v0.1.10
type Member struct {
ODataId string `json:"@odata.id"`
}
Member is a member of a redfish collection
type PasswordData ¶ added in v0.1.11
type PasswordData struct {
Password string
}
type PatchSpec ¶
type PatchSpec struct { Op string `json:"op"` Path string `json:"path"` Value string `json:"value"` }
PatchSpec is a typed JSON patch description
type PoolLimit ¶ added in v0.1.10
func InitializeLimits ¶ added in v0.1.10
type PoolRequest ¶ added in v0.1.10
type PoolResponse ¶
type RedfishClient ¶ added in v0.1.10
type RedfishClient struct {
// contains filtered or unexported fields
}
RedfishClient is the type of a specialized http.Client for Redfish It stores the target host and the credentials.
type RedfishCollection ¶ added in v0.1.10
RedfishCollection is the type of a collection of records in Redfish. It only contains pointers to the actual objects.
type ServerData ¶
type ServerRequest ¶
type ServerResponse ¶
type ServerResponse struct { Id string `json:"id"` K8sLabels map[string]string `json:"k8slabels"` K8sAnnotations map[string]string `json:"k8sannotations"` Baremetal string `json:"baremetal"` Url string `json:"url"` MacAddress string `json:"macAddress"` RootDeviceHints *bmh.RootDeviceHints `json:"rootDeviceHints,omitempty"` DisableCertificateVerification bool `json:"disablecertificateverification"` }
type SignatureRequest ¶ added in v0.1.5
type SignatureResponse ¶ added in v0.1.5
type SignatureResponse struct {
SignatureVerified string `json:"signatureverified"`
}