Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer using Data over StringData in secrets #3141

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

georgethebeatle
Copy link
Member

Is there a related GitHub Issue?

#3125

What is this change about?

According to the docs:

stringData allows specifying non-binary secret data in string form.
It is provided as a write-only input field for convenience.
All keys and values are merged into the data field on write, overwriting any existing values.

This means that it is not always safe to use StringData, since existing
keys will never be removed

Does this PR introduce a breaking change?

No

@georgethebeatle georgethebeatle linked an issue Feb 23, 2024 that may be closed by this pull request
@danail-branekov danail-branekov enabled auto-merge (rebase) February 23, 2024 16:12
According to the [docs](https://github.com/kubernetes/api/blob/48ed98046a81320c5ec6681f614e31892035edef/core/v1/types.go#L6841):

```
stringData allows specifying non-binary secret data in string form.
It is provided as a write-only input field for convenience.
All keys and values are merged into the data field on write, overwriting any existing values.
```

This means that it is not always safe to use StringData, since existing
keys will never be removed

fixes #3125

Co-authored-by: Danail Branekov <danailster@gmail.com>
Co-authored-by: Georgi Sabev <georgethebeatle@gmail.com>
@danail-branekov danail-branekov merged commit f3a89b3 into main Feb 26, 2024
11 checks passed
@danail-branekov danail-branekov deleted the issue/3125-string-data branch February 26, 2024 11:36
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.

Revisit usages of secret.StringData
2 participants