common

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildResourceReference

func BuildResourceReference(gvk schema.GroupVersionKind, obj metav1.Object) v1alpha1.ResourceReference

BuildResourceReference builds a ResourceReference for the given object.

func GetAnnotatedOwners

func GetAnnotatedOwners(obj metav1.Object) []string

GetAnnotatedOwners returns the list of owner references stored in the annotation `resources.gardener.cloud/owners`.

func GetMergedAnnotation

func GetMergedAnnotation(gvk schema.GroupVersionKind, state state.AnnotationState, obj metav1.Object) map[string]string

GetMergedAnnotation gets the merged annotations for the given object.

Types

type DNSSpecInput

type DNSSpecInput struct {
	Names                     *utils.UniqueStrings
	TTL                       *int64
	Interval                  *int64
	Targets                   *utils.UniqueStrings
	Text                      *utils.UniqueStrings
	RoutingPolicy             *v1alpha1.RoutingPolicy
	IPStack                   string
	ResolveTargetsToAddresses *bool
	Ignore                    string
}

DNSSpecInput specifies names, targets, and policies for DNS records.

func GetDNSSpecInputForService

func GetDNSSpecInputForService(log logr.Logger, state state.AnnotationState, gvk schema.GroupVersionKind, svc *corev1.Service) (*DNSSpecInput, error)

GetDNSSpecInputForService gets the DNS spec input for a service of type loadbalancer.

type EntryOwnerData

type EntryOwnerData struct {
	Config config.SourceControllerConfig
	GVK    schema.GroupVersionKind
}

EntryOwnerData contains the information about the owner type of DNSEntry.

func (EntryOwnerData) GetOwnerObjectKeys

func (d EntryOwnerData) GetOwnerObjectKeys(obj metav1.Object) []client.ObjectKey

GetOwnerObjectKeys returns the list of owner object keys for the given

func (EntryOwnerData) IsRelevantEntry

func (d EntryOwnerData) IsRelevantEntry(entry *dnsv1alpha1.DNSEntry) bool

IsRelevantEntry checks whether the given DNSEntry has an owner of the given GroupVersionKind. If sameNamespaceAndCluster is true, only the owner references are checked. Otherwise, the annotation `resources.gardener.cloud/owners` is checked.

type OwnerData

type OwnerData struct {
	Object    metav1.Object
	ClusterID string
	GVK       schema.GroupVersionKind
}

OwnerData contains the information about an owner object.

func (OwnerData) AddOwner

func (o OwnerData) AddOwner(obj metav1.Object, clusterID string) bool

AddOwner adds an owner reference to the given object. If the owner is from the same cluster and namespace, a proper owner reference is added. Otherwise, the owner reference is stored in an annotation.

func (OwnerData) AsAnnotationRef

func (o OwnerData) AsAnnotationRef(targetClusterID string) string

AsAnnotationRef returns the owner reference in the format used in the annotation `resources.gardener.cloud/owners`.

func (OwnerData) HasOwner

func (o OwnerData) HasOwner(obj metav1.Object, clusterID string) bool

HasOwner checks whether the given owner is already present in the object's owner references or in the annotation `resources.gardener.cloud/owners`. It returns true if the owner reference or annotation is already present, false otherwise.

func (OwnerData) RemoveOwner

func (o OwnerData) RemoveOwner(obj metav1.Object, clusterID string) bool

RemoveOwner removes the given owner from the object's owner references or from the annotation `resources.gardener.cloud/owners`. It returns true if an owner reference or annotation was removed, false otherwise.

func (OwnerData) String

func (o OwnerData) String() string

type ReconcilerBase

type ReconcilerBase struct {
	Client             client.Client
	ControlPlaneClient client.Client
	Recorder           record.EventRecorder
	Class              string
	GVK                schema.GroupVersionKind
	Config             config.SourceControllerConfig
	State              state.AnnotationState
}

ReconcilerBase is base for source reconcilers.

func (*ReconcilerBase) DoDelete

func (r *ReconcilerBase) DoDelete(ctx context.Context, log logr.Logger, obj client.Object) (reconcile.Result, error)

DoDelete performs delete reconciliation for given object.

func (*ReconcilerBase) DoReconcile

func (r *ReconcilerBase) DoReconcile(ctx context.Context, log logr.Logger, obj client.Object, dnsSpecInput *DNSSpecInput) (reconcile.Result, error)

DoReconcile reconciles for given object and dnsSpecInput.

func (*ReconcilerBase) IsOwnedByController

func (r *ReconcilerBase) IsOwnedByController(entry *dnsv1alpha1.DNSEntry, owner metav1.Object) bool

IsOwnedByController checks whether the given DNSEntry is owned by the given owner.

Jump to

Keyboard shortcuts

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