Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: abhiraut <rauta@vmware.com>
  • Loading branch information
abhiraut committed Aug 19, 2021
1 parent 1ab6bbd commit 44d6b99
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
7 changes: 3 additions & 4 deletions pkg/apis/controlplane/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
package controlplane

import (
"net"
"strconv"

"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/intstr"
"net"

crdv1alpha1 "antrea.io/antrea/pkg/apis/crd/v1alpha1"
statsv1alpha1 "antrea.io/antrea/pkg/apis/stats/v1alpha1"
Expand Down Expand Up @@ -135,7 +134,7 @@ type IPNet struct {
}

func (ipn IPNet) String() string {
return ipn.IP.String() + "/" + strconv.Itoa(int(ipn.PrefixLength))
return fmt.Sprintf("%s/%d", ipn.IP.String(), ipn.PrefixLength)
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ func (r *REST) Get(ctx context.Context, name string, options *metav1.GetOptions)
if len(ipBlocks) > 0 {
effectiveIPBlocks := make([]controlplane.IPNet, 0, len(ipBlocks))
for _, ipb := range ipBlocks {
// ClusterGroup ipBlock cannot have except slices
// ClusterGroup ipBlock does not support Except slices, so no need to generate an effective
// list of IPs by removing Except slices from allowed CIDR.
effectiveIPBlocks = append(effectiveIPBlocks, ipb.CIDR)
}
memberList.EffectiveIPBlocks = effectiveIPBlocks
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/networkpolicy/clustergroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ func (n *NetworkPolicyController) getAssociatedGroupsByName(grpName string) []an
}

// GetGroupMembers returns the current members of a ClusterGroup.
// If the ClusterGroup is defined by IPBlocks, the returned members will be []controlplane.IPBlock.
// If the ClusterGroup is defined with IPBlocks, the returned members will be []controlplane.IPBlock.
// Otherwise, the returned members will be of type controlplane.GroupMemberSet.
func (n *NetworkPolicyController) GetGroupMembers(cgName string) (controlplane.GroupMemberSet, []controlplane.IPBlock, error) {
groupObj, found, _ := n.internalGroupStore.Get(cgName)
Expand Down

0 comments on commit 44d6b99

Please sign in to comment.