Skip to content

Conversation

@vakalapa
Copy link
Contributor

@vakalapa vakalapa commented Oct 7, 2021

This PR includes changes to distinguish different kinds of IPSets by expanding on existing prefixes we use. This PR also updates the existing Dataplane APIs now to take in IPSetMetaData struct instead of strings

// Prefixes for ipsets
NamedPortIPSetPrefix string = "namedport:"
NamespacePrefix      string = "ns-"
NamespaceLabelPrefix string = "nslabel-"
PodLabelPrefix       string = "podlabel-"
CIDRPrefix           string = "cidr-"
NestedLabelPrefix    string = "nestedlabel-"

Copy link
Contributor

@huntergregory huntergregory left a comment

Choose a reason for hiding this comment

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

Changes look great. Noted a couple things about dataplane

// Check if any 2nd level IPSets are generated by Controller with members
// Apply members to the list set
if set.Kind == ipsets.ListSet {
if ipsets.GetSetKind(set.Metadata.Type) == ipsets.ListSet {
Copy link
Contributor

Choose a reason for hiding this comment

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

mismatched types Type and Kind

Copy link
Contributor

Choose a reason for hiding this comment

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

can we do a check in the first loop to see if len(set.MemberIPSets) > 0, then the metadata Type needs to be a list kind or we throw an error?

Copy link
Contributor

Choose a reason for hiding this comment

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

same comments apply to deleteIPSetsAndReferences

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually we missed a case which if forgot to add, CIDR ipsets can be translated and provided to us, i will need to add CIDR block ips to corresponding IPSets, so we should not be throwing an error if it is not list

Copy link
Contributor

Choose a reason for hiding this comment

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

But a CIDR is a hash set, right? why not make the members/list check still?

IpsetNomatch string = "nomatch"

// Prefixes for ipsets
NamedPortIPSetPrefix string = "namedport:"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason to have ":" instead of "-" for NamedPortIPsetPrefix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We used ":" name for this alone because k8s would not allow adding a ":" in labels. keeping it same in v2 even though there is no other reason apart from being backward compatible

huntergregory
huntergregory previously approved these changes Oct 8, 2021
// Copyright 2017 Microsoft. All rights reserved.
// MIT License

//go:build windows
Copy link
Member

Choose a reason for hiding this comment

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

can we add the _windows suffix to this filename?

@vakalapa vakalapa merged commit dfc70ac into master Oct 11, 2021
@vakalapa vakalapa deleted the vakr/setmanagerupdates branch October 11, 2021 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement npm Related to NPM.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants