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

Draft: Add pausing deployment rollouts #838

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tom1299
Copy link
Contributor

@tom1299 tom1299 commented Feb 12, 2025

Note that this pull request is just a draft for implementing the functionality described in the enhancement #837


time.AfterFunc(pauseDuration, func() {
deployment, err := clients.KubernetesClient.AppsV1().Deployments(itemNamespace).Get(context.TODO(), itemName, metav1.GetOptions{})
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

seven levels of if clauses - decrease the cyclomatic complexity

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@karl-johan-grahn Thanks for the review. The ode is really not that good. As I wrote in the issue this was just code to prove that it works. Would it be ok to add such a feature in general ? I would then of course refactor the code and add appropriate tests.

Copy link
Contributor Author

@tom1299 tom1299 Feb 19, 2025

Choose a reason for hiding this comment

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

@karl-johan-grahn I refactored the code in general:

  • Reduced complexity / readability in general
  • Put the code into a separate file instead of upgrade.go (separation of concerns)
  • Reduced the number of changes introduced in PerformAction
  • Refactor annotation to flags.go
  • Add test cases for annotation and environment variable reload strategy

Could you please have a look at the changes ? Thanks in advance.

@karl-johan-grahn karl-johan-grahn changed the title Add pausing deployment rollouts Draft: Add pausing deployment rollouts Feb 13, 2025
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