controllers

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitScheme

func InitScheme() (*runtime.Scheme, error)

Types

type Mode

type Mode int64
const (
	SendUpdates Mode = iota
	DoNotSendUpdates
)

type ResourceSummaryReconciler

type ResourceSummaryReconciler struct {
	client.Client
	Config           *rest.Config
	Scheme           *runtime.Scheme
	RunMode          Mode
	ClusterNamespace string
	ClusterName      string
	ClusterType      libsveltosv1alpha1.ClusterType

	// Used to update internal maps and sets
	Mux sync.RWMutex

	// key: ResourceSummary; value: set of resources referenced by ResourceSummary
	// This map is used efficiently stop tracking resources not referenced anynmore
	// by ResourceSummary.
	ResourceSummaryMap map[corev1.ObjectReference]*libsveltosset.Set

	// key: ResourceSummary; value: set of resources referenced by ResourceSummary
	// This map is used efficiently stop tracking resources not referenced anynmore
	// by ResourceSummary.
	HelmResourceSummaryMap map[corev1.ObjectReference]*libsveltosset.Set

	MapperLock sync.Mutex
	// contains filtered or unexported fields
}

ResourceSummaryReconciler reconciles a ResourceSummary object. The goal of this controller is to make sure none of the resources deployed by Sveltos are locally modified in the cluster. Logic to achieve such goal is following: - When a ClusterSummary deploys resources in a cluster, it creates a ResourceSummary instance containing all the resources deployed by the ClusterSummary.; - The resourceSummary controller watches for ResourceSummary instances and creates internal maps containing the list of resources deployed by Sveltos (various resource maps below) and the list of GVKs to watch (GVKClusterSummaries map below); - For any GVK a watcher is started. When an instance of the GVK is modified, if the resource is contained in the Resources/HelmResources map, ResourceSummary status is updated indicating resource modification (that is signal for sveltos to redeploy again to make sure there is no configuration drift)

func (*ResourceSummaryReconciler) Reconcile

func (r *ResourceSummaryReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error)

func (*ResourceSummaryReconciler) SetupWithManager

func (r *ResourceSummaryReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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