openshift

package
v0.0.0-...-ab17c91 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const IPToNamespaceAnnotation = "egressip-ipam-operator.redhat-cop.io/"

IPToNamespaceAnnotation -- Will be used to construct the IP-to-namespace annotation on hostSubnet in form of "egressip-ipam-operator.redhat-cop.io/<ip>=<namespace>"

Variables

This section is empty.

Functions

This section is empty.

Types

type EgressIPHandler

type EgressIPHandler interface {
	// adds IPs (specified or random) to the infrastructure (AWS and hostSubnet)
	AddIPsToInfrastructure(namespace *corev1.Namespace) ([]*net.IP, error)

	// ensures that the IPs are on the given host
	CheckIPsForHost(hostSubnet *ocpnetv1.HostSubnet, ips []*net.IP) error
	// redistributes IPs from a failing host
	RedistributeIPsFromHost(node *ocpnetv1.HostSubnet) (map[string]string, error)
	// returns a map with key=IP and value=new hostname
	ReadIpsFromHostSubnet(node *ocpnetv1.HostSubnet) []*net.IP

	// Adds the IPs to the NetNamespace
	AddIPsToNetNamespace(netNamespace *ocpnetv1.NetNamespace, ips []*net.IP) error
	// Removes the IPs from the NetNamespace
	RemoveIPsFromNetNamespace(netNamespace *ocpnetv1.NetNamespace)
	// removes IPs (specified on the NetNamespace) from the infrastructure (AWS and hostSubnet)
	RemoveIPsFromInfrastructure(netNamespace *ocpnetv1.NetNamespace) error

	LoadNamespace(name string) (*corev1.Namespace, error)
	SaveNamespace(instance *corev1.Namespace) error

	LoadNetNameSpace(name string) (*ocpnetv1.NetNamespace, error)
	SaveNetNameSpace(instance *ocpnetv1.NetNamespace) error

	LoadHostSubnet(name string) (*ocpnetv1.HostSubnet, error)
	SaveHostSubnet(instance *ocpnetv1.HostSubnet) error
}

The EgressIPHandler hides the infrastructure from the workflows defined in the reconcilers.

func NewEgressIPHandler

func NewEgressIPHandler(c cloudprovider.CloudProvider, o OcpClient) *EgressIPHandler

NewEgressIPHandler - creates a new handler with cloudprovider and OCP client

type OcpClient

type OcpClient interface {
	Get(ctx context.Context, key client.ObjectKey, obj runtime.Object) error
	Update(ctx context.Context, obj runtime.Object, opts ...client.UpdateOption) error
}

OcpClient -- Abstraction needed to mock out the infrastructure calls.

func NewOcpClient

func NewOcpClient(ocp client.Client) *OcpClient

NewOcpClient -- returns a client with the given OCP client.Client (may be mocked)

type OcpClientImpl

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

OcpClientImpl -- the implementation to access an OCP cluster.

func (OcpClientImpl) Get

Get -- retrieve an OCP object.

func (OcpClientImpl) Update

func (o OcpClientImpl) Update(ctx context.Context, obj runtime.Object, opts ...client.UpdateOption) error

Update -- update an OCP opbject.

type ProdEgressIPHandler

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

ProdEgressIPHandler The AWS/OCP implementation of the EgressIPHandler

func (*ProdEgressIPHandler) AddIPsToInfrastructure

func (h *ProdEgressIPHandler) AddIPsToInfrastructure(namespace *corev1.Namespace) ([]*net.IP, error)

AddIPsToInfrastructure - adds the annotated IPs of the namespace to the operating system and AWS.

func (*ProdEgressIPHandler) AddIPsToNetNamespace

func (h *ProdEgressIPHandler) AddIPsToNetNamespace(netNamespace *ocpnetv1.NetNamespace, ips []*net.IP) error

AddIPsToNetNamespace - Addres the list of IPs to the OCP netnamespace

func (*ProdEgressIPHandler) CheckIPsForHost

func (h *ProdEgressIPHandler) CheckIPsForHost(hostSubnet *ocpnetv1.HostSubnet, ips []*net.IP) error

CheckIPsForHost - tests if all IPs are attached to this host

func (*ProdEgressIPHandler) LoadHostSubnet

func (h *ProdEgressIPHandler) LoadHostSubnet(name string) (*ocpnetv1.HostSubnet, error)

LoadHostSubnet - really?

func (*ProdEgressIPHandler) LoadNamespace

func (h *ProdEgressIPHandler) LoadNamespace(name string) (*corev1.Namespace, error)

LoadNamespace - really?

func (*ProdEgressIPHandler) LoadNetNameSpace

func (h *ProdEgressIPHandler) LoadNetNameSpace(name string) (*ocpnetv1.NetNamespace, error)

LoadNetNameSpace - really?

func (*ProdEgressIPHandler) ReadIpsFromHostSubnet

func (h *ProdEgressIPHandler) ReadIpsFromHostSubnet(hostSubnet *ocpnetv1.HostSubnet) []*net.IP

ReadIpsFromHostSubnet - Reads the IP from the status field of the OCP node object and returns them as array.

func (*ProdEgressIPHandler) RedistributeIPsFromHost

func (h *ProdEgressIPHandler) RedistributeIPsFromHost(hostSubnet *ocpnetv1.HostSubnet) (map[string]string, error)

RedistributeIPsFromHost - redistributes the secondary IPs from the given host and returns a map with key=ip-address and the instance id as value.

func (*ProdEgressIPHandler) RemoveIPsFromInfrastructure

func (h *ProdEgressIPHandler) RemoveIPsFromInfrastructure(netNamespace *ocpnetv1.NetNamespace) error

RemoveIPsFromInfrastructure - Removes the IP from AWS and the HostSubnets it had been distributed to. Will return a multierror.

func (*ProdEgressIPHandler) RemoveIPsFromNetNamespace

func (h *ProdEgressIPHandler) RemoveIPsFromNetNamespace(netNamespace *ocpnetv1.NetNamespace)

RemoveIPsFromNetNamespace - Removes all IPs from the given netnamespace

func (*ProdEgressIPHandler) SaveHostSubnet

func (h *ProdEgressIPHandler) SaveHostSubnet(instance *ocpnetv1.HostSubnet) error

SaveHostSubnet - really?

func (*ProdEgressIPHandler) SaveNamespace

func (h *ProdEgressIPHandler) SaveNamespace(instance *corev1.Namespace) error

SaveNamespace - really?

func (*ProdEgressIPHandler) SaveNetNameSpace

func (h *ProdEgressIPHandler) SaveNetNameSpace(instance *ocpnetv1.NetNamespace) error

SaveNetNameSpace - really?

Jump to

Keyboard shortcuts

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