Dependent Watches

    In most cases, an operator creates a bunch of Kubernetes resources in the cluster, that helps deploy and manage the application. For instance, the etcd-operator creates two services and a number of pods for a single EtcdCluster CR. In this case, all the Kubernetes resources created by the operator for a CR is defined as dependent resources.

    Often, an operator needs to watch dependent resources. To achieve this, a developer would set the field, watchDependentResources to True in the file. If enabled, a change in a dependent resource will trigger the reconciliation loop causing Ansible code to run.

    Note: By default it is enabled when using ansible-operator

    The ansible-operator base image achieves this by leveraging the concept of . Whenever a Kubernetes resource is created by Ansible code, the ansible-operator‘s proxy module injects into the resource being created. The owner-references means the resource is owned by the CR for which reconciliation is taking place.

    This is an example of a watches file with the field set to True