-
Notifications
You must be signed in to change notification settings - Fork 116
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
Fix normalization of base64 encoded secrets.data values to strip whitespace #2715
Conversation
Does the PR have any schema changes?Looking good! No breaking changes found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel comfortable with this fix for a few reasons.
- I don't understand why one would get spurious diffs if the whitespace were present.
- I feel it is presumptuous to manipulate the value; could there be a legit use case for trailing whitespace?
e77e0ad
to
6aa5dbc
Compare
apiVersion: v1
kind: Secret
metadata:
name: dotfile-secret
data:
secret: "dmFsdWUtMg0KDQo=\n\n\n" When this secret is applied to the cluster using apiVersion: v1
data:
secret: dmFsdWUtMg0KDQo=
kind: Secret
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","data":{"secret":"dmFsdWUtMg0KDQo=\n"},"kind":"Secret","metadata":{"annotations":{},"name":"dotfile-secret","namespace":"default"}}
creationTimestamp: "2023-12-13T21:55:13Z"
name: dotfile-secret
namespace: default
resourceVersion: "54021"
uid: 1d680c61-327f-4bdd-bc81-6e922fe525e4
type: Opaque
Note: A secret with multiple base64 strings separated by a new line would be rejected by the API server, e.g., Trailing whitespace is stripped by Kubernetes due to the underlying implementation of the Refer to this simple Go Playground example (Go Playground) that demonstrates Golang's |
…espace (#2715) ### Proposed changes This pull request introduces a normalization mechanism for `secret.data` base64 encoded values, specifically stripping whitespace to prevent unintended spurious diffs. **Changes Made:** - Created comprehensive integration and unit tests to verify and highlight the broken behavior associated with `secret.data` values containing whitespaces. - Updated the provider to incorporate the normalization process, ensuring that all related tests pass seamlessly. ### Related issues (optional) Fixes: #2681
Proposed changes
This pull request introduces a normalization mechanism for
secret.data
base64 encoded values, specifically stripping whitespace to prevent unintended spurious diffs.Changes Made:
secret.data
values containing whitespaces.Related issues (optional)
Fixes: #2681