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

Commit

Permalink
errcode: remove unused error codes (#4077)
Browse files Browse the repository at this point in the history
A lot of unused error paths were cleaned up as a
part of refactoring efforts. This change removes
unused error codes.

Signed-off-by: Shashank Ram <[email protected]>
  • Loading branch information
shashankram authored Sep 7, 2021
1 parent 0288571 commit ed71553
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 87 deletions.
7 changes: 5 additions & 2 deletions pkg/envoy/eds/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/openservicemesh/osm/pkg/endpoint"
"github.com/openservicemesh/osm/pkg/envoy"
"github.com/openservicemesh/osm/pkg/envoy/registry"
"github.com/openservicemesh/osm/pkg/errcode"
"github.com/openservicemesh/osm/pkg/identity"
"github.com/openservicemesh/osm/pkg/service"
)
Expand Down Expand Up @@ -50,7 +51,8 @@ func fulfillEDSRequest(meshCatalog catalog.MeshCataloger, proxy *envoy.Proxy, re
}
endpoints := meshCatalog.ListAllowedUpstreamEndpointsForService(proxyIdentity, meshSvc)
if len(endpoints) == 0 {
log.Error().Msgf("Endpoints not found for upstream cluster %s for proxy identity %s, skipping cluster in EDS response", cluster, proxyIdentity)
log.Error().Str(errcode.Kind, errcode.GetErrCodeWithMetric(errcode.ErrEndpointsNotFound)).
Msgf("Endpoints not found for upstream cluster %s for proxy identity %s, skipping cluster in EDS response", cluster, proxyIdentity)
continue
}
log.Trace().Msgf("Endpoints for upstream cluster %s for downstream proxy identity %s: %v", cluster, proxyIdentity, endpoints)
Expand Down Expand Up @@ -118,7 +120,8 @@ func getUpstreamEndpointsForProxyIdentity(meshCatalog catalog.MeshCataloger, pro
for _, dstSvc := range meshCatalog.ListOutboundServicesForIdentity(proxyIdentity) {
endpoints := meshCatalog.ListAllowedUpstreamEndpointsForService(proxyIdentity, dstSvc)
if len(endpoints) == 0 {
log.Error().Msgf("Endpoints not found for upstream MeshService %s for proxy identity %s, skipping cluster in EDS response", dstSvc, proxyIdentity)
log.Error().Str(errcode.Kind, errcode.GetErrCodeWithMetric(errcode.ErrEndpointsNotFound)).
Msgf("Endpoints not found for upstream MeshService %s for proxy identity %s, skipping cluster in EDS response", dstSvc, proxyIdentity)
continue
}
allowedServicesEndpoints[dstSvc] = endpoints
Expand Down
86 changes: 1 addition & 85 deletions pkg/errcode/errcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ const (
// ErrSettingLogLevel indicates the specified log level could not be set
ErrSettingLogLevel

// ErrParsingMeshConfig indicates the MeshConfig resource could not be parsed
ErrParsingMeshConfig

// ErrFetchingControllerPod indicates the osm-controller pod resource could not be fetched
ErrFetchingControllerPod

Expand Down Expand Up @@ -74,9 +71,6 @@ const (
// ErrAddingRouteToOutboundTrafficPolicy indicates there was an error adding a route to an outbound traffic policy
ErrAddingRouteToOutboundTrafficPolicy

// ErrFetchingServiceForTrafficTargetDestination indicates an error retrieving services associated with a TrafficTarget destination
ErrFetchingServiceForTrafficTargetDestination

// ErrGettingInboundTrafficTargets indicates the inbound traffic targets composed of its routes for a given
// desitination ServiceIdentity could not be obtained
ErrGettingInboundTrafficTargets
Expand All @@ -90,23 +84,8 @@ const (

// Range 3000-3500 is reserved for errors related to k8s constructs (service accounts, namespaces, etc.)
const (
// ErrServiceHostnames indicates the hostnames associated with a service could not be computed
ErrServiceHostnames ErrCode = iota + 3000

// ErrNoMatchingServiceForServiceAccount indicates there are no services associated with the service account
ErrNoMatchingServiceForServiceAccount

// ErrGettingResolvableServiceEndpoints indicates the resolvable set of endpoints over which the service is accessible using its FQDN cannot be obtained
ErrGettingResolvableServiceEndpoints

// ErrEndpointsNotFound indicates resolvable service endpoints could not be found
ErrEndpointsNotFound

// ErrGettingServicePorts indicates the mapping of a service's ports to their corresponding application protocol could not be obtained
ErrGettingServicePorts

// ErrGettingServiceIdentitiesForService indicates the ServiceIdentities associated with a specified MeshService could not be listed
ErrGettingServiceIdentitiesForService
ErrEndpointsNotFound = iota + 3000

// ErrMarshallingKubernetesResource indicates that a Kubernetes resource could not be marshalled
ErrMarshallingKubernetesResource
Expand Down Expand Up @@ -144,9 +123,6 @@ const (
// ErrCreatingCertReq indicates a certificate request could not be created
ErrCreatingCertReq

// ErrDeletingcertReq indicates a certificate request could not be deleted
ErrDeletingCertReq

// ErrdeletingCertReq inicates that the issue certificate request could not be deleted
ErrCreatingRootCert

Expand Down Expand Up @@ -264,9 +240,6 @@ const (
// ErrFetchingServiceList indicates the services corresponding to a specified proxy could not be listed
ErrFetchingServiceList

// ErrGettingLocalServiceCluster indicates that an Envoy cluster for a local service behind the Envoy proxy could not be configured
ErrGettingLocalServiceCluster

// ErrDuplicateluster indicates Envoy clusters with the same name were found
ErrDuplicateClusters

Expand All @@ -279,12 +252,6 @@ const (
// ErrIngressFilterChain indicates there an error related to an ingress filter chain
ErrIngressFilterChain

// ErrGettingLuaFilter indicates the Lua XDS HttpFilter could not be configured
ErrGettingLuaFilter

// ErrGettingWASMFilter indicates the WASM XDS HttpFilter could not be configured
ErrGettingWASMFilter

// ErrBuildingRBACPolicyForRoute indicates a traffic policy rule could not be configured as an RBAC rule on a proxy
ErrBuildingRBACPolicyForRoute

Expand Down Expand Up @@ -403,10 +370,6 @@ An invalid command line argument was passed to the application.

ErrSettingLogLevel: `
The specified log level could not be set in the system.
`,

ErrParsingMeshConfig: `
The 'osm-mesh-config' MeshConfig custom resource could not be parsed.
`,

ErrFetchingControllerPod: `
Expand Down Expand Up @@ -486,12 +449,6 @@ referring the same apex service are ignored.
There was an error adding a route match to an outbound traffic policy representation
within the system.
The associated route was ignored by the system.
`,

ErrFetchingServiceForTrafficTargetDestination: `
The system was unable to lookup the services associated with the destination specified
in the SMI TrafficTarget policy.
The associated SMI TrafficTarget policy was ignored by the system.
`,

ErrInvalidDestinationKind: `
Expand All @@ -510,33 +467,8 @@ ServiceIdentity could not be configured.
//
// Range 3000-3500
//
ErrServiceHostnames: `
The hostnames (FQDN) used to access the k8s service could not be retrieved by the system.
Any HTTP traffic policy associated with this service was ignored by the system.
`,

ErrNoMatchingServiceForServiceAccount: `
The system expected k8s services to be associated with a service account, but no such
service was found. A service matches a service account if the pods backing the service
belong to the service account.
`,

ErrGettingResolvableServiceEndpoints: `
The expexted endpoints that are reached when the service's FQDN is resolved could not be
retrieved by the system.
`,

ErrGettingServicePorts: `
The mapping of ports the application is exposing a service on to their corresponding
application protocol could not be obtained for a specified service.
`,

ErrEndpointsNotFound: `
The system found 0 endpoints to be reached when the service's FQDN was resolved.
`,

ErrGettingServiceIdentitiesForService: `
The ServiceIdentities associated with a specified MeshService could not be listed.
`,

ErrMarshallingKubernetesResource: `
Expand Down Expand Up @@ -586,10 +518,6 @@ PEM encoded key.

ErrCreatingCertReq: `
The certificate request fails to be created when attempting to issue a certificate.
`,

ErrDeletingCertReq: `
The certificate request could not be deleted.
`,

ErrCreatingRootCert: `
Expand Down Expand Up @@ -757,10 +685,6 @@ configured.

ErrFetchingServiceList: `
The meshed services corresponding a specified Envoy proxy could not be listed.
`,

ErrGettingLocalServiceCluster: `
An Envoy cluster for a local service behind an Envoy proxy could not be configured.
`,

ErrDuplicateClusters: `
Expand All @@ -780,14 +704,6 @@ policy.

ErrIngressFilterChain: `
An XDS filter chain could not be constructed for ingress.
`,

ErrGettingLuaFilter: `
The Lua XDS HttpFilter could not be configured.
`,

ErrGettingWASMFilter: `
The WASM XDS HttpFilter could not be configured.
`,

ErrBuildingRBACPolicyForRoute: `
Expand Down

0 comments on commit ed71553

Please sign in to comment.