Documentation
¶
Overview ¶
Package external provides access to external data sources for scheduling.
Index ¶
- type NovaReader
- func (r *NovaReader) GetAllAggregates(ctx context.Context) ([]nova.Aggregate, error)
- func (r *NovaReader) GetAllFlavors(ctx context.Context) ([]nova.Flavor, error)
- func (r *NovaReader) GetAllHypervisors(ctx context.Context) ([]nova.Hypervisor, error)
- func (r *NovaReader) GetAllMigrations(ctx context.Context) ([]nova.Migration, error)
- func (r *NovaReader) GetAllServers(ctx context.Context) ([]nova.Server, error)
- func (r *NovaReader) GetDeletedServerByID(ctx context.Context, serverID string) (*nova.DeletedServer, error)
- func (r *NovaReader) GetFlavorByName(ctx context.Context, flavorName string) (*nova.Flavor, error)
- func (r *NovaReader) GetServerByID(ctx context.Context, serverID string) (*nova.Server, error)
- type NovaReaderInterface
- type PostgresReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NovaReader ¶
type NovaReader struct {
*PostgresReader
}
NovaReader provides read access to Nova data stored in the database. It uses a PostgresReader to connect to the database.
func NewNovaReader ¶
func NewNovaReader(reader *PostgresReader) *NovaReader
NewNovaReader creates a new NovaReader from a PostgresReader.
func (*NovaReader) GetAllAggregates ¶
GetAllAggregates returns all Nova aggregates from the database.
func (*NovaReader) GetAllFlavors ¶
GetAllFlavors returns all Nova flavors from the database.
func (*NovaReader) GetAllHypervisors ¶
func (r *NovaReader) GetAllHypervisors(ctx context.Context) ([]nova.Hypervisor, error)
GetAllHypervisors returns all Nova hypervisors from the database.
func (*NovaReader) GetAllMigrations ¶
GetAllMigrations returns all Nova migrations from the database.
func (*NovaReader) GetAllServers ¶
GetAllServers returns all Nova servers from the database.
func (*NovaReader) GetDeletedServerByID ¶
func (r *NovaReader) GetDeletedServerByID(ctx context.Context, serverID string) (*nova.DeletedServer, error)
GetDeletedServerByID returns a deleted Nova server by its ID from the deleted_servers table. Returns nil, nil if the server is not found in the deleted_servers table.
func (*NovaReader) GetFlavorByName ¶
GetFlavorByName returns a Nova flavor by its name. Returns nil, nil if the flavor is not found.
func (*NovaReader) GetServerByID ¶
GetServerByID returns a Nova server by its ID. Returns nil, nil if the server is not found.
type NovaReaderInterface ¶
type NovaReaderInterface interface {
GetAllServers(ctx context.Context) ([]nova.Server, error)
GetAllFlavors(ctx context.Context) ([]nova.Flavor, error)
GetServerByID(ctx context.Context, serverID string) (*nova.Server, error)
GetFlavorByName(ctx context.Context, flavorName string) (*nova.Flavor, error)
// GetDeletedServerByID returns a deleted server by its ID from the deleted_servers table.
// Returns nil, nil if the server is not found in the deleted_servers table.
GetDeletedServerByID(ctx context.Context, serverID string) (*nova.DeletedServer, error)
}
NovaReaderInterface defines the methods needed to read Nova data. This interface allows mocking the NovaReader in tests.
type PostgresReader ¶
type PostgresReader struct {
// Kubernetes client to read the Datasource CRD and secrets.
Client client.Client
// Reference to the database secret containing connection info.
DatabaseSecretRef corev1.SecretReference
// contains filtered or unexported fields
}
PostgresReader provides read access to a postgres database. It reads the database connection info from a Datasource CRD.
func NewPostgresReader ¶
func NewPostgresReader(ctx context.Context, c client.Client, datasourceName string) (*PostgresReader, error)
NewPostgresReader creates a new PostgresReader from a Datasource CRD name. It looks up the Datasource CRD to get the database secret reference.