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

Remove Metrics Server APIService in finalizer #333

Merged

Conversation

carloscastrojumo
Copy link
Contributor

@carloscastrojumo carloscastrojumo commented Jul 9, 2021

What does this PR do?

Call cleanupMetricsServerAPIService function in datadogagent finalizer.

Motivation

Starting in Kubernetes 1.20 version, when deleting the datadogagent resource, or delete the datadog namespace, the metrics service APIService is not removed, leading to a stuck namespace state at Terminating.

NAME                                   SERVICE                                        AVAILABLE                 AGE
v1beta1.external.metrics.k8s.io        datadog/datadog-cluster-agent-metrics-server   False (ServiceNotFound)   2m15s

I did not found this scenario in Kubernetes version <= 1.19.

Additional Notes

I'm not sure if I'm calling the cleanupMetricsServerAPIService in the best spot. Open for feedback.

Describe your test plan

You can test this issue by creating a testing cluster (eg: using kind) with Kubernetes version >= 1.20 and deploy the Datadog Operator. Remove the datadogagent resource or delete the datadog namespace and check if the apiservice is removed.

Repeat the same step but deploying Datadog Operator with this fix, the APIService will be removed upon deleting datadogagent resource.

@carloscastrojumo carloscastrojumo requested a review from a team as a code owner July 9, 2021 06: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 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 Jul 9, 2021
@codecov-commenter
Copy link

Codecov Report

Merging #333 (078748f) into main (5a31233) will decrease coverage by 0.02%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #333      +/-   ##
==========================================
- Coverage   63.21%   63.18%   -0.03%     
==========================================
  Files          60       60              
  Lines        6606     6609       +3     
==========================================
  Hits         4176     4176              
- Misses       2126     2129       +3     
  Partials      304      304              
Flag Coverage Δ
unittests 63.18% <0.00%> (-0.03%) ⬇️

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

Impacted Files Coverage Δ
controllers/datadogagent/finalizer.go 30.76% <0.00%> (-4.02%) ⬇️

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 5a31233...078748f. Read the comment docs.

@ahmed-mez ahmed-mez merged commit 9dd611c into DataDog:main Jul 15, 2021
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

4 participants