-
Notifications
You must be signed in to change notification settings - Fork 446
Delete secrets created if it fails on tenant creation #274
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
Conversation
Also a fix on a parity condition has been fixed.
errDelete := clientSet.deleteSecret(ctx, ns, tenantExternalClientCertSecretName, metav1.DeleteOptions{}) | ||
if errDelete != nil { | ||
log.Print(errDelete) | ||
} | ||
errDelete = clientSet.deleteSecret(ctx, ns, kesExternalCertSecretName, metav1.DeleteOptions{}) | ||
if errDelete != nil { | ||
log.Print(errDelete) | ||
} | ||
errDelete = clientSet.deleteSecret(ctx, ns, kesClientCertSecretName, metav1.DeleteOptions{}) | ||
if errDelete != nil { | ||
log.Print(errDelete) | ||
} | ||
errDelete = clientSet.deleteSecret(ctx, ns, kesConfigurationSecretName, metav1.DeleteOptions{}) | ||
if errDelete != nil { | ||
log.Print(errDelete) | ||
} | ||
return |
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.
where did this code got moved?
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.
Cause that will be handled by the defer function on create Tenant func, I also saw that this function was only being used there. Do you think this will be used in other funcs?
@@ -713,7 +726,7 @@ func getTenantCreatedResponse(session *models.Principal, params admin_api.Create | |||
|
|||
if tenantReq.ImagePullSecret != "" { | |||
imagePullSecret = tenantReq.ImagePullSecret | |||
} else if imagePullSecret, err = setImageRegistry(ctx, tenantName, tenantReq.ImageRegistry, clientSet.CoreV1(), ns); err != nil { | |||
} else if imagePullSecret, err = setImageRegistry(ctx, tenantReq.ImageRegistry, clientSet.CoreV1(), ns, tenantName); err != nil { |
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.
how was this working before? o_O
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.
nv,
@@ -713,7 +726,7 @@ func getTenantCreatedResponse(session *models.Principal, params admin_api.Create | |||
|
|||
if tenantReq.ImagePullSecret != "" { | |||
imagePullSecret = tenantReq.ImagePullSecret | |||
} else if imagePullSecret, err = setImageRegistry(ctx, tenantName, tenantReq.ImageRegistry, clientSet.CoreV1(), ns); err != nil { | |||
} else if imagePullSecret, err = setImageRegistry(ctx, tenantReq.ImageRegistry, clientSet.CoreV1(), ns, tenantName); err != nil { |
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.
nv,
If an error happened on tenant creation, if any secret was created before, the secret was not being removed. This helps by making sure all the secrets are being deleted if any on an error.
Also a fix on a parity condition has been fixed.