Skip to content

Commit

Permalink
removing references for CIDR (openservicemesh#1900)
Browse files Browse the repository at this point in the history
The PR removes redundant CIDR code
  • Loading branch information
snehachhabria authored Oct 22, 2020
1 parent a91ccad commit d59ca65
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 73 deletions.
1 change: 0 additions & 1 deletion cmd/cli/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ var (
testCertManagerIssuerGroup = "example.co.uk"
testCABundleSecretName = "osm-ca-bundle"
testRetentionTime = "5d"
testMeshCIDR = "10.20.0.0/16"
testEnvoyLogLevel = "error"
)

Expand Down
38 changes: 0 additions & 38 deletions pkg/envoy/lds/listener.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package lds

import (
"net"
"strconv"
"strings"

xds_core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
xds_listener "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
xds_hcm "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3"
Expand All @@ -14,7 +10,6 @@ import (

"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/any"
"github.com/golang/protobuf/ptypes/wrappers"

"github.com/openservicemesh/osm/pkg/catalog"
"github.com/openservicemesh/osm/pkg/configurator"
Expand Down Expand Up @@ -120,39 +115,6 @@ func buildEgressFilterChain() (*xds_listener.FilterChain, error) {
}, nil
}

func parseCIDR(cidr string) (string, uint32, error) {
var addr string

_, _, err := net.ParseCIDR(cidr)
if err != nil {
return addr, 0, err
}
chunks := strings.Split(cidr, "/")
addr = chunks[0]
prefix, err := strconv.Atoi(chunks[1])
if err != nil {
return addr, 0, err
}

return addr, uint32(prefix), nil
}

func getCIDRRange(cidr string) (*xds_core.CidrRange, error) {
addr, prefix, err := parseCIDR(cidr)
if err != nil {
return nil, err
}

cidrRange := &xds_core.CidrRange{
AddressPrefix: addr,
PrefixLen: &wrappers.UInt32Value{
Value: prefix,
},
}

return cidrRange, nil
}

// getOutboundFilterForService builds a network filter action for traffic destined to a specific service
func getOutboundFilterForService(dstSvc service.MeshService, cfg configurator.Configurator) (*xds_listener.Filter, error) {
var marshalledFilter *any.Any
Expand Down
16 changes: 0 additions & 16 deletions pkg/envoy/lds/listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,6 @@ var _ = Describe("Construct inbound listeners", func() {
Expect(listener.TrafficDirection).To(Equal(xds_core.TrafficDirection_INBOUND))
})
})

Context("Test parseCIDR", func() {
It("Tests that a valid CIDR is parsed correctly", func() {
cidr := "10.2.0.0/24"
addr, prefix, err := parseCIDR(cidr)
Expect(err).ToNot(HaveOccurred())
Expect(addr).To(Equal("10.2.0.0"))
Expect(prefix).To(Equal(uint32(24)))
})

It("Tests that an invalid CIDR returns an error", func() {
cidr := "10.2.0.0/99"
_, _, err := parseCIDR(cidr)
Expect(err).To(HaveOccurred())
})
})
})

var _ = Describe("Test getHTTPConnectionManager", func() {
Expand Down
18 changes: 0 additions & 18 deletions scripts/get_mesh_cidr.sh

This file was deleted.

0 comments on commit d59ca65

Please sign in to comment.