convert

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// FieldManager identifies cloud-operator as the owner of fields in Server-Side Apply.
	// It is also used by the watcher to check managedFields ownership on K8s objects.
	FieldManager = "illumio-cloud-operator"
)
View Source
const GatewayAPIGroup = "gateway.networking.k8s.io"

GatewayAPIGroup is the API group of the Gateway API objects. Conversion matches on the group as well as the kind: config.openshift.io serves an Ingress kind and networking.istio.io a Gateway kind, with other schemas.

Variables

This section is empty.

Functions

func BuildConfiguredFromMetadata

func BuildConfiguredFromMetadata(metadata *pb.KubernetesObjectData) (*pb.ConfiguredKubernetesObjectData, error)

BuildConfiguredFromMetadata builds a ConfiguredKubernetesObjectData from the already-converted KubernetesObjectData for the runtime cache. Labels and annotations are copied as-is so the reconciler can detect drift via proto.Equal.

func CacheKey added in v1.5.0

func CacheKey(kind, namespace, name string) string

CacheKey builds a cache key from kind, namespace, and name. Both config and runtime caches use this key format so lookups match without needing labels or reverse indexes.

func CacheKeyForObject added in v1.5.0

func CacheKeyForObject(data *pb.ConfiguredKubernetesObjectData) (string, error)

CacheKeyForObject computes a cache key from a configured object's kind, namespace, and name.

func ConvertIPBlockToProto added in v1.6.0

func ConvertIPBlockToProto(ipBlock *networkingv1.IPBlock) *pb.IPBlock

ConvertIPBlockToProto converts a Kubernetes IPBlock to a proto IPBlock object. It is exported for use by CRD-specific converter subpackages (e.g. aws, cilium, ovn).

func ConvertLabelSelectorToProto added in v1.6.0

func ConvertLabelSelectorToProto(selector *metav1.LabelSelector) *pb.LabelSelector

ConvertLabelSelectorToProto converts a Kubernetes LabelSelector to a proto LabelSelector. It is exported for use by CRD-specific converter subpackages (e.g. aws, cilium, ovn).

func ConvertMetaObjectToMetadata

func ConvertMetaObjectToMetadata(ctx context.Context, obj metav1.ObjectMeta, rawObj *unstructured.Unstructured, clientset kubernetes.Interface, kind, apiGroup, apiVersion string) *pb.KubernetesObjectData

ConvertMetaObjectToMetadata takes a metav1.ObjectMeta and converts it into a proto message object KubernetesObjectData. rawObj is the already-listed unstructured object, used to read kind-specific data (e.g. Pod IPs) without extra API calls.

func ConvertOwnerReferences added in v1.6.0

func ConvertOwnerReferences(ownerReferences []metav1.OwnerReference) []*pb.KubernetesOwnerReference

ConvertOwnerReferences converts a slice of Kubernetes OwnerReference objects into a slice of protobuf KubernetesOwnerReference objects. It is exported for use by CRD-specific converter subpackages (e.g. aws, cilium, ovn).

func ConvertToApplyObject

func ConvertToApplyObject(data *pb.ConfiguredKubernetesObjectData, apiGroup, apiVersion string) (*unstructured.Unstructured, string, error)

ConvertToApplyObject converts ConfiguredKubernetesObjectData to an *unstructured.Unstructured suitable for Server-Side Apply. Proto specs are marshaled via protojson to preserve strict typing and produce camelCase field names that match Cilium's CRD schema.

func ExtractGroupResource added in v1.6.0

func ExtractGroupResource(data *pb.ConfiguredKubernetesObjectData) (schema.GroupResource, error)

ExtractGroupResource returns the API group and plural resource name for the given configured object's kind.

func ExtractKind added in v1.5.0

func ExtractKind(data *pb.ConfiguredKubernetesObjectData) (string, error)

ExtractKind returns the Kubernetes kind string for a configured object.

func ExtractResourceName

func ExtractResourceName(data *pb.ConfiguredKubernetesObjectData) (string, error)

ExtractResourceName returns the plural resource name for the given configured object's kind.

func GetMetadataFromResource

func GetMetadataFromResource(logger *zap.Logger, resource unstructured.Unstructured) (*metav1.ObjectMeta, error)

GetMetadataFromResource extracts the metav1.ObjectMeta from an unstructured.Unstructured resource. It utilizes the unstructured's inherent methods to access the metadata directly.

func GetObjectMetadataFromRuntimeObject

func GetObjectMetadataFromRuntimeObject(obj runtime.Object) (*metav1.ObjectMeta, error)

GetObjectMetadataFromRuntimeObject safely extracts metadata from any Kubernetes runtime.Object. It returns a pointer to a metav1.ObjectMeta structure if successful, along with any error encountered.

func NewCoreResourceConverter

func NewCoreResourceConverter(clientset kubernetes.Interface, logger *zap.Logger) func(ctx context.Context, obj *unstructured.Unstructured) (*pb.KubernetesObjectData, error)

NewCoreResourceConverter returns a ResourceConverter for standard Kubernetes resources. It closes over clientset and logger because core resource conversion needs them: clientset to fetch NetworkPolicy specs, logger to report objects whose kind-specific data cannot be read.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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