Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit 8441e17

Browse files
committed
remove unused code paths
Signed-off-by: Sean Teeling <[email protected]>
1 parent ecc4e67 commit 8441e17

File tree

6 files changed

+8
-348
lines changed

6 files changed

+8
-348
lines changed

pkg/catalog/outbound_traffic_policies.go

-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package catalog
22

33
import (
44
mapset "github.com/deckarep/golang-set"
5-
access "github.com/servicemeshinterface/smi-sdk-go/pkg/apis/access/v1alpha3"
65

76
"github.com/openservicemesh/osm/pkg/constants"
87
"github.com/openservicemesh/osm/pkg/errcode"
@@ -174,14 +173,6 @@ func (mc *MeshCatalog) ListOutboundServicesForIdentity(serviceIdentity identity.
174173
return allowedServices
175174
}
176175

177-
func (mc *MeshCatalog) getDestinationServicesFromTrafficTarget(t *access.TrafficTarget) []service.MeshService {
178-
sa := identity.K8sServiceAccount{
179-
Name: t.Spec.Destination.Name,
180-
Namespace: t.Spec.Destination.Namespace,
181-
}
182-
return mc.getServicesForServiceIdentity(sa.ToServiceIdentity())
183-
}
184-
185176
// listAllowedUpstreamServicesIncludeApex returns a list of services the given downstream service identity
186177
// is authorized to communicate with, including traffic split apex services that are not backed by
187178
// pods as well as other sibling pods from the same headless service.

pkg/catalog/outbound_traffic_policies_test.go

-58
Original file line numberDiff line numberDiff line change
@@ -708,64 +708,6 @@ func TestListOutboundServicesForIdentity(t *testing.T) {
708708
}
709709
}
710710

711-
func TestGetDestinationServicesFromTrafficTarget(t *testing.T) {
712-
assert := tassert.New(t)
713-
mockCtrl := gomock.NewController(t)
714-
defer mockCtrl.Finish()
715-
716-
mockKubeController := k8s.NewMockController(mockCtrl)
717-
mockEndpointProvider := endpoint.NewMockProvider(mockCtrl)
718-
mockServiceProvider := service.NewMockProvider(mockCtrl)
719-
720-
mc := MeshCatalog{
721-
kubeController: mockKubeController,
722-
endpointsProviders: []endpoint.Provider{mockEndpointProvider},
723-
serviceProviders: []service.Provider{mockServiceProvider},
724-
}
725-
726-
destSA := identity.K8sServiceAccount{
727-
Name: "bookstore",
728-
Namespace: "bookstore-ns",
729-
}
730-
731-
destMeshService := service.MeshService{
732-
Name: "bookstore",
733-
Namespace: "bookstore-ns",
734-
}
735-
736-
destK8sService := tests.NewServiceFixture(destMeshService.Name, destMeshService.Namespace, map[string]string{})
737-
mockServiceProvider.EXPECT().GetServicesForServiceIdentity(destSA.ToServiceIdentity()).Return([]service.MeshService{destMeshService}).AnyTimes()
738-
mockEndpointProvider.EXPECT().GetID().Return("fake").AnyTimes()
739-
mockServiceProvider.EXPECT().GetID().Return("fake").AnyTimes()
740-
mockKubeController.EXPECT().GetService(destMeshService).Return(destK8sService).AnyTimes()
741-
742-
trafficTarget := &access.TrafficTarget{
743-
TypeMeta: metav1.TypeMeta{
744-
APIVersion: "access.smi-spec.io/v1alpha3",
745-
Kind: "TrafficTarget",
746-
},
747-
ObjectMeta: metav1.ObjectMeta{
748-
Name: "target",
749-
Namespace: "bookstore-ns",
750-
},
751-
Spec: access.TrafficTargetSpec{
752-
Destination: access.IdentityBindingSubject{
753-
Kind: "Name",
754-
Name: "bookstore",
755-
Namespace: "bookstore-ns",
756-
},
757-
Sources: []access.IdentityBindingSubject{{
758-
Kind: "Name",
759-
Name: "bookbuyer",
760-
Namespace: "default",
761-
}},
762-
},
763-
}
764-
765-
actual := mc.getDestinationServicesFromTrafficTarget(trafficTarget)
766-
assert.Equal([]service.MeshService{destMeshService}, actual)
767-
}
768-
769711
func TestListAllowedUpstreamServicesIncludeApex(t *testing.T) {
770712
testCases := []struct {
771713
name string

pkg/envoy/ads/response_test.go

-25
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
. "github.com/onsi/gomega"
1111

1212
xds_auth "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3"
13-
xds_discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
1413
"github.com/golang/mock/gomock"
1514
"github.com/golang/protobuf/ptypes/any"
1615
"github.com/google/uuid"
@@ -97,30 +96,6 @@ var _ = Describe("Test ADS response functions", func() {
9796
Expect(err).ToNot(HaveOccurred())
9897
})
9998

100-
Context("Test makeRequestForAllSecrets()", func() {
101-
It("returns service cert", func() {
102-
103-
actual := makeRequestForAllSecrets(proxy, mc)
104-
expected := &xds_discovery.DiscoveryRequest{
105-
TypeUrl: string(envoy.TypeSDS),
106-
ResourceNames: []string{
107-
secrets.SDSCert{
108-
// Proxy's own cert to present to peer during mTLS/TLS handshake
109-
Name: proxySvcAccount.String(),
110-
CertType: secrets.ServiceCertType,
111-
}.String(),
112-
secrets.SDSCert{
113-
// Validation certificate for mTLS when this proxy is an upstream
114-
Name: proxySvcAccount.String(),
115-
CertType: secrets.RootCertTypeForMTLSInbound,
116-
}.String(),
117-
},
118-
}
119-
Expect(actual).ToNot(BeNil())
120-
Expect(actual).To(Equal(expected))
121-
})
122-
})
123-
12499
Context("Test sendAllResponses()", func() {
125100

126101
certManager := tresorFake.NewFake(nil)

pkg/envoy/ads/secrets.go

-73
This file was deleted.

pkg/envoy/ads/secrets_test.go

-136
This file was deleted.

0 commit comments

Comments
 (0)