Documentation ¶
Index ¶
Constants ¶
const ( InstanceStateInProgress = "IN_PROGRESS" InstanceStateFailed = "FAILED" InstanceStateActive = "ACTIVE" InstanceStateDeleting = "DELETING" InstanceStateError = "ERROR" )
const ( // MetricImpersonationTotal is the total number of impersonation requests // made by the controller MetricImpersonationTotal = "controller_impersonation_total" // MetricImpersonationErrors is the total number of errors encountered // while making impersonation requests MetricImpersonationErrors = "controller_impersonation_errors_total" // MetricImpersonationDuration tracks the duration of impersonation operations MetricImpersonationDuration = "controller_impersonation_duration_seconds" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller manages the reconciliation of a single instance of a ResourceGroup, / it is responsible for reconciling the instance and its sub-resources.
The controller is responsible for the following: - Reconciling the instance - Reconciling the sub-resources of the instance - Updating the status of the instance - Managing finalizers, owner references and labels - Handling errors and retries - Performing cleanup operations (garbage collection)
For each instance of a ResourceGroup, the controller creates a new instance of the InstanceGraphReconciler to manage the reconciliation of the instance and its sub-resources.
It is important to state that when the controller is reconciling an instance, it creates and uses a new instance of the ResourceGroupRuntime to uniquely manage the state of the instance and its sub-resources. This ensure that at each reconciliation loop, the controller is working with a fresh state of the instance and its sub-resources.
func NewController ¶
func NewController( log logr.Logger, reconcileConfig ReconcileConfig, gvr schema.GroupVersionResource, rg *graph.Graph, clientSet *kroclient.Set, defaultServiceAccounts map[string]string, instanceLabeler metadata.Labeler, ) *Controller
NewController creates a new Controller instance.
type InstanceState ¶
type InstanceState struct { // Current state of the instance State string // Map of resource IDs to their current states ResourceStates map[string]*ResourceState // Any error encountered during reconciliation ReconcileErr error }
InstanceState tracks the overall state of resources being managed
type ReconcileConfig ¶
type ReconcileConfig struct { // DefaultRequeueDuration is the default duration to wait before requeueing a // a reconciliation if no specific requeue time is set. DefaultRequeueDuration time.Duration // DeletionGraceTimeDuration is the duration to wait after initializing a resource // deletion before considering it failed // Not implemented. DeletionGraceTimeDuration time.Duration // DeletionPolicy is the deletion policy to use when deleting resources in the graph // TODO(a-hilaly): need to define think the different deletion policies we need to // support. DeletionPolicy string }
ReconcileConfig holds configuration parameters for the recnociliation process. It allows the customization of various aspects of the controller's behavior.
type ResourceState ¶
type ResourceState struct { // State represents the current state of the resource State string // Err captures any error associated with the current state Err error }
ResourceState represents the state and any associated error of a resource being managed by the controller.