Documentation
¶
Overview ¶
Package openstack provides OpenStack-specific functionality.
This package contains functions for performing preflight checks and other operations related to OpenStack.
When to use ¶
This package is used internally by opencenter for OpenStack discovery, storage, and bootstrap validation. Its bootstrap preflight helper is not part of the cluster-independent `cluster doctor` command.
Index ¶
- func DefaultCloudsYAMLPath() string
- func PreflightOpenStack(authURL string) []string
- type AccessRule
- type AppCredential
- type AppCredentialRequest
- type CatalogItem
- type ContainerRequest
- type DiscoveryCatalog
- type DiscoveryClient
- type DiscoveryOptions
- type DiscoverySnapshot
- type EC2CredentialRequest
- type EC2Credentials
- type GophercloudDiscoveryClient
- type GophercloudStorageAdapter
- func (a *GophercloudStorageAdapter) CreateAppCredential(ctx context.Context, req AppCredentialRequest) (AppCredential, error)
- func (a *GophercloudStorageAdapter) CreateEC2Credentials(ctx context.Context, req EC2CredentialRequest) (EC2Credentials, error)
- func (a *GophercloudStorageAdapter) DeleteAppCredential(ctx context.Context, id, userID string) error
- func (a *GophercloudStorageAdapter) DeleteEC2Credentials(ctx context.Context, id, userID string) error
- func (a *GophercloudStorageAdapter) EnsureContainer(ctx context.Context, req ContainerRequest) error
- func (a *GophercloudStorageAdapter) Preflight(ctx context.Context, backend, explicitS3Endpoint string, resolveOwner bool) (StoragePreflight, error)
- type Profile
- type ProfileDiscovery
- type Provider
- func (p *Provider) DetectDrift(ctx context.Context, desired, actual *cloud.InfrastructureState) (*cloud.DriftReport, error)
- func (p *Provider) GetCurrentState(ctx context.Context, cfg v2.Config) (*cloud.InfrastructureState, error)
- func (p *Provider) ReconcileDrift(ctx context.Context, drift *cloud.DriftReport) error
- type Resource
- type StorageAdapter
- type StoragePreflight
- type Subnet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultCloudsYAMLPath ¶
func DefaultCloudsYAMLPath() string
DefaultCloudsYAMLPath returns the standard OpenStack client configuration path, respecting the conventional override used by openstacksdk and OSC.
func PreflightOpenStack ¶
PreflightOpenStack performs provider-specific preflight checks for OpenStack. It checks for the presence of the `openstack` CLI tool and verifies that the authentication URL is configured.
Inputs:
- authURL: The OpenStack authentication URL.
Outputs:
- []string: A list of warning messages. If the list is empty, all checks passed.
Types ¶
type AccessRule ¶
type AppCredential ¶
type AppCredentialRequest ¶
type AppCredentialRequest struct {
UserID string
Name string
Description string
AccessRules []AccessRule
}
type CatalogItem ¶
type ContainerRequest ¶
type DiscoveryCatalog ¶
type DiscoveryCatalog struct {
Images []CatalogItem
Flavors []CatalogItem
Networks []CatalogItem
Subnets []CatalogItem
ExternalNetworks []CatalogItem
AvailabilityZones []CatalogItem
DesignateAvailable bool
}
type DiscoveryClient ¶
type DiscoveryClient interface {
Discover(ctx context.Context, cfg *v2.Config) (*DiscoveryCatalog, error)
}
func NewDiscoveryClient ¶
func NewDiscoveryClient() DiscoveryClient
type DiscoveryOptions ¶
type DiscoveryOptions struct {
SkipInternalNetworkAndSubnet bool
}
DiscoveryOptions controls optional inventory reads.
type DiscoverySnapshot ¶
type DiscoverySnapshot struct {
AuthURL string
Region string
ProjectID string
ProjectName string
UserDomainName string
ProjectDomainName string
DomainName string
Insecure bool
CA string
AvailabilityZonesAvailable bool
Images []Resource
WindowsImages []Resource
Networks []Resource
Subnets []Subnet
ExternalNetworks []Resource
AvailabilityZones []Resource
Flavors []Resource
Warnings []string
}
DiscoverySnapshot is a read-only inventory and profile metadata snapshot.
type EC2CredentialRequest ¶
type EC2Credentials ¶
type GophercloudDiscoveryClient ¶
type GophercloudDiscoveryClient struct{}
func (*GophercloudDiscoveryClient) Discover ¶
func (c *GophercloudDiscoveryClient) Discover(ctx context.Context, cfg *v2.Config) (*DiscoveryCatalog, error)
type GophercloudStorageAdapter ¶
type GophercloudStorageAdapter struct{ Profile Profile }
func NewStorageAdapter ¶
func NewStorageAdapter(profile Profile) *GophercloudStorageAdapter
func (*GophercloudStorageAdapter) CreateAppCredential ¶
func (a *GophercloudStorageAdapter) CreateAppCredential(ctx context.Context, req AppCredentialRequest) (AppCredential, error)
func (*GophercloudStorageAdapter) CreateEC2Credentials ¶
func (a *GophercloudStorageAdapter) CreateEC2Credentials(ctx context.Context, req EC2CredentialRequest) (EC2Credentials, error)
func (*GophercloudStorageAdapter) DeleteAppCredential ¶
func (a *GophercloudStorageAdapter) DeleteAppCredential(ctx context.Context, id, userID string) error
func (*GophercloudStorageAdapter) DeleteEC2Credentials ¶
func (a *GophercloudStorageAdapter) DeleteEC2Credentials(ctx context.Context, id, userID string) error
func (*GophercloudStorageAdapter) EnsureContainer ¶
func (a *GophercloudStorageAdapter) EnsureContainer(ctx context.Context, req ContainerRequest) error
func (*GophercloudStorageAdapter) Preflight ¶
func (a *GophercloudStorageAdapter) Preflight(ctx context.Context, backend, explicitS3Endpoint string, resolveOwner bool) (StoragePreflight, error)
type Profile ¶
type Profile struct {
Name string
AuthURL string
Username string
UserID string
Password string
ProjectID string
ProjectName string
Region string
S3Endpoint string
Interface string
DomainName string
UserDomain string
ProjectDomain string
AppCredID string
AppCredName string
AppCredSecret string
CACert string
Cert string
Key string
Insecure bool
Verify *bool
}
Profile is the read-only representation of one clouds.yaml profile. Secret fields are retained for authentication but are never included in results.
func LoadProfile ¶
LoadProfile reads a selected profile without authenticating or mutating a remote resource.
func (Profile) AuthOptions ¶
func (p Profile) AuthOptions() gophercloud.AuthOptions
type ProfileDiscovery ¶
type ProfileDiscovery struct{ Profile Profile }
ProfileDiscovery performs only OpenStack reads. Optional compute inventory failures are returned as warnings because provider wiring does not require flavor matching or availability-zone enumeration by default.
func NewProfileDiscovery ¶
func NewProfileDiscovery(profile Profile) *ProfileDiscovery
func (*ProfileDiscovery) Discover ¶
func (d *ProfileDiscovery) Discover(ctx context.Context) (*DiscoverySnapshot, error)
func (*ProfileDiscovery) DiscoverWithOptions ¶
func (d *ProfileDiscovery) DiscoverWithOptions(ctx context.Context, opts DiscoveryOptions) (*DiscoverySnapshot, error)
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements the CloudProvider interface for OpenStack.
func NewProvider ¶
func NewProvider(authOpts gophercloud.AuthOptions, region string) *Provider
NewProvider creates a new OpenStack cloud provider.
func (*Provider) DetectDrift ¶
func (p *Provider) DetectDrift(ctx context.Context, desired, actual *cloud.InfrastructureState) (*cloud.DriftReport, error)
DetectDrift compares desired state with actual state and returns a drift report.
func (*Provider) GetCurrentState ¶
func (p *Provider) GetCurrentState(ctx context.Context, cfg v2.Config) (*cloud.InfrastructureState, error)
GetCurrentState retrieves the current infrastructure state from OpenStack.
func (*Provider) ReconcileDrift ¶
ReconcileDrift applies safe mutable changes only.
type StorageAdapter ¶
type StorageAdapter interface {
Preflight(context.Context, string, string, bool) (StoragePreflight, error)
EnsureContainer(context.Context, ContainerRequest) error
CreateAppCredential(context.Context, AppCredentialRequest) (AppCredential, error)
DeleteAppCredential(context.Context, string, string) error
CreateEC2Credentials(context.Context, EC2CredentialRequest) (EC2Credentials, error)
DeleteEC2Credentials(context.Context, string, string) error
}
StorageAdapter is the only OpenStack surface used by the one-service storage flow.
type StoragePreflight ¶
type StoragePreflight struct {
Endpoint string `json:"endpoint" yaml:"endpoint"`
S3Endpoint string `json:"s3_endpoint,omitempty" yaml:"s3_endpoint,omitempty"`
AuthURL string `json:"auth_url" yaml:"auth_url"`
Region string `json:"region" yaml:"region"`
ProjectID string `json:"project_id" yaml:"project_id"`
CredentialOwnerID string `json:"-" yaml:"-"`
}