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 Network Policy logging on Windows Nodes #2052

Conversation

antoninbas
Copy link
Contributor

On Windows Nodes the path should be /k/antrea/logs/networkpolicy/np.log
and not /var/log/antrea/networkpolicy/np.log, as decided by the log_dir
flag.

We unify the approach for support bundle and Network Policy logging.

Fixes #2050

On Windows Nodes the path should be /k/antrea/logs/networkpolicy/np.log
and not /var/log/antrea/networkpolicy/np.log, as decided by the log_dir
flag.

We unify the approach for support bundle and Network Policy logging.

Fixes antrea-io#2050
@antoninbas
Copy link
Contributor Author

/test-all

@antoninbas antoninbas added this to the Antrea v1.0 release milestone Apr 8, 2021
jianjuns
jianjuns previously approved these changes Apr 8, 2021
@codecov-io
Copy link

codecov-io commented Apr 8, 2021

Codecov Report

Merging #2052 (ab3c677) into main (49cb578) will increase coverage by 23.43%.
The diff coverage is 70.58%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #2052       +/-   ##
===========================================
+ Coverage   41.41%   64.84%   +23.43%     
===========================================
  Files         131      270      +139     
  Lines       16437    20366     +3929     
===========================================
+ Hits         6807    13206     +6399     
+ Misses       9049     5823     -3226     
- Partials      581     1337      +756     
Flag Coverage Δ
e2e-tests 45.16% <70.58%> (?)
kind-e2e-tests 51.77% <70.58%> (?)
unit-tests 41.42% <0.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
pkg/util/logdir/logdir.go 44.44% <44.44%> (ø)
pkg/agent/controller/networkpolicy/packetin.go 71.72% <100.00%> (+65.64%) ⬆️
pkg/support/dump.go 65.11% <100.00%> (ø)
pkg/support/dump_others.go 50.00% <100.00%> (ø)
pkg/apiserver/handlers/webhook/mutation_labels.go 24.71% <0.00%> (ø)
pkg/agent/cniserver/ipam/ipam_delegator.go 48.83% <0.00%> (ø)
pkg/legacyapis/stats/v1alpha1/register.go 90.90% <0.00%> (ø)
pkg/agent/interfacestore/interface_cache.go 90.19% <0.00%> (ø)
...controller/crdmirroring/crdhandler/clustergroup.go 13.46% <0.00%> (ø)
pkg/apis/crd/v1beta1/register.go 92.85% <0.00%> (ø)
... and 236 more

@antoninbas
Copy link
Contributor Author

/test-all

@antoninbas
Copy link
Contributor Author

/test-windows-networkpolicy

@antoninbas
Copy link
Contributor Author

/test-networkpolicy

@antoninbas
Copy link
Contributor Author

/test-all

@antoninbas
Copy link
Contributor Author

/test-e2e

tnqn
tnqn previously approved these changes Apr 9, 2021
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

LGTM

if logDirFlag == nil {
logDir = antreaWellKnownLogDir
} else if len(logDirFlag.Value.String()) == 0 {
logDir = logDirFlag.DefValue
Copy link
Member

Choose a reason for hiding this comment

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

Out of curiosity, what's the default value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good question. I copied the code from support bundle and it seems wrong now. DefValue will be an empty string, but it should be os.TempDir(). I will wait for the tests to pass then fix before I merge (this code path is not actually used by any test).

Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

LGTM

@antoninbas
Copy link
Contributor Author

skipping tests because they are not affected by the last commit
/skip-all

@antoninbas antoninbas merged commit bc6d66b into antrea-io:main Apr 9, 2021
@antoninbas antoninbas deleted the fix-network-policy-loggin-on-windows-nodes branch April 9, 2021 03:32
antoninbas added a commit to antoninbas/antrea that referenced this pull request Apr 30, 2021
On Windows Nodes the path should be /k/antrea/logs/networkpolicy/np.log
and not /var/log/antrea/networkpolicy/np.log, as decided by the log_dir
flag.

We unify the approach for support bundle and Network Policy logging.

Fixes antrea-io#2050
antoninbas added a commit to antoninbas/antrea that referenced this pull request Apr 30, 2021
On Windows Nodes the path should be /k/antrea/logs/networkpolicy/np.log
and not /var/log/antrea/networkpolicy/np.log, as decided by the log_dir
flag.

We unify the approach for support bundle and Network Policy logging.

Fixes antrea-io#2050
antoninbas added a commit that referenced this pull request Apr 30, 2021
On Windows Nodes the path should be /k/antrea/logs/networkpolicy/np.log
and not /var/log/antrea/networkpolicy/np.log, as decided by the log_dir
flag.

We unify the approach for support bundle and Network Policy logging.

Fixes #2050
antoninbas added a commit to antoninbas/antrea that referenced this pull request Apr 30, 2021
On Windows Nodes the path should be /k/antrea/logs/networkpolicy/np.log
and not /var/log/antrea/networkpolicy/np.log, as decided by the log_dir
flag.

We unify the approach for support bundle and Network Policy logging.

Fixes antrea-io#2050
antoninbas added a commit that referenced this pull request May 1, 2021
On Windows Nodes the path should be /k/antrea/logs/networkpolicy/np.log
and not /var/log/antrea/networkpolicy/np.log, as decided by the log_dir
flag.

We unify the approach for support bundle and Network Policy logging.

Fixes #2050
antoninbas added a commit to antoninbas/antrea that referenced this pull request May 1, 2021
On Windows Nodes the path should be /k/antrea/logs/networkpolicy/np.log
and not /var/log/antrea/networkpolicy/np.log, as decided by the log_dir
flag.

We unify the approach for support bundle and Network Policy logging.

Fixes antrea-io#2050
antoninbas added a commit that referenced this pull request May 3, 2021
On Windows Nodes the path should be /k/antrea/logs/networkpolicy/np.log
and not /var/log/antrea/networkpolicy/np.log, as decided by the log_dir
flag.

We unify the approach for support bundle and Network Policy logging.

Fixes #2050
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AntreaPolicy cannot be enabled on Windows
5 participants