# IsController: true

```
if err := c.Watch(&source.Kind{Type: &clusterapiv1alpha1.Cluster{}}, &handler.EnqueueRequestForOwner{
	IsController: true,
	OwnerType:    &gcmv1alpha1.ManagedCluster{},
}); err != nil {
	return err
}
```

From above, you could see there is `IsController: true` set. The [documentation](https://godoc.org/sigs.k8s.io/controller-runtime/pkg/handler#EnqueueRequestForOwner) says: **IsController if set will only look at the first OwnerReference with Controller: true.**&#x20;

Now, Let's take a look at what we have under cluster object:

```
apiVersion: cluster.k8s.io/v1alpha1
kind: Cluster
metadata:
  creationTimestamp: "2019-09-16T23:53:20Z"
  finalizers:
  - foregroundDeletion
  - cluster.cluster.k8s.io
  generation: 2
  name: test-guest-cluster-2
  namespace: default
  ownerReferences:
  - apiVersion: gcm.vmware.com/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: ManagedCluster
    name: test-guest-cluster-2
    uid: a143951c-2ebf-4846-b9d3-adb598da2995
  ...

```

If we have `IsController: true` set in our `&handler.EnqueueRequestForOwner` . That means we are going to enqueue the name and namespace of ManagedCluster `test-guest-cluster-2` that is becuase it is the first ownerRefernce which has `controller: true` . \[To be verified: If no ownerReferences have controller:true, or only the last one has it. What will happen ?]&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://daniel-guo.gitbook.io/notebook/k8s-controller-related/iscontroller-true.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
