converter

package
v1.11.0-cni-plu...-8a901cc Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractPodFromUpdate

func ExtractPodFromUpdate(obj interface{}) (*v1.Pod, error)

ExtractPodFromUpdate takes an update as received from the informer and returns the pod object, if present. some updates (particularly deletes) can include tombstone placeholders rather than an exact pod object. This function should be called in order to safely handles those cases.

func MergeWorkloadEndpointData

func MergeWorkloadEndpointData(wep *api.WorkloadEndpoint, upd WorkloadEndpointData)

MergeWorkloadEndpointData applies the given WorkloadEndpointData to the provided WorkloadEndpoint, updating relevant fields with new values.

Types

type Converter

type Converter interface {
	// Converts kubernetes object to calico representation of it.
	Convert(k8sObj interface{}) (interface{}, error)

	// Returns appropriate key for the object
	GetKey(obj interface{}) string

	// DeleteArgsFromKey returns name and namespace of the object to pass to Delete
	// for the given key as generated by GetKey.
	DeleteArgsFromKey(key string) (string, string)
}

Converter Responsible for conversion of given kubernetes object to equivalent calico object

func NewNamespaceConverter

func NewNamespaceConverter() Converter

NewNamespaceConverter Constructor for namespaceConverter

func NewPolicyConverter

func NewPolicyConverter() Converter

NewPolicyConverter Constructor for policyConverter

func NewServiceAccountConverter

func NewServiceAccountConverter() Converter

NewServiceaccountConverter Constructor to convert ServiceAccount to Profile

type PodConverter

type PodConverter interface {
	Convert(k8sObj interface{}) ([]WorkloadEndpointData, error)
	GetKey(obj WorkloadEndpointData) string
	DeleteArgsFromKey(key string) (string, string)
}

func NewPodConverter

func NewPodConverter() PodConverter

NewPodConverter Constructor for podConverter

type WorkloadEndpointData

type WorkloadEndpointData struct {
	PodName        string
	Namespace      string
	Labels         map[string]string
	ServiceAccount string
}

WorkloadEndpointData is an internal struct used to store the various bits of information that the policy controller cares about on a workload endpoint.

func BuildWorkloadEndpointData

func BuildWorkloadEndpointData(weps ...api.WorkloadEndpoint) []WorkloadEndpointData

BuildWorkloadEndpointData generates the correct WorkloadEndpointData for the given list of WorkloadEndpoints, extracting fields that the policy controller is responsible for syncing.

Jump to

Keyboard shortcuts

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