404 Not Found
  • Introduction
  • Monitoring related
    • K8s cluster monitoring
    • Monitor Jenkins with G.A.P on K8s cluster
    • Monitoring tools | projects
      • Grafana
      • AlertManager
      • Prometheus
      • Wavefront
  • Logging related
    • BOSH logs
    • How to gather systemd log
    • K8s cluster logging
    • Logging tools | projects
      • vRealize Log Insight
      • Fluentd
      • syslog vs fluentd
  • Having fun with docker
    • Using docker-compose for redmine
    • Customize Fluentd docker image
  • K8S or Apache Mesos
  • K8S Related
    • Main Architecture
      • Master components
        • API Server
        • etcd
        • Controller Manager
        • Kube Scheduler
      • Worker components
        • kubelet
        • kube-proxy
    • K8S Storage
      • Volume Provisioning
      • Understand CSI
      • How to write CSI
      • VMware CNS
      • K8S storage e2e experiment under VMware vSphere
      • Experiment on Persistent Volume Access Mode
      • Design: Storage in Cluster-API architecture
    • K8S Networking
      • Ingress
      • Endpoints
    • K8S Policies
      • Resource Quotas
    • K8S Management Platform
    • K8S Tests Tool
    • K8S Extension
      • CRDs
        • Custom Resources
        • Custom Controllers
        • How to user code-generator
        • K8S Operators
        • Operators Development Tools
          • Kubebuilder
          • Metacontroller
          • Operator SDK
      • Custom API Server
    • K8S Resource CRUD Workflow
    • K8S Garbage Collection
  • K8S CONTROLLER RELATED
    • IsController: true
    • Controller clients
  • PKS RELATED
    • How to Access VMs and Databases related to PKS
    • PKS Basics
    • BOSH Director
    • Backup and Restore on Ent. PKS with Velero
  • CICD RELATED
    • Configure Jenkins to run on K8S
    • Customize Jenkins JNLP slave image
    • Jenkins global shared libs
  • Google Anthos
    • Google Anthos Day from KubeCon 2019 San Diego
    • Migrate for Anthos
    • Config Connector
  • SYSTEM DESIGN RELATED
    • Design Data Intensive Application - Notes
      • RSM
        • Reliability
        • Scalability
      • Data models and Query Languages
      • Storage and Retrieval
    • How Alibaba Ensure K8S Performance At Large Scale
  • Miscellaneous
    • Knative
    • Serverless
    • Service Mesh
    • gRPC
    • Local persistent volumes
    • ownerReferences in K8S
    • File(NAS) vs Block(SAN) vs Object storage
    • KubeVirt
    • Why K8S HA chooses 3 instead of 5..6..7 as the size of masters?
    • goroutine & go channel
    • How to make docker images smaller
Powered by GitBook
On this page

Was this helpful?

  1. K8S CONTROLLER RELATED

IsController: true

PreviousK8S Garbage CollectionNextController clients

Last updated 5 years ago

Was this helpful?

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 says: IsController if set will only look at the first OwnerReference with Controller: true.

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 ?]

documentation