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

Fix TOCTOU bug in CloneVolumeSnapshotClass #690

Merged
merged 1 commit into from
May 29, 2020
Merged

Fix TOCTOU bug in CloneVolumeSnapshotClass #690

merged 1 commit into from
May 29, 2020

Conversation

vkamra
Copy link

@vkamra vkamra commented May 29, 2020

Change Overview

Fixes a bug where racing CloneVolumeSnapshotClass would fail.

Also address review comments from previous PR.

Pull request type

Please check the type of change your PR introduces:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test

Test Plan

  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

@@ -78,8 +74,7 @@ func (sna *SnapshotAlpha) CloneVolumeSnapshotClass(sourceClassName, targetClassN
// Set Annotations/Labels
usNew.SetAnnotations(existingAnnotations)
usNew.SetLabels(map[string]string{CloneVolumeSnapshotClassLabelName: sourceClassName})
_, err = sna.dynCli.Resource(v1alpha1.VolSnapClassGVR).Create(usNew, metav1.CreateOptions{})
if err != nil {
if _, err = sna.dynCli.Resource(v1alpha1.VolSnapClassGVR).Create(usNew, metav1.CreateOptions{}); !apierrors.IsAlreadyExists(err) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea this is better.

@vkamra vkamra added the kueue label May 29, 2020
@mergify mergify bot merged commit 92b1cd9 into master May 29, 2020
@mergify mergify bot deleted the review_fixes branch May 29, 2020 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants