Skip to content

[ENHANCE] Allow match by dynamic, workload specific label #1196

Description

@Cenness

Is your feature request related to a problem? Please describe.
I use both kiwigrid/k8s-sidecar and reloader for an app. Sidecar is in init container, preparing bunch of files. Sidecar selects them by label plugins: appname. Target app doesn't have reload method so it must be done at initialisation.

Configs aren't referenced directly in app deployment so reloader doesn't know they are related. To bypass it in current version I therefore must add configmap.reloader.stakater.com/reload: "app-config-1" for each existing configmap.

Describe the solution you'd like
Reloader already have capability to watch for a specific label. I propose allowing that label be dynamic and workload specific. Or alternatively this could be seen as extending "Targeted Reload (Match + Search Annotations)" scenario.

Workload label reloader.stakater.com/search-by-label-enabled: "true" (maybe, for a slightly cheaper watch)
Workload annotation reloader.stakater.com/search-by-label: "plugins=appname"
Secret/ConfigMap label: plugins: appname

Describe alternatives you've considered
Add another sidecar that kills target process annotates deployment.

Additional context
Controller would need to watch create and delete events. For delete maybe don't bother with object reconstruction from tombstones to check if it was a target, it would be way less error/race prone to use composite hash for currently present objects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions