Documentation ¶
Index ¶
- Constants
- Variables
- type ApplicationCredentialProvider
- type BlockStorageClient
- type ComputeClient
- func (c *ComputeClient) AvailabilityZones(ctx context.Context) ([]availabilityzones.AvailabilityZone, error)
- func (c *ComputeClient) CreateServerGroup(ctx context.Context, name string) (*servergroups.ServerGroup, error)
- func (c *ComputeClient) FlavorGPUs(flavor *flavors.Flavor) (GPUMeta, error)
- func (c *ComputeClient) Flavors(ctx context.Context) ([]flavors.Flavor, error)
- func (c *ComputeClient) KeyPairs(ctx context.Context) ([]keypairs.KeyPair, error)
- func (c *ComputeClient) ListServerGroups(ctx context.Context) ([]servergroups.ServerGroup, error)
- type CreateTokenOptions
- type CreateTokenOptionsScopedToken
- type CreateTokenOptionsUnscopedPassword
- type CredentialProvider
- type DomainScopedPasswordProvider
- type GPUMeta
- type IdentityClient
- func (c *IdentityClient) CreateApplicationCredential(ctx context.Context, userID, name, description string, roles []string) (*applicationcredentials.ApplicationCredential, error)
- func (c *IdentityClient) CreateProject(ctx context.Context, domainID, name string, tags []string) (*projects.Project, error)
- func (c *IdentityClient) CreateRoleAssignment(ctx context.Context, userID, projectID, roleID string) error
- func (c *IdentityClient) CreateToken(ctx context.Context, options CreateTokenOptions) (*tokens.Token, *tokens.User, error)
- func (c *IdentityClient) CreateUser(ctx context.Context, domainID, name, password string) (*users.User, error)
- func (c *IdentityClient) DeleteApplicationCredential(ctx context.Context, userID, id string) error
- func (c *IdentityClient) DeleteProject(ctx context.Context, projectID string) error
- func (c *IdentityClient) DeleteUser(ctx context.Context, userID string) error
- func (c *IdentityClient) GetUser(ctx context.Context, userID string) (*users.User, error)
- func (c *IdentityClient) ListApplicationCredentials(ctx context.Context, userID string) ([]applicationcredentials.ApplicationCredential, error)
- func (c *IdentityClient) ListAvailableProjects(ctx context.Context) ([]projects.Project, error)
- func (c *IdentityClient) ListRoles(ctx context.Context) ([]roles.Role, error)
- type ImageClient
- type NetworkClient
- type PasswordProvider
- type Provider
- func (p *Provider) CreateIdentity(ctx context.Context, info *providers.ClusterInfo) (*unikornv1.Identity, *providers.CloudConfig, error)
- func (p *Provider) DeleteIdentity(ctx context.Context, identityID string) error
- func (p *Provider) Flavors(ctx context.Context) (providers.FlavorList, error)
- func (p *Provider) Images(ctx context.Context) (providers.ImageList, error)
- func (p *Provider) ListExternalNetworks(ctx context.Context) (providers.ExternalNetworks, error)
- type TokenProvider
- type UnauthenticatedProvider
Constants ¶
const ( // ProjectIDAnnotation records the project ID created for a cluster. ProjectIDAnnotation = "openstack." + providers.MetdataDomain + "/project-id" // UserIDAnnotation records the user ID create for a cluster. UserIDAnnotation = "openstack." + providers.MetdataDomain + "/user-id" // Projects are randomly named to avoid clashes, so we need to add some tags // in order to be able to reason about who they really belong to. It is also // useful to have these in place so we can spot orphaned resources and garbage // collect them. OrganizationTag = "organization" ProjectTag = "project" ClusterTag = "cluster" )
Variables ¶
var ( // ErrPEMDecode is raised when the PEM decode failed for some reason. ErrPEMDecode = errors.New("PEM decode error") // ErrPEMType is raised when the encounter the wrong PEM type, e.g. PKCS#1. ErrPEMType = errors.New("PEM type unsupported") // ErrKeyType is raised when we encounter an unsupported key type. ErrKeyType = errors.New("key type unsupported") )
var ( // ErrExpression is raised at runtime when expression evaluation fails. ErrExpression = errors.New("expression must contain exactly one sub match that yields a number string") )
var (
ErrKeyUndefined = errors.New("a required key was not defined")
)
var ( // ErrResourceNotFound is returned when a named resource cannot // be looked up (we have to do it ourselves) and it cannot be found. ErrResourceNotFound = errors.New("requested resource not found") )
Functions ¶
This section is empty.
Types ¶
type ApplicationCredentialProvider ¶
type ApplicationCredentialProvider struct {
// contains filtered or unexported fields
}
ApplicationCredentialProvider allows use of an application credential.
func NewApplicationCredentialProvider ¶
func NewApplicationCredentialProvider(endpoint, id, secret string) *ApplicationCredentialProvider
NewApplicationCredentialProvider creates a client that comsumes application credentials for authentication.
type BlockStorageClient ¶
type BlockStorageClient struct {
// contains filtered or unexported fields
}
BlockStorageClient wraps the generic client because gophercloud is unsafe.
func NewBlockStorageClient ¶
func NewBlockStorageClient(ctx context.Context, provider CredentialProvider) (*BlockStorageClient, error)
NewBlockStorageClient provides a simple one-liner to start computing.
func (*BlockStorageClient) AvailabilityZones ¶
func (c *BlockStorageClient) AvailabilityZones(ctx context.Context) ([]availabilityzones.AvailabilityZone, error)
AvailabilityZones retrieves block storage availability zones.
type ComputeClient ¶
type ComputeClient struct {
// contains filtered or unexported fields
}
ComputeClient wraps the generic client because gophercloud is unsafe.
func NewComputeClient ¶
func NewComputeClient(ctx context.Context, provider CredentialProvider, options *unikornv1.RegionOpenstackComputeSpec) (*ComputeClient, error)
NewComputeClient provides a simple one-liner to start computing.
func (*ComputeClient) AvailabilityZones ¶
func (c *ComputeClient) AvailabilityZones(ctx context.Context) ([]availabilityzones.AvailabilityZone, error)
AvailabilityZones returns a list of availability zones.
func (*ComputeClient) CreateServerGroup ¶
func (c *ComputeClient) CreateServerGroup(ctx context.Context, name string) (*servergroups.ServerGroup, error)
CreateServerGroup creates the named server group with the given policy and returns the result.
func (*ComputeClient) FlavorGPUs ¶
func (c *ComputeClient) FlavorGPUs(flavor *flavors.Flavor) (GPUMeta, error)
FlavorGPUs returns metadata about GPUs, e.g. the number of GPUs. Sadly there is absolutely no way of assiging metadata to flavors without having to add those same values to your host aggregates, so we have to have knowledge of flavors built in somewhere.
func (*ComputeClient) ListServerGroups ¶
func (c *ComputeClient) ListServerGroups(ctx context.Context) ([]servergroups.ServerGroup, error)
ListServerGroups returns all server groups in the project.
type CreateTokenOptions ¶
type CreateTokenOptions interface { // Options returns a valid set of authentication options. Options() *tokens.AuthOptions }
CreateTokenOptions abstracts away how schizophrenic Openstack is with its million options and million ways to fuck it up.
type CreateTokenOptionsScopedToken ¶
type CreateTokenOptionsScopedToken struct {
// contains filtered or unexported fields
}
CreateTokenOptionsScopedToken is typically used to upgrade from an unscoped password passed login to a project scoped one once you have determined a valid project.
func NewCreateTokenOptionsScopedToken ¶
func NewCreateTokenOptionsScopedToken(token, projectID string) *CreateTokenOptionsScopedToken
NewCreateTokenOptionsScopedToken returns a new instance of project scoped token options.
func (*CreateTokenOptionsScopedToken) Options ¶
func (o *CreateTokenOptionsScopedToken) Options() *tokens.AuthOptions
Options implements the CreateTokenOptions interface.
type CreateTokenOptionsUnscopedPassword ¶
type CreateTokenOptionsUnscopedPassword struct {
// contains filtered or unexported fields
}
CreateTokenOptionsUnscopedPassword is typically used when logging on to a UI when you don't know anything other than username/password.
func NewCreateTokenOptionsUnscopedPassword ¶
func NewCreateTokenOptionsUnscopedPassword(domain, username, password string) *CreateTokenOptionsUnscopedPassword
NewCreateTokenOptionsUnscopedPassword returns a new instance of unscoped username/password options.
func (*CreateTokenOptionsUnscopedPassword) Options ¶
func (o *CreateTokenOptionsUnscopedPassword) Options() *tokens.AuthOptions
Options implements the CreateTokenOptions interface.
type CredentialProvider ¶
type CredentialProvider interface { // Client returns a new provider client. Client(ctx context.Context) (*gophercloud.ProviderClient, error) }
CredentialProvider abstracts authentication methods.
type DomainScopedPasswordProvider ¶
type DomainScopedPasswordProvider struct {
// contains filtered or unexported fields
}
DomainScopedPasswordProvider allows use of an application credential.
func NewDomainScopedPasswordProvider ¶
func NewDomainScopedPasswordProvider(endpoint, userID, password, domainID string) *DomainScopedPasswordProvider
NewDomainScopedPasswordProvider creates a client that comsumes passwords for authentication.
type GPUMeta ¶
type GPUMeta struct { // GPUs is the number of GPUs, this may be the total number // or physical GPUs, or a single virtual GPU. This value // is what will be reported for Kubernetes scheduling. GPUs int }
GPUMeta describes GPUs.
type IdentityClient ¶
type IdentityClient struct {
// contains filtered or unexported fields
}
IdentityClient wraps up gophercloud identity management.
func NewIdentityClient ¶
func NewIdentityClient(ctx context.Context, provider CredentialProvider) (*IdentityClient, error)
NewIdentityClient returns a new identity client.
func (*IdentityClient) CreateApplicationCredential ¶
func (c *IdentityClient) CreateApplicationCredential(ctx context.Context, userID, name, description string, roles []string) (*applicationcredentials.ApplicationCredential, error)
CreateApplicationCredential creates an application credential for the user.
func (*IdentityClient) CreateProject ¶
func (c *IdentityClient) CreateProject(ctx context.Context, domainID, name string, tags []string) (*projects.Project, error)
CreateProject creates the named project.
func (*IdentityClient) CreateRoleAssignment ¶
func (c *IdentityClient) CreateRoleAssignment(ctx context.Context, userID, projectID, roleID string) error
CreateRoleAssignment creates a role between a user and a project.
func (*IdentityClient) CreateToken ¶
func (c *IdentityClient) CreateToken(ctx context.Context, options CreateTokenOptions) (*tokens.Token, *tokens.User, error)
CreateToken issues a new token.
func (*IdentityClient) CreateUser ¶
func (c *IdentityClient) CreateUser(ctx context.Context, domainID, name, password string) (*users.User, error)
CreateUser creates a new user.
func (*IdentityClient) DeleteApplicationCredential ¶
func (c *IdentityClient) DeleteApplicationCredential(ctx context.Context, userID, id string) error
DeleteApplicationCredential deletes an application credential for the user.
func (*IdentityClient) DeleteProject ¶
func (c *IdentityClient) DeleteProject(ctx context.Context, projectID string) error
func (*IdentityClient) DeleteUser ¶
func (c *IdentityClient) DeleteUser(ctx context.Context, userID string) error
DeleteUser removes an existing user.
func (*IdentityClient) ListApplicationCredentials ¶
func (c *IdentityClient) ListApplicationCredentials(ctx context.Context, userID string) ([]applicationcredentials.ApplicationCredential, error)
ListApplicationCredentials lists application credentials for the scoped user.
func (*IdentityClient) ListAvailableProjects ¶
ListAvailableProjects lists projects that an authenticated (but unscoped) user can scope to.
type ImageClient ¶
type ImageClient struct {
// contains filtered or unexported fields
}
ImageClient wraps the generic client because gophercloud is unsafe.
func NewImageClient ¶
func NewImageClient(ctx context.Context, provider CredentialProvider, options *unikornv1.RegionOpenstackImageSpec) (*ImageClient, error)
NewImageClient provides a simple one-liner to start computing.
type NetworkClient ¶
type NetworkClient struct {
// contains filtered or unexported fields
}
NetworkClient wraps the generic client because gophercloud is unsafe.
func NewNetworkClient ¶
func NewNetworkClient(ctx context.Context, provider CredentialProvider) (*NetworkClient, error)
NewNetworkClient provides a simple one-liner to start networking.
func (*NetworkClient) ExternalNetworks ¶
ExternalNetworks returns a list of external networks.
type PasswordProvider ¶
type PasswordProvider struct {
// contains filtered or unexported fields
}
PasswordProvider allows use of an application credential.
func NewPasswordProvider ¶
func NewPasswordProvider(endpoint, userID, password, projectID string) *PasswordProvider
NewPasswordProvider creates a client that comsumes passwords for authentication.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func (*Provider) CreateIdentity ¶ added in v0.1.2
func (p *Provider) CreateIdentity(ctx context.Context, info *providers.ClusterInfo) (*unikornv1.Identity, *providers.CloudConfig, error)
CreateIdentity creates a new identity for cloud infrastructure.
func (*Provider) DeleteIdentity ¶ added in v0.1.4
DeleteIdentity cleans up an identity for cloud infrastructure.
func (*Provider) ListExternalNetworks ¶ added in v0.1.3
ListExternalNetworks returns a list of external networks if the platform supports such a concept.
type TokenProvider ¶
type TokenProvider struct {
// contains filtered or unexported fields
}
TokenProvider creates a client from an endpoint and token.
func NewTokenProvider ¶
func NewTokenProvider(endpoint, token string) *TokenProvider
NewTokenProvider returns a new initialized provider.
type UnauthenticatedProvider ¶
type UnauthenticatedProvider struct {
// contains filtered or unexported fields
}
UnauthenticatedProvider is used for token issue.
func NewUnauthenticatedProvider ¶
func NewUnauthenticatedProvider(endpoint string) *UnauthenticatedProvider
NewTokenProvider returns a new initialized provider.