Flagsmith / Flagsmith/flagsmith-charts

fix(Helpers): flagsmith.annotations emits duplicate keys when a custom annotation overrides a common one

Open Beginner friendly
#543 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Mustache
Stars
44
Forks
47
Avg merge
3d 18h
Merged PRs (30d)
1

Description

The `flagsmith.annotations` helper combines `common.annotations` with a resource's own annotations by printing both blocks one after the other. When the same key exists in both, the rendered output contains that key twice:

```yaml
annotations:
company.io/owner: platform # from common.annotations
company.io/owner: migrations-team # from the resource
```

Duplicate keys are invalid YAML. Kubernetes and lenient parsers keep the last one, so applies usually work — but strict tools (`kubeconform --strict`, `kubectl --strict`, ArgoCD) reject it, and the manifest is misleading to read.

This affects every resource using the helper with the `customAnnotations` / `commonValues` form — services, ingresses, gateways.

## Suggested fix

Merge the two maps into one before rendering (resource-specific key wins), instead of concatenating. A fresh-dict merge avoids mutating values:

```
merge (dict) $resourceAnnotations $commonAnnotations
```

## How to reproduce

Set the same annotation key in both `common.annotations` and a resource's `annotations`, run `helm template`, observe the duplicate key.

Discovered while reviewing #542.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the Helm helper that renders flagsmith.annotations, tracing the customAnnotations/commonValues form used by services, ingresses, and gateways. Reproduce with helm template using the same key in common.annotations and resource annotations, then confirm the rendered YAML has one key, with the resource value winning, and passes strict validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
helm, kubernetes
Domain
devops, infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.