-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
apiserver: better-log handling routines when changes occur to extensi… #9719
base: master
Are you sure you want to change the base?
apiserver: better-log handling routines when changes occur to extensi… #9719
Conversation
…on-apiserver-authentication ConfigMap
6d40be5
to
5542d83
Compare
@@ -81,6 +84,7 @@ func WatchExtensionAuth(ctx context.Context) (bool, error) { | |||
n := new.(*corev1.ConfigMap) | |||
// Only detect as changed if the version has changed |
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.
Do we definitely care about every revision change here? Seems like we could easily check the data for changes instead:
if len(n.Data) != len(o.Data) { changed = true ... }
for k, v := range n.Data {
if ov, ok := o.Data[k] !ok || ov != v {
logrus.WithField("key", k).Info("Config map key changed/added") // Guessing we don't want to log the value (might be sensitive?)
changed = true ... }
}
// Same for n.BinaryData ...
(It's common for an operator to tweak annotations on the object every few seconds, but we should look at the data we care about and ignore anything else.)
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.
The intention of this change is to see if our cache is stale and re-iterating over the same revisions post-restart, rather than investigating the change itself. Though, I suppose if we confirm that our cache is not stale, inspecting the changes themselves is the next step, so I'll put both in, thanks!
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.
This is done now
387f3e7
to
4b34d5f
Compare
4b34d5f
to
2c93a61
Compare
"newResourceVersion": n.ResourceVersion, | ||
"changedDataKey": changedKey, | ||
"oldKeyValue": oldVal, | ||
"newKeyValue": newVal, |
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.
We mustn't log sensitive values, and I think these come from a secret which by default makes them sensitive (unless carefully reasoned otherwise).
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.
Sorted now, thanks
…on-apiserver-authentication ConfigMap
Description
Related issues/PRs
Todos
Release Note
Reminder for the reviewer
Make sure that this PR has the correct labels and milestone set.
Every PR needs one
docs-*
label.docs-pr-required
: This change requires a change to the documentation that has not been completed yet.docs-completed
: This change has all necessary documentation completed.docs-not-required
: This change has no user-facing impact and requires no docs.Every PR needs one
release-note-*
label.release-note-required
: This PR has user-facing changes. Most PRs should have this label.release-note-not-required
: This PR has no user-facing changes.Other optional labels:
cherry-pick-candidate
: This PR should be cherry-picked to an earlier release. For bug fixes only.needs-operator-pr
: This PR is related to install and requires a corresponding change to the operator.