openstack

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Copyright 2020 CLOUD&HEAT Technologies GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Copyright 2020 CLOUD&HEAT Technologies GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Copyright 2020 CLOUD&HEAT Technologies GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const (
	TagLBManagedPort         = "cah-loadbalancer.k8s.cloudandheat.com/managed"
	DescriptionLBManagedPort = "Managed by cah-loadbalancer"
)

Variables

View Source
var (
	ErrFloatingIPMissing   = errors.New("Expected floating IP was not found")
	ErrFixedIPMissing      = errors.New("Port has no IP address assigned")
	ErrPortIsNil           = errors.New("Port is nil")
	ErrNoFloatingIPCreated = errors.New("No floating IP was created by OpenStack")
)

Functions

func NewProviderClient

func NewProviderClient(cfg *AuthOpts) (*gophercloud.ProviderClient, error)

Types

type AuthOpts

type AuthOpts struct {
	AuthURL           string `toml:"auth-url"`
	UserID            string `toml:"user-id"`
	Username          string `toml:"username"`
	Password          string `toml:"password"`
	ProjectID         string `toml:"project-id"`
	ProjectName       string `toml:"project-name"`
	TrustID           string `toml:"trust-id"`
	DomainID          string `toml:"domain-id"`
	DomainName        string `toml:"domain-name"`
	ProjectDomainID   string `toml:"project-domain-id"`
	ProjectDomainName string `toml:"project-domain-name"`
	UserDomainID      string `toml:"user-domain-id"`
	UserDomainName    string `toml:"user-domain-name"`
	Region            string `toml:"region"`
	CAFile            string `toml:"ca-file"`
	TLSInsecure       bool   `toml:"tls-insecure"`

	ApplicationCredentialID     string `toml:"application-credential-id"`
	ApplicationCredentialName   string `toml:"application-credential-name"`
	ApplicationCredentialSecret string `toml:"application-credential-secret"`
}

func (AuthOpts) ToAuthOptions

func (cfg AuthOpts) ToAuthOptions() gophercloud.AuthOptions

type CachedPort

type CachedPort struct {
	Port       portsv2.Port
	FloatingIP *floatingipsv2.FloatingIP
}

type Config

type Config struct {
	Global     AuthOpts       `toml:"auth"`
	Networking NetworkingOpts `toml:"network"`
}

type CustomCreateOpts

type CustomCreateOpts struct {
	NetworkID           string                `json:"network_id" required:"true"`
	Name                string                `json:"name,omitempty"`
	Description         string                `json:"description,omitempty"`
	AdminStateUp        *bool                 `json:"admin_state_up,omitempty"`
	MACAddress          string                `json:"mac_address,omitempty"`
	FixedIPs            interface{}           `json:"fixed_ips,omitempty"`
	DeviceID            string                `json:"device_id,omitempty"`
	DeviceOwner         string                `json:"device_owner,omitempty"`
	TenantID            string                `json:"tenant_id,omitempty"`
	ProjectID           string                `json:"project_id,omitempty"`
	SecurityGroups      *[]string             `json:"security_groups,omitempty"`
	AllowedAddressPairs []portsv2.AddressPair `json:"allowed_address_pairs,omitempty"`

	// specifically this one
	PortSecurityEnabled *bool `json:"port_security_enabled,omitempty"`
}

We need options which are not included in the default gophercloud struct

func (CustomCreateOpts) ToPortCreateMap

func (opts CustomCreateOpts) ToPortCreateMap() (map[string]interface{}, error)

type NetworkingOpts

type NetworkingOpts struct {
	UseFloatingIPs      bool   `toml:"use-floating-ips"`
	FloatingIPNetworkID string `toml:"floating-ip-network-id"`
	SubnetID            string `toml:"subnet-id"`
}

type OpenStackClient

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

func NewClient

func NewClient(cfg *AuthOpts) (*OpenStackClient, error)

func (*OpenStackClient) NewNetworkV2

func (client *OpenStackClient) NewNetworkV2() (*gophercloud.ServiceClient, error)

func (*OpenStackClient) NewOpenStackL3PortManager

func (client *OpenStackClient) NewOpenStackL3PortManager(networkConfig *NetworkingOpts) (*OpenStackL3PortManager, error)

type OpenStackL3PortManager

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

func (*OpenStackL3PortManager) CheckPortExists added in v0.6.0

func (pm *OpenStackL3PortManager) CheckPortExists(portID string) (bool, error)

CheckPortExists tries to fetch the port with the given ID and return true if it was successful. Returns false if a 404 was returned.

func (*OpenStackL3PortManager) CleanUnusedPorts

func (pm *OpenStackL3PortManager) CleanUnusedPorts(usedPorts []string) error

func (*OpenStackL3PortManager) GetAvailablePorts

func (pm *OpenStackL3PortManager) GetAvailablePorts() ([]string, error)

func (*OpenStackL3PortManager) GetExternalAddress

func (pm *OpenStackL3PortManager) GetExternalAddress(portID string) (string, string, error)

func (*OpenStackL3PortManager) GetInternalAddress

func (pm *OpenStackL3PortManager) GetInternalAddress(portID string) (string, error)

func (*OpenStackL3PortManager) ProvisionPort

func (pm *OpenStackL3PortManager) ProvisionPort() (string, error)

type PortClient added in v0.4.0

type PortClient interface {
	GetPorts() ([]portsv2.Port, error)
	GetPortByID(ID string) (*portsv2.Port, *floatingipsv2.FloatingIP, error)
}

type UncachedClient added in v0.4.0

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

func NewPortClient added in v0.4.0

func NewPortClient(networkingclient *gophercloud.ServiceClient, tag string, useFloatingIPs bool, projectID string) *UncachedClient

func (*UncachedClient) GetPortByID added in v0.4.0

func (pc *UncachedClient) GetPortByID(ID string) (port *portsv2.Port, fip *floatingipsv2.FloatingIP, err error)

func (*UncachedClient) GetPorts added in v0.4.0

func (pc *UncachedClient) GetPorts() (ports []portsv2.Port, err error)

Directories

Path Synopsis
Copyright 2020 CLOUD&HEAT Technologies GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.
Copyright 2020 CLOUD&HEAT Technologies GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.

Jump to

Keyboard shortcuts

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