Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

Triggering GrandPa Controller Reconcile on Indirect GrandSon Resource Changes in Kubernetes

Автор: vlogommentary

Загружено: 2025-12-15

Просмотров: 0

Описание:

Learn how to set up Kubernetes controller-runtime to trigger a parent controller reconcile when an indirectly owned child resource changes, using custom Watches and owner reference mapping.
---
This video is based on the question https://stackoverflow.com/q/79475508/ asked by the user 'guettli' ( https://stackoverflow.com/u/633961/ ) and on the answer https://stackoverflow.com/a/79497058/ provided by the user 'Halo' ( https://stackoverflow.com/u/16752210/ ) at 'Stack Overflow' website. Thanks to these great users and Stackexchange community for their contributions.

Visit these links for original content and any more details, such as alternate solutions, latest updates/developments on topic, comments, revision history etc. For example, the original title of the Question was: controller runtime: GrandPa, Son, GrandSon and setting OwnerReferences

Also, Content (except music) licensed under CC BY-SA https://meta.stackexchange.com/help/l...
The original Question post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license, and the original Answer post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license.

If anything seems off to you, please feel free to drop me a comment under this video.
---
Introduction

In Kubernetes controller development using controller-runtime, it is common to set up ownership relations so that changes in child resources trigger the reconcile loop of their owners. But what happens when ownership is indirect, spanning multiple generations of Custom Resources?

Consider three Custom Resource Definitions (CRDs): GrandPa, Son, and GrandSon. Each has its own controller in separate deployments:

The GrandPa controller creates a Son resource and sets itself as owner.

The Son controller creates a GrandSon resource and sets itself as owner.

The challenge: How to trigger GrandPa's Reconcile() function when a GrandSon changes, given GrandPa is not a direct owner?

Problem Breakdown

GrandPa directly owns Son

Son directly owns GrandSon

GrandPa's controller watches Son but not GrandSon

controller-runtime .Owns() only watches directly owned resources

Hence, changes to GrandSon do not trigger GrandPa reconciles automatically.

Solution Overview

You can solve this by using the Watches() feature in controller-runtime with a custom mapping function:

Watch GrandSon resources explicitly.

When a GrandSon event occurs, manually:

Read the GrandSon's owner reference to find the Son resource.

Fetch the Son object to read its owner reference to find the GrandPa resource.

Enqueue a reconcile request for the corresponding GrandPa.

This way, the GrandPa controller reacts to changes in the indirectly owned GrandSon.

Implementing the Watch with Owner Reference Mapping

Here’s an example snippet using controller-runtime:

[[See Video to Reveal this Text or Code Snippet]]

Key Points

Direct .Owns() works only for immediate owner-child relationships.

Use Watches() with custom mapping functions for multi-level ownership.

Owner references are your source of truth to chain from GrandSon back to GrandPa.

This pattern lets GrandPa controller respond to deep resource changes without modifying other controllers.

Conclusion

By leveraging Watches() and owner reference traversal, you can elegantly trigger reconciles in the GrandPa controller on changes to indirectly owned GrandSon resources. This pattern is essential in complex operator architectures with hierarchies of custom resources.

Feel free to adapt this method in any multi-tier controller ownership scenario in Kubernetes.

Triggering GrandPa Controller Reconcile on Indirect GrandSon Resource Changes in Kubernetes

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

Почему Собаки Вдруг ЗАЛЕЗАЮТ На Вас? (Причина шокирует)

Почему Собаки Вдруг ЗАЛЕЗАЮТ На Вас? (Причина шокирует)

Что такое Rest API (http)? Soap? GraphQL? Websockets? RPC (gRPC, tRPC). Клиент - сервер. Вся теория

Что такое Rest API (http)? Soap? GraphQL? Websockets? RPC (gRPC, tRPC). Клиент - сервер. Вся теория

Код работает в 100 раз медленнее из-за ложного разделения ресурсов.

Код работает в 100 раз медленнее из-за ложного разделения ресурсов.

Превратите ЛЮБОЙ файл в знания LLM за СЕКУНДЫ

Превратите ЛЮБОЙ файл в знания LLM за СЕКУНДЫ

Анатомия масштабируемого проекта Python (FastAPI)

Анатомия масштабируемого проекта Python (FastAPI)

ДАМПЫ В JAVA на практике, разбираем проблемы

ДАМПЫ В JAVA на практике, разбираем проблемы

LLM fine-tuning или ОБУЧЕНИЕ малой модели? Мы проверили!

LLM fine-tuning или ОБУЧЕНИЕ малой модели? Мы проверили!

Экспресс-курс RAG для начинающих

Экспресс-курс RAG для начинающих

Typst: Современная замена Word и LaTeX, которую ждали 40 лет

Typst: Современная замена Word и LaTeX, которую ждали 40 лет

Microsoft begs for mercy

Microsoft begs for mercy

Учебник по React для начинающих

Учебник по React для начинающих

Путин перестал говорить о войне | Что случилось (English subtitles)

Путин перестал говорить о войне | Что случилось (English subtitles)

Kubernetes — Простым Языком на Понятном Примере

Kubernetes — Простым Языком на Понятном Примере

Алгоритмы и структуры данных ФУНДАМЕНТАЛЬНЫЙ КУРС от А до Я. Графы, деревья, хеш таблицы и тд

Алгоритмы и структуры данных ФУНДАМЕНТАЛЬНЫЙ КУРС от А до Я. Графы, деревья, хеш таблицы и тд

Сисадмины больше не нужны? Gemini настраивает Linux сервер и устанавливает cтек N8N. ЭТО ЗАКОННО?

Сисадмины больше не нужны? Gemini настраивает Linux сервер и устанавливает cтек N8N. ЭТО ЗАКОННО?

Деревенский парень - долгожданный разбор и бесплатные табы!

Деревенский парень - долгожданный разбор и бесплатные табы!

Если у тебя спросили «Как твои дела?» — НЕ ГОВОРИ! Ты теряешь свою силу | Еврейская мудрость

Если у тебя спросили «Как твои дела?» — НЕ ГОВОРИ! Ты теряешь свою силу | Еврейская мудрость

Чем ОПАСЕН МАХ? Разбор приложения специалистом по кибер безопасности

Чем ОПАСЕН МАХ? Разбор приложения специалистом по кибер безопасности

Как устроен PHP 🐘: фундаментальное знание для инженеров

Как устроен PHP 🐘: фундаментальное знание для инженеров

Bluetooth-шпионаж: Как ваши гаджеты следят за вами? OSINT-расследование

Bluetooth-шпионаж: Как ваши гаджеты следят за вами? OSINT-расследование

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: infodtube@gmail.com