chaos_infrastructure

package
v0.0.0-...-bcdb799 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: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CIVersion specifies the version tag used for ci builds
	CIVersion             = "ci"
	ClusterScope   string = "cluster"
	NamespaceScope string = "namespace"
)

Variables

This section is empty.

Functions

func GetEndpoint

func GetEndpoint(agentType string) (string, error)

func GetK8sInfraYaml

func GetK8sInfraYaml(infra dbChaosInfra.ChaosInfra) ([]byte, error)

func InfraCreateJWT

func InfraCreateJWT(id string) (string, error)

InfraCreateJWT generates jwt used in chaos_infra registration

func InfraValidateJWT

func InfraValidateJWT(token string) (string, error)

InfraValidateJWT validates the chaos_infra jwt

func ManifestParser

func ManifestParser(infra dbChaosInfra.ChaosInfra, rootPath string, config *SubscriberConfigurations) ([]byte, error)

ManifestParser parses manifests yaml and generates dynamic manifest with specified keys

func SendExperimentToSubscriber

func SendExperimentToSubscriber(projectID string, workflow *model.ChaosExperimentRequest, username *string, externalData *string, reqType string, r *store.StateData)

SendExperimentToSubscriber sends the workflow to the subscriber to be handled

func SendRequestToSubscriber

func SendRequestToSubscriber(subscriberRequest SubscriberRequests, r store.StateData)

SendRequestToSubscriber sends events from the graphQL server to the subscribers listening for the requests

Types

type KubeObjData

type KubeObjData struct {
	Namespace string       `json:"namespace"`
	Data      []ObjectData `json:"data"`
}

type ObjectData

type ObjectData struct {
	Name                    string            `json:"name"`
	UID                     types.UID         `json:"uid"`
	Namespace               string            `json:"namespace"`
	APIVersion              string            `json:"apiVersion"`
	CreationTimestamp       metav1.Time       `json:"creationTimestamp"`
	Containers              []v1.Container    `json:"containers"`
	TerminationGracePeriods *int64            `json:"terminationGracePeriods"`
	Volumes                 []v1.Volume       `json:"volumes"`
	Labels                  map[string]string `json:"labels"`
}

type PodLogData

type PodLogData struct {
	InfraID       string `json:"infraID"`
	WorkflowRunID string `json:"workflowRunID"`
	PodName       string `json:"podName"`
	PodType       string `json:"podType"`
	Log           string `json:"log"`
}

type Service

type Service interface {
	RegisterInfra(c context.Context, projectID string, input model.RegisterInfraRequest) (*model.RegisterInfraResponse, error)
	ConfirmInfraRegistration(request model.InfraIdentity, r store.StateData) (*model.ConfirmInfraRegistrationResponse, error)
	VerifyInfra(identity model.InfraIdentity) (*dbChaosInfra.ChaosInfra, error)
	//NewClusterEvent(request model.NewClusterEventRequest, r store.StateData) (string, error)
	DeleteInfra(ctx context.Context, projectID string, infraId string, r store.StateData) (string, error)
	ListInfras(projectID string, request *model.ListInfraRequest) (*model.ListInfraResponse, error)
	GetInfraDetails(ctx context.Context, infraID string, projectID string) (*model.Infra, error)
	SendInfraEvent(eventType, eventName, description string, infra model.Infra, r store.StateData)
	GetManifest(token string) ([]byte, int, error)
	GetManifestWithInfraID(infraID string, accessKey string) ([]byte, error)
	GetInfra(ctx context.Context, projectID string, infraID string) (*model.Infra, error)
	GetInfraStats(ctx context.Context, projectID string) (*model.GetInfraStatsResponse, error)
	GetVersionDetails() (*model.InfraVersionDetails, error)
	QueryServerVersion(ctx context.Context) (*model.ServerVersionResponse, error)
	PodLog(request model.PodLog, r store.StateData) (string, error)
	KubeObj(request model.KubeObjectData, r store.StateData) (string, error)
	UpdateInfra(query bson.D, update bson.D) error
	GetDBInfra(infraID string) (dbChaosInfra.ChaosInfra, error)
}

func NewChaosInfrastructureService

func NewChaosInfrastructureService(infraOperator *dbChaosInfra.Operator, envOperator *dbEnvironments.Operator) Service

NewChaosInfrastructureService returns a new instance of Service

type SubscriberConfigurations

type SubscriberConfigurations struct {
	ServerEndpoint string
	TLSCert        string
}

type SubscriberRequests

type SubscriberRequests struct {
	RequestType  string  `json:"request_type"`
	K8sManifest  string  `json:"k8s_manifest"`
	ExternalData *string `json:"external_data"`
	ProjectID    string  `json:"project_id"`
	InfraID      string  `json:"infra_id"`
	Namespace    string  `json:"namespace"`
	Username     *string `json:"username"`
}

SubscriberRequests contains the required configurable parameters for the requests sent to the subscriber

Directories

Path Synopsis
model

Jump to

Keyboard shortcuts

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