openstack

package
v0.0.0-...-d833102 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 36 Imported by: 0

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

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

func PreflightOpenStack(authURL string) []string

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 AccessRule struct {
	Service string
	Method  string
	Path    string
}

type AppCredential

type AppCredential struct {
	ID     string
	Secret string
}

type AppCredentialRequest

type AppCredentialRequest struct {
	UserID      string
	Name        string
	Description string
	AccessRules []AccessRule
}

type CatalogItem

type CatalogItem struct {
	ID   string
	Name string
}

type ContainerRequest

type ContainerRequest struct {
	Name   string
	Region string
}

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 EC2CredentialRequest struct {
	UserID      string
	ProjectID   string
	ProjectName string
	UserName    string
}

type EC2Credentials

type EC2Credentials struct {
	ID          string
	AccessKeyID string
	Secret      string
	Endpoint    string
	Region      string
	ProjectID   string
}

type GophercloudDiscoveryClient

type GophercloudDiscoveryClient struct{}

func (*GophercloudDiscoveryClient) Discover

type GophercloudStorageAdapter

type GophercloudStorageAdapter struct{ Profile Profile }

func NewStorageAdapter

func NewStorageAdapter(profile Profile) *GophercloudStorageAdapter

func (*GophercloudStorageAdapter) CreateAppCredential

func (*GophercloudStorageAdapter) CreateEC2Credentials

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

func LoadProfile(path, name string) (Profile, error)

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 (*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

func (p *Provider) ReconcileDrift(ctx context.Context, drift *cloud.DriftReport) error

ReconcileDrift applies safe mutable changes only.

type Resource

type Resource struct {
	ID   string `json:"id" yaml:"id"`
	Name string `json:"name" yaml:"name"`
}

Resource is a stable, redacted inventory item suitable for selection output.

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

type Subnet

type Subnet struct {
	Resource
	NetworkID string `json:"network_id" yaml:"network_id"`
}

Subnet carries the network relationship needed to validate provider wiring.

Jump to

Keyboard shortcuts

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