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

remove unused code paths #4758

Merged
merged 1 commit into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions pkg/catalog/outbound_traffic_policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package catalog

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

"github.com/openservicemesh/osm/pkg/constants"
"github.com/openservicemesh/osm/pkg/errcode"
Expand Down Expand Up @@ -174,14 +173,6 @@ func (mc *MeshCatalog) ListOutboundServicesForIdentity(serviceIdentity identity.
return allowedServices
}

func (mc *MeshCatalog) getDestinationServicesFromTrafficTarget(t *access.TrafficTarget) []service.MeshService {
sa := identity.K8sServiceAccount{
Name: t.Spec.Destination.Name,
Namespace: t.Spec.Destination.Namespace,
}
return mc.getServicesForServiceIdentity(sa.ToServiceIdentity())
}

// listAllowedUpstreamServicesIncludeApex returns a list of services the given downstream service identity
// is authorized to communicate with, including traffic split apex services that are not backed by
// pods as well as other sibling pods from the same headless service.
Expand Down
58 changes: 0 additions & 58 deletions pkg/catalog/outbound_traffic_policies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,64 +708,6 @@ func TestListOutboundServicesForIdentity(t *testing.T) {
}
}

func TestGetDestinationServicesFromTrafficTarget(t *testing.T) {
assert := tassert.New(t)
mockCtrl := gomock.NewController(t)
defer mockCtrl.Finish()

mockKubeController := k8s.NewMockController(mockCtrl)
mockEndpointProvider := endpoint.NewMockProvider(mockCtrl)
mockServiceProvider := service.NewMockProvider(mockCtrl)

mc := MeshCatalog{
kubeController: mockKubeController,
endpointsProviders: []endpoint.Provider{mockEndpointProvider},
serviceProviders: []service.Provider{mockServiceProvider},
}

destSA := identity.K8sServiceAccount{
Name: "bookstore",
Namespace: "bookstore-ns",
}

destMeshService := service.MeshService{
Name: "bookstore",
Namespace: "bookstore-ns",
}

destK8sService := tests.NewServiceFixture(destMeshService.Name, destMeshService.Namespace, map[string]string{})
mockServiceProvider.EXPECT().GetServicesForServiceIdentity(destSA.ToServiceIdentity()).Return([]service.MeshService{destMeshService}).AnyTimes()
mockEndpointProvider.EXPECT().GetID().Return("fake").AnyTimes()
mockServiceProvider.EXPECT().GetID().Return("fake").AnyTimes()
mockKubeController.EXPECT().GetService(destMeshService).Return(destK8sService).AnyTimes()

trafficTarget := &access.TrafficTarget{
TypeMeta: metav1.TypeMeta{
APIVersion: "access.smi-spec.io/v1alpha3",
Kind: "TrafficTarget",
},
ObjectMeta: metav1.ObjectMeta{
Name: "target",
Namespace: "bookstore-ns",
},
Spec: access.TrafficTargetSpec{
Destination: access.IdentityBindingSubject{
Kind: "Name",
Name: "bookstore",
Namespace: "bookstore-ns",
},
Sources: []access.IdentityBindingSubject{{
Kind: "Name",
Name: "bookbuyer",
Namespace: "default",
}},
},
}

actual := mc.getDestinationServicesFromTrafficTarget(trafficTarget)
assert.Equal([]service.MeshService{destMeshService}, actual)
}

func TestListAllowedUpstreamServicesIncludeApex(t *testing.T) {
testCases := []struct {
name string
Expand Down
25 changes: 0 additions & 25 deletions pkg/envoy/ads/response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
. "github.com/onsi/gomega"

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

Context("Test makeRequestForAllSecrets()", func() {
It("returns service cert", func() {

actual := makeRequestForAllSecrets(proxy, mc)
expected := &xds_discovery.DiscoveryRequest{
TypeUrl: string(envoy.TypeSDS),
ResourceNames: []string{
secrets.SDSCert{
// Proxy's own cert to present to peer during mTLS/TLS handshake
Name: proxySvcAccount.String(),
CertType: secrets.ServiceCertType,
}.String(),
secrets.SDSCert{
// Validation certificate for mTLS when this proxy is an upstream
Name: proxySvcAccount.String(),
CertType: secrets.RootCertTypeForMTLSInbound,
}.String(),
},
}
Expect(actual).ToNot(BeNil())
Expect(actual).To(Equal(expected))
})
})

Context("Test sendAllResponses()", func() {

certManager := tresorFake.NewFake(nil)
Expand Down
73 changes: 0 additions & 73 deletions pkg/envoy/ads/secrets.go

This file was deleted.

136 changes: 0 additions & 136 deletions pkg/envoy/ads/secrets_test.go

This file was deleted.

9 changes: 0 additions & 9 deletions pkg/envoy/sds/errors.go

This file was deleted.

Loading