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

Add the option to create NetworkPolicy for the Agents #162

Merged
merged 1 commit into from Oct 20, 2020

Conversation

juliogreff
Copy link
Contributor

What does this PR do?

This adds a NetworkPolicy configuration option for the Datadog Agent, Cluster Agent, and Cluster Checks Runner. Currently, it only controls whether or not a NetworkPolicy should be added.

Motivation

This matches the introduction of the creation of network policies in the helm chart, introduced in this PR and follow ups: DataDog/helm-charts#44

Describe your test plan

Add the following configs to a DatadogAgent, and check that the NetworkPolicy doesn't prevent the agents from working properly:

apiVersion: datadoghq.com/v1alpha1
kind: DatadogAgent
metadata:
  name: datadog
spec:
  agent:
    networkPolicy:
      create: true
  clusterAgent:
    networkPolicy:
      create: true
  clusterChecksRunner:
    networkPolicy:
      create: true

Also check that removing the NetworkPolicy or the corresponding agent removes the network policy as well.

@juliogreff juliogreff added the enhancement New feature or request label Oct 15, 2020
@juliogreff juliogreff added this to the v0.4 milestone Oct 15, 2020
@juliogreff juliogreff requested review from a team as code owners October 15, 2020 12:48
docs/configuration.md Outdated Show resolved Hide resolved
@juliogreff juliogreff force-pushed the juliogreff/network-policy branch 2 times, most recently from 8a2ccc3 to 0e3156f Compare October 16, 2020 08:08
@codecov-io
Copy link

codecov-io commented Oct 16, 2020

Codecov Report

Merging #162 into master will increase coverage by 1.03%.
The diff coverage is 76.92%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #162      +/-   ##
==========================================
+ Coverage   59.51%   60.55%   +1.03%     
==========================================
  Files          33       34       +1     
  Lines        4456     4728     +272     
==========================================
+ Hits         2652     2863     +211     
- Misses       1593     1648      +55     
- Partials      211      217       +6     
Flag Coverage Δ
#unittests 60.55% <76.92%> (+1.03%) ⬆️

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

Impacted Files Coverage Δ
controllers/datadogagent_controller.go 66.66% <ø> (ø)
controllers/datadogagent/common_networkpolicy.go 41.02% <41.02%> (ø)
controllers/datadogagent/agent.go 55.63% <75.38%> (+5.63%) ⬆️
controllers/datadogagent/clusterchecksrunner.go 76.65% <85.54%> (+2.50%) ⬆️
controllers/datadogagent/clusteragent.go 70.74% <85.88%> (+1.94%) ⬆️
controllers/datadogagent/common_rbac.go 73.86% <100.00%> (ø)

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 812a3c4...5036f05. Read the comment docs.

@juliogreff juliogreff merged commit bc8c7dc into master Oct 20, 2020
@juliogreff juliogreff deleted the juliogreff/network-policy branch October 20, 2020 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants