grpc

package
v0.0.0-...-1e8dc9b Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearGrpcDisruptions

func ClearGrpcDisruptions(client pb.DisruptionListenerClient) error

ClearGrpcDisruptions executes a ResetDisruptions call on the provided DisruptionListenerClient

func GenerateEndpointSpecs

func GenerateEndpointSpecs(endpoints []chaosv1beta1.EndpointAlteration) []*pb.EndpointSpec

GenerateEndpointSpecs converts a slice of EndpointAlterations into a slice of EndpointSpecs which can be sent through gRPC call to disruptionListener

func SendGrpcDisruption

func SendGrpcDisruption(client pb.DisruptionListenerClient, spec chaosv1beta1.GRPCDisruptionSpec) error

SendGrpcDisruption takes in a CRD specification for GRPC disruptions and executes a Disrupt call on the provided DisruptionListenerClient

Types

type ChaosDisruptionListener

type ChaosDisruptionListener struct {
	pb.UnimplementedDisruptionListenerServer
	// contains filtered or unexported fields
}

ChaosDisruptionListener is a gRPC Service that can disrupt endpoints of a gRPC server. The interface it is implementing was generated in the grpc/disruptionlistener package.

func NewDisruptionListener

func NewDisruptionListener(logger *zap.SugaredLogger) *ChaosDisruptionListener

NewDisruptionListener creates a new DisruptionListener Service with the logger instantiated and DisruptionConfiguration set to be empty

func (*ChaosDisruptionListener) ChaosServerInterceptor

func (d *ChaosDisruptionListener) ChaosServerInterceptor(ctx context.Context, req interface{},
	info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (response interface{}, err error)

ChaosServerInterceptor is a function which can be registered on instantiation of a gRPC server to intercept all traffic to the server and crosscheck their endpoints to disrupt them.

func (*ChaosDisruptionListener) Disrupt

Disrupt receives a disruption specification and configures the interceptor to spoof responses to specified endpoints.

func (*ChaosDisruptionListener) ResetDisruptions

ResetDisruptions removes all configured endpoint alterations for DisruptionListener.

Directories

Path Synopsis
Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.

Jump to

Keyboard shortcuts

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