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

Update the Type field name to PolicyType for SetPolicy #1194

Merged
merged 3 commits into from
Nov 10, 2021

Conversation

netal
Copy link
Contributor

@netal netal commented Oct 13, 2021

The "Type" fieldname was interfering with a internal "Type" field. Changing it to "PolicyType"
Signed-off-by: netal [email protected]

@netal netal requested a review from a team as a code owner October 13, 2021 23:38
@dcantah
Copy link
Contributor

dcantah commented Oct 14, 2021

@netal You'll need to run go mod vendor and go mod tidy in the /test directory in this repo and re-push to fix the CI. Also, I'm having trouble finding uses/examples of SetPolicySetting. I don't see any in this repo or Kubernetes so not sure how it's used.

@dcantah dcantah self-assigned this Oct 14, 2021
@vakalapa
Copy link

@dcantah Azure NPM is in the process of adding support for this setpolicy settings, you can see preliminary changes in here https://github.com/Azure/azure-container-networking/blob/1bcf6d80b54965515780e2d3f90d41598147f46e/npm/pkg/dataplane/ipsets/ipsetmanager_windows.go#L153

@kevpar
Copy link
Member

kevpar commented Oct 14, 2021

This would be a breaking change if anyone is depending on the code as it exists today. Can you expand on why this change is needed?

@dcantah
Copy link
Contributor

dcantah commented Oct 14, 2021

+1 with Kevin.

You could add a json struct tag to have it be marshalled to the PolicyType name to avoid the actual field rename I suppose if this is really needed.

type SetPolicySetting struct {
	Id     string
	Name   string
	Type   SetPolicyType `json:"PolicyType"`
	Values string
}

@netal
Copy link
Contributor Author

netal commented Oct 14, 2021

As of now, there are no customers using Setpolicy. Azure NPM is the first customer using this policy.

@kevpar
Copy link
Member

kevpar commented Oct 14, 2021

As of now, there are no customers using Setpolicy. Azure NPM is the first customer using this policy.

Do we know that no one in the community has taken a dependency on this code? I'd still like to understand better what motivates this change. Was a new field added to this struct internally?

@netal
Copy link
Contributor Author

netal commented Oct 14, 2021

No. The "Type" field is an internal field which gets inherited from the base class of SetPolicy. All our automated testing calls HNS APIs directly and the field name is "PolicyType" in our internal mars file. Hence this bug was not caught through that. Once Azure NPM started using SetPolicy though hcsshim, they caught this bug.

@dcantah
Copy link
Contributor

dcantah commented Oct 25, 2021

@kevpar Do the new changes look alright?

@vakalapa
Copy link

vakalapa commented Nov 9, 2021

@netal or @dcantah or @kevpar any ETA on when this PR will be merged and released ?

@dcantah
Copy link
Contributor

dcantah commented Nov 10, 2021

@vakalapa @netal Sorry for the delay, this looks fine to us. Going to squash the commits and check in shortly

@vakalapa
Copy link

vakalapa commented Dec 3, 2021

@dcantah when can we have a release with this version ?

princepereira pushed a commit to princepereira/hcsshim that referenced this pull request Aug 28, 2024
Add json struct tag to SetPolicyType's Type field

The "Type" fieldname was interfering with an internal "Type" field. Added a struct tag to marshal it as "PolicyType" instead.

Signed-off-by: netal <[email protected]>
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.

4 participants