kube

package
v0.0.0-...-2393416 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotator

type Annotator interface {
	Set(key string, value interface{}) error
	Delete(key string)
	Run() error
}

Annotator represents the exported methods for handling node annotations Implementations should enforce thread safety on the declared methods

func NewNamespaceAnnotator

func NewNamespaceAnnotator(kube Interface, namespaceName string) Annotator

NewNamespaceAnnotator returns a new annotator for Namespace objects

func NewNodeAnnotator

func NewNodeAnnotator(kube Interface, nodeName string) Annotator

NewNodeAnnotator returns a new annotator for Node objects

func NewPodAnnotator

func NewPodAnnotator(kube Interface, podName string, namespace string) Annotator

NewPodAnnotator returns a new annotator for Pod objects

type Interface

type Interface interface {
	SetAnnotationsOnPod(namespace, podName string, annotations map[string]interface{}) error
	SetAnnotationsOnService(namespace, serviceName string, annotations map[string]interface{}) error
	SetAnnotationsOnNode(nodeName string, annotations map[string]interface{}) error
	SetAnnotationsOnNamespace(namespaceName string, annotations map[string]interface{}) error
	SetTaintOnNode(nodeName string, taint *kapi.Taint) error
	RemoveTaintFromNode(nodeName string, taint *kapi.Taint) error
	SetLabelsOnNode(nodeName string, labels map[string]interface{}) error
	PatchNode(old, new *kapi.Node) error
	UpdateNodeStatus(node *kapi.Node) error
	UpdatePodStatus(pod *kapi.Pod) error
	GetAnnotationsOnPod(namespace, name string) (map[string]string, error)
	GetNodes() ([]*kapi.Node, error)
	GetNamespaces(labelSelector metav1.LabelSelector) ([]*kapi.Namespace, error)
	GetPods(namespace string, opts metav1.ListOptions) ([]*kapi.Pod, error)
	GetPod(namespace, name string) (*kapi.Pod, error)
	GetNode(name string) (*kapi.Node, error)
	Events() kv1core.EventInterface
}

Interface represents the exported methods for dealing with getting/setting kubernetes resources

type InterfaceOVN

type InterfaceOVN interface {
	Interface
	UpdateEgressFirewall(egressfirewall *egressfirewall.EgressFirewall) error
	UpdateEgressIP(eIP *egressipv1.EgressIP) error
	PatchEgressIP(name string, patchData []byte) error
	GetEgressIP(name string) (*egressipv1.EgressIP, error)
	GetEgressIPs() ([]*egressipv1.EgressIP, error)
	GetEgressFirewalls() ([]*egressfirewall.EgressFirewall, error)
	CreateCloudPrivateIPConfig(cloudPrivateIPConfig *ocpcloudnetworkapi.CloudPrivateIPConfig) (*ocpcloudnetworkapi.CloudPrivateIPConfig, error)
	UpdateCloudPrivateIPConfig(cloudPrivateIPConfig *ocpcloudnetworkapi.CloudPrivateIPConfig) (*ocpcloudnetworkapi.CloudPrivateIPConfig, error)
	DeleteCloudPrivateIPConfig(name string) error
	UpdateEgressServiceStatus(namespace, name, host string) error
	UpdateIPAMClaimIPs(updatedIPAMClaim *ipamclaimsapi.IPAMClaim) error
}

InterfaceOVN represents the exported methods for dealing with getting/setting kubernetes and OVN resources

type Kube

type Kube struct {
	KClient kubernetes.Interface
}

Kube works with kube client only Implements Interface

func (*Kube) Events

func (k *Kube) Events() kv1core.EventInterface

Events returns events to use when creating an EventSinkImpl

func (*Kube) GetAnnotationsOnPod

func (k *Kube) GetAnnotationsOnPod(namespace, name string) (map[string]string, error)

GetAnnotationsOnPod obtains the pod annotations from kubernetes apiserver, given the name and namespace

func (*Kube) GetNamespaces

func (k *Kube) GetNamespaces(labelSelector metav1.LabelSelector) ([]*kapi.Namespace, error)

GetNamespaces returns the list of all Namespace objects matching the labelSelector

func (*Kube) GetNode

func (k *Kube) GetNode(name string) (*kapi.Node, error)

GetNode returns the Node resource from kubernetes apiserver, given its name

func (*Kube) GetNodes

func (k *Kube) GetNodes() ([]*kapi.Node, error)

GetNodes returns the list of all Node objects from kubernetes

func (*Kube) GetPod

func (k *Kube) GetPod(namespace, name string) (*kapi.Pod, error)

GetPod obtains the pod from kubernetes apiserver, given the name and namespace

func (*Kube) GetPods

func (k *Kube) GetPods(namespace string, opts metav1.ListOptions) ([]*kapi.Pod, error)

GetPods returns the list of all Pod objects in a namespace matching the options

func (*Kube) PatchNode

func (k *Kube) PatchNode(old, new *kapi.Node) error

PatchNode patches the old node object with the changes provided in the new node object.

func (*Kube) RemoveTaintFromNode

func (k *Kube) RemoveTaintFromNode(nodeName string, taint *kapi.Taint) error

RemoveTaintFromNode removes all the taints that have the same key and effect from the node. If the taint doesn't exist, it doesn't do anything.

func (*Kube) SetAnnotationsOnNamespace

func (k *Kube) SetAnnotationsOnNamespace(namespaceName string, annotations map[string]interface{}) error

SetAnnotationsOnNamespace takes the namespace name and map of key/value string pairs to set as annotations

func (*Kube) SetAnnotationsOnNode

func (k *Kube) SetAnnotationsOnNode(nodeName string, annotations map[string]interface{}) error

SetAnnotationsOnNode takes the node name and map of key/value string pairs to set as annotations

func (*Kube) SetAnnotationsOnPod

func (k *Kube) SetAnnotationsOnPod(namespace, podName string, annotations map[string]interface{}) error

SetAnnotationsOnPod takes the pod object and map of key/value string pairs to set as annotations

func (*Kube) SetAnnotationsOnService

func (k *Kube) SetAnnotationsOnService(namespace, name string, annotations map[string]interface{}) error

SetAnnotationsOnService takes a service namespace and name and a map of key/value string pairs to set as annotations

func (*Kube) SetLabelsOnNode

func (k *Kube) SetLabelsOnNode(nodeName string, labels map[string]interface{}) error

SetLabelsOnNode takes the node name and map of key/value string pairs to set as labels

func (*Kube) SetTaintOnNode

func (k *Kube) SetTaintOnNode(nodeName string, taint *kapi.Taint) error

SetTaintOnNode tries to add a new taint to the node. If the taint already exists, it doesn't do anything.

func (*Kube) UpdateNodeStatus

func (k *Kube) UpdateNodeStatus(node *kapi.Node) error

UpdateNodeStatus takes the node object and sets the provided update status

func (*Kube) UpdatePodStatus

func (k *Kube) UpdatePodStatus(pod *kapi.Pod) error

UpdatePodStatus update pod with provided pod data, limited to .Status and .ObjectMeta fields

type KubeOVN

type KubeOVN struct {
	Kube
	ANPClient            anpclientset.Interface
	EIPClient            egressipclientset.Interface
	EgressFirewallClient egressfirewallclientset.Interface
	CloudNetworkClient   ocpcloudnetworkclientset.Interface
	EgressServiceClient  egressserviceclientset.Interface
	APBRouteClient       adminpolicybasedrouteclientset.Interface
	EgressQoSClient      egressqosclientset.Interface
	IPAMClaimsClient     ipamclaimssclientset.Interface
}

KubeOVN works with all kube and ovn resources Implements InterfaceOVN

func (*KubeOVN) CreateCloudPrivateIPConfig

func (k *KubeOVN) CreateCloudPrivateIPConfig(cloudPrivateIPConfig *ocpcloudnetworkapi.CloudPrivateIPConfig) (*ocpcloudnetworkapi.CloudPrivateIPConfig, error)

func (*KubeOVN) DeleteCloudPrivateIPConfig

func (k *KubeOVN) DeleteCloudPrivateIPConfig(name string) error

func (*KubeOVN) GetEgressFirewalls

func (k *KubeOVN) GetEgressFirewalls() ([]*egressfirewall.EgressFirewall, error)

GetEgressFirewalls returns the list of all EgressFirewall objects from kubernetes

func (*KubeOVN) GetEgressIP

func (k *KubeOVN) GetEgressIP(name string) (*egressipv1.EgressIP, error)

GetEgressIP returns the EgressIP object from kubernetes

func (*KubeOVN) GetEgressIPs

func (k *KubeOVN) GetEgressIPs() ([]*egressipv1.EgressIP, error)

GetEgressIPs returns the list of all EgressIP objects from kubernetes

func (*KubeOVN) PatchEgressIP

func (k *KubeOVN) PatchEgressIP(name string, patchData []byte) error

func (*KubeOVN) UpdateCloudPrivateIPConfig

func (k *KubeOVN) UpdateCloudPrivateIPConfig(cloudPrivateIPConfig *ocpcloudnetworkapi.CloudPrivateIPConfig) (*ocpcloudnetworkapi.CloudPrivateIPConfig, error)

func (*KubeOVN) UpdateEgressFirewall

func (k *KubeOVN) UpdateEgressFirewall(egressfirewall *egressfirewall.EgressFirewall) error

UpdateEgressFirewall updates the EgressFirewall with the provided EgressFirewall data

func (*KubeOVN) UpdateEgressIP

func (k *KubeOVN) UpdateEgressIP(eIP *egressipv1.EgressIP) error

UpdateEgressIP updates the EgressIP with the provided EgressIP data

func (*KubeOVN) UpdateEgressServiceStatus

func (k *KubeOVN) UpdateEgressServiceStatus(namespace, name, host string) error

func (*KubeOVN) UpdateIPAMClaimIPs

func (k *KubeOVN) UpdateIPAMClaimIPs(updatedIPAMClaim *ipamclaimsapi.IPAMClaim) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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