Skip to content

Conversation

squeed
Copy link
Contributor

@squeed squeed commented Nov 6, 2024

Before this change, marshalling policy to a struct caused the line ... "enableDefaultDeny":{}, ... to be written to json-marshalled network policy. This later caused problems when using cilium-cli with cluster versions that do not support the enableDefaultDeny field.

This can be replaced with a omitzero modifier on the json struct tag once go1.24 is released. Until then, we can work around this with a simple pointer instead.

@squeed squeed added the release-note/misc This PR makes changes that have no direct user impact. label Nov 6, 2024
@squeed squeed requested a review from a team as a code owner November 6, 2024 10:46
@squeed squeed requested a review from learnitall November 6, 2024 10:46
@github-actions github-actions bot added the sig/policy Impacts whether traffic is allowed or denied based on user-defined policies. label Nov 6, 2024
@squeed
Copy link
Contributor Author

squeed commented Nov 6, 2024

/test

@aanm
Copy link
Member

aanm commented Nov 11, 2024

/test

@squeed squeed force-pushed the policy-no-marshal-default-deny branch from c28f080 to 1174d99 Compare November 11, 2024 15:37
@squeed
Copy link
Contributor Author

squeed commented Nov 11, 2024

/test

@squeed squeed force-pushed the policy-no-marshal-default-deny branch from 1174d99 to d6036f7 Compare November 13, 2024 20:59
@squeed
Copy link
Contributor Author

squeed commented Nov 13, 2024

/test

Copy link
Member

@tklauser tklauser left a comment

Choose a reason for hiding this comment

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

The failing https://github.com/cilium/cilium/actions/runs/11825695933/job/33196483218#step:18:960 f02-agent-fqdn e2e test seems to be legitimate, it's persistent across re-runs.

I think we need to additionally protect access to the EnableDefaultDeny field with r.EnableDefaultDeny != nil checks now that it is a (potentially nil) pointer.

@tklauser tklauser added the release-blocker/1.16 This issue will prevent the release of the next version of Cilium. label Nov 19, 2024
Before this change, marshalling policy to a struct caused the line
`... "enableDefaultDeny":{}, ...` to be written to json-marshalled
network policy. This later caused problems when using cilium-cli with
cluster versions that do not support the `enableDefaultDeny` field.

This can be replaced with a `omitzero` modifier on the json struct tag
once go1.24 is released. Until then, we can work around this with a
simple pointer instead.

Signed-off-by: Casey Callendrello <cdc@isovalent.com>
@squeed
Copy link
Contributor Author

squeed commented Nov 20, 2024

EnableDefaultDeny isn't a pointer, so it can't be nil. That's what got us in to this mess in the first place :-/.

The CI failure is actually #35985, I just need to rebase.

@squeed squeed force-pushed the policy-no-marshal-default-deny branch from d6036f7 to 3cdcc16 Compare November 20, 2024 15:15
@squeed
Copy link
Contributor Author

squeed commented Nov 20, 2024

/test

@tklauser
Copy link
Member

tklauser commented Nov 20, 2024

EnableDefaultDeny isn't a pointer, so it can't be nil. That's what got us in to this mess in the first place :-/.

Now I´m confused. Isn't this the other way around that it wasn't a pointer before and couldn't be nil and was thus always written?

The CI failure is actually #35985, I just need to rebase.

Ah, perfect.

@squeed
Copy link
Contributor Author

squeed commented Nov 20, 2024

Now I´m confused. Isn't this the other way around that it wasn't a pointer before and couldn't be nil and was thus always written?

Right, this doesn't change the policy type, just the stub type we use for JSON marshalling. We never actually dereference the pointer.

@tklauser
Copy link
Member

Now I´m confused. Isn't this the other way around that it wasn't a pointer before and couldn't be nil and was thus always written?

Right, this doesn't change the policy type, just the stub type we use for JSON marshalling. We never actually dereference the pointer.

Ah, stub type was what confused me. Thanks for clarifying.

@aanm aanm added this pull request to the merge queue Nov 20, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Nov 20, 2024
Merged via the queue into cilium:main with commit ede9dfe Nov 20, 2024
64 checks passed
@jrajahalme jrajahalme removed the release-blocker/1.16 This issue will prevent the release of the next version of Cilium. label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact. sig/policy Impacts whether traffic is allowed or denied based on user-defined policies.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants