Ensure that required is always fixed up by ApplySecret#1272
Conversation
|
/assign @deads2k |
|
|
||
| // ApplySecret merges objectmeta, requires data | ||
| func ApplySecretImproved(ctx context.Context, client coreclientv1.SecretsGetter, recorder events.Recorder, requiredInput *corev1.Secret, cache ResourceCache) (*corev1.Secret, bool, error) { | ||
| existing, err := client.Secrets(requiredInput.Namespace).Get(ctx, requiredInput.Name, metav1.GetOptions{}) |
There was a problem hiding this comment.
existing, err :=
if err != nil && !apierrors.IsNotFound(err){
return nil, false, err
}
if cache.SafeToSkipApply(requiredInput, existing) {
return existing, false, nil
}
// do the required deep copy and string data stuff
if apierrors.IsNotFound(err) {
requiredCopy := requiredInput.DeepCopy()
actual, err := client.Secrets(requiredCopy.Namespace).
Create(ctx, resourcemerge.WithCleanLabelsAndAnnotations(requiredCopy).(*corev1.Secret), metav1.CreateOptions{})
reportCreateEvent(recorder, requiredCopy, err)
cache.UpdateCachedResourceMetadata(requiredInput, actual)
return actual, true, err
}
// make sure all UpdateCachedResourceMetadata use requiredInput and not requiredand you keep your "skip deep copy" behavior, right?
There was a problem hiding this comment.
I just tested your suggestion, but I had to make a small change to get the unit tests to pass (requiredCopy := required.DeepCopy() instead of requiredCopy := requiredInput.DeepCopy()
20d4bcd to
0c35def
Compare
required is always fixed up in by ApplySecret
required is always fixed up in by ApplySecretrequired is always fixed up by ApplySecret
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, jerpeter1 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@jerpeter1: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
pull in to grab fix described here openshift/library-go#1272 Signed-off-by: ehila <ehila@redhat.com>
pull in to grab lfix described here openshift/library-go#1272 Signed-off-by: ehila <ehila@redhat.com>
pull in to grab lfix described here openshift/library-go#1272 Signed-off-by: ehila <ehila@redhat.com>
pull in to grab fix described here openshift/library-go#1272 Signed-off-by: ehila <ehila@redhat.com>
pull in to grab fix described here openshift/library-go#1272 Signed-off-by: ehila <ehila@redhat.com>
pull in to grab fix described here openshift/library-go#1272 Signed-off-by: ehila <ehila@redhat.com>
pull in to grab fix described here openshift/library-go#1272 Signed-off-by: ehila <ehila@redhat.com>
pull in to grab fix described here openshift/library-go#1272 Signed-off-by: ehila <ehila@redhat.com>
pull in to grab fix described here openshift/library-go#1272 Signed-off-by: ehila <ehila@redhat.com>
pull in to grab fix described here openshift/library-go#1272 Signed-off-by: ehila <ehila@redhat.com>
pull in to grab fix described here openshift/library-go#1272 Signed-off-by: ehila <ehila@redhat.com> bump: library-go updated library-go to latest for fix in pr openshift/library-go#1273 Signed-off-by: ehila <ehila@redhat.com>
pull in to grab lfix described here openshift/library-go#1272 Signed-off-by: ehila <ehila@redhat.com>
updated method scalls with new signatures removed passing next generation to ApplyValidationWebhookConfiguration updated to use explicit call to bind log flags to cli commandline Signed-off-by: ehila <ehila@redhat.com> upkeep: removed unused code and small clean up Signed-off-by: ehila <ehila@redhat.com> fix: pull in latest library-go pull in to grab fix described here openshift/library-go#1272 Signed-off-by: ehila <ehila@redhat.com> bump: library-go updated library-go to latest for fix in pr openshift/library-go#1273 Signed-off-by: ehila <ehila@redhat.com>
pull in to grab fix described here openshift/library-go#1272 Signed-off-by: ehila <ehila@redhat.com> bump: library-go updated library-go to latest for fix in pr openshift/library-go#1273 Signed-off-by: ehila <ehila@redhat.com>
fetched latest library-go and vendored dep updated handlers to use updated sctruct names updated okd builder image to use go 1.17 Signed-off-by: ehila <ehila@redhat.com> fix: updated build-machinery to fix yaml-patch verify updated build-machinery - more info: openshift/build-machinery-go#58 Signed-off-by: ehila <ehila@redhat.com> fix: pull in latest library-go pull in to grab fix described here openshift/library-go#1272 Signed-off-by: ehila <ehila@redhat.com> bump: library-go updated library-go to latest for fix in pr openshift/library-go#1273 Signed-off-by: ehila <ehila@redhat.com>
This is to fix TestEnsureNodeKubeconfigs in cluster-kube-apiserver's unit tests (I'm not sure if the test being broken is actually important or not, but we can re-address that later)