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 IsPodAvailable() to wait the PodReady is true #72

Merged
merged 1 commit into from
Dec 28, 2020

Conversation

clamoriniere
Copy link
Collaborator

@clamoriniere clamoriniere commented Dec 28, 2020

What does this PR do?

Fix the function IsPodAvailable() used by the controller to compute the number of available Pods.

Motivation

This behaviour was the origin of a nasty bug with which the controller didn't respect the "MaxUnavailable" parameter.

The controller was considering too many Pods as available, for example, Pods in ImagePullBackoff were considered as available.

Additional Notes

Anything else we should know when reviewing?

Describe your test plan

Create a EDS instance on a multi nodes cluster (you can use the kand and the examples/kind-cluster-configuration.yaml)

apiVersion: datadoghq.com/v1alpha1
kind: ExtendedDaemonSet
metadata:
  name: foo
spec:
  strategy:
    rollingUpdate:
      maxParallelPodCreation: 1
      slowStartIntervalDuration: 1m
      maxUnavailable: 1
  template:
    spec: 
      containers:
      - name: daemon
        image: k8s.gcr.io/pause:3.0
      tolerations:
      - operator: Exists

when the EDS properly deployed, update it with:

apiVersion: datadoghq.com/v1alpha1
kind: ExtendedDaemonSet
metadata:
  name: foo
spec:
  strategy:
    rollingUpdate:
      maxParallelPodCreation: 1
      slowStartIntervalDuration: 1m
      maxUnavailable: 1
  template:
    spec: 
      containers:
      - name: daemon
        image: k8s.gcr.io/pause:42
      tolerations:
      - operator: Exists

The image doesn't exist. so the new pod should in ImagePullBackoff.

wanted behaviour: Only one pod should be updated and in ImagePullBackoff

@clamoriniere clamoriniere requested a review from a team as a code owner December 28, 2020 13:15
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

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 28, 2020
@clamoriniere clamoriniere added this to the v0.5 milestone Dec 28, 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.

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.

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.

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.

This behaviour was the origin of a nasty bug with which the controller
didn't respect the "MaxUnavailable" parameter.
The controller was considering to many Pods as available, for example,
Pods in ImagePullBackoff were considered as available.
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.

@codecov-io
Copy link

Codecov Report

Merging #72 (e8ceb8c) into master (9df60a1) will increase coverage by 0.09%.
The diff coverage is 23.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #72      +/-   ##
==========================================
+ Coverage   32.26%   32.36%   +0.09%     
==========================================
  Files          37       41       +4     
  Lines        2833     2917      +84     
==========================================
+ Hits          914      944      +30     
- Misses       1830     1882      +52     
- Partials       89       91       +2     
Flag Coverage Δ
unittests 32.36% <23.28%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/plugin/common/client.go 0.00% <ø> (ø)
pkg/plugin/common/pods.go 0.00% <0.00%> (ø)
pkg/plugin/common/table.go 0.00% <0.00%> (ø)
pkg/plugin/common/utils.go 62.50% <62.50%> (ø)
pkg/controller/utils/pod/pod.go 39.08% <100.00%> (+17.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 87217d6...e8ceb8c. Read the comment docs.

@clamoriniere clamoriniere merged commit 8e7c119 into master Dec 28, 2020
@clamoriniere clamoriniere deleted the clamoriniere/fixIsPodAvailabled branch December 28, 2020 20:42
clamoriniere added a commit that referenced this pull request Dec 28, 2020
This behaviour was the origin of a nasty bug with which the controller
didn't respect the "MaxUnavailable" parameter.
The controller was considering to many Pods as available, for example,
Pods in ImagePullBackoff were considered as available.
clamoriniere added a commit that referenced this pull request Dec 29, 2020
This behaviour was the origin of a nasty bug with which the controller
didn't respect the "MaxUnavailable" parameter.
The controller was considering to many Pods as available, for example,
Pods in ImagePullBackoff were considered as available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component/controller
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants