DataDog / extendeddaemonset

Kubernetes Extended Daemonset controller
Apache License 2.0
98 stars 13 forks source link

use client.Patch() for [add|remov]ing canary label #69

Closed clamoriniere closed 3 years ago

clamoriniere commented 3 years ago

What does this PR do?

Use the client.Patch() function instead of client.Update() to add canary label on Pods.

Motivation

Previously the function client.Update() was used to add or remove the canary labels on the Pods. Using Patch() limit possible conflict and decrease message size.

It removes bug on Kubernetes 1.19.0 when the API-Server return an error with the function client.Update(), because the controller is trying to update an immutable Pod.Spec field.

Additional Notes

Anything else we should know when reviewing?

Describe your test plan

codecov-io commented 3 years ago

Codecov Report

Merging #69 (ebf72ee) into master (efa4090) will increase coverage by 0.66%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #69      +/-   ##
==========================================
+ Coverage   31.55%   32.21%   +0.66%     
==========================================
  Files          37       37              
  Lines        2830     2834       +4     
==========================================
+ Hits          893      913      +20     
+ Misses       1851     1831      -20     
- Partials       86       90       +4     
Flag Coverage Δ
unittests 32.21% <100.00%> (+0.66%) :arrow_up:

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

Impacted Files Coverage Δ
...lers/extendeddaemonsetreplicaset/strategy/utils.go 53.70% <100.00%> (+17.16%) :arrow_up:

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 efa4090...ebf72ee. Read the comment docs.