octavia

package
v0.0.0-...-a024e70 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 59 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ServiceName -
	ServiceName = "octavia"
	// ServiceType -
	ServiceType = "load-balancer"

	// DatabaseName - Name of the database used in CREATE DATABASE statement
	// for the main octavia database
	DatabaseName = "octavia"

	// PersistenceDatabaseName - Name of the database used in CREATE DATABASE statement
	// for the persistence database
	PersistenceDatabaseName = "octavia_persistence"

	// DatabaseCRName - Name of the MariaDBDatabase CR
	DatabaseCRName = "octavia"

	// PersistenceDatabaseCRName - Name of the MariaDBDatabase CR
	PersistenceDatabaseCRName = "octavia-persistence"

	// DatabaseUsernamePrefix - used by EnsureMariaDBAccount when a new username
	// is to be generated, e.g. "octavia_e5a4", "octavia_78bc", etc
	DatabaseUsernamePrefix = "octavia"

	// OctaviaPublicPort -
	OctaviaPublicPort int32 = 9876
	// OctaviaInternalPort -
	OctaviaInternalPort int32 = 9876

	// ApacheInternalPort -
	ApacheInternalPort int32 = 80

	// AdminTenantName
	AdminTenant = "admin"

	// HmConfigMap ...
	HmConfigMap = "octavia-hmport-map"
)
View Source
const (
	AmphoraImageTag     = "amphora-image"
	AmphoraImageVertTag = "amphora-image-vert"
)
View Source
const (

	// LbMgmtNetName -
	LbMgmtNetName = "lb-mgmt-net"

	// LbMgmtNetNameAZ -
	LbMgmtNetNameAZ = "lb-mgmt-%s-net"

	// LbMgmtNetDescription -
	LbMgmtNetDescription = "LBaaS Management Network"

	// LbMgmtNetDescriptionAZ -
	LbMgmtNetDescriptionAZ = "LBaaS Management Network for %s"

	// LbMgmtSubnetName -
	LbMgmtSubnetName = "lb-mgmt-subnet"

	// LbMgmtSubnetNameAZ -
	LbMgmtSubnetNameAZ = "lb-mgmt-%s-subnet"

	// LbMgmtSubnetDescription -
	LbMgmtSubnetDescription = "LBaaS Management Subnet"

	// LbMgmtSubnetDescriptionAZ -
	LbMgmtSubnetDescriptionAZ = "LBaaS Management Subnet for %s"

	// LbMgmtSubnetGatewayIP -
	LbMgmtSubnetGatewayIP = ""

	// LbMgmtSubnetIPv6AddressMode -
	LbMgmtSubnetIPv6AddressMode = "slaac"

	// LbMgmtSubnetIPv6RAMode -
	LbMgmtSubnetIPv6RAMode = "slaac"

	// LbMgmtSubnetIPv6GatewayIP -
	LbMgmtSubnetIPv6GatewayIP = ""

	// LbProvNetName -
	LbProvNetName = "octavia-provider-net"

	// LbProvNetDescription -
	LbProvNetDescription = "LBaaS Management Provider Network"

	// LbProvSubnetName -
	LbProvSubnetName = "octavia-provider-subnet"

	// LbProvSubnetDescription -
	LbProvSubnetDescription = "LBaaS Management Provider Subnet"

	// LbProvSubnetPoolSize -
	LbProvSubnetPoolSize = 25

	// LbProvPredictablePoolSize  -
	LbProvPredictablePoolSize = 25

	// TODO(beagles): support IPv6 for the provider network.
	// LbRouterName -
	LbRouterName = "octavia-link-router"

	// LbProvPhysicalNet -
	LbProvPhysicalNet = "octavia"

	// LbMgmtRouterPortName
	LbMgmtRouterPortName = "lb-mgmt-router-port"

	// LbMgmtRouterPortNameAZ
	LbMgmtRouterPortNameAZ = "lb-mgmt-%s-router-port"

	// Network attachment details
	// LbNetworkAttachmentName
	LbNetworkAttachmentName = "octavia"

	// LbMgmtNetworkSecurityGroup
	LbMgmtNetworkSecurityGroupName = "lb-mgmt-sec-grp"

	// LbMgmtHealthManagerSecurityGroup
	LbMgmtHealthManagerSecurityGroupName = "lb-health-mgr-sec-grp"

	// LbMgmtNetworkSecurityGroup
	LbProvNetworkSecurityGroupName = "lb-prov-sec-grp"

	// LbMgmtHealthManagerSecurityGroup
	LbProvHealthManagerSecurityGroupName = "lb-health-prov-sec-grp"
)
View Source
const (
	OctaviaUID int64 = 42437
	OctaviaGID int64 = 42437
)
View Source
const (
	// InitContainerCommand -
	InitContainerCommand = "/usr/local/bin/container-scripts/init.sh"
)
View Source
const NovaKeyPairName string = "octavia-ssh-keypair"

NovaKeyPairName stores the name of the nova keypair that holds the public SSH key for access to the amphorae

View Source
const (
	// ServiceCommand -
	ServiceCommand = "cp -f /usr/local/apache2/conf/httpd.conf /etc/httpd/conf/httpd.conf && /usr/bin/run-httpd"
)

Variables

This section is empty.

Functions

func DbSyncJob

func DbSyncJob(
	instance *octaviav1.Octavia,
	labels map[string]string,
	annotations map[string]string,
) *batchv1.Job

DbSyncJob func

func EncryptPrivateKey

func EncryptPrivateKey(data, password []byte) (*pem.Block, error)

EncryptPrivateKey encrypts given private key data using AES in PKCS#8 format

func EnsureAmpSSHConfig

func EnsureAmpSSHConfig(
	ctx context.Context,
	instance *octaviav1.Octavia,
	h *helper.Helper,
) error

EnsureAmpSSHConfig ensures amphora SSH configuration is set up

func EnsureAmphoraCerts

func EnsureAmphoraCerts(
	ctx context.Context,
	instance *octaviav1.Octavia,
	h *helper.Helper) error

EnsureAmphoraCerts ensures Amphora certificates exist in the secret store

func EnsureAmphoraImages

func EnsureAmphoraImages(
	ctx context.Context,
	instance *octaviav1.Octavia,
	log *logr.Logger,
	helper *helper.Helper,
	imageList []AmphoraImage,
) (bool, error)

func EnsureQuotas

func EnsureQuotas(
	ctx context.Context,
	instance *octaviav1.Octavia,
	log *logr.Logger,
	helper *helper.Helper,
) error

EnsureQuotas -- set the quotas for the Octavia project

func GetAdminServiceClient

func GetAdminServiceClient(
	ctx context.Context,
	h *helper.Helper,
	keystoneAPI *keystonev1.KeystoneAPI,
) (*openstack.OpenStack, ctrl.Result, error)

GetAdminServiceClient - get a client for the "admin" tenant

func GetComputeClient

func GetComputeClient(o *openstack.OpenStack) (*gophercloud.ServiceClient, error)

GetComputeClient -

func GetImageClient

func GetImageClient(o *openstack.OpenStack) (*gophercloud.ServiceClient, error)

GetImageClient -

func GetImageOwnerID

func GetImageOwnerID(
	ctx context.Context,
	instance *octaviav1.Octavia,
	helper *helper.Helper,
) (string, error)

func GetInitVolumeMounts

func GetInitVolumeMounts() []corev1.VolumeMount

GetInitVolumeMounts - general init task VolumeMounts

func GetLoadBalancerClient

func GetLoadBalancerClient(o *openstack.OpenStack) (*gophercloud.ServiceClient, error)

GetLoadBalancerClient -

func GetNetworkClient

func GetNetworkClient(o *openstack.OpenStack) (*gophercloud.ServiceClient, error)

GetNetworkClient -

func GetNextIP

func GetNextIP(predParams *NADIpam, currentValues map[string]bool) (string, error)

GetNextIP picks the next available IP from the range defined by a NADIpam, skipping ones that are already used appear as keys in the currentValues map.

func GetOctaviaSecurityContext

func GetOctaviaSecurityContext() *corev1.SecurityContext

func GetOpenstackClient

func GetOpenstackClient(
	ctx context.Context,
	ns string,
	h *helper.Helper,
) (*openstack.OpenStack, error)

GetOpenstackClient returns an openstack admin service client object

func GetOpenstackServiceClient

func GetOpenstackServiceClient(
	ctx context.Context,
	instance *octaviav1.Octavia,
	h *helper.Helper,
) (*openstack.OpenStack, error)

GetOpenstackServiceClient returns an openstack service client object

func GetOwningOctaviaControllerName

func GetOwningOctaviaControllerName(instance client.Object) string

GetOwningOctaviaControllerName - Given a OctaviaHousekeeping, OctaviaHealthmanager or OctaviaWorker object, returning the parent Octavia object that created it (if any)

func GetProject

func GetProject(openstack *openstack.OpenStack, projectName string) (*projects.Project, error)

GetProject -

func GetRangeFromCIDR

func GetRangeFromCIDR(
	cidr netip.Prefix,
) (start netip.Addr, end netip.Addr)

GetRangeFromCIDR - compute a IP address range from a CIDR

func GetServiceClient

func GetServiceClient(
	ctx context.Context,
	h *helper.Helper,
	octavia *octaviav1.Octavia,
	keystoneAPI *keystonev1.KeystoneAPI,
) (*openstack.OpenStack, ctrl.Result, error)

GetServiceClient - Get a client for the "service" tenant

func GetUser

func GetUser(openstack *openstack.OpenStack, userName string) (*users.User, error)

GetUser -

func GetVolumeMounts

func GetVolumeMounts(serviceName string) []corev1.VolumeMount

GetVolumeMounts - general VolumeMounts

func GetVolumes

func GetVolumes(name string) []corev1.Volume

GetVolumes - service volumes

func ImageUploadDeployment

func ImageUploadDeployment(
	instance *octaviav1.Octavia,
	labels map[string]string,
) *appsv1.Deployment

Deployment func

Types

type AmphoraImage

type AmphoraImage struct {
	ID       string
	URL      string
	Checksum string
	Name     string
	Status   images.ImageStatus
}

type ClientConfig

type ClientConfig struct {
	User       string
	TenantName string
	Region     string
	Secret     string
	Selector   string
}

type ClientType

type ClientType int
const (
	AdminClient   ClientType = iota
	ServiceClient ClientType = iota
)

type ImageUploadDetails

type ImageUploadDetails struct {
	ContainerImage string
	VolumeMounts   []corev1.VolumeMount
}

type NADConfig

type NADConfig struct {
	IPAM NADIpam `json:"ipam"`
}

NADConfig - IPAM parameters of the NAD

type NADIpam

type NADIpam struct {
	CIDR       netip.Prefix `json:"range"`
	RangeStart netip.Addr   `json:"range_start"`
	RangeEnd   netip.Addr   `json:"range_end"`

	Routes []NADRoute `json:"routes"`
}

func GetPredictableIPAM

func GetPredictableIPAM(networkParameters *NetworkParameters) (*NADIpam, error)

GetPredictableIPAM returns a struct describing the available IP range. If the IP pool size does not fit in given networkParameters CIDR it will return an error instead.

type NADRoute

type NADRoute struct {
	Gateway     netip.Addr   `json:"gw"`
	Destination netip.Prefix `json:"dst"`
}

type NetworkParameters

type NetworkParameters struct {
	ProviderCIDR            netip.Prefix
	ProviderAllocationStart netip.Addr
	ProviderAllocationEnd   netip.Addr
	ProviderGateway         netip.Addr
	TenantCIDR              netip.Prefix
	TenantAllocationStart   netip.Addr
	TenantAllocationEnd     netip.Addr
}

NetworkParameters - Parameters for the Octavia networks, based on the config of the NAD

func GetNetworkParametersFromNAD

func GetNetworkParametersFromNAD(
	nad *networkv1.NetworkAttachmentDefinition,
	instance *octaviav1.Octavia,
) (*NetworkParameters, error)

GetNetworkParametersFromNAD - Extract network information from the Network Attachment Definition

type NetworkProvisioningSummary

type NetworkProvisioningSummary struct {
	TenantNetworkID            string
	SecurityGroupID            string
	ManagementSubnetCIDR       string
	ManagementSubnetGateway    string
	ManagementSubnetExtraCIDRs []string
}

NetworkProvisioningSummary - Type for conveying the results of the EnsureAmphoraManagementNetwork call.

func EnsureAmphoraManagementNetwork

func EnsureAmphoraManagementNetwork(
	ctx context.Context,
	ns string,
	tenantName string,
	netDetails *octaviav1.OctaviaLbMgmtNetworks,
	networkParameters *NetworkParameters,
	log *logr.Logger,
	helper *helper.Helper,
) (NetworkProvisioningSummary, error)

EnsureAmphoraManagementNetwork - retrieve, create and reconcile the Octavia management network for the in cluster link to the management tenant network.

func HandleUnmanagedAmphoraManagementNetwork

func HandleUnmanagedAmphoraManagementNetwork(
	ctx context.Context,
	ns string,
	tenantName string,
	netDetails *octaviav1.OctaviaLbMgmtNetworks,
	log *logr.Logger,
	helper *helper.Helper,
) (NetworkProvisioningSummary, error)

Jump to

Keyboard shortcuts

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