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

Added retry on conflict logic for regenerate deploy key #555

Merged
merged 3 commits into from
Nov 15, 2023

Conversation

satr
Copy link
Contributor

@satr satr commented Nov 14, 2023

No description provided.

@satr satr self-assigned this Nov 14, 2023
Copy link
Contributor

@nilsgstrabo nilsgstrabo left a comment

Choose a reason for hiding this comment

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

Added a few suggestions

if err := ah.isValidRegistrationUpdate(updatedRegistration, currentRegistration); err != nil {
return err
}
_, err = ah.getUserAccount().RadixClient.RadixV1().RadixRegistrations().Update(ctx, updatedRegistration, metav1.UpdateOptions{})
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use reflect.DeepEqual to prevent unneccessary updates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't it used? updatedRegistration := currentRegistration.DeepCopy()

Copy link
Contributor

Choose a reason for hiding this comment

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

DeepEqual, not DeepCopy.

Example:

		if !reflect.DeepEqual(updatedRegistration, currentRegistration) {
			_, err = ah.getUserAccount().RadixClient.RadixV1().RadixRegistrations().Update(ctx, updatedRegistration, metav1.UpdateOptions{})
			return err
		}
		return nil

}
if regenerateDeployKeyAndSecretData.PrivateKey == "" {
// Deleting the secret with the private key. This triggers the RR to be reconciled and the new key to be generated
return ah.getUserAccount().Client.CoreV1().Secrets(operatorUtils.GetAppNamespace(appName)).Delete(ctx, defaults.GitPrivateKeySecretName, metav1.DeleteOptions{})
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we ignore returning error if it is NotFound?

@nilsgstrabo nilsgstrabo self-requested a review November 15, 2023 10:50
@satr satr merged commit e3c137f into master Nov 15, 2023
3 checks passed
@satr satr deleted the fix-regenerate-key branch November 15, 2023 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants