hashicorp / hashicorp/vault-secrets-operator

Setting `destination` -> `label` does not seem to set label on end secret

Open
#1,045 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
600
Forks
146
Avg merge
3d 8h
Merged PRs (30d)
6

Description

More of a question rather than a bug I'm sure because this feature is clearly documented so I am sure my config of the `vaultstaticsecret` is wrong.

I have the following yaml:
```apiVersion: secrets.hashicorp.com/v1beta1
kind: VaultStaticSecret
metadata:
name: my-secret
namespace: my-namespace
spec:
destination:
create: true
labels:
app.kubernetes.io/component: secret-sync
app.kubernetes.io/managed-by: by-some-tool
app.kubernetes.io/name: my-secret
name: my-secret
overwrite: true
transformation:
excludeRaw: true
excludes:
- .*
templates:
.dockerconfigjson:
text: |
[...]
type: kubernetes.io/dockerconfigjson
hmacSecretData: true
mount: my-kv/kv-v2
namespace: my-namespace
path: hashicorp-vso/my-secret
```

and my expectation was i would see kube `secret` created with the labels:
```
app.kubernetes.io/component: secret-sync
app.kubernetes.io/managed-by: by-some-tool
app.kubernetes.io/name: my-secret
```
as per vso doc at https://github.com/hashicorp/vault-secrets-operator/blob/main/docs/api/api-reference.md#destination

but the end secret instead has:
```
"app.kubernetes.io/component": "secret-sync",
"app.kubernetes.io/managed-by": "hashicorp-vso",
"app.kubernetes.io/name": "vault-secrets-operator",
```
i.e. the managed-by and name is somehow not being set?

I thought it might be due to the fact i am setting:
```
create: true
overwrite: true
```
but the doc does seem to suggest this is fine.
FYI, i've tried it with both non-existing secret (so creating it from scratch) as well as existing secret.

Is my config the problem here and also where are the values above coming from? (clearly from hashicorp-vso but i don't know where since i don't have that in any config)

version: `hashicorp/vault-secrets-operator:0.5.2`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the VaultStaticSecret destination.labels behavior described in the API reference and reproduce it on version 0.5.2 using the YAML in the issue. Inspect the resulting Kubernetes Secret metadata and trace where the operator's managed-by and name labels are assigned. Done means determining whether the configuration or the operator behavior is responsible, with a fix or documentation clarification supported by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.