Skip to content

chore(shield): Add generic labels and annotations - #2661

Draft
mavimo wants to merge 8 commits into
mainfrom
add-generic-labels-and-annotations
Draft

chore(shield): Add generic labels and annotations#2661
mavimo wants to merge 8 commits into
mainfrom
add-generic-labels-and-annotations

Conversation

@mavimo

@mavimo mavimo commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Checklist

  • Title of the PR starts with type and scope, (e.g. feat(agent,node-analyzer,sysdig-deploy):)
  • Chart Version bumped for the respective charts
  • Variables are documented in the README.md (or README.tpl in some charts)
  • Check GithubAction checks (like lint) to avoid merge-check stoppers
  • All test files are added in the tests folder of their respective chart and have a "_test" suffix

mavimo added 8 commits June 19, 2026 17:06
Add top-level `annotations` value that propagates to every Kubernetes
resource the chart creates (Deployments, DaemonSets, ConfigMaps, Secrets,
RBAC resources, Services, etc.). Annotations are merged with any existing
resource-specific annotations, with component-level values taking
precedence over the global ones.

New helpers:
- `shield.annotations` – base helper returning .Values.annotations
- `cluster.rbac_annotations` – merges shield.annotations + cluster RBAC annotations
- `host.rbac_annotations` – merges shield.annotations + host RBAC annotations

Generated with support from AI

Co-Authored-By: Marco Vito Moscaritolo <marcovito.moscaritolo@sysdig.com>
Add top-level `labels` value that propagates to every Kubernetes resource
the chart creates. Implemented by merging .Values.labels into the
`shield.labels` base helper, which is inherited by all component label
helpers (cluster.labels, host.labels, host.windows.labels, common.labels)
and cascades to every resource-specific label set.

Generated with support from AI

Co-Authored-By: Marco Vito Moscaritolo <marcovito.moscaritolo@sysdig.com>
Verify that the standard Kubernetes labels (helm.sh/chart,
app.kubernetes.io/*) and sysdig/component are always present on every
resource type (Deployment, DaemonSet, Service, ServiceAccount, ConfigMap)
even when no custom labels/annotations are set.

Also verify that resources without any annotations do not gain an
unexpected annotations block when annotations: {} (default).

Add chart.version: 1.2.3-helmtest to suite headers that lacked it so
helm.sh/chart assertions are stable across version bumps.

Generated with support from AI

Co-Authored-By: Marco Vito Moscaritolo <marcovito.moscaritolo@sysdig.com>
…host_windows

Add annotations fields under cluster.annotations, host.annotations, and
host_windows.annotations that scope extra annotations to a single component.
These are merged on top of the global annotations and below any
resource-specific annotations (workload_annotations, rbac.annotations, etc.).

New base helpers: cluster.annotations, host.annotations, host.windows.annotations.
All existing workload/pod/RBAC annotation helpers are updated to derive from
the component base instead of shield.annotations directly. Templates for
services, configmaps, secrets, and OpenShift SCCs updated accordingly.

Generated with support from AI

Co-Authored-By: Marco Vito Moscaritolo <marcovito.moscaritolo@sysdig.com>
…windows

Add labels fields under cluster.labels, host.labels, and
host_windows.labels that scope extra labels to a single component.
Implemented by merging .Values.<component>.labels into the component base
label helper (cluster.labels, host.labels, host.windows.labels), which
cascades automatically to every workload, pod, RBAC, service, and ConfigMap
label set for that component.

Generated with support from AI

Co-Authored-By: Marco Vito Moscaritolo <marcovito.moscaritolo@sysdig.com>
…ows.annotations

Align the template helper name with the values key naming convention
(host_windows.* instead of host.windows.*).

Generated with support from AI

Co-Authored-By: Marco Vito Moscaritolo <marcovito.moscaritolo@sysdig.com>
Reverse the merge order in all annotation helpers so more-specific values
win over less-specific ones. Previous order had global annotations winning
over component annotations, and component-generic winning over
workload/rbac-specific — both backwards.

Correct precedence (highest → lowest):
  workload_annotations / pod_annotations / rbac.annotations
  > cluster.annotations / host.annotations / host_windows.annotations
  > workload_annotations (global)
  > annotations (global)

Add override tests that set the same key at multiple levels and assert the
more-specific value wins, covering cluster, host, and host_windows for
workload, pod, and RBAC resources.

Generated with support from AI

Co-Authored-By: Marco Vito Moscaritolo <marcovito.moscaritolo@sysdig.com>
Reverse the merge order in workload/pod label helpers so component-specific
values win over global ones. Previous order had global workload_labels
winning over cluster.workload_labels / host.workload_labels.

Correct precedence (highest → lowest):
  cluster.workload_labels / cluster.pod_labels / cluster.rbac.labels
  > workload_labels / pod_labels (global)
  > cluster.labels (base, which already has cluster.labels value > shield.labels)
  > labels (global, inside shield.labels)

rbac_labels helpers were already correct and unchanged.

Add override tests that set the same key at multiple levels and assert the
more-specific value wins, covering cluster, host, and host_windows for
workload, pod, RBAC, service, and ConfigMap resources.

Generated with support from AI

Co-Authored-By: Marco Vito Moscaritolo <marcovito.moscaritolo@sysdig.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant