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

Improve controller logic + fix tests flakiness #74

Merged
merged 11 commits into from
Jan 19, 2021

Conversation

clamoriniere
Copy link
Collaborator

@clamoriniere clamoriniere commented Dec 29, 2020

What does this PR do?

  • Add new CanaryFailed and CanaryPause conditions in ERS.status
  • Add EDS.status.conditions with CanaryFailed and CanaryPause
    conditions.
  • Remove EDS annotations update in the ERS reconcile loop.
  • Check ERS.status.conditions in EDS reconcile loop to detec Canary
    paused or failed
  • Update unit-tests and e2t tests according the logic update
  • Add some reconcile loops documentations.
  • In the ERS-controller, If the parent ExtendedDaemonset is not defaulted, we force the Defaulting by updating the ERS status with an error conditions. like this the EDS-controller received an event on an ERS update and requeue the parent EDS.
  • Speed-up reconcile frequency in tests to avoid test flakiness
  • Use only one Canary Pod in the canary strategy configuration in test.

Motivation

Remove test flakiness and improve EDS/ERS lifecycles.

Additional Notes

N/A

Describe your test plan

  • Tests should not be flaky.

@clamoriniere clamoriniere requested a review from a team as a code owner December 29, 2020 15:42
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request does not contain a valid label. Please add one of the following labels: bug, enhancement, documentation

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from 8918039 to 147d6da Compare December 29, 2020 15:44
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request does not contain a valid label. Please add one of the following labels: bug, enhancement, documentation

@clamoriniere clamoriniere added the bug Something isn't working label Dec 29, 2020
@clamoriniere clamoriniere added this to the v0.5 milestone Dec 29, 2020
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from 147d6da to c8baa45 Compare December 29, 2020 15:57
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from c8baa45 to a5d3d8c Compare December 29, 2020 16:42
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from a5d3d8c to 7dc75f5 Compare December 29, 2020 16:42
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from 7dc75f5 to bc069f6 Compare December 29, 2020 17:16
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from bc069f6 to 81d7a93 Compare December 29, 2020 17:28
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from 84c9e69 to 3ea0c7c Compare December 29, 2020 20:47
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from 3ea0c7c to 1b297b3 Compare December 29, 2020 21:07
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from 1b297b3 to 3321493 Compare December 29, 2020 22:00
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from 3321493 to d25a063 Compare December 29, 2020 22:10
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from d25a063 to 993e4bd Compare December 29, 2020 22:20
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from 993e4bd to 20ce653 Compare December 29, 2020 22:41
Copy link
Contributor

@xornivore xornivore left a comment

Choose a reason for hiding this comment

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

Looks great, the diagram is very helpful.

Are we confident we don't need reset command anymore?


switch isCanaryActive {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we do if/else instead here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure

@@ -425,6 +411,77 @@ func (r *Reconciler) selectNodes(logger logr.Logger, daemonsetSpec *datadoghqv1a
return nil
}

func isCanaryActive(daemonset *datadoghqv1alpha1.ExtendedDaemonSet, activeERSName string, uptodateERSName string, isCanaryFailed bool) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: uptodateERSName -> upToDateERSName

if isCanaryFailed {
msg := fmt.Sprintf("canary failed with ers: %s", ersName)
conditions.UpdateExtendedDaemonSetStatusCondition(status, now, datadoghqv1alpha1.ConditionTypeEDSCanaryFailed, corev1.ConditionTrue, "CanaryFailed", msg, updateOptions)
status.State = datadoghqv1alpha1.ExtendedDaemonSetStatusStateCanaryFailed
Copy link
Contributor

Choose a reason for hiding this comment

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

i think this is being set here and in manageCanaryStatus

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

right removing this line

if !isCanaryPaused {
status.State = datadoghqv1alpha1.ExtendedDaemonSetStatusStateCanary
} else {
status.State = datadoghqv1alpha1.ExtendedDaemonSetStatusStateCanaryPaused
Copy link
Contributor

Choose a reason for hiding this comment

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

similarly maybe pausedReason should be set here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good catch 👍
done

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from 406fc26 to 58d14a1 Compare January 15, 2021 12:05
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from 58d14a1 to d158da4 Compare January 15, 2021 12:07
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from d158da4 to 99c4952 Compare January 15, 2021 12:57
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from 99c4952 to 32dd743 Compare January 15, 2021 14:26
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

msg := fmt.Sprintf("canary paused with ers: %s", ersName)
conditions.UpdateExtendedDaemonSetStatusCondition(status, now, datadoghqv1alpha1.ConditionTypeEDSCanaryPaused, corev1.ConditionTrue, string(pausedReason), msg, updateOptions)
status.State = datadoghqv1alpha1.ExtendedDaemonSetStatusStateCanaryPaused
status.Reason = pausedReason
Copy link
Contributor

Choose a reason for hiding this comment

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

these two should be removed also

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from 7b9e66a to 774e90d Compare January 18, 2021 09:31
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from 774e90d to 1a1c55b Compare January 18, 2021 09:58
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from 1a1c55b to 0d6dd25 Compare January 18, 2021 15:42
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere force-pushed the clamoriniere/fix-tests-flakiness branch from 0d6dd25 to 5d8481f Compare January 18, 2021 17:19
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request contains a valid label.

@clamoriniere clamoriniere merged commit 99ef906 into v0.5 Jan 19, 2021
@clamoriniere clamoriniere deleted the clamoriniere/fix-tests-flakiness branch January 19, 2021 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants