client

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: Apache-2.0, MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ServerGroupPolicyAntiAffinity is a constant for the anti-affinity server group policy.
	ServerGroupPolicyAntiAffinity = "anti-affinity"
	// ServerGroupPolicyAffinity is a constant for the affinity server group policy.
	ServerGroupPolicyAffinity = "affinity"
)

Variables

This section is empty.

Functions

func IgnoreNotFoundError added in v1.27.0

func IgnoreNotFoundError(err error) error

IgnoreNotFoundError ignore not found error

func IsNotFoundError added in v1.14.0

func IsNotFoundError(err error) bool

IsNotFoundError checks if an error returned by OpenStack is caused by HTTP 404 status code.

Types

type Compute added in v1.14.0

type Compute interface {
	CreateServerGroup(name, policy string) (*servergroups.ServerGroup, error)
	GetServerGroup(id string) (*servergroups.ServerGroup, error)
	DeleteServerGroup(id string) error
	// Server
	CreateServer(createOpts servers.CreateOpts) (*servers.Server, error)
	DeleteServer(id string) error
	ListServerGroups() ([]servergroups.ServerGroup, error)
	FindServersByName(name string) ([]servers.Server, error)
	AssociateFIPWithInstance(serverID string, associateOpts computefip.AssociateOpts) error
	// FloatingID
	FindFloatingIDByInstanceID(id string) (string, error)

	FindFlavorID(name string) (string, error)
	FindImages(name string) ([]images.Image, error)
	ListImages(listOpts images.ListOpts) ([]images.Image, error)
}

Compute describes the operations of a client interacting with OpenStack's Compute service.

type ComputeClient added in v1.14.0

type ComputeClient struct {
	// contains filtered or unexported fields
}

ComputeClient is a client for the Nova service.

func (*ComputeClient) AssociateFIPWithInstance added in v1.27.0

func (c *ComputeClient) AssociateFIPWithInstance(serverID string, associateOpts floatingips.AssociateOpts) error

AssociateFIPWithInstance associate floating ip with instance

func (*ComputeClient) CreateServer added in v1.27.0

func (c *ComputeClient) CreateServer(createOpts servers.CreateOpts) (*servers.Server, error)

CreateServer retrieves the Create of Compute service.

func (*ComputeClient) CreateServerGroup added in v1.14.0

func (c *ComputeClient) CreateServerGroup(name, policy string) (*servergroups.ServerGroup, error)

CreateServerGroup creates a server group with the specified policy.

func (*ComputeClient) DeleteServer added in v1.27.0

func (c *ComputeClient) DeleteServer(id string) error

DeleteServer delete the Compute service.

func (*ComputeClient) DeleteServerGroup added in v1.14.0

func (c *ComputeClient) DeleteServerGroup(id string) error

DeleteServerGroup deletes the server group with the specified id. It returns nil if the server group could not be found.

func (*ComputeClient) FindFlavorID added in v1.27.0

func (c *ComputeClient) FindFlavorID(name string) (string, error)

FindFlavorID find flavor ID by flavor name

func (*ComputeClient) FindFloatingIDByInstanceID added in v1.27.0

func (c *ComputeClient) FindFloatingIDByInstanceID(id string) (string, error)

FindFloatingIDByInstanceID find floating id by instance id

func (*ComputeClient) FindImages added in v1.27.0

func (c *ComputeClient) FindImages(name string) ([]images.Image, error)

FindImages find image ID by images name

func (*ComputeClient) FindServersByName added in v1.27.0

func (c *ComputeClient) FindServersByName(name string) ([]servers.Server, error)

FindServersByName retrieves the Compute Server by Name

func (*ComputeClient) GetServerGroup added in v1.14.0

func (c *ComputeClient) GetServerGroup(id string) (*servergroups.ServerGroup, error)

GetServerGroup retrieves the server group with the specified id.

func (*ComputeClient) ListImages added in v1.27.0

func (c *ComputeClient) ListImages(listOpts images.ListOpts) ([]images.Image, error)

ListImages list all images

func (*ComputeClient) ListServerGroups added in v1.14.0

func (c *ComputeClient) ListServerGroups() ([]servergroups.ServerGroup, error)

ListServerGroups retrieves the list of server groups.

type DNS added in v1.21.0

type DNS interface {
	GetZones(ctx context.Context) (map[string]string, error)
	CreateOrUpdateRecordSet(ctx context.Context, zoneID, name, recordType string, records []string, ttl int) error
	DeleteRecordSet(ctx context.Context, zoneID, name, recordType string) error
}

DNS describes the operations of a client interacting with OpenStack's DNS service.

type DNSClient added in v1.21.0

type DNSClient struct {
	// contains filtered or unexported fields
}

DNSClient is a client for the Designate service.

func (*DNSClient) CreateOrUpdateRecordSet added in v1.21.0

func (c *DNSClient) CreateOrUpdateRecordSet(ctx context.Context, zoneID, name, recordType string, records []string, ttl int) error

CreateOrUpdateRecordSet creates or updates the recordset with the given name, record type, records, and ttl in the zone with the given zone ID.

func (*DNSClient) DeleteRecordSet added in v1.21.0

func (c *DNSClient) DeleteRecordSet(ctx context.Context, zoneID, name, recordType string) error

DeleteRecordSet deletes the recordset with the given name and record type in the zone with the given zone ID.

func (*DNSClient) GetZones added in v1.21.0

func (c *DNSClient) GetZones(ctx context.Context) (map[string]string, error)

GetZones returns a map of all zone names mapped to their IDs.

type Factory added in v1.14.0

type Factory interface {
	Compute(options ...Option) (Compute, error)
	Storage(options ...Option) (Storage, error)
	DNS(options ...Option) (DNS, error)
	Networking(options ...Option) (Networking, error)
}

Factory is an interface for constructing OpenStack service clients.

func NewOpenStackClientFromSecretRef added in v1.14.0

func NewOpenStackClientFromSecretRef(ctx context.Context, c client.Client, secretRef corev1.SecretReference, keyStoneUrl *string) (Factory, error)

NewOpenStackClientFromSecretRef returns a Factory implementation that can be used to create clients for OpenStack services. The credentials are fetched from the Kubernetes secret referenced by <secretRef>.

func NewOpenstackClientFromCredentials added in v1.14.0

func NewOpenstackClientFromCredentials(credentials *os.Credentials) (Factory, error)

NewOpenstackClientFromCredentials returns a Factory implementation that can be used to create clients for OpenStack services. TODO: respect CloudProfile's requestTimeout for the OpenStack client. see https://github.com/kubernetes/cloud-provider-openstack/blob/c44d941cdb5c7fe651f5cb9191d0af23e266c7cb/pkg/openstack/openstack.go#L257

type FactoryFactory added in v1.21.0

type FactoryFactory interface {
	// NewFactory creates a new instance of Factory for the given Openstack credentials.
	NewFactory(credentials *openstack.Credentials) (Factory, error)
}

FactoryFactory creates instances of Factory.

type FactoryFactoryFunc added in v1.21.0

type FactoryFactoryFunc func(credentials *openstack.Credentials) (Factory, error)

FactoryFactoryFunc is a function that implements FactoryFactory.

func (FactoryFactoryFunc) NewFactory added in v1.21.0

func (f FactoryFactoryFunc) NewFactory(credentials *openstack.Credentials) (Factory, error)

NewFactory creates a new instance of Factory for the given Openstack credentials.

type Networking added in v1.21.0

type Networking interface {
	// External Network
	GetExternalNetworkNames(ctx context.Context) ([]string, error)
	ListNetwork(listOpts networks.ListOpts) ([]networks.Network, error)
	GetNetworkByName(name string) ([]networks.Network, error)
	// FloatingIP
	CreateFloatingIP(createOpts floatingips.CreateOpts) (*floatingips.FloatingIP, error)
	DeleteFloatingIP(id string) error
	ListFip(listOpts floatingips.ListOpts) ([]floatingips.FloatingIP, error)
	GetFipByName(name string) ([]floatingips.FloatingIP, error)
	// Security Group
	CreateSecurityGroup(listOpts groups.CreateOpts) (*groups.SecGroup, error)
	DeleteSecurityGroup(groupID string) error
	ListSecurityGroup(listOpts groups.ListOpts) ([]groups.SecGroup, error)
	GetSecurityGroupByName(name string) ([]groups.SecGroup, error)
	// Security Group rules
	CreateRule(createOpts rules.CreateOpts) (*rules.SecGroupRule, error)
	ListRules(listOpts rules.ListOpts) ([]rules.SecGroupRule, error)
	DeleteRule(ruleID string) error
	// Routers
	GetRouterByID(id string) ([]routers.Router, error)
	ListRouters(listOpts routers.ListOpts) ([]routers.Router, error)
	UpdateRoutesForRouter(routes []routers.Route, routerID string) (*routers.Router, error)
}

Networking describes the operations of a client interacting with OpenStack's Networking service.

type NetworkingClient added in v1.21.0

type NetworkingClient struct {
	// contains filtered or unexported fields
}

NetworkingClient is a client for the Neutron service.

func (*NetworkingClient) CreateFloatingIP added in v1.27.0

func (c *NetworkingClient) CreateFloatingIP(createOpts floatingips.CreateOpts) (*floatingips.FloatingIP, error)

CreateFloatingIP create floating ip

func (*NetworkingClient) CreateRule added in v1.27.0

func (c *NetworkingClient) CreateRule(createOpts rules.CreateOpts) (*rules.SecGroupRule, error)

CreateRule create security group rule

func (*NetworkingClient) CreateSecurityGroup added in v1.27.0

func (c *NetworkingClient) CreateSecurityGroup(listOpts groups.CreateOpts) (*groups.SecGroup, error)

CreateSecurityGroup create a security group

func (*NetworkingClient) DeleteFloatingIP added in v1.27.0

func (c *NetworkingClient) DeleteFloatingIP(id string) error

DeleteFloatingIP delete floatingip by floatingip id

func (*NetworkingClient) DeleteRule added in v1.27.0

func (c *NetworkingClient) DeleteRule(ruleID string) error

DeleteRule delete security group rule

func (*NetworkingClient) DeleteSecurityGroup added in v1.27.0

func (c *NetworkingClient) DeleteSecurityGroup(groupID string) error

DeleteSecurityGroup delete a security group

func (*NetworkingClient) GetExternalNetworkNames added in v1.21.0

func (c *NetworkingClient) GetExternalNetworkNames(_ context.Context) ([]string, error)

GetExternalNetworkNames returns a list of all external network names.

func (*NetworkingClient) GetFipByName added in v1.27.0

func (c *NetworkingClient) GetFipByName(name string) ([]floatingips.FloatingIP, error)

GetFipByName returns floating IP info by floatingip name

func (*NetworkingClient) GetNetworkByName added in v1.27.0

func (c *NetworkingClient) GetNetworkByName(name string) ([]networks.Network, error)

GetNetworkByName return a network info by name

func (*NetworkingClient) GetRouterByID added in v1.30.2

func (c *NetworkingClient) GetRouterByID(id string) ([]routers.Router, error)

GetRouterByID return a router info by name

func (*NetworkingClient) GetSecurityGroupByName added in v1.27.0

func (c *NetworkingClient) GetSecurityGroupByName(name string) ([]groups.SecGroup, error)

GetSecurityGroupByName returns a security group info by security group name

func (*NetworkingClient) ListFip added in v1.27.0

ListFip returns a list of all network info

func (*NetworkingClient) ListNetwork added in v1.27.0

func (c *NetworkingClient) ListNetwork(listOpts networks.ListOpts) ([]networks.Network, error)

ListNetwork returns a list of all network info by listOpts

func (*NetworkingClient) ListRouters added in v1.30.2

func (c *NetworkingClient) ListRouters(listOpts routers.ListOpts) ([]routers.Router, error)

ListRouters returns a list of routers

func (*NetworkingClient) ListRules added in v1.27.0

func (c *NetworkingClient) ListRules(listOpts rules.ListOpts) ([]rules.SecGroupRule, error)

ListRules returns a list of security group rules

func (*NetworkingClient) ListSecurityGroup added in v1.27.0

func (c *NetworkingClient) ListSecurityGroup(listOpts groups.ListOpts) ([]groups.SecGroup, error)

ListSecurityGroup returns a list of security group

func (*NetworkingClient) UpdateRoutesForRouter added in v1.30.2

func (c *NetworkingClient) UpdateRoutesForRouter(routes []routers.Route, routerID string) (*routers.Router, error)

UpdateRoutesForRouter updates the route list for a router

type OpenstackClientFactory added in v1.14.0

type OpenstackClientFactory struct {
	// contains filtered or unexported fields
}

OpenstackClientFactory implements a factory that can construct clients for Openstack services.

func (*OpenstackClientFactory) Compute added in v1.14.0

func (oc *OpenstackClientFactory) Compute(options ...Option) (Compute, error)

Compute returns a Compute client. The client uses Nova v2 API for issuing calls.

func (*OpenstackClientFactory) DNS added in v1.21.0

func (oc *OpenstackClientFactory) DNS(options ...Option) (DNS, error)

DNS returns a DNS client. The client uses Designate v2 API for issuing calls.

func (*OpenstackClientFactory) Networking added in v1.21.0

func (oc *OpenstackClientFactory) Networking(options ...Option) (Networking, error)

Networking returns a Networking client. The client uses Neutron v2 API for issuing calls.

func (*OpenstackClientFactory) Storage added in v1.14.0

func (oc *OpenstackClientFactory) Storage(options ...Option) (Storage, error)

Storage returns a Storage client. The client uses Swift v1 API for issuing calls.

type Option added in v1.14.0

Option can be passed to Factory implementations to modify the produced clients.

func WithRegion added in v1.14.0

func WithRegion(region string) Option

WithRegion returns an Option that can modify the region a client targets.

type Storage

type Storage interface {
	DeleteObjectsWithPrefix(ctx context.Context, container, prefix string) error
	CreateContainerIfNotExists(ctx context.Context, container string) error
	DeleteContainerIfExists(ctx context.Context, container string) error
}

Storage describes the operations of a client interacting with OpenStack's ObjectStorage service.

func NewStorageClientFromSecretRef

func NewStorageClientFromSecretRef(ctx context.Context, c client.Client, secretRef corev1.SecretReference, region string) (Storage, error)

NewStorageClientFromSecretRef retrieves the openstack client from specified by the secret reference.

type StorageClient

type StorageClient struct {
	// contains filtered or unexported fields
}

StorageClient is a client for the Swift service.

func (*StorageClient) CreateContainerIfNotExists

func (s *StorageClient) CreateContainerIfNotExists(ctx context.Context, container string) error

CreateContainerIfNotExists creates the openstack blob container with name <container>. If it already exist, no error is returned.

func (*StorageClient) DeleteContainerIfExists

func (s *StorageClient) DeleteContainerIfExists(ctx context.Context, container string) error

DeleteContainerIfExists deletes the openstack blob container with name <container>. If it does not exist, no error is returned.

func (*StorageClient) DeleteObjectsWithPrefix

func (s *StorageClient) DeleteObjectsWithPrefix(ctx context.Context, container, prefix string) error

DeleteObjectsWithPrefix deletes the blob objects with the specific <prefix> from <container>. If it does not exist, no error is returned.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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