broker

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2022 License: Apache-2.0 Imports: 32 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAnnotation

func AddAnnotation(baremetalId string, namespace string, poolId string, serverId string, schema string, logger logr.Logger) error

func BaremetalFound

func BaremetalFound(name string) bool

func CreateNewBaremetal

func CreateNewBaremetal(bm Baremetal)

func CreateNewPool

func CreateNewPool(pool Pool)

func CreateNewServer

func CreateNewServer(poolId string, serverId string, baremetalName string, schema string)

func DeleteBaremetal

func DeleteBaremetal(name string)

func DeletePool

func DeletePool(poolId string, logger logr.Logger)

func DeleteServer

func DeleteServer(serverId string, poolId string)

func GetBrokerClient

func GetBrokerClient(
	kubeconfig *rest.Config,
) (*rest.RESTClient, error)

func GetK8SClient

func GetK8SClient(kubeconfig *rest.Config) (*kubernetes.Clientset, error)

func HandleBrokerApiRequests

func HandleBrokerApiRequests(setupLog logr.Logger)

func InitBrokerData

func InitBrokerData(setupLog logr.Logger) error

func IsBrokerDataEmpty

func IsBrokerDataEmpty() bool

func PoolFound

func PoolFound(name string) bool

func ServerFound

func ServerFound(name string, poolid string) bool

func Sign added in v0.1.5

func Sign(challenge string, logger logr.Logger) (result string, err error)

func UpdateBaremetal

func UpdateBaremetal(bm Baremetal)

func UpdatePoolValues

func UpdatePoolValues(name string, poolValues Pool)

func ValidateBaremetalDataRequest

func ValidateBaremetalDataRequest(baremetalValues Baremetal) error

func ValidatePoolDataRequest

func ValidatePoolDataRequest(poolValues Pool) error

func ValidateServerDataRequest

func ValidateServerDataRequest(serverValues ServerRequest) error

func Verify added in v0.1.5

func Verify(challenge string, signature string, logger logr.Logger) (err error)

func VerifyPoolAuthent

func VerifyPoolAuthent(username string, password string, poolId string) bool

//////////////////////////////////////////////////////////////

func VerifySignature added in v0.1.5

func VerifySignature(w http.ResponseWriter, r *http.Request, logger logr.Logger)

Types

type AuthRequest

type AuthRequest struct {
	UserName string `json:"username"`
	Password string `json:"password"`
}

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"`
}

func GetBaremetal

func GetBaremetal(name string) *Baremetal

func RetrieveAllBaremetals

func RetrieveAllBaremetals() []Baremetal

type BrokerData

type BrokerData struct {
	Baremetals map[string]Baremetal
	Pools      map[string]Pool
}
var (
	BROKERDATA BrokerData = BrokerData{
		Baremetals: make(map[string]Baremetal),
		Pools:      make(map[string]Pool),
	}

	Mutex sync.Mutex
)

type ChallengeRequest added in v0.1.5

type ChallengeRequest struct {
	Challenge string `json:"challenge"`
}

type ChallengeResponse added in v0.1.5

type ChallengeResponse struct {
	Challenge       string `json:"challenge"`
	SignedChallenge string `json:"signedchallenge"`
}

type ErrorCode added in v0.1.5

type ErrorCode int
const (
	NO_ERROR ErrorCode = iota
	CHECK_CERTIFICATE_ERROR
	OTHER_ERROR
)

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
}

type ErrorResponseNetdef added in v0.1.5

type ErrorResponseNetdef struct {
	Code    ErrorCode `json:"code"`
	Message string    `json:"message"`
}

type PatchSpec

type PatchSpec struct {
	Op    string `json:"op"`
	Path  string `json:"path"`
	Value string `json:"value"`
}

type Pool

type Pool struct {
	Id            string
	Username      string
	Password      string
	LabelSelector map[string]string
	MaxServers    int
	Servers       map[string]ServerData
}

type PoolResponse

type PoolResponse struct {
	Id            string            `json:"id"`
	Username      string            `json:"username"`
	Password      string            `json:"password"`
	LabelSelector map[string]string `json:"labelSelector"`
	MaxServers    int               `json:"maxServers"`
}

func GetPool

func GetPool(poolId string) *PoolResponse

func RetrieveAllPools

func RetrieveAllPools() []PoolResponse

type ServerData

type ServerData struct {
	Id        string `json:"id"`
	Baremetal string `json:"baremetal"`
	Schema    string `json:"schema"`
}

type ServerRequest

type ServerRequest struct {
	Id     string `json:"id"`
	Schema string `json:"schema"`
}

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"`
}

func RetrieveAllServers

func RetrieveAllServers(poolId string) []ServerResponse

type SignatureRequest added in v0.1.5

type SignatureRequest struct {
	Challenge string `json:"challenge"`
	Signature string `json:"signature"`
}

type SignatureResponse added in v0.1.5

type SignatureResponse struct {
	SignatureVerified string `json:"signatureverified"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL