errcode

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package errcode defines the error codes for error messages and an explanation of what the error signifies.

Index

Constants

View Source
const (
	// Kind defines the kind for the error code constants
	Kind = "error_code"
)

Variables

View Source
var ErrCodeMap = map[ErrCode]string{}/* 103 elements not displayed */

ErrCodeMap defines the mapping of error codes to their description. Note: error code description mappings must be defined in the same order as they appear in the error code definitions - from lowest to highest ranges in the order they appear within the range.

Functions

func GetErrCodeWithMetric

func GetErrCodeWithMetric(e ErrCode) string

GetErrCodeWithMetric increments the ErrCodeCounter metric for the given error code Returns the error code as a string

Types

type ErrCode

type ErrCode int

ErrCode defines the type to represent error codes

const (
	// ErrInvalidCLIArgument indicates an invalid CLI argument
	ErrInvalidCLIArgument ErrCode = iota + 1000

	// 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

	// ErrFetchingInjectorPod indicates the osm-injector pod resource could not be fetched
	ErrFetchingInjectorPod

	// ErrStartingReconcileManager indicates the controller-runtime Manager failed to start
	ErrStartingReconcileManager

	// ErrStartingIngressClient indicates the Ingress client failed to start
	ErrStartingIngressClient
)

Range 1000-1050 is reserved for errors related to application startup or bootstrapping

const (
	// ErrDedupEgressTrafficMatches indicates an error related to deduplicating egress traffic matches
	ErrDedupEgressTrafficMatches ErrCode = iota + 2000

	// ErrDedupEgressClusterConfigs indicates an error related to deduplicating egress cluster configs
	ErrDedupEgressClusterConfigs

	// ErrInvalidEgressIPRange indicates the IP address range specified in an egress policy is invalid
	ErrInvalidEgressIPRange

	// ErrInvalidEgressMatches indicates the matches specified in an egress policy is invalid
	ErrInvalidEgressMatches

	// ErrEgressSMIHTTPRouteGroupNotFound indicates the SMI HTTPRouteGroup specified in the egress policy was not found
	ErrEgressSMIHTTPRouteGroupNotFound

	// ErrFetchingSMIHTTPRouteGroupForTrafficTarget indicates the SMI HTTPRouteGroup specified as a match in an SMI
	// TrafficTarget resource was not able to be retrieved
	ErrFetchingSMIHTTPRouteGroupForTrafficTarget

	// ErrSMIHTTPRouteGroupNoMatch indicates the SMI HTTPRouteGroup resource has no matches specified
	ErrSMIHTTPRouteGroupNoMatch

	// ErrMultipleSMISplitPerServiceUnsupported indicates multiple SMI split policies per service exists and is not supported
	ErrMultipleSMISplitPerServiceUnsupported

	// 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

	// ErrInvalidDestinationKind indicates an applied SMI TrafficTarget policy has an invalid destination kind
	ErrInvalidDestinationKind

	// ErrInvalidSourceKind	indicated an applied SMI TrafficTarget policy has an invalid source kind
	ErrInvalidSourceKind
)

Range 2000-2500 is reserved for errors related to traffic policies

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

	// ErrMarshallingKubernetesResource indicates that a Kubernetes resource could not be marshalled
	ErrMarshallingKubernetesResource

	// ErrUnmarshallingKubernetesResource indicates that a Kubernetes resource could not be unmarshalled
	ErrUnmarshallingKubernetesResource
)

Range 3000-3500 is reserved for errors related to k8s constructs (service accounts, namespaces, etc.)

const (
	// ErrFetchingCertSecret indicates a secret containing a certificate could not be fetched
	ErrFetchingCertSecret ErrCode = iota + 4000

	// ErrObtainingCertFrom indicates a certificate could not be obtained from a secret
	ErrObtainingCertFromSecret

	// ErrObtainingPrivateKeyFromSecret indicates the certificate's private key could not be obtained from a secret
	ErrObtainingPrivateKeyFromSecret

	// ErrObtainingCertExpirationFromSecret indicates the certificate's expiration could not be obtained from a secret
	ErrObtainingCertExpirationFromSecret

	// ErrParsingCertExpiration indicates the certificate's expiration could not be parsed
	ErrParsingCertExpiration

	// ErrCreatingCertSecret indicates the secret to containing a certificate could not be created
	ErrCreatingCertSecret

	// ErrGeneratingPrivateKey indicates a private key could not be generated
	ErrGeneratingPrivateKey

	// ErrEncodingKeyDERtoPEM indicates a private key could not be encoded from DER to PEM
	ErrEncodingKeyDERtoPEM

	// 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

	// ErrEncodingCertDERtoPEM indicates a certificate could not be encoded from DER to PEM
	ErrEncodingCertDERtoPEM

	// ErrDecodingPEMCert indicates a PEM certificate could not be decoded
	ErrDecodingPEMCert

	// ErrDecodingPEMPrivateKey indicates a PEM private key for a certificate could not be decoded
	ErrDecodingPEMPrivateKey

	// ErrIssuingCert indicates a nonspecific failure to issue a certificate
	ErrIssuingCert

	// ErrCreatingCert indicates certificate creation failed when issuing a certificate
	ErrCreatingCert

	// ErrInvalidCA indicates an invalid certificate authority was provided when attempting to issue a certificate
	ErrInvalidCA

	// ErrRotatingCert indicates a certificate could not be rotated
	ErrRotatingCert
)

Range 4000-4100 reserved for errors related to certificate providers

const (
	// ErrMeshConfigInformerInitCache indicates failed to init cache sync for MeshConfig informer
	ErrMeshConfigInformerInitCache ErrCode = iota + 4150

	// ErrMeshConfigStructParsing indicates failed to cast object to MeshConfig
	ErrMeshConfigStructCasting

	// ErrMeshConfigFetchFromCache indicates failed to fetch MeshConfig from cache with specific key
	ErrMeshConfigFetchFromCache

	// ErrMeshConfigMarshaling indicates failed to marshal MeshConfig into other format like JSON
	ErrMeshConfigMarshaling
)

Range 4150-4200 reserved for MeshConfig related errors

const (
	// ErrMarshallingXDSResource indicates an XDS resource could not be marshalled
	ErrMarshallingXDSResource ErrCode = iota + 5000

	// ErrParsingXDSCertCN indicates the configured XDS certificate common name could not be parsed
	ErrParsingXDSCertCN

	// ErrFetchingPodFromCert indicates the proxy UUID obtained from a certificate's common name metadata was not
	// found as a osm-proxy-uuid label value for any pod
	ErrFetchingPodFromCert

	// ErrPodBelongsToMultipleServices indicates a pod in the mesh belongs to more than one service
	ErrPodBelongsToMultipleServices

	// ErrGettingProxyFromPod indicates the proxy data structure could not be obtained from the osm-proxy-uuid
	// label value on a pods
	ErrGettingProxyFromPod

	// ErrGRPCConnectionFailed indicates discovery requests cannot be received by ADS due to a GRPC connection failure
	ErrGRPCConnectionFailed

	// ErrSendingDiscoveryResponse indicates the configured discovery response could not be sent
	ErrSendingDiscoveryResponse

	// ErrGeneratingReqResource indicates the resources for the discovery response could not be generated
	ErrGeneratingReqResource

	// ErrRecordingSnapshot indicates the aggregated resources generate for a discovery response could not be created
	ErrRecordingSnapshot

	// ErrGettingServiceIdentity indicates the ServiceIdentity name encoded in the XDS certificate CN could not be
	// obtained
	ErrGettingServiceIdentity

	// ErrStartingADSServer indicates the gPRC service failed to start
	ErrStartingADSServer

	// ERRInitializingProxy indicates an instance of the Envoy proxy that connected to the XDS server could not be
	// initialized
	ErrInitializingProxy

	// ErrMismatchedServiceAccount inicates the ServiceAccount referenced in the NodeID does not match the
	// ServiceAccount specified in the proxy certificate
	ErrMismatchedServiceAccount

	// ErrGRPCStreamClosedByProxy indicates the gRPC stream was closed by the proxy
	ErrGRPCStreamClosedByProxy

	// ErrUnexpectedXDSRequest indicates that a proxy has not completed its init phase and is not ready to
	// receive updates
	ErrUnexpectedXDSRequest

	// ErrInvalidXDSTypeURI indicates the TypeURL of the discovery request is invalid
	ErrInvalidXDSTypeURI

	// ErrParsingDiscoveryReqVersion indicates the discovery request response version could not be parsed
	ErrParsingDiscoveryReqVersion

	// ErrGettingOrgDstEgressCluster indicates that an Envoy egress cluster that routes traffic to its original destination could not be configured
	ErrGettingOrgDstEgressCluster

	// ErrGettingDNSEgressCluster indicates that an Envoy egress cluster that routes traffic based on the specified Host resolved using DNS could not be configured
	ErrGettingDNSEgressCluster

	// ErrObtainingUpstreamServiceCluster indicates an Envoy cluster corresponding to an upstream service could not be configured
	ErrObtainingUpstreamServiceCluster

	// 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

	// ErrUnsupportedProtocolForService indicates a port's corresponding application protocol is not supported
	ErrUnsupportedProtocolForService

	// ErrBuildingRBACPolicy indicates the XDS RBAC policy could not be created from a given traffic target policy
	ErrBuildingRBACPolicy

	// 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

	// ErrUnmarshallingSDSCert indicates the SDS certificate resource could not be unmarshalled
	ErrUnmarshallingSDSCert

	// ErrGettingServiceCertSecret indicates a XDS secret containing a TLS certificate could not be retrieved
	ErrGettingServiceCertSecret

	// ErrGettingMeshService indicates a SDS secret does not correspond to a MeshService
	ErrGettingMeshService

	// ErrGettingK8sServiceAccount indicates a SDS secret does not correspond to a ServiceAccount
	ErrGettingK8sServiceAccount

	// ErrSDSCertMismatch indicates the indentity obtained from the SDSCert request does not match the identity of the proxy
	ErrSDSCertMismatch
)

Range 5000-5500 reserved for errors related to Envoy XDS control plane

const (
	// ErrMarshallingProtoToYAML indicates a ProtoMessage could not be converted into YAML
	ErrMarshallingProtoToYAML ErrCode = iota + 6100

	// ErrParsingMutatingWebhookCert indicates the mutating webhook certificate could not be parsed
	ErrParsingMutatingWebhookCert

	// ErrStartingInjectionWebhookHTTPServer indicates the sidecar injection webhook HTTP server failed to start
	ErrStartingInjectionWebhookHTTPServer

	// ErrDecodingAdmissionReqBody indicates the admission request received by the mutating webhook could not be decoded
	ErrDecodingAdmissionReqBody

	// ErrParsingReqTimeout indicates an admission request timeout could not be parsed
	ErrParsingReqTimeout

	// ErrInvalidAdmissionReqHeader indicates the received admission request's header was invalid
	ErrInvalidAdmissionReqHeader

	// ErrWritingAdmissionResp indicates the response to an admission request could not be written
	ErrWritingAdmissionResp

	// ErrNilAdmissionReq indicates the received admission request was nil
	ErrNilAdmissionReq

	// ErrDeterminingPodInjectionEnablement indicates the enablement of a pod for sidecar injection could not be determined
	ErrDeterminingPodInjectionEnablement

	// ErrDeterminingNamespaceInjectionEnablement indicates the enablement of a namespace for sidecar injection could not
	// be determined
	ErrDeterminingNamespaceInjectionEnablement

	// ErrDeterminingPodPortExclusions indicates the oubound port exclusions for a pod could not be obtained
	ErrDeterminingPodPortExclusions

	// ErrUpdatingMutatingWebhookCABundle indicates the MutatingWebhookConfiguration could not be patched with the CA Bundle
	ErrUpdatingMutatingWebhookCABundle

	// ErrReadingAdmissionReqBody indicates the AdmissionRequest body could not be read
	ErrReadingAdmissionReqBody

	// ErrNilAdmissionReqBody indicates the admissionRequest body was nil
	ErrNilAdmissionReqBody
)

Range 6000-6500 reserved for errors related to the OSM Injector

const (
	// ErrShuttingDownValidatingWebhookHTTPServer indicates an error occurred when shutting down the validating webhook
	// HTTP server
	ErrShuttingDownValidatingWebhookHTTPServer ErrCode = iota + 6700

	// ErrStartingValidatingWebhookHTTPServer indicates the validating webhook HTTP server failed to start
	ErrStartingValidatingWebhookHTTPServer

	// ErrUpdatingValidatingWebhookCABundle indicates the MutatingWebhookConfiguration could not be patched with the CA Bundle
	ErrUpdatingValidatingWebhookCABundle

	// ErrParsingWebhookCert indicates the validating webhook certificate could not be parsed
	ErrParsingValidatingWebhookCert
)

Range 6700-6800 reserved for errors related to the validating webhook

const (
	// ErrPubSubMessageFormat indicates error when parsing an object to a pubsub message
	ErrPubSubMessageFormat ErrCode = iota + 4100
)

Range 4100-4150 reserved for PubSub system

func FromStr

func FromStr(e string) (ErrCode, error)

FromStr returns the ErrCode representation for the given error code string Ex. E1000 is converted to ErrInvalidCLIArgument

func (ErrCode) String

func (e ErrCode) String() string

String returns the error code as a string, ex. E1000

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL