Skip to content

how to distinguish the action when entering the reconcile() function? #2511

Closed Answered by camilamacedo86
a85302543 asked this question in Support
Discussion options

You must be logged in to vote

Hi @a85302543,

The k8s api raise events when a resource is created, edited and deleted. By Watching Resources we can re-trigger the reconcile to ensure a desired stated on the cluster.

You can define them in the function SetupWithManager that you can find in the controller.go. In the following example, we will be setting up controller Watches in a simplified way which has the controller Builder:

func (r *KindReconciler) SetupWithManager(mgr ctrl.Manager) error {
    return ctrl.NewControllerManagedBy(mgr).
        For(&cachev1alpha1.MyKind{}). // primary ( API defined in the Operator ) to be watched.
        Owns(&appsv1.Deployment{}). // secunary resources to be watched. 
        Complet…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@a85302543
Comment options

@Adembc
Comment options

@camilamacedo86
Comment options

@Adembc
Comment options

@camilamacedo86
Comment options

Answer selected by a85302543
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
3 participants