diff --git a/chaoscenter/graphql/definitions/shared/chaos_experiment.graphqls b/chaoscenter/graphql/definitions/shared/chaos_experiment.graphqls index b0794034a0d..246d190ff78 100644 --- a/chaoscenter/graphql/definitions/shared/chaos_experiment.graphqls +++ b/chaoscenter/graphql/definitions/shared/chaos_experiment.graphqls @@ -413,6 +413,14 @@ type ExperimentRun implements Audit { User who has created the experiment run """ createdBy: UserDetails + """ + Notify ID of the experiment run + """ + notifyID: ID + """ + runSequence is the sequence number of experiment run + """ + runSequence: Int! } """ @@ -532,6 +540,10 @@ type RecentExperimentRun implements Audit { User who updated the experiment run """ updatedBy: UserDetails + """ + runSequence is the sequence number of experiment run + """ + runSequence: Int! } """ diff --git a/chaoscenter/graphql/definitions/shared/chaos_experiment_run.graphqls b/chaoscenter/graphql/definitions/shared/chaos_experiment_run.graphqls index 46f859e3b37..44f387555f1 100644 --- a/chaoscenter/graphql/definitions/shared/chaos_experiment_run.graphqls +++ b/chaoscenter/graphql/definitions/shared/chaos_experiment_run.graphqls @@ -2,7 +2,7 @@ extend type Query { """ Returns experiment run based on experiment run ID """ - getExperimentRun(projectID: ID!, experimentRunID: String!): ExperimentRun! + getExperimentRun(projectID: ID!, experimentRunID: ID, notifyID: ID): ExperimentRun! """ Returns the list of experiment run based on various filter parameters diff --git a/chaoscenter/graphql/definitions/shared/chaos_infrastructure.graphqls b/chaoscenter/graphql/definitions/shared/chaos_infrastructure.graphqls index 4d9be202a75..d0c2b4b5a5c 100644 --- a/chaoscenter/graphql/definitions/shared/chaos_infrastructure.graphqls +++ b/chaoscenter/graphql/definitions/shared/chaos_infrastructure.graphqls @@ -121,8 +121,7 @@ type Infra implements ResourceDetails & Audit { } enum InfrastructureType { - INTERNAL - EXTERNAL + Kubernetes } """ diff --git a/chaoscenter/graphql/definitions/shared/probe.graphqls b/chaoscenter/graphql/definitions/shared/probe.graphqls index 2efe852bc3c..a5ab4605cca 100644 --- a/chaoscenter/graphql/definitions/shared/probe.graphqls +++ b/chaoscenter/graphql/definitions/shared/probe.graphqls @@ -217,13 +217,17 @@ input ProbeRequest { """ type: ProbeType! """ + Infrastructure type of the Probe + """ + infrastructureType: InfrastructureType! + """ HTTP Properties of the specific type of the Probe """ - httpProperties: HTTPProbeRequest + kubernetesHTTPProperties: KubernetesHTTPProbeRequest """ CMD Properties of the specific type of the Probe """ - cmdProperties: CMDProbeRequest + kubernetesCMDProperties: KubernetesCMDProbeRequest """ K8S Properties of the specific type of the Probe """ @@ -234,6 +238,57 @@ input ProbeRequest { promProperties: PROMProbeRequest } +""" +Defines the input for Kubernetes HTTP probe properties +""" +input KubernetesHTTPProbeRequest { + """ + Timeout of the Probe + """ + probeTimeout: String! + """ + Interval of the Probe + """ + interval: String! + """ + Retry interval of the Probe + """ + retry: Int + """ + Attempt contains the total attempt count for the probe + """ + attempt: Int + """ + Polling interval of the Probe + """ + probePollingInterval: String + """ + Initial delay interval of the Probe in seconds + """ + initialDelay: String + """ + EvaluationTimeout is the timeout window in which the SLO metrics + """ + evaluationTimeout: String + """ + Is stop on failure enabled in the Probe + """ + stopOnFailure: Boolean + """ + URL of the Probe + """ + url: String! + """ + HTTP method of the Probe + """ + method: MethodRequest! + """ + If Insecure HTTP verification should be skipped + """ + insecureSkipVerify: Boolean +} + + """ Defines the properties of the comparator """ @@ -294,20 +349,28 @@ type ExecutedByExperiment { updatedBy: UserDetails } + """ Defines the Execution History of experiment referenced by the Probe """ type ExecutionHistory { - """ - Fault Status - """ - status: Status! - """ - Fault executed by which experiment - """ - executedByExperiment: ExecutedByExperiment! +""" +Probe Mode +""" +mode: Mode! +""" +Fault Name +""" +faultName: String! +""" +Fault Status +""" +status: Status! +""" +Fault executed by which experiment +""" +executedByExperiment: ExecutedByExperiment! } - """ Defines the Recent Executions of global probe in ListProbe API with different fault and execution history each time """ @@ -369,7 +432,7 @@ type GetProbeReferenceResponse { """ Defines the CMD probe properties """ -type CMDProbe implements CommonProbeProperties { +type KubernetesCMDProbe implements CommonProbeProperties { """ Timeout of the Probe """ @@ -441,13 +504,17 @@ type Probe implements ResourceDetails & Audit { """ type: ProbeType! """ - HTTP Properties of the specific type of the Probe + Infrastructure type of the Probe """ - httpProperties: HTTPProbe + infrastructureType: InfrastructureType! """ - CMD Properties of the specific type of the Probe + Kubernetes HTTP Properties of the specific type of the Probe + """ + kubernetesHTTPProperties: KubernetesHTTPProbe """ - cmdProperties: CMDProbe + Kubernetes CMD Properties of the specific type of the Probe + """ + kubernetesCMDProperties: KubernetesCMDProbe """ K8S Properties of the specific type of the Probe """ @@ -725,9 +792,60 @@ type PROMProbe implements CommonProbeProperties { } """ -Defines the HTTP probe properties +Defines the input for Kubernetes CMD probe properties """ -type HTTPProbe implements CommonProbeProperties { +input KubernetesCMDProbeRequest { + """ + Timeout of the Probe + """ + probeTimeout: String! + """ + Interval of the Probe + """ + interval: String! + """ + Retry interval of the Probe + """ + retry: Int + """ + Attempt contains the total attempt count for the probe + """ + attempt: Int + """ + Polling interval of the Probe + """ + probePollingInterval: String + """ + Initial delay interval of the Probe in seconds + """ + initialDelay: String + """ + EvaluationTimeout is the timeout window in which the SLO metrics + """ + evaluationTimeout: String + """ + Is stop on failure enabled in the Probe + """ + stopOnFailure: Boolean + """ + Command of the Probe + """ + command: String! + """ + Comparator of the Probe + """ + comparator: ComparatorInput! + """ + Source of the Probe + """ + source: String +} + + +""" +Defines the Kubernetes HTTP probe properties +""" +type KubernetesHTTPProbe implements CommonProbeProperties { """ Timeout of the Probe """ @@ -774,6 +892,7 @@ type HTTPProbe implements CommonProbeProperties { insecureSkipVerify: Boolean } + """ Defines the input for CMD probe properties """ @@ -941,7 +1060,7 @@ extend type Query { """ Returns the list of Probes based on various filter parameters """ - listProbes(projectID: ID!, probeNames: [ID!], filter: ProbeFilterInput): [Probe]! + listProbes(projectID: ID!, infrastructureType: InfrastructureType, probeNames: [ID!], filter: ProbeFilterInput): [Probe]! @authorized """ diff --git a/chaoscenter/graphql/server/graph/chaos_experiment_run.resolvers.go b/chaoscenter/graphql/server/graph/chaos_experiment_run.resolvers.go index eb429b2b569..61b4140c5a9 100644 --- a/chaoscenter/graphql/server/graph/chaos_experiment_run.resolvers.go +++ b/chaoscenter/graphql/server/graph/chaos_experiment_run.resolvers.go @@ -53,7 +53,7 @@ func (r *mutationResolver) RunChaosExperiment(ctx context.Context, experimentID return &model.RunChaosExperimentResponse{NotifyID: uiResponse.NotifyID}, err } -func (r *queryResolver) GetExperimentRun(ctx context.Context, projectID string, experimentRunID string) (*model.ExperimentRun, error) { +func (r *queryResolver) GetExperimentRun(ctx context.Context, projectID string, experimentRunID *string, notifyID *string) (*model.ExperimentRun, error) { logFields := logrus.Fields{ "projectId": projectID, "chaosExperimentRunId": experimentRunID, @@ -66,7 +66,7 @@ func (r *queryResolver) GetExperimentRun(ctx context.Context, projectID string, return nil, err } - expRunResponse, err := r.chaosExperimentRunHandler.GetExperimentRun(ctx, projectID, experimentRunID) + expRunResponse, err := r.chaosExperimentRunHandler.GetExperimentRun(ctx, projectID, experimentRunID, notifyID) if err != nil { logrus.WithFields(logFields).Error(err) return nil, err diff --git a/chaoscenter/graphql/server/graph/generated/generated.go b/chaoscenter/graphql/server/graph/generated/generated.go index 3b3f2fb8e7d..f3b0e452904 100644 --- a/chaoscenter/graphql/server/graph/generated/generated.go +++ b/chaoscenter/graphql/server/graph/generated/generated.go @@ -65,20 +65,6 @@ type ComplexityRoot struct { Vendor func(childComplexity int) int } - CMDProbe struct { - Attempt func(childComplexity int) int - Command func(childComplexity int) int - Comparator func(childComplexity int) int - EvaluationTimeout func(childComplexity int) int - InitialDelay func(childComplexity int) int - Interval func(childComplexity int) int - ProbePollingInterval func(childComplexity int) int - ProbeTimeout func(childComplexity int) int - Retry func(childComplexity int) int - Source func(childComplexity int) int - StopOnFailure func(childComplexity int) int - } - ChaosExperimentResponse struct { CronSyntax func(childComplexity int) int ExperimentDescription func(childComplexity int) int @@ -184,6 +170,8 @@ type ComplexityRoot struct { ExecutionHistory struct { ExecutedByExperiment func(childComplexity int) int + FaultName func(childComplexity int) int + Mode func(childComplexity int) int Status func(childComplexity int) int } @@ -228,9 +216,11 @@ type ComplexityRoot struct { FaultsStopped func(childComplexity int) int Infra func(childComplexity int) int IsRemoved func(childComplexity int) int + NotifyID func(childComplexity int) int Phase func(childComplexity int) int ProjectID func(childComplexity int) int ResiliencyScore func(childComplexity int) int + RunSequence func(childComplexity int) int TotalFaults func(childComplexity int) int UpdatedAt func(childComplexity int) int UpdatedBy func(childComplexity int) int @@ -317,20 +307,6 @@ type ComplexityRoot struct { UserName func(childComplexity int) int } - HTTPProbe struct { - Attempt func(childComplexity int) int - EvaluationTimeout func(childComplexity int) int - InitialDelay func(childComplexity int) int - InsecureSkipVerify func(childComplexity int) int - Interval func(childComplexity int) int - Method func(childComplexity int) int - ProbePollingInterval func(childComplexity int) int - ProbeTimeout func(childComplexity int) int - Retry func(childComplexity int) int - StopOnFailure func(childComplexity int) int - URL func(childComplexity int) int - } - ImageRegistry struct { EnableRegistry func(childComplexity int) int ImageRegistryName func(childComplexity int) int @@ -429,6 +405,34 @@ type ComplexityRoot struct { KubeObj func(childComplexity int) int } + KubernetesCMDProbe struct { + Attempt func(childComplexity int) int + Command func(childComplexity int) int + Comparator func(childComplexity int) int + EvaluationTimeout func(childComplexity int) int + InitialDelay func(childComplexity int) int + Interval func(childComplexity int) int + ProbePollingInterval func(childComplexity int) int + ProbeTimeout func(childComplexity int) int + Retry func(childComplexity int) int + Source func(childComplexity int) int + StopOnFailure func(childComplexity int) int + } + + KubernetesHTTPProbe struct { + Attempt func(childComplexity int) int + EvaluationTimeout func(childComplexity int) int + InitialDelay func(childComplexity int) int + InsecureSkipVerify func(childComplexity int) int + Interval func(childComplexity int) int + Method func(childComplexity int) int + ProbePollingInterval func(childComplexity int) int + ProbeTimeout func(childComplexity int) int + Retry func(childComplexity int) int + StopOnFailure func(childComplexity int) int + URL func(childComplexity int) int + } + Link struct { Name func(childComplexity int) int URL func(childComplexity int) int @@ -552,21 +556,22 @@ type ComplexityRoot struct { } Probe struct { - CmdProperties func(childComplexity int) int - CreatedAt func(childComplexity int) int - CreatedBy func(childComplexity int) int - Description func(childComplexity int) int - HTTPProperties func(childComplexity int) int - K8sProperties func(childComplexity int) int - Name func(childComplexity int) int - ProjectID func(childComplexity int) int - PromProperties func(childComplexity int) int - RecentExecutions func(childComplexity int) int - ReferencedBy func(childComplexity int) int - Tags func(childComplexity int) int - Type func(childComplexity int) int - UpdatedAt func(childComplexity int) int - UpdatedBy func(childComplexity int) int + CreatedAt func(childComplexity int) int + CreatedBy func(childComplexity int) int + Description func(childComplexity int) int + InfrastructureType func(childComplexity int) int + K8sProperties func(childComplexity int) int + KubernetesCMDProperties func(childComplexity int) int + KubernetesHTTPProperties func(childComplexity int) int + Name func(childComplexity int) int + ProjectID func(childComplexity int) int + PromProperties func(childComplexity int) int + RecentExecutions func(childComplexity int) int + ReferencedBy func(childComplexity int) int + Tags func(childComplexity int) int + Type func(childComplexity int) int + UpdatedAt func(childComplexity int) int + UpdatedBy func(childComplexity int) int } ProbeRecentExecutions struct { @@ -585,7 +590,7 @@ type ComplexityRoot struct { GetChaosHubStats func(childComplexity int, projectID string) int GetEnvironment func(childComplexity int, projectID string, environmentID string) int GetExperiment func(childComplexity int, projectID string, experimentID string) int - GetExperimentRun func(childComplexity int, projectID string, experimentRunID string) int + GetExperimentRun func(childComplexity int, projectID string, experimentRunID *string, notifyID *string) int GetExperimentRunStats func(childComplexity int, projectID string) int GetExperimentStats func(childComplexity int, projectID string) int GetGitOpsDetails func(childComplexity int, projectID string) int @@ -609,7 +614,7 @@ type ComplexityRoot struct { ListImageRegistry func(childComplexity int, projectID string) int ListInfras func(childComplexity int, projectID string, request *model.ListInfraRequest) int ListPredefinedExperiments func(childComplexity int, hubID string, projectID string) int - ListProbes func(childComplexity int, projectID string, probeNames []string, filter *model.ProbeFilterInput) int + ListProbes func(childComplexity int, projectID string, infrastructureType *model.InfrastructureType, probeNames []string, filter *model.ProbeFilterInput) int ValidateUniqueProbe func(childComplexity int, projectID string, probeName string) int } @@ -625,6 +630,7 @@ type ComplexityRoot struct { ExperimentRunID func(childComplexity int) int Phase func(childComplexity int) int ResiliencyScore func(childComplexity int) int + RunSequence func(childComplexity int) int UpdatedAt func(childComplexity int) int UpdatedBy func(childComplexity int) int } @@ -739,7 +745,7 @@ type QueryResolver interface { GetExperiment(ctx context.Context, projectID string, experimentID string) (*model.GetExperimentResponse, error) ListExperiment(ctx context.Context, projectID string, request model.ListExperimentRequest) (*model.ListExperimentResponse, error) GetExperimentStats(ctx context.Context, projectID string) (*model.GetExperimentStatsResponse, error) - GetExperimentRun(ctx context.Context, projectID string, experimentRunID string) (*model.ExperimentRun, error) + GetExperimentRun(ctx context.Context, projectID string, experimentRunID *string, notifyID *string) (*model.ExperimentRun, error) ListExperimentRun(ctx context.Context, projectID string, request model.ListExperimentRunRequest) (*model.ListExperimentRunResponse, error) GetExperimentRunStats(ctx context.Context, projectID string) (*model.GetExperimentRunStatsResponse, error) GetInfra(ctx context.Context, projectID string, infraID string) (*model.Infra, error) @@ -761,7 +767,7 @@ type QueryResolver interface { GetGitOpsDetails(ctx context.Context, projectID string) (*model.GitConfigResponse, error) ListImageRegistry(ctx context.Context, projectID string) ([]*model.ImageRegistryResponse, error) GetImageRegistry(ctx context.Context, projectID string) (*model.ImageRegistryResponse, error) - ListProbes(ctx context.Context, projectID string, probeNames []string, filter *model.ProbeFilterInput) ([]*model.Probe, error) + ListProbes(ctx context.Context, projectID string, infrastructureType *model.InfrastructureType, probeNames []string, filter *model.ProbeFilterInput) ([]*model.Probe, error) GetProbe(ctx context.Context, projectID string, probeName string) (*model.Probe, error) GetProbeYaml(ctx context.Context, projectID string, request model.GetProbeYAMLRequest) (string, error) GetProbeReference(ctx context.Context, projectID string, probeName string) (*model.GetProbeReferenceResponse, error) @@ -874,83 +880,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Annotation.Vendor(childComplexity), true - case "CMDProbe.attempt": - if e.complexity.CMDProbe.Attempt == nil { - break - } - - return e.complexity.CMDProbe.Attempt(childComplexity), true - - case "CMDProbe.command": - if e.complexity.CMDProbe.Command == nil { - break - } - - return e.complexity.CMDProbe.Command(childComplexity), true - - case "CMDProbe.comparator": - if e.complexity.CMDProbe.Comparator == nil { - break - } - - return e.complexity.CMDProbe.Comparator(childComplexity), true - - case "CMDProbe.evaluationTimeout": - if e.complexity.CMDProbe.EvaluationTimeout == nil { - break - } - - return e.complexity.CMDProbe.EvaluationTimeout(childComplexity), true - - case "CMDProbe.initialDelay": - if e.complexity.CMDProbe.InitialDelay == nil { - break - } - - return e.complexity.CMDProbe.InitialDelay(childComplexity), true - - case "CMDProbe.interval": - if e.complexity.CMDProbe.Interval == nil { - break - } - - return e.complexity.CMDProbe.Interval(childComplexity), true - - case "CMDProbe.probePollingInterval": - if e.complexity.CMDProbe.ProbePollingInterval == nil { - break - } - - return e.complexity.CMDProbe.ProbePollingInterval(childComplexity), true - - case "CMDProbe.probeTimeout": - if e.complexity.CMDProbe.ProbeTimeout == nil { - break - } - - return e.complexity.CMDProbe.ProbeTimeout(childComplexity), true - - case "CMDProbe.retry": - if e.complexity.CMDProbe.Retry == nil { - break - } - - return e.complexity.CMDProbe.Retry(childComplexity), true - - case "CMDProbe.source": - if e.complexity.CMDProbe.Source == nil { - break - } - - return e.complexity.CMDProbe.Source(childComplexity), true - - case "CMDProbe.stopOnFailure": - if e.complexity.CMDProbe.StopOnFailure == nil { - break - } - - return e.complexity.CMDProbe.StopOnFailure(childComplexity), true - case "ChaosExperimentResponse.cronSyntax": if e.complexity.ChaosExperimentResponse.CronSyntax == nil { break @@ -1511,6 +1440,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ExecutionHistory.ExecutedByExperiment(childComplexity), true + case "ExecutionHistory.faultName": + if e.complexity.ExecutionHistory.FaultName == nil { + break + } + + return e.complexity.ExecutionHistory.FaultName(childComplexity), true + + case "ExecutionHistory.mode": + if e.complexity.ExecutionHistory.Mode == nil { + break + } + + return e.complexity.ExecutionHistory.Mode(childComplexity), true + case "ExecutionHistory.status": if e.complexity.ExecutionHistory.Status == nil { break @@ -1756,6 +1699,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ExperimentRun.IsRemoved(childComplexity), true + case "ExperimentRun.notifyID": + if e.complexity.ExperimentRun.NotifyID == nil { + break + } + + return e.complexity.ExperimentRun.NotifyID(childComplexity), true + case "ExperimentRun.phase": if e.complexity.ExperimentRun.Phase == nil { break @@ -1777,6 +1727,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ExperimentRun.ResiliencyScore(childComplexity), true + case "ExperimentRun.runSequence": + if e.complexity.ExperimentRun.RunSequence == nil { + break + } + + return e.complexity.ExperimentRun.RunSequence(childComplexity), true + case "ExperimentRun.totalFaults": if e.complexity.ExperimentRun.TotalFaults == nil { break @@ -2113,83 +2070,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.GitConfigResponse.UserName(childComplexity), true - case "HTTPProbe.attempt": - if e.complexity.HTTPProbe.Attempt == nil { - break - } - - return e.complexity.HTTPProbe.Attempt(childComplexity), true - - case "HTTPProbe.evaluationTimeout": - if e.complexity.HTTPProbe.EvaluationTimeout == nil { - break - } - - return e.complexity.HTTPProbe.EvaluationTimeout(childComplexity), true - - case "HTTPProbe.initialDelay": - if e.complexity.HTTPProbe.InitialDelay == nil { - break - } - - return e.complexity.HTTPProbe.InitialDelay(childComplexity), true - - case "HTTPProbe.insecureSkipVerify": - if e.complexity.HTTPProbe.InsecureSkipVerify == nil { - break - } - - return e.complexity.HTTPProbe.InsecureSkipVerify(childComplexity), true - - case "HTTPProbe.interval": - if e.complexity.HTTPProbe.Interval == nil { - break - } - - return e.complexity.HTTPProbe.Interval(childComplexity), true - - case "HTTPProbe.method": - if e.complexity.HTTPProbe.Method == nil { - break - } - - return e.complexity.HTTPProbe.Method(childComplexity), true - - case "HTTPProbe.probePollingInterval": - if e.complexity.HTTPProbe.ProbePollingInterval == nil { - break - } - - return e.complexity.HTTPProbe.ProbePollingInterval(childComplexity), true - - case "HTTPProbe.probeTimeout": - if e.complexity.HTTPProbe.ProbeTimeout == nil { - break - } - - return e.complexity.HTTPProbe.ProbeTimeout(childComplexity), true - - case "HTTPProbe.retry": - if e.complexity.HTTPProbe.Retry == nil { - break - } - - return e.complexity.HTTPProbe.Retry(childComplexity), true - - case "HTTPProbe.stopOnFailure": - if e.complexity.HTTPProbe.StopOnFailure == nil { - break - } - - return e.complexity.HTTPProbe.StopOnFailure(childComplexity), true - - case "HTTPProbe.url": - if e.complexity.HTTPProbe.URL == nil { - break - } - - return e.complexity.HTTPProbe.URL(childComplexity), true - case "ImageRegistry.enableRegistry": if e.complexity.ImageRegistry.EnableRegistry == nil { break @@ -2687,6 +2567,160 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.KubeObjectResponse.KubeObj(childComplexity), true + case "KubernetesCMDProbe.attempt": + if e.complexity.KubernetesCMDProbe.Attempt == nil { + break + } + + return e.complexity.KubernetesCMDProbe.Attempt(childComplexity), true + + case "KubernetesCMDProbe.command": + if e.complexity.KubernetesCMDProbe.Command == nil { + break + } + + return e.complexity.KubernetesCMDProbe.Command(childComplexity), true + + case "KubernetesCMDProbe.comparator": + if e.complexity.KubernetesCMDProbe.Comparator == nil { + break + } + + return e.complexity.KubernetesCMDProbe.Comparator(childComplexity), true + + case "KubernetesCMDProbe.evaluationTimeout": + if e.complexity.KubernetesCMDProbe.EvaluationTimeout == nil { + break + } + + return e.complexity.KubernetesCMDProbe.EvaluationTimeout(childComplexity), true + + case "KubernetesCMDProbe.initialDelay": + if e.complexity.KubernetesCMDProbe.InitialDelay == nil { + break + } + + return e.complexity.KubernetesCMDProbe.InitialDelay(childComplexity), true + + case "KubernetesCMDProbe.interval": + if e.complexity.KubernetesCMDProbe.Interval == nil { + break + } + + return e.complexity.KubernetesCMDProbe.Interval(childComplexity), true + + case "KubernetesCMDProbe.probePollingInterval": + if e.complexity.KubernetesCMDProbe.ProbePollingInterval == nil { + break + } + + return e.complexity.KubernetesCMDProbe.ProbePollingInterval(childComplexity), true + + case "KubernetesCMDProbe.probeTimeout": + if e.complexity.KubernetesCMDProbe.ProbeTimeout == nil { + break + } + + return e.complexity.KubernetesCMDProbe.ProbeTimeout(childComplexity), true + + case "KubernetesCMDProbe.retry": + if e.complexity.KubernetesCMDProbe.Retry == nil { + break + } + + return e.complexity.KubernetesCMDProbe.Retry(childComplexity), true + + case "KubernetesCMDProbe.source": + if e.complexity.KubernetesCMDProbe.Source == nil { + break + } + + return e.complexity.KubernetesCMDProbe.Source(childComplexity), true + + case "KubernetesCMDProbe.stopOnFailure": + if e.complexity.KubernetesCMDProbe.StopOnFailure == nil { + break + } + + return e.complexity.KubernetesCMDProbe.StopOnFailure(childComplexity), true + + case "KubernetesHTTPProbe.attempt": + if e.complexity.KubernetesHTTPProbe.Attempt == nil { + break + } + + return e.complexity.KubernetesHTTPProbe.Attempt(childComplexity), true + + case "KubernetesHTTPProbe.evaluationTimeout": + if e.complexity.KubernetesHTTPProbe.EvaluationTimeout == nil { + break + } + + return e.complexity.KubernetesHTTPProbe.EvaluationTimeout(childComplexity), true + + case "KubernetesHTTPProbe.initialDelay": + if e.complexity.KubernetesHTTPProbe.InitialDelay == nil { + break + } + + return e.complexity.KubernetesHTTPProbe.InitialDelay(childComplexity), true + + case "KubernetesHTTPProbe.insecureSkipVerify": + if e.complexity.KubernetesHTTPProbe.InsecureSkipVerify == nil { + break + } + + return e.complexity.KubernetesHTTPProbe.InsecureSkipVerify(childComplexity), true + + case "KubernetesHTTPProbe.interval": + if e.complexity.KubernetesHTTPProbe.Interval == nil { + break + } + + return e.complexity.KubernetesHTTPProbe.Interval(childComplexity), true + + case "KubernetesHTTPProbe.method": + if e.complexity.KubernetesHTTPProbe.Method == nil { + break + } + + return e.complexity.KubernetesHTTPProbe.Method(childComplexity), true + + case "KubernetesHTTPProbe.probePollingInterval": + if e.complexity.KubernetesHTTPProbe.ProbePollingInterval == nil { + break + } + + return e.complexity.KubernetesHTTPProbe.ProbePollingInterval(childComplexity), true + + case "KubernetesHTTPProbe.probeTimeout": + if e.complexity.KubernetesHTTPProbe.ProbeTimeout == nil { + break + } + + return e.complexity.KubernetesHTTPProbe.ProbeTimeout(childComplexity), true + + case "KubernetesHTTPProbe.retry": + if e.complexity.KubernetesHTTPProbe.Retry == nil { + break + } + + return e.complexity.KubernetesHTTPProbe.Retry(childComplexity), true + + case "KubernetesHTTPProbe.stopOnFailure": + if e.complexity.KubernetesHTTPProbe.StopOnFailure == nil { + break + } + + return e.complexity.KubernetesHTTPProbe.StopOnFailure(childComplexity), true + + case "KubernetesHTTPProbe.url": + if e.complexity.KubernetesHTTPProbe.URL == nil { + break + } + + return e.complexity.KubernetesHTTPProbe.URL(childComplexity), true + case "Link.name": if e.complexity.Link.Name == nil { break @@ -3381,13 +3415,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.PredefinedExperimentList.ExperimentName(childComplexity), true - case "Probe.cmdProperties": - if e.complexity.Probe.CmdProperties == nil { - break - } - - return e.complexity.Probe.CmdProperties(childComplexity), true - case "Probe.createdAt": if e.complexity.Probe.CreatedAt == nil { break @@ -3409,12 +3436,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Probe.Description(childComplexity), true - case "Probe.httpProperties": - if e.complexity.Probe.HTTPProperties == nil { + case "Probe.infrastructureType": + if e.complexity.Probe.InfrastructureType == nil { break } - return e.complexity.Probe.HTTPProperties(childComplexity), true + return e.complexity.Probe.InfrastructureType(childComplexity), true case "Probe.k8sProperties": if e.complexity.Probe.K8sProperties == nil { @@ -3423,6 +3450,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Probe.K8sProperties(childComplexity), true + case "Probe.kubernetesCMDProperties": + if e.complexity.Probe.KubernetesCMDProperties == nil { + break + } + + return e.complexity.Probe.KubernetesCMDProperties(childComplexity), true + + case "Probe.kubernetesHTTPProperties": + if e.complexity.Probe.KubernetesHTTPProperties == nil { + break + } + + return e.complexity.Probe.KubernetesHTTPProperties(childComplexity), true + case "Probe.name": if e.complexity.Probe.Name == nil { break @@ -3584,7 +3625,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.GetExperimentRun(childComplexity, args["projectID"].(string), args["experimentRunID"].(string)), true + return e.complexity.Query.GetExperimentRun(childComplexity, args["projectID"].(string), args["experimentRunID"].(*string), args["notifyID"].(*string)), true case "Query.getExperimentRunStats": if e.complexity.Query.GetExperimentRunStats == nil { @@ -3867,7 +3908,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Query.ListProbes(childComplexity, args["projectID"].(string), args["probeNames"].([]string), args["filter"].(*model.ProbeFilterInput)), true + return e.complexity.Query.ListProbes(childComplexity, args["projectID"].(string), args["infrastructureType"].(*model.InfrastructureType), args["probeNames"].([]string), args["filter"].(*model.ProbeFilterInput)), true case "Query.validateUniqueProbe": if e.complexity.Query.ValidateUniqueProbe == nil { @@ -3937,6 +3978,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.RecentExperimentRun.ResiliencyScore(childComplexity), true + case "RecentExperimentRun.runSequence": + if e.complexity.RecentExperimentRun.RunSequence == nil { + break + } + + return e.complexity.RecentExperimentRun.RunSequence(childComplexity), true + case "RecentExperimentRun.updatedAt": if e.complexity.RecentExperimentRun.UpdatedAt == nil { break @@ -4733,6 +4781,14 @@ type ExperimentRun implements Audit { User who has created the experiment run """ createdBy: UserDetails + """ + Notify ID of the experiment run + """ + notifyID: ID + """ + runSequence is the sequence number of experiment run + """ + runSequence: Int! } """ @@ -4852,6 +4908,10 @@ type RecentExperimentRun implements Audit { User who updated the experiment run """ updatedBy: UserDetails + """ + runSequence is the sequence number of experiment run + """ + runSequence: Int! } """ @@ -5082,7 +5142,7 @@ extend type Mutation { """ Returns experiment run based on experiment run ID """ - getExperimentRun(projectID: ID!, experimentRunID: String!): ExperimentRun! + getExperimentRun(projectID: ID!, experimentRunID: ID, notifyID: ID): ExperimentRun! """ Returns the list of experiment run based on various filter parameters @@ -5236,8 +5296,7 @@ type Infra implements ResourceDetails & Audit { } enum InfrastructureType { - INTERNAL - EXTERNAL + Kubernetes } """ @@ -7058,13 +7117,17 @@ input ProbeRequest { """ type: ProbeType! """ + Infrastructure type of the Probe + """ + infrastructureType: InfrastructureType! + """ HTTP Properties of the specific type of the Probe """ - httpProperties: HTTPProbeRequest + kubernetesHTTPProperties: KubernetesHTTPProbeRequest """ CMD Properties of the specific type of the Probe """ - cmdProperties: CMDProbeRequest + kubernetesCMDProperties: KubernetesCMDProbeRequest """ K8S Properties of the specific type of the Probe """ @@ -7075,6 +7138,57 @@ input ProbeRequest { promProperties: PROMProbeRequest } +""" +Defines the input for Kubernetes HTTP probe properties +""" +input KubernetesHTTPProbeRequest { + """ + Timeout of the Probe + """ + probeTimeout: String! + """ + Interval of the Probe + """ + interval: String! + """ + Retry interval of the Probe + """ + retry: Int + """ + Attempt contains the total attempt count for the probe + """ + attempt: Int + """ + Polling interval of the Probe + """ + probePollingInterval: String + """ + Initial delay interval of the Probe in seconds + """ + initialDelay: String + """ + EvaluationTimeout is the timeout window in which the SLO metrics + """ + evaluationTimeout: String + """ + Is stop on failure enabled in the Probe + """ + stopOnFailure: Boolean + """ + URL of the Probe + """ + url: String! + """ + HTTP method of the Probe + """ + method: MethodRequest! + """ + If Insecure HTTP verification should be skipped + """ + insecureSkipVerify: Boolean +} + + """ Defines the properties of the comparator """ @@ -7135,20 +7249,28 @@ type ExecutedByExperiment { updatedBy: UserDetails } + """ Defines the Execution History of experiment referenced by the Probe """ type ExecutionHistory { - """ - Fault Status - """ - status: Status! - """ - Fault executed by which experiment - """ - executedByExperiment: ExecutedByExperiment! +""" +Probe Mode +""" +mode: Mode! +""" +Fault Name +""" +faultName: String! +""" +Fault Status +""" +status: Status! +""" +Fault executed by which experiment +""" +executedByExperiment: ExecutedByExperiment! } - """ Defines the Recent Executions of global probe in ListProbe API with different fault and execution history each time """ @@ -7210,7 +7332,7 @@ type GetProbeReferenceResponse { """ Defines the CMD probe properties """ -type CMDProbe implements CommonProbeProperties { +type KubernetesCMDProbe implements CommonProbeProperties { """ Timeout of the Probe """ @@ -7282,13 +7404,17 @@ type Probe implements ResourceDetails & Audit { """ type: ProbeType! """ - HTTP Properties of the specific type of the Probe + Infrastructure type of the Probe """ - httpProperties: HTTPProbe + infrastructureType: InfrastructureType! """ - CMD Properties of the specific type of the Probe + Kubernetes HTTP Properties of the specific type of the Probe + """ + kubernetesHTTPProperties: KubernetesHTTPProbe """ - cmdProperties: CMDProbe + Kubernetes CMD Properties of the specific type of the Probe + """ + kubernetesCMDProperties: KubernetesCMDProbe """ K8S Properties of the specific type of the Probe """ @@ -7566,9 +7692,60 @@ type PROMProbe implements CommonProbeProperties { } """ -Defines the HTTP probe properties +Defines the input for Kubernetes CMD probe properties +""" +input KubernetesCMDProbeRequest { + """ + Timeout of the Probe + """ + probeTimeout: String! + """ + Interval of the Probe + """ + interval: String! + """ + Retry interval of the Probe + """ + retry: Int + """ + Attempt contains the total attempt count for the probe + """ + attempt: Int + """ + Polling interval of the Probe + """ + probePollingInterval: String + """ + Initial delay interval of the Probe in seconds + """ + initialDelay: String + """ + EvaluationTimeout is the timeout window in which the SLO metrics + """ + evaluationTimeout: String + """ + Is stop on failure enabled in the Probe + """ + stopOnFailure: Boolean + """ + Command of the Probe + """ + command: String! + """ + Comparator of the Probe + """ + comparator: ComparatorInput! + """ + Source of the Probe + """ + source: String +} + + +""" +Defines the Kubernetes HTTP probe properties """ -type HTTPProbe implements CommonProbeProperties { +type KubernetesHTTPProbe implements CommonProbeProperties { """ Timeout of the Probe """ @@ -7615,6 +7792,7 @@ type HTTPProbe implements CommonProbeProperties { insecureSkipVerify: Boolean } + """ Defines the input for CMD probe properties """ @@ -7782,7 +7960,7 @@ extend type Query { """ Returns the list of Probes based on various filter parameters """ - listProbes(projectID: ID!, probeNames: [ID!], filter: ProbeFilterInput): [Probe]! + listProbes(projectID: ID!, infrastructureType: InfrastructureType, probeNames: [ID!], filter: ProbeFilterInput): [Probe]! @authorized """ @@ -8649,14 +8827,22 @@ func (ec *executionContext) field_Query_getExperimentRun_args(ctx context.Contex } } args["projectID"] = arg0 - var arg1 string + var arg1 *string if tmp, ok := rawArgs["experimentRunID"]; ok { - arg1, err = ec.unmarshalNString2string(ctx, tmp) + arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp) if err != nil { return nil, err } } args["experimentRunID"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["notifyID"]; ok { + arg2, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["notifyID"] = arg2 return args, nil } @@ -9131,22 +9317,30 @@ func (ec *executionContext) field_Query_listProbes_args(ctx context.Context, raw } } args["projectID"] = arg0 - var arg1 []string + var arg1 *model.InfrastructureType + if tmp, ok := rawArgs["infrastructureType"]; ok { + arg1, err = ec.unmarshalOInfrastructureType2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐInfrastructureType(ctx, tmp) + if err != nil { + return nil, err + } + } + args["infrastructureType"] = arg1 + var arg2 []string if tmp, ok := rawArgs["probeNames"]; ok { - arg1, err = ec.unmarshalOID2ᚕstringᚄ(ctx, tmp) + arg2, err = ec.unmarshalOID2ᚕstringᚄ(ctx, tmp) if err != nil { return nil, err } } - args["probeNames"] = arg1 - var arg2 *model.ProbeFilterInput + args["probeNames"] = arg2 + var arg3 *model.ProbeFilterInput if tmp, ok := rawArgs["filter"]; ok { - arg2, err = ec.unmarshalOProbeFilterInput2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐProbeFilterInput(ctx, tmp) + arg3, err = ec.unmarshalOProbeFilterInput2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐProbeFilterInput(ctx, tmp) if err != nil { return nil, err } } - args["filter"] = arg2 + args["filter"] = arg3 return args, nil } @@ -9666,7 +9860,7 @@ func (ec *executionContext) _Annotation_chartDescription(ctx context.Context, fi return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _CMDProbe_probeTimeout(ctx context.Context, field graphql.CollectedField, obj *model.CMDProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _ChaosExperimentResponse_experimentID(ctx context.Context, field graphql.CollectedField, obj *model.ChaosExperimentResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -9674,7 +9868,7 @@ func (ec *executionContext) _CMDProbe_probeTimeout(ctx context.Context, field gr } }() fc := &graphql.FieldContext{ - Object: "CMDProbe", + Object: "ChaosExperimentResponse", Field: field, Args: nil, IsMethod: false, @@ -9683,7 +9877,7 @@ func (ec *executionContext) _CMDProbe_probeTimeout(ctx context.Context, field gr ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ProbeTimeout, nil + return obj.ExperimentID, nil }) if err != nil { ec.Error(ctx, err) @@ -9700,7 +9894,7 @@ func (ec *executionContext) _CMDProbe_probeTimeout(ctx context.Context, field gr return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _CMDProbe_interval(ctx context.Context, field graphql.CollectedField, obj *model.CMDProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _ChaosExperimentResponse_projectID(ctx context.Context, field graphql.CollectedField, obj *model.ChaosExperimentResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -9708,7 +9902,7 @@ func (ec *executionContext) _CMDProbe_interval(ctx context.Context, field graphq } }() fc := &graphql.FieldContext{ - Object: "CMDProbe", + Object: "ChaosExperimentResponse", Field: field, Args: nil, IsMethod: false, @@ -9717,7 +9911,7 @@ func (ec *executionContext) _CMDProbe_interval(ctx context.Context, field graphq ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Interval, nil + return obj.ProjectID, nil }) if err != nil { ec.Error(ctx, err) @@ -9731,10 +9925,10 @@ func (ec *executionContext) _CMDProbe_interval(ctx context.Context, field graphq } res := resTmp.(string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _CMDProbe_retry(ctx context.Context, field graphql.CollectedField, obj *model.CMDProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _ChaosExperimentResponse_cronSyntax(ctx context.Context, field graphql.CollectedField, obj *model.ChaosExperimentResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -9742,7 +9936,7 @@ func (ec *executionContext) _CMDProbe_retry(ctx context.Context, field graphql.C } }() fc := &graphql.FieldContext{ - Object: "CMDProbe", + Object: "ChaosExperimentResponse", Field: field, Args: nil, IsMethod: false, @@ -9751,52 +9945,24 @@ func (ec *executionContext) _CMDProbe_retry(ctx context.Context, field graphql.C ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Retry, nil + return obj.CronSyntax, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - return graphql.Null - } - res := resTmp.(*int) - fc.Result = res - return ec.marshalOInt2ᚖint(ctx, field.Selections, res) -} - -func (ec *executionContext) _CMDProbe_attempt(ctx context.Context, field graphql.CollectedField, obj *model.CMDProbe) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") } - }() - fc := &graphql.FieldContext{ - Object: "CMDProbe", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Attempt, nil - }) - if err != nil { - ec.Error(ctx, err) return graphql.Null } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*int) + res := resTmp.(string) fc.Result = res - return ec.marshalOInt2ᚖint(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _CMDProbe_probePollingInterval(ctx context.Context, field graphql.CollectedField, obj *model.CMDProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _ChaosExperimentResponse_experimentName(ctx context.Context, field graphql.CollectedField, obj *model.ChaosExperimentResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -9804,7 +9970,7 @@ func (ec *executionContext) _CMDProbe_probePollingInterval(ctx context.Context, } }() fc := &graphql.FieldContext{ - Object: "CMDProbe", + Object: "ChaosExperimentResponse", Field: field, Args: nil, IsMethod: false, @@ -9813,21 +9979,24 @@ func (ec *executionContext) _CMDProbe_probePollingInterval(ctx context.Context, ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ProbePollingInterval, nil + return obj.ExperimentName, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _CMDProbe_initialDelay(ctx context.Context, field graphql.CollectedField, obj *model.CMDProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _ChaosExperimentResponse_experimentDescription(ctx context.Context, field graphql.CollectedField, obj *model.ChaosExperimentResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -9835,7 +10004,7 @@ func (ec *executionContext) _CMDProbe_initialDelay(ctx context.Context, field gr } }() fc := &graphql.FieldContext{ - Object: "CMDProbe", + Object: "ChaosExperimentResponse", Field: field, Args: nil, IsMethod: false, @@ -9844,21 +10013,24 @@ func (ec *executionContext) _CMDProbe_initialDelay(ctx context.Context, field gr ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InitialDelay, nil + return obj.ExperimentDescription, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _CMDProbe_evaluationTimeout(ctx context.Context, field graphql.CollectedField, obj *model.CMDProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _ChaosExperimentResponse_isCustomExperiment(ctx context.Context, field graphql.CollectedField, obj *model.ChaosExperimentResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -9866,7 +10038,7 @@ func (ec *executionContext) _CMDProbe_evaluationTimeout(ctx context.Context, fie } }() fc := &graphql.FieldContext{ - Object: "CMDProbe", + Object: "ChaosExperimentResponse", Field: field, Args: nil, IsMethod: false, @@ -9875,21 +10047,24 @@ func (ec *executionContext) _CMDProbe_evaluationTimeout(ctx context.Context, fie ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.EvaluationTimeout, nil + return obj.IsCustomExperiment, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(bool) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _CMDProbe_stopOnFailure(ctx context.Context, field graphql.CollectedField, obj *model.CMDProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _ChaosExperimentResponse_tags(ctx context.Context, field graphql.CollectedField, obj *model.ChaosExperimentResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -9897,7 +10072,7 @@ func (ec *executionContext) _CMDProbe_stopOnFailure(ctx context.Context, field g } }() fc := &graphql.FieldContext{ - Object: "CMDProbe", + Object: "ChaosExperimentResponse", Field: field, Args: nil, IsMethod: false, @@ -9906,7 +10081,7 @@ func (ec *executionContext) _CMDProbe_stopOnFailure(ctx context.Context, field g ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.StopOnFailure, nil + return obj.Tags, nil }) if err != nil { ec.Error(ctx, err) @@ -9915,12 +10090,12 @@ func (ec *executionContext) _CMDProbe_stopOnFailure(ctx context.Context, field g if resTmp == nil { return graphql.Null } - res := resTmp.(*bool) + res := resTmp.([]string) fc.Result = res - return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) + return ec.marshalOString2ᚕstringᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _CMDProbe_command(ctx context.Context, field graphql.CollectedField, obj *model.CMDProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _ChaosHub_id(ctx context.Context, field graphql.CollectedField, obj *model.ChaosHub) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -9928,7 +10103,7 @@ func (ec *executionContext) _CMDProbe_command(ctx context.Context, field graphql } }() fc := &graphql.FieldContext{ - Object: "CMDProbe", + Object: "ChaosHub", Field: field, Args: nil, IsMethod: false, @@ -9937,7 +10112,7 @@ func (ec *executionContext) _CMDProbe_command(ctx context.Context, field graphql ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Command, nil + return obj.ID, nil }) if err != nil { ec.Error(ctx, err) @@ -9951,10 +10126,10 @@ func (ec *executionContext) _CMDProbe_command(ctx context.Context, field graphql } res := resTmp.(string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _CMDProbe_comparator(ctx context.Context, field graphql.CollectedField, obj *model.CMDProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _ChaosHub_repoURL(ctx context.Context, field graphql.CollectedField, obj *model.ChaosHub) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -9962,7 +10137,7 @@ func (ec *executionContext) _CMDProbe_comparator(ctx context.Context, field grap } }() fc := &graphql.FieldContext{ - Object: "CMDProbe", + Object: "ChaosHub", Field: field, Args: nil, IsMethod: false, @@ -9971,7 +10146,7 @@ func (ec *executionContext) _CMDProbe_comparator(ctx context.Context, field grap ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Comparator, nil + return obj.RepoURL, nil }) if err != nil { ec.Error(ctx, err) @@ -9983,43 +10158,12 @@ func (ec *executionContext) _CMDProbe_comparator(ctx context.Context, field grap } return graphql.Null } - res := resTmp.(*model.Comparator) - fc.Result = res - return ec.marshalNComparator2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐComparator(ctx, field.Selections, res) -} - -func (ec *executionContext) _CMDProbe_source(ctx context.Context, field graphql.CollectedField, obj *model.CMDProbe) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "CMDProbe", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Source, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _ChaosExperimentResponse_experimentID(ctx context.Context, field graphql.CollectedField, obj *model.ChaosExperimentResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _ChaosHub_repoBranch(ctx context.Context, field graphql.CollectedField, obj *model.ChaosHub) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -10027,7 +10171,7 @@ func (ec *executionContext) _ChaosExperimentResponse_experimentID(ctx context.Co } }() fc := &graphql.FieldContext{ - Object: "ChaosExperimentResponse", + Object: "ChaosHub", Field: field, Args: nil, IsMethod: false, @@ -10036,7 +10180,7 @@ func (ec *executionContext) _ChaosExperimentResponse_experimentID(ctx context.Co ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ExperimentID, nil + return obj.RepoBranch, nil }) if err != nil { ec.Error(ctx, err) @@ -10053,7 +10197,7 @@ func (ec *executionContext) _ChaosExperimentResponse_experimentID(ctx context.Co return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _ChaosExperimentResponse_projectID(ctx context.Context, field graphql.CollectedField, obj *model.ChaosExperimentResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _ChaosHub_projectID(ctx context.Context, field graphql.CollectedField, obj *model.ChaosHub) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -10061,310 +10205,7 @@ func (ec *executionContext) _ChaosExperimentResponse_projectID(ctx context.Conte } }() fc := &graphql.FieldContext{ - Object: "ChaosExperimentResponse", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ProjectID, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNID2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _ChaosExperimentResponse_cronSyntax(ctx context.Context, field graphql.CollectedField, obj *model.ChaosExperimentResponse) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ChaosExperimentResponse", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.CronSyntax, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _ChaosExperimentResponse_experimentName(ctx context.Context, field graphql.CollectedField, obj *model.ChaosExperimentResponse) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ChaosExperimentResponse", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ExperimentName, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _ChaosExperimentResponse_experimentDescription(ctx context.Context, field graphql.CollectedField, obj *model.ChaosExperimentResponse) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ChaosExperimentResponse", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ExperimentDescription, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _ChaosExperimentResponse_isCustomExperiment(ctx context.Context, field graphql.CollectedField, obj *model.ChaosExperimentResponse) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ChaosExperimentResponse", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.IsCustomExperiment, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) _ChaosExperimentResponse_tags(ctx context.Context, field graphql.CollectedField, obj *model.ChaosExperimentResponse) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ChaosExperimentResponse", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Tags, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]string) - fc.Result = res - return ec.marshalOString2ᚕstringᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) _ChaosHub_id(ctx context.Context, field graphql.CollectedField, obj *model.ChaosHub) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ChaosHub", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ID, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNID2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _ChaosHub_repoURL(ctx context.Context, field graphql.CollectedField, obj *model.ChaosHub) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ChaosHub", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.RepoURL, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _ChaosHub_repoBranch(ctx context.Context, field graphql.CollectedField, obj *model.ChaosHub) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ChaosHub", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.RepoBranch, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _ChaosHub_projectID(ctx context.Context, field graphql.CollectedField, obj *model.ChaosHub) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ChaosHub", + Object: "ChaosHub", Field: field, Args: nil, IsMethod: false, @@ -12624,6 +12465,74 @@ func (ec *executionContext) _ExecutedByExperiment_updatedBy(ctx context.Context, return ec.marshalOUserDetails2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐUserDetails(ctx, field.Selections, res) } +func (ec *executionContext) _ExecutionHistory_mode(ctx context.Context, field graphql.CollectedField, obj *model.ExecutionHistory) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ExecutionHistory", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Mode, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.Mode) + fc.Result = res + return ec.marshalNMode2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐMode(ctx, field.Selections, res) +} + +func (ec *executionContext) _ExecutionHistory_faultName(ctx context.Context, field graphql.CollectedField, obj *model.ExecutionHistory) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ExecutionHistory", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.FaultName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + func (ec *executionContext) _ExecutionHistory_status(ctx context.Context, field graphql.CollectedField, obj *model.ExecutionHistory) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -14035,6 +13944,71 @@ func (ec *executionContext) _ExperimentRun_createdBy(ctx context.Context, field return ec.marshalOUserDetails2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐUserDetails(ctx, field.Selections, res) } +func (ec *executionContext) _ExperimentRun_notifyID(ctx context.Context, field graphql.CollectedField, obj *model.ExperimentRun) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ExperimentRun", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.NotifyID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOID2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) _ExperimentRun_runSequence(ctx context.Context, field graphql.CollectedField, obj *model.ExperimentRun) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ExperimentRun", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RunSequence, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + func (ec *executionContext) _Experiments_name(ctx context.Context, field graphql.CollectedField, obj *model.Experiments) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -15287,7 +15261,583 @@ func (ec *executionContext) _GitConfigResponse_projectID(ctx context.Context, fi return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _GitConfigResponse_branch(ctx context.Context, field graphql.CollectedField, obj *model.GitConfigResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _GitConfigResponse_branch(ctx context.Context, field graphql.CollectedField, obj *model.GitConfigResponse) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "GitConfigResponse", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Branch, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) _GitConfigResponse_repoURL(ctx context.Context, field graphql.CollectedField, obj *model.GitConfigResponse) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "GitConfigResponse", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RepoURL, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) _GitConfigResponse_authType(ctx context.Context, field graphql.CollectedField, obj *model.GitConfigResponse) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "GitConfigResponse", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.AuthType, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.AuthType) + fc.Result = res + return ec.marshalOAuthType2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐAuthType(ctx, field.Selections, res) +} + +func (ec *executionContext) _GitConfigResponse_token(ctx context.Context, field graphql.CollectedField, obj *model.GitConfigResponse) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "GitConfigResponse", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Token, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) _GitConfigResponse_userName(ctx context.Context, field graphql.CollectedField, obj *model.GitConfigResponse) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "GitConfigResponse", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UserName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) _GitConfigResponse_password(ctx context.Context, field graphql.CollectedField, obj *model.GitConfigResponse) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "GitConfigResponse", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Password, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) _GitConfigResponse_sshPrivateKey(ctx context.Context, field graphql.CollectedField, obj *model.GitConfigResponse) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "GitConfigResponse", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SSHPrivateKey, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) _ImageRegistry_isDefault(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistry) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ImageRegistry", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDefault, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*bool) + fc.Result = res + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) +} + +func (ec *executionContext) _ImageRegistry_imageRegistryName(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistry) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ImageRegistry", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ImageRegistryName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _ImageRegistry_imageRepoName(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistry) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ImageRegistry", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ImageRepoName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _ImageRegistry_imageRegistryType(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistry) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ImageRegistry", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ImageRegistryType, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _ImageRegistry_secretName(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistry) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ImageRegistry", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SecretName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) _ImageRegistry_secretNamespace(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistry) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ImageRegistry", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SecretNamespace, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) _ImageRegistry_enableRegistry(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistry) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ImageRegistry", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.EnableRegistry, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*bool) + fc.Result = res + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) +} + +func (ec *executionContext) _ImageRegistryResponse_isDefault(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ImageRegistryResponse", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDefault, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) _ImageRegistryResponse_imageRegistryInfo(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ImageRegistryResponse", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ImageRegistryInfo, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.ImageRegistry) + fc.Result = res + return ec.marshalOImageRegistry2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐImageRegistry(ctx, field.Selections, res) +} + +func (ec *executionContext) _ImageRegistryResponse_imageRegistryID(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ImageRegistryResponse", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ImageRegistryID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _ImageRegistryResponse_projectID(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "ImageRegistryResponse", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ProjectID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _ImageRegistryResponse_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15295,7 +15845,7 @@ func (ec *executionContext) _GitConfigResponse_branch(ctx context.Context, field } }() fc := &graphql.FieldContext{ - Object: "GitConfigResponse", + Object: "ImageRegistryResponse", Field: field, Args: nil, IsMethod: false, @@ -15304,7 +15854,7 @@ func (ec *executionContext) _GitConfigResponse_branch(ctx context.Context, field ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Branch, nil + return obj.UpdatedAt, nil }) if err != nil { ec.Error(ctx, err) @@ -15318,7 +15868,7 @@ func (ec *executionContext) _GitConfigResponse_branch(ctx context.Context, field return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _GitConfigResponse_repoURL(ctx context.Context, field graphql.CollectedField, obj *model.GitConfigResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _ImageRegistryResponse_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15326,7 +15876,7 @@ func (ec *executionContext) _GitConfigResponse_repoURL(ctx context.Context, fiel } }() fc := &graphql.FieldContext{ - Object: "GitConfigResponse", + Object: "ImageRegistryResponse", Field: field, Args: nil, IsMethod: false, @@ -15335,7 +15885,7 @@ func (ec *executionContext) _GitConfigResponse_repoURL(ctx context.Context, fiel ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.RepoURL, nil + return obj.CreatedAt, nil }) if err != nil { ec.Error(ctx, err) @@ -15349,7 +15899,7 @@ func (ec *executionContext) _GitConfigResponse_repoURL(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _GitConfigResponse_authType(ctx context.Context, field graphql.CollectedField, obj *model.GitConfigResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _ImageRegistryResponse_createdBy(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15357,7 +15907,7 @@ func (ec *executionContext) _GitConfigResponse_authType(ctx context.Context, fie } }() fc := &graphql.FieldContext{ - Object: "GitConfigResponse", + Object: "ImageRegistryResponse", Field: field, Args: nil, IsMethod: false, @@ -15366,7 +15916,7 @@ func (ec *executionContext) _GitConfigResponse_authType(ctx context.Context, fie ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.AuthType, nil + return obj.CreatedBy, nil }) if err != nil { ec.Error(ctx, err) @@ -15375,12 +15925,12 @@ func (ec *executionContext) _GitConfigResponse_authType(ctx context.Context, fie if resTmp == nil { return graphql.Null } - res := resTmp.(*model.AuthType) + res := resTmp.(*model.UserDetails) fc.Result = res - return ec.marshalOAuthType2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐAuthType(ctx, field.Selections, res) + return ec.marshalOUserDetails2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐUserDetails(ctx, field.Selections, res) } -func (ec *executionContext) _GitConfigResponse_token(ctx context.Context, field graphql.CollectedField, obj *model.GitConfigResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _ImageRegistryResponse_updatedBy(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15388,7 +15938,7 @@ func (ec *executionContext) _GitConfigResponse_token(ctx context.Context, field } }() fc := &graphql.FieldContext{ - Object: "GitConfigResponse", + Object: "ImageRegistryResponse", Field: field, Args: nil, IsMethod: false, @@ -15397,7 +15947,7 @@ func (ec *executionContext) _GitConfigResponse_token(ctx context.Context, field ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Token, nil + return obj.UpdatedBy, nil }) if err != nil { ec.Error(ctx, err) @@ -15406,12 +15956,12 @@ func (ec *executionContext) _GitConfigResponse_token(ctx context.Context, field if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*model.UserDetails) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOUserDetails2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐUserDetails(ctx, field.Selections, res) } -func (ec *executionContext) _GitConfigResponse_userName(ctx context.Context, field graphql.CollectedField, obj *model.GitConfigResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _ImageRegistryResponse_isRemoved(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15419,7 +15969,7 @@ func (ec *executionContext) _GitConfigResponse_userName(ctx context.Context, fie } }() fc := &graphql.FieldContext{ - Object: "GitConfigResponse", + Object: "ImageRegistryResponse", Field: field, Args: nil, IsMethod: false, @@ -15428,7 +15978,7 @@ func (ec *executionContext) _GitConfigResponse_userName(ctx context.Context, fie ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.UserName, nil + return obj.IsRemoved, nil }) if err != nil { ec.Error(ctx, err) @@ -15437,12 +15987,12 @@ func (ec *executionContext) _GitConfigResponse_userName(ctx context.Context, fie if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*bool) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } -func (ec *executionContext) _GitConfigResponse_password(ctx context.Context, field graphql.CollectedField, obj *model.GitConfigResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_projectID(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15450,7 +16000,7 @@ func (ec *executionContext) _GitConfigResponse_password(ctx context.Context, fie } }() fc := &graphql.FieldContext{ - Object: "GitConfigResponse", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -15459,52 +16009,24 @@ func (ec *executionContext) _GitConfigResponse_password(ctx context.Context, fie ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Password, nil + return obj.ProjectID, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) _GitConfigResponse_sshPrivateKey(ctx context.Context, field graphql.CollectedField, obj *model.GitConfigResponse) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") } - }() - fc := &graphql.FieldContext{ - Object: "GitConfigResponse", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.SSHPrivateKey, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _HTTPProbe_probeTimeout(ctx context.Context, field graphql.CollectedField, obj *model.HTTPProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_infraID(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15512,7 +16034,7 @@ func (ec *executionContext) _HTTPProbe_probeTimeout(ctx context.Context, field g } }() fc := &graphql.FieldContext{ - Object: "HTTPProbe", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -15521,7 +16043,7 @@ func (ec *executionContext) _HTTPProbe_probeTimeout(ctx context.Context, field g ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ProbeTimeout, nil + return obj.InfraID, nil }) if err != nil { ec.Error(ctx, err) @@ -15535,10 +16057,10 @@ func (ec *executionContext) _HTTPProbe_probeTimeout(ctx context.Context, field g } res := resTmp.(string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _HTTPProbe_interval(ctx context.Context, field graphql.CollectedField, obj *model.HTTPProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_name(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15546,7 +16068,7 @@ func (ec *executionContext) _HTTPProbe_interval(ctx context.Context, field graph } }() fc := &graphql.FieldContext{ - Object: "HTTPProbe", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -15555,7 +16077,7 @@ func (ec *executionContext) _HTTPProbe_interval(ctx context.Context, field graph ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Interval, nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) @@ -15572,7 +16094,7 @@ func (ec *executionContext) _HTTPProbe_interval(ctx context.Context, field graph return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _HTTPProbe_retry(ctx context.Context, field graphql.CollectedField, obj *model.HTTPProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_description(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15580,7 +16102,7 @@ func (ec *executionContext) _HTTPProbe_retry(ctx context.Context, field graphql. } }() fc := &graphql.FieldContext{ - Object: "HTTPProbe", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -15589,7 +16111,7 @@ func (ec *executionContext) _HTTPProbe_retry(ctx context.Context, field graphql. ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Retry, nil + return obj.Description, nil }) if err != nil { ec.Error(ctx, err) @@ -15598,12 +16120,12 @@ func (ec *executionContext) _HTTPProbe_retry(ctx context.Context, field graphql. if resTmp == nil { return graphql.Null } - res := resTmp.(*int) + res := resTmp.(*string) fc.Result = res - return ec.marshalOInt2ᚖint(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _HTTPProbe_attempt(ctx context.Context, field graphql.CollectedField, obj *model.HTTPProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_tags(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15611,7 +16133,7 @@ func (ec *executionContext) _HTTPProbe_attempt(ctx context.Context, field graphq } }() fc := &graphql.FieldContext{ - Object: "HTTPProbe", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -15620,7 +16142,7 @@ func (ec *executionContext) _HTTPProbe_attempt(ctx context.Context, field graphq ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Attempt, nil + return obj.Tags, nil }) if err != nil { ec.Error(ctx, err) @@ -15629,12 +16151,12 @@ func (ec *executionContext) _HTTPProbe_attempt(ctx context.Context, field graphq if resTmp == nil { return graphql.Null } - res := resTmp.(*int) + res := resTmp.([]string) fc.Result = res - return ec.marshalOInt2ᚖint(ctx, field.Selections, res) + return ec.marshalOString2ᚕstringᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _HTTPProbe_probePollingInterval(ctx context.Context, field graphql.CollectedField, obj *model.HTTPProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_environmentID(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15642,7 +16164,7 @@ func (ec *executionContext) _HTTPProbe_probePollingInterval(ctx context.Context, } }() fc := &graphql.FieldContext{ - Object: "HTTPProbe", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -15651,21 +16173,24 @@ func (ec *executionContext) _HTTPProbe_probePollingInterval(ctx context.Context, ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ProbePollingInterval, nil + return obj.EnvironmentID, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _HTTPProbe_initialDelay(ctx context.Context, field graphql.CollectedField, obj *model.HTTPProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_platformName(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15673,7 +16198,7 @@ func (ec *executionContext) _HTTPProbe_initialDelay(ctx context.Context, field g } }() fc := &graphql.FieldContext{ - Object: "HTTPProbe", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -15682,21 +16207,24 @@ func (ec *executionContext) _HTTPProbe_initialDelay(ctx context.Context, field g ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InitialDelay, nil + return obj.PlatformName, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _HTTPProbe_evaluationTimeout(ctx context.Context, field graphql.CollectedField, obj *model.HTTPProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_isActive(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15704,7 +16232,7 @@ func (ec *executionContext) _HTTPProbe_evaluationTimeout(ctx context.Context, fi } }() fc := &graphql.FieldContext{ - Object: "HTTPProbe", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -15713,21 +16241,24 @@ func (ec *executionContext) _HTTPProbe_evaluationTimeout(ctx context.Context, fi ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.EvaluationTimeout, nil + return obj.IsActive, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(bool) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _HTTPProbe_stopOnFailure(ctx context.Context, field graphql.CollectedField, obj *model.HTTPProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_isInfraConfirmed(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15735,7 +16266,7 @@ func (ec *executionContext) _HTTPProbe_stopOnFailure(ctx context.Context, field } }() fc := &graphql.FieldContext{ - Object: "HTTPProbe", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -15744,21 +16275,24 @@ func (ec *executionContext) _HTTPProbe_stopOnFailure(ctx context.Context, field ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.StopOnFailure, nil + return obj.IsInfraConfirmed, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*bool) + res := resTmp.(bool) fc.Result = res - return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _HTTPProbe_url(ctx context.Context, field graphql.CollectedField, obj *model.HTTPProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_isRemoved(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15766,7 +16300,7 @@ func (ec *executionContext) _HTTPProbe_url(ctx context.Context, field graphql.Co } }() fc := &graphql.FieldContext{ - Object: "HTTPProbe", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -15775,7 +16309,7 @@ func (ec *executionContext) _HTTPProbe_url(ctx context.Context, field graphql.Co ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.URL, nil + return obj.IsRemoved, nil }) if err != nil { ec.Error(ctx, err) @@ -15787,12 +16321,12 @@ func (ec *executionContext) _HTTPProbe_url(ctx context.Context, field graphql.Co } return graphql.Null } - res := resTmp.(string) + res := resTmp.(bool) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _HTTPProbe_method(ctx context.Context, field graphql.CollectedField, obj *model.HTTPProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15800,7 +16334,7 @@ func (ec *executionContext) _HTTPProbe_method(ctx context.Context, field graphql } }() fc := &graphql.FieldContext{ - Object: "HTTPProbe", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -15809,7 +16343,7 @@ func (ec *executionContext) _HTTPProbe_method(ctx context.Context, field graphql ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Method, nil + return obj.UpdatedAt, nil }) if err != nil { ec.Error(ctx, err) @@ -15821,12 +16355,12 @@ func (ec *executionContext) _HTTPProbe_method(ctx context.Context, field graphql } return graphql.Null } - res := resTmp.(*model.Method) + res := resTmp.(string) fc.Result = res - return ec.marshalNMethod2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐMethod(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _HTTPProbe_insecureSkipVerify(ctx context.Context, field graphql.CollectedField, obj *model.HTTPProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15834,7 +16368,7 @@ func (ec *executionContext) _HTTPProbe_insecureSkipVerify(ctx context.Context, f } }() fc := &graphql.FieldContext{ - Object: "HTTPProbe", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -15843,21 +16377,24 @@ func (ec *executionContext) _HTTPProbe_insecureSkipVerify(ctx context.Context, f ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InsecureSkipVerify, nil + return obj.CreatedAt, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*bool) + res := resTmp.(string) fc.Result = res - return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _ImageRegistry_isDefault(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistry) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_noOfExperiments(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15865,7 +16402,7 @@ func (ec *executionContext) _ImageRegistry_isDefault(ctx context.Context, field } }() fc := &graphql.FieldContext{ - Object: "ImageRegistry", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -15874,7 +16411,7 @@ func (ec *executionContext) _ImageRegistry_isDefault(ctx context.Context, field ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.IsDefault, nil + return obj.NoOfExperiments, nil }) if err != nil { ec.Error(ctx, err) @@ -15883,12 +16420,12 @@ func (ec *executionContext) _ImageRegistry_isDefault(ctx context.Context, field if resTmp == nil { return graphql.Null } - res := resTmp.(*bool) + res := resTmp.(*int) fc.Result = res - return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) + return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } -func (ec *executionContext) _ImageRegistry_imageRegistryName(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistry) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_noOfExperimentRuns(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15896,7 +16433,7 @@ func (ec *executionContext) _ImageRegistry_imageRegistryName(ctx context.Context } }() fc := &graphql.FieldContext{ - Object: "ImageRegistry", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -15905,24 +16442,21 @@ func (ec *executionContext) _ImageRegistry_imageRegistryName(ctx context.Context ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ImageRegistryName, nil + return obj.NoOfExperimentRuns, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*int) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } -func (ec *executionContext) _ImageRegistry_imageRepoName(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistry) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_token(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15930,7 +16464,7 @@ func (ec *executionContext) _ImageRegistry_imageRepoName(ctx context.Context, fi } }() fc := &graphql.FieldContext{ - Object: "ImageRegistry", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -15939,7 +16473,7 @@ func (ec *executionContext) _ImageRegistry_imageRepoName(ctx context.Context, fi ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ImageRepoName, nil + return obj.Token, nil }) if err != nil { ec.Error(ctx, err) @@ -15956,7 +16490,7 @@ func (ec *executionContext) _ImageRegistry_imageRepoName(ctx context.Context, fi return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _ImageRegistry_imageRegistryType(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistry) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_infraNamespace(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15964,7 +16498,7 @@ func (ec *executionContext) _ImageRegistry_imageRegistryType(ctx context.Context } }() fc := &graphql.FieldContext{ - Object: "ImageRegistry", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -15973,24 +16507,21 @@ func (ec *executionContext) _ImageRegistry_imageRegistryType(ctx context.Context ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ImageRegistryType, nil + return obj.InfraNamespace, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _ImageRegistry_secretName(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistry) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_serviceAccount(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -15998,7 +16529,7 @@ func (ec *executionContext) _ImageRegistry_secretName(ctx context.Context, field } }() fc := &graphql.FieldContext{ - Object: "ImageRegistry", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -16007,7 +16538,7 @@ func (ec *executionContext) _ImageRegistry_secretName(ctx context.Context, field ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.SecretName, nil + return obj.ServiceAccount, nil }) if err != nil { ec.Error(ctx, err) @@ -16021,7 +16552,7 @@ func (ec *executionContext) _ImageRegistry_secretName(ctx context.Context, field return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _ImageRegistry_secretNamespace(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistry) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_infraScope(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16029,7 +16560,7 @@ func (ec *executionContext) _ImageRegistry_secretNamespace(ctx context.Context, } }() fc := &graphql.FieldContext{ - Object: "ImageRegistry", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -16038,21 +16569,24 @@ func (ec *executionContext) _ImageRegistry_secretNamespace(ctx context.Context, ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.SecretNamespace, nil + return obj.InfraScope, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _ImageRegistry_enableRegistry(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistry) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_infraNsExists(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16060,7 +16594,7 @@ func (ec *executionContext) _ImageRegistry_enableRegistry(ctx context.Context, f } }() fc := &graphql.FieldContext{ - Object: "ImageRegistry", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -16069,7 +16603,7 @@ func (ec *executionContext) _ImageRegistry_enableRegistry(ctx context.Context, f ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.EnableRegistry, nil + return obj.InfraNsExists, nil }) if err != nil { ec.Error(ctx, err) @@ -16083,7 +16617,7 @@ func (ec *executionContext) _ImageRegistry_enableRegistry(ctx context.Context, f return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } -func (ec *executionContext) _ImageRegistryResponse_isDefault(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_infraSaExists(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16091,7 +16625,7 @@ func (ec *executionContext) _ImageRegistryResponse_isDefault(ctx context.Context } }() fc := &graphql.FieldContext{ - Object: "ImageRegistryResponse", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -16100,24 +16634,21 @@ func (ec *executionContext) _ImageRegistryResponse_isDefault(ctx context.Context ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.IsDefault, nil + return obj.InfraSaExists, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(*bool) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } -func (ec *executionContext) _ImageRegistryResponse_imageRegistryInfo(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_lastExperimentTimestamp(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16125,7 +16656,7 @@ func (ec *executionContext) _ImageRegistryResponse_imageRegistryInfo(ctx context } }() fc := &graphql.FieldContext{ - Object: "ImageRegistryResponse", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -16134,7 +16665,7 @@ func (ec *executionContext) _ImageRegistryResponse_imageRegistryInfo(ctx context ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ImageRegistryInfo, nil + return obj.LastExperimentTimestamp, nil }) if err != nil { ec.Error(ctx, err) @@ -16143,12 +16674,12 @@ func (ec *executionContext) _ImageRegistryResponse_imageRegistryInfo(ctx context if resTmp == nil { return graphql.Null } - res := resTmp.(*model.ImageRegistry) + res := resTmp.(*string) fc.Result = res - return ec.marshalOImageRegistry2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐImageRegistry(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _ImageRegistryResponse_imageRegistryID(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_startTime(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16156,7 +16687,7 @@ func (ec *executionContext) _ImageRegistryResponse_imageRegistryID(ctx context.C } }() fc := &graphql.FieldContext{ - Object: "ImageRegistryResponse", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -16165,7 +16696,7 @@ func (ec *executionContext) _ImageRegistryResponse_imageRegistryID(ctx context.C ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ImageRegistryID, nil + return obj.StartTime, nil }) if err != nil { ec.Error(ctx, err) @@ -16182,7 +16713,7 @@ func (ec *executionContext) _ImageRegistryResponse_imageRegistryID(ctx context.C return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _ImageRegistryResponse_projectID(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_version(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16190,7 +16721,7 @@ func (ec *executionContext) _ImageRegistryResponse_projectID(ctx context.Context } }() fc := &graphql.FieldContext{ - Object: "ImageRegistryResponse", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -16199,7 +16730,7 @@ func (ec *executionContext) _ImageRegistryResponse_projectID(ctx context.Context ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ProjectID, nil + return obj.Version, nil }) if err != nil { ec.Error(ctx, err) @@ -16216,69 +16747,7 @@ func (ec *executionContext) _ImageRegistryResponse_projectID(ctx context.Context return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _ImageRegistryResponse_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ImageRegistryResponse", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.UpdatedAt, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) _ImageRegistryResponse_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "ImageRegistryResponse", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.CreatedAt, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) _ImageRegistryResponse_createdBy(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_createdBy(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16286,7 +16755,7 @@ func (ec *executionContext) _ImageRegistryResponse_createdBy(ctx context.Context } }() fc := &graphql.FieldContext{ - Object: "ImageRegistryResponse", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -16309,7 +16778,7 @@ func (ec *executionContext) _ImageRegistryResponse_createdBy(ctx context.Context return ec.marshalOUserDetails2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐUserDetails(ctx, field.Selections, res) } -func (ec *executionContext) _ImageRegistryResponse_updatedBy(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_updatedBy(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16317,7 +16786,7 @@ func (ec *executionContext) _ImageRegistryResponse_updatedBy(ctx context.Context } }() fc := &graphql.FieldContext{ - Object: "ImageRegistryResponse", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -16340,7 +16809,7 @@ func (ec *executionContext) _ImageRegistryResponse_updatedBy(ctx context.Context return ec.marshalOUserDetails2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐUserDetails(ctx, field.Selections, res) } -func (ec *executionContext) _ImageRegistryResponse_isRemoved(ctx context.Context, field graphql.CollectedField, obj *model.ImageRegistryResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_infraType(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16348,7 +16817,7 @@ func (ec *executionContext) _ImageRegistryResponse_isRemoved(ctx context.Context } }() fc := &graphql.FieldContext{ - Object: "ImageRegistryResponse", + Object: "Infra", Field: field, Args: nil, IsMethod: false, @@ -16357,7 +16826,7 @@ func (ec *executionContext) _ImageRegistryResponse_isRemoved(ctx context.Context ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.IsRemoved, nil + return obj.InfraType, nil }) if err != nil { ec.Error(ctx, err) @@ -16366,12 +16835,12 @@ func (ec *executionContext) _ImageRegistryResponse_isRemoved(ctx context.Context if resTmp == nil { return graphql.Null } - res := resTmp.(*bool) + res := resTmp.(*model.InfrastructureType) fc.Result = res - return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) + return ec.marshalOInfrastructureType2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐInfrastructureType(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_projectID(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _Infra_updateStatus(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16388,7 +16857,7 @@ func (ec *executionContext) _Infra_projectID(ctx context.Context, field graphql. ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ProjectID, nil + return obj.UpdateStatus, nil }) if err != nil { ec.Error(ctx, err) @@ -16400,12 +16869,12 @@ func (ec *executionContext) _Infra_projectID(ctx context.Context, field graphql. } return graphql.Null } - res := resTmp.(string) + res := resTmp.(model.UpdateStatus) fc.Result = res - return ec.marshalNID2string(ctx, field.Selections, res) + return ec.marshalNUpdateStatus2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐUpdateStatus(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_infraID(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _InfraActionResponse_projectID(ctx context.Context, field graphql.CollectedField, obj *model.InfraActionResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16413,7 +16882,7 @@ func (ec *executionContext) _Infra_infraID(ctx context.Context, field graphql.Co } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "InfraActionResponse", Field: field, Args: nil, IsMethod: false, @@ -16422,7 +16891,7 @@ func (ec *executionContext) _Infra_infraID(ctx context.Context, field graphql.Co ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InfraID, nil + return obj.ProjectID, nil }) if err != nil { ec.Error(ctx, err) @@ -16436,10 +16905,10 @@ func (ec *executionContext) _Infra_infraID(ctx context.Context, field graphql.Co } res := resTmp.(string) fc.Result = res - return ec.marshalNID2string(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_name(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _InfraActionResponse_action(ctx context.Context, field graphql.CollectedField, obj *model.InfraActionResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16447,7 +16916,7 @@ func (ec *executionContext) _Infra_name(ctx context.Context, field graphql.Colle } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "InfraActionResponse", Field: field, Args: nil, IsMethod: false, @@ -16456,7 +16925,7 @@ func (ec *executionContext) _Infra_name(ctx context.Context, field graphql.Colle ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.Action, nil }) if err != nil { ec.Error(ctx, err) @@ -16468,12 +16937,12 @@ func (ec *executionContext) _Infra_name(ctx context.Context, field graphql.Colle } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*model.ActionPayload) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNActionPayload2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐActionPayload(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_description(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _InfraEventResponse_eventID(ctx context.Context, field graphql.CollectedField, obj *model.InfraEventResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16481,7 +16950,7 @@ func (ec *executionContext) _Infra_description(ctx context.Context, field graphq } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "InfraEventResponse", Field: field, Args: nil, IsMethod: false, @@ -16490,21 +16959,24 @@ func (ec *executionContext) _Infra_description(ctx context.Context, field graphq ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Description, nil + return obj.EventID, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_tags(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _InfraEventResponse_eventType(ctx context.Context, field graphql.CollectedField, obj *model.InfraEventResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16512,7 +16984,7 @@ func (ec *executionContext) _Infra_tags(ctx context.Context, field graphql.Colle } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "InfraEventResponse", Field: field, Args: nil, IsMethod: false, @@ -16521,21 +16993,24 @@ func (ec *executionContext) _Infra_tags(ctx context.Context, field graphql.Colle ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Tags, nil + return obj.EventType, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚕstringᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_environmentID(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _InfraEventResponse_eventName(ctx context.Context, field graphql.CollectedField, obj *model.InfraEventResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16543,7 +17018,7 @@ func (ec *executionContext) _Infra_environmentID(ctx context.Context, field grap } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "InfraEventResponse", Field: field, Args: nil, IsMethod: false, @@ -16552,7 +17027,7 @@ func (ec *executionContext) _Infra_environmentID(ctx context.Context, field grap ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.EnvironmentID, nil + return obj.EventName, nil }) if err != nil { ec.Error(ctx, err) @@ -16569,7 +17044,7 @@ func (ec *executionContext) _Infra_environmentID(ctx context.Context, field grap return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_platformName(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _InfraEventResponse_description(ctx context.Context, field graphql.CollectedField, obj *model.InfraEventResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16577,7 +17052,7 @@ func (ec *executionContext) _Infra_platformName(ctx context.Context, field graph } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "InfraEventResponse", Field: field, Args: nil, IsMethod: false, @@ -16586,7 +17061,7 @@ func (ec *executionContext) _Infra_platformName(ctx context.Context, field graph ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.PlatformName, nil + return obj.Description, nil }) if err != nil { ec.Error(ctx, err) @@ -16603,7 +17078,7 @@ func (ec *executionContext) _Infra_platformName(ctx context.Context, field graph return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_isActive(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _InfraEventResponse_infra(ctx context.Context, field graphql.CollectedField, obj *model.InfraEventResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16611,7 +17086,7 @@ func (ec *executionContext) _Infra_isActive(ctx context.Context, field graphql.C } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "InfraEventResponse", Field: field, Args: nil, IsMethod: false, @@ -16620,7 +17095,7 @@ func (ec *executionContext) _Infra_isActive(ctx context.Context, field graphql.C ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.IsActive, nil + return obj.Infra, nil }) if err != nil { ec.Error(ctx, err) @@ -16632,12 +17107,12 @@ func (ec *executionContext) _Infra_isActive(ctx context.Context, field graphql.C } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(*model.Infra) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNInfra2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐInfra(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_isInfraConfirmed(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _InfraVersionDetails_latestVersion(ctx context.Context, field graphql.CollectedField, obj *model.InfraVersionDetails) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16645,7 +17120,7 @@ func (ec *executionContext) _Infra_isInfraConfirmed(ctx context.Context, field g } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "InfraVersionDetails", Field: field, Args: nil, IsMethod: false, @@ -16654,7 +17129,7 @@ func (ec *executionContext) _Infra_isInfraConfirmed(ctx context.Context, field g ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.IsInfraConfirmed, nil + return obj.LatestVersion, nil }) if err != nil { ec.Error(ctx, err) @@ -16666,12 +17141,12 @@ func (ec *executionContext) _Infra_isInfraConfirmed(ctx context.Context, field g } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(string) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_isRemoved(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _InfraVersionDetails_compatibleVersions(ctx context.Context, field graphql.CollectedField, obj *model.InfraVersionDetails) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16679,7 +17154,7 @@ func (ec *executionContext) _Infra_isRemoved(ctx context.Context, field graphql. } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "InfraVersionDetails", Field: field, Args: nil, IsMethod: false, @@ -16688,7 +17163,7 @@ func (ec *executionContext) _Infra_isRemoved(ctx context.Context, field graphql. ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.IsRemoved, nil + return obj.CompatibleVersions, nil }) if err != nil { ec.Error(ctx, err) @@ -16700,12 +17175,12 @@ func (ec *executionContext) _Infra_isRemoved(ctx context.Context, field graphql. } return graphql.Null } - res := resTmp.(bool) + res := resTmp.([]string) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_updatedAt(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _K8SProbe_probeTimeout(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16713,7 +17188,7 @@ func (ec *executionContext) _Infra_updatedAt(ctx context.Context, field graphql. } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "K8SProbe", Field: field, Args: nil, IsMethod: false, @@ -16722,7 +17197,7 @@ func (ec *executionContext) _Infra_updatedAt(ctx context.Context, field graphql. ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.UpdatedAt, nil + return obj.ProbeTimeout, nil }) if err != nil { ec.Error(ctx, err) @@ -16739,7 +17214,7 @@ func (ec *executionContext) _Infra_updatedAt(ctx context.Context, field graphql. return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_createdAt(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _K8SProbe_interval(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16747,7 +17222,7 @@ func (ec *executionContext) _Infra_createdAt(ctx context.Context, field graphql. } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "K8SProbe", Field: field, Args: nil, IsMethod: false, @@ -16756,7 +17231,7 @@ func (ec *executionContext) _Infra_createdAt(ctx context.Context, field graphql. ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.CreatedAt, nil + return obj.Interval, nil }) if err != nil { ec.Error(ctx, err) @@ -16773,7 +17248,7 @@ func (ec *executionContext) _Infra_createdAt(ctx context.Context, field graphql. return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_noOfExperiments(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _K8SProbe_retry(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16781,7 +17256,7 @@ func (ec *executionContext) _Infra_noOfExperiments(ctx context.Context, field gr } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "K8SProbe", Field: field, Args: nil, IsMethod: false, @@ -16790,7 +17265,7 @@ func (ec *executionContext) _Infra_noOfExperiments(ctx context.Context, field gr ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.NoOfExperiments, nil + return obj.Retry, nil }) if err != nil { ec.Error(ctx, err) @@ -16804,7 +17279,7 @@ func (ec *executionContext) _Infra_noOfExperiments(ctx context.Context, field gr return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_noOfExperimentRuns(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _K8SProbe_attempt(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16812,7 +17287,7 @@ func (ec *executionContext) _Infra_noOfExperimentRuns(ctx context.Context, field } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "K8SProbe", Field: field, Args: nil, IsMethod: false, @@ -16821,7 +17296,7 @@ func (ec *executionContext) _Infra_noOfExperimentRuns(ctx context.Context, field ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.NoOfExperimentRuns, nil + return obj.Attempt, nil }) if err != nil { ec.Error(ctx, err) @@ -16835,41 +17310,7 @@ func (ec *executionContext) _Infra_noOfExperimentRuns(ctx context.Context, field return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_token(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Infra", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Token, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _Infra_infraNamespace(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _K8SProbe_probePollingInterval(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16877,7 +17318,7 @@ func (ec *executionContext) _Infra_infraNamespace(ctx context.Context, field gra } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "K8SProbe", Field: field, Args: nil, IsMethod: false, @@ -16886,7 +17327,7 @@ func (ec *executionContext) _Infra_infraNamespace(ctx context.Context, field gra ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InfraNamespace, nil + return obj.ProbePollingInterval, nil }) if err != nil { ec.Error(ctx, err) @@ -16900,7 +17341,7 @@ func (ec *executionContext) _Infra_infraNamespace(ctx context.Context, field gra return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_serviceAccount(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _K8SProbe_initialDelay(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16908,7 +17349,7 @@ func (ec *executionContext) _Infra_serviceAccount(ctx context.Context, field gra } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "K8SProbe", Field: field, Args: nil, IsMethod: false, @@ -16917,7 +17358,7 @@ func (ec *executionContext) _Infra_serviceAccount(ctx context.Context, field gra ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ServiceAccount, nil + return obj.InitialDelay, nil }) if err != nil { ec.Error(ctx, err) @@ -16931,41 +17372,7 @@ func (ec *executionContext) _Infra_serviceAccount(ctx context.Context, field gra return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_infraScope(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Infra", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.InfraScope, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _Infra_infraNsExists(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _K8SProbe_evaluationTimeout(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -16973,7 +17380,7 @@ func (ec *executionContext) _Infra_infraNsExists(ctx context.Context, field grap } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "K8SProbe", Field: field, Args: nil, IsMethod: false, @@ -16982,7 +17389,7 @@ func (ec *executionContext) _Infra_infraNsExists(ctx context.Context, field grap ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InfraNsExists, nil + return obj.EvaluationTimeout, nil }) if err != nil { ec.Error(ctx, err) @@ -16991,12 +17398,12 @@ func (ec *executionContext) _Infra_infraNsExists(ctx context.Context, field grap if resTmp == nil { return graphql.Null } - res := resTmp.(*bool) + res := resTmp.(*string) fc.Result = res - return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_infraSaExists(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _K8SProbe_stopOnFailure(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17004,7 +17411,7 @@ func (ec *executionContext) _Infra_infraSaExists(ctx context.Context, field grap } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "K8SProbe", Field: field, Args: nil, IsMethod: false, @@ -17013,7 +17420,7 @@ func (ec *executionContext) _Infra_infraSaExists(ctx context.Context, field grap ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InfraSaExists, nil + return obj.StopOnFailure, nil }) if err != nil { ec.Error(ctx, err) @@ -17027,7 +17434,7 @@ func (ec *executionContext) _Infra_infraSaExists(ctx context.Context, field grap return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_lastExperimentTimestamp(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _K8SProbe_group(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17035,7 +17442,7 @@ func (ec *executionContext) _Infra_lastExperimentTimestamp(ctx context.Context, } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "K8SProbe", Field: field, Args: nil, IsMethod: false, @@ -17044,7 +17451,7 @@ func (ec *executionContext) _Infra_lastExperimentTimestamp(ctx context.Context, ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.LastExperimentTimestamp, nil + return obj.Group, nil }) if err != nil { ec.Error(ctx, err) @@ -17058,41 +17465,7 @@ func (ec *executionContext) _Infra_lastExperimentTimestamp(ctx context.Context, return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_startTime(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - fc := &graphql.FieldContext{ - Object: "Infra", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.StartTime, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) -} - -func (ec *executionContext) _Infra_version(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _K8SProbe_version(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17100,7 +17473,7 @@ func (ec *executionContext) _Infra_version(ctx context.Context, field graphql.Co } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "K8SProbe", Field: field, Args: nil, IsMethod: false, @@ -17126,7 +17499,7 @@ func (ec *executionContext) _Infra_version(ctx context.Context, field graphql.Co return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_createdBy(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _K8SProbe_resource(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17134,7 +17507,7 @@ func (ec *executionContext) _Infra_createdBy(ctx context.Context, field graphql. } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "K8SProbe", Field: field, Args: nil, IsMethod: false, @@ -17143,21 +17516,24 @@ func (ec *executionContext) _Infra_createdBy(ctx context.Context, field graphql. ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.CreatedBy, nil + return obj.Resource, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*model.UserDetails) + res := resTmp.(string) fc.Result = res - return ec.marshalOUserDetails2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐUserDetails(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_updatedBy(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _K8SProbe_namespace(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17165,7 +17541,7 @@ func (ec *executionContext) _Infra_updatedBy(ctx context.Context, field graphql. } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "K8SProbe", Field: field, Args: nil, IsMethod: false, @@ -17174,7 +17550,7 @@ func (ec *executionContext) _Infra_updatedBy(ctx context.Context, field graphql. ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.UpdatedBy, nil + return obj.Namespace, nil }) if err != nil { ec.Error(ctx, err) @@ -17183,12 +17559,12 @@ func (ec *executionContext) _Infra_updatedBy(ctx context.Context, field graphql. if resTmp == nil { return graphql.Null } - res := resTmp.(*model.UserDetails) + res := resTmp.(*string) fc.Result = res - return ec.marshalOUserDetails2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐUserDetails(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_infraType(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _K8SProbe_fieldSelector(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17196,7 +17572,7 @@ func (ec *executionContext) _Infra_infraType(ctx context.Context, field graphql. } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "K8SProbe", Field: field, Args: nil, IsMethod: false, @@ -17205,7 +17581,7 @@ func (ec *executionContext) _Infra_infraType(ctx context.Context, field graphql. ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InfraType, nil + return obj.FieldSelector, nil }) if err != nil { ec.Error(ctx, err) @@ -17214,12 +17590,12 @@ func (ec *executionContext) _Infra_infraType(ctx context.Context, field graphql. if resTmp == nil { return graphql.Null } - res := resTmp.(*model.InfrastructureType) + res := resTmp.(*string) fc.Result = res - return ec.marshalOInfrastructureType2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐInfrastructureType(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Infra_updateStatus(ctx context.Context, field graphql.CollectedField, obj *model.Infra) (ret graphql.Marshaler) { +func (ec *executionContext) _K8SProbe_labelSelector(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17227,7 +17603,7 @@ func (ec *executionContext) _Infra_updateStatus(ctx context.Context, field graph } }() fc := &graphql.FieldContext{ - Object: "Infra", + Object: "K8SProbe", Field: field, Args: nil, IsMethod: false, @@ -17236,24 +17612,21 @@ func (ec *executionContext) _Infra_updateStatus(ctx context.Context, field graph ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.UpdateStatus, nil + return obj.LabelSelector, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(model.UpdateStatus) + res := resTmp.(*string) fc.Result = res - return ec.marshalNUpdateStatus2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐUpdateStatus(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _InfraActionResponse_projectID(ctx context.Context, field graphql.CollectedField, obj *model.InfraActionResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _K8SProbe_operation(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17261,7 +17634,7 @@ func (ec *executionContext) _InfraActionResponse_projectID(ctx context.Context, } }() fc := &graphql.FieldContext{ - Object: "InfraActionResponse", + Object: "K8SProbe", Field: field, Args: nil, IsMethod: false, @@ -17270,7 +17643,7 @@ func (ec *executionContext) _InfraActionResponse_projectID(ctx context.Context, ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ProjectID, nil + return obj.Operation, nil }) if err != nil { ec.Error(ctx, err) @@ -17287,7 +17660,7 @@ func (ec *executionContext) _InfraActionResponse_projectID(ctx context.Context, return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _InfraActionResponse_action(ctx context.Context, field graphql.CollectedField, obj *model.InfraActionResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _KubeObject_namespace(ctx context.Context, field graphql.CollectedField, obj *model.KubeObject) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17295,7 +17668,7 @@ func (ec *executionContext) _InfraActionResponse_action(ctx context.Context, fie } }() fc := &graphql.FieldContext{ - Object: "InfraActionResponse", + Object: "KubeObject", Field: field, Args: nil, IsMethod: false, @@ -17304,7 +17677,7 @@ func (ec *executionContext) _InfraActionResponse_action(ctx context.Context, fie ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Action, nil + return obj.Namespace, nil }) if err != nil { ec.Error(ctx, err) @@ -17316,12 +17689,12 @@ func (ec *executionContext) _InfraActionResponse_action(ctx context.Context, fie } return graphql.Null } - res := resTmp.(*model.ActionPayload) + res := resTmp.(string) fc.Result = res - return ec.marshalNActionPayload2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐActionPayload(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _InfraEventResponse_eventID(ctx context.Context, field graphql.CollectedField, obj *model.InfraEventResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _KubeObject_data(ctx context.Context, field graphql.CollectedField, obj *model.KubeObject) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17329,7 +17702,7 @@ func (ec *executionContext) _InfraEventResponse_eventID(ctx context.Context, fie } }() fc := &graphql.FieldContext{ - Object: "InfraEventResponse", + Object: "KubeObject", Field: field, Args: nil, IsMethod: false, @@ -17338,7 +17711,7 @@ func (ec *executionContext) _InfraEventResponse_eventID(ctx context.Context, fie ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.EventID, nil + return obj.Data, nil }) if err != nil { ec.Error(ctx, err) @@ -17350,12 +17723,12 @@ func (ec *executionContext) _InfraEventResponse_eventID(ctx context.Context, fie } return graphql.Null } - res := resTmp.(string) + res := resTmp.([]*model.ObjectData) fc.Result = res - return ec.marshalNID2string(ctx, field.Selections, res) + return ec.marshalNObjectData2ᚕᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐObjectData(ctx, field.Selections, res) } -func (ec *executionContext) _InfraEventResponse_eventType(ctx context.Context, field graphql.CollectedField, obj *model.InfraEventResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _KubeObjectResponse_infraID(ctx context.Context, field graphql.CollectedField, obj *model.KubeObjectResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17363,7 +17736,7 @@ func (ec *executionContext) _InfraEventResponse_eventType(ctx context.Context, f } }() fc := &graphql.FieldContext{ - Object: "InfraEventResponse", + Object: "KubeObjectResponse", Field: field, Args: nil, IsMethod: false, @@ -17372,7 +17745,7 @@ func (ec *executionContext) _InfraEventResponse_eventType(ctx context.Context, f ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.EventType, nil + return obj.InfraID, nil }) if err != nil { ec.Error(ctx, err) @@ -17386,10 +17759,10 @@ func (ec *executionContext) _InfraEventResponse_eventType(ctx context.Context, f } res := resTmp.(string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _InfraEventResponse_eventName(ctx context.Context, field graphql.CollectedField, obj *model.InfraEventResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _KubeObjectResponse_kubeObj(ctx context.Context, field graphql.CollectedField, obj *model.KubeObjectResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17397,7 +17770,7 @@ func (ec *executionContext) _InfraEventResponse_eventName(ctx context.Context, f } }() fc := &graphql.FieldContext{ - Object: "InfraEventResponse", + Object: "KubeObjectResponse", Field: field, Args: nil, IsMethod: false, @@ -17406,7 +17779,7 @@ func (ec *executionContext) _InfraEventResponse_eventName(ctx context.Context, f ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.EventName, nil + return obj.KubeObj, nil }) if err != nil { ec.Error(ctx, err) @@ -17418,12 +17791,12 @@ func (ec *executionContext) _InfraEventResponse_eventName(ctx context.Context, f } return graphql.Null } - res := resTmp.(string) + res := resTmp.([]*model.KubeObject) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNKubeObject2ᚕᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubeObject(ctx, field.Selections, res) } -func (ec *executionContext) _InfraEventResponse_description(ctx context.Context, field graphql.CollectedField, obj *model.InfraEventResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesCMDProbe_probeTimeout(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesCMDProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17431,7 +17804,7 @@ func (ec *executionContext) _InfraEventResponse_description(ctx context.Context, } }() fc := &graphql.FieldContext{ - Object: "InfraEventResponse", + Object: "KubernetesCMDProbe", Field: field, Args: nil, IsMethod: false, @@ -17440,7 +17813,7 @@ func (ec *executionContext) _InfraEventResponse_description(ctx context.Context, ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Description, nil + return obj.ProbeTimeout, nil }) if err != nil { ec.Error(ctx, err) @@ -17457,7 +17830,7 @@ func (ec *executionContext) _InfraEventResponse_description(ctx context.Context, return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _InfraEventResponse_infra(ctx context.Context, field graphql.CollectedField, obj *model.InfraEventResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesCMDProbe_interval(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesCMDProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17465,7 +17838,7 @@ func (ec *executionContext) _InfraEventResponse_infra(ctx context.Context, field } }() fc := &graphql.FieldContext{ - Object: "InfraEventResponse", + Object: "KubernetesCMDProbe", Field: field, Args: nil, IsMethod: false, @@ -17474,7 +17847,7 @@ func (ec *executionContext) _InfraEventResponse_infra(ctx context.Context, field ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Infra, nil + return obj.Interval, nil }) if err != nil { ec.Error(ctx, err) @@ -17486,12 +17859,12 @@ func (ec *executionContext) _InfraEventResponse_infra(ctx context.Context, field } return graphql.Null } - res := resTmp.(*model.Infra) + res := resTmp.(string) fc.Result = res - return ec.marshalNInfra2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐInfra(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _InfraVersionDetails_latestVersion(ctx context.Context, field graphql.CollectedField, obj *model.InfraVersionDetails) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesCMDProbe_retry(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesCMDProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17499,7 +17872,7 @@ func (ec *executionContext) _InfraVersionDetails_latestVersion(ctx context.Conte } }() fc := &graphql.FieldContext{ - Object: "InfraVersionDetails", + Object: "KubernetesCMDProbe", Field: field, Args: nil, IsMethod: false, @@ -17508,24 +17881,21 @@ func (ec *executionContext) _InfraVersionDetails_latestVersion(ctx context.Conte ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.LatestVersion, nil + return obj.Retry, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*int) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } -func (ec *executionContext) _InfraVersionDetails_compatibleVersions(ctx context.Context, field graphql.CollectedField, obj *model.InfraVersionDetails) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesCMDProbe_attempt(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesCMDProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17533,7 +17903,7 @@ func (ec *executionContext) _InfraVersionDetails_compatibleVersions(ctx context. } }() fc := &graphql.FieldContext{ - Object: "InfraVersionDetails", + Object: "KubernetesCMDProbe", Field: field, Args: nil, IsMethod: false, @@ -17542,24 +17912,21 @@ func (ec *executionContext) _InfraVersionDetails_compatibleVersions(ctx context. ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.CompatibleVersions, nil + return obj.Attempt, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.([]string) + res := resTmp.(*int) fc.Result = res - return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res) + return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } -func (ec *executionContext) _K8SProbe_probeTimeout(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesCMDProbe_probePollingInterval(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesCMDProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17567,7 +17934,7 @@ func (ec *executionContext) _K8SProbe_probeTimeout(ctx context.Context, field gr } }() fc := &graphql.FieldContext{ - Object: "K8SProbe", + Object: "KubernetesCMDProbe", Field: field, Args: nil, IsMethod: false, @@ -17576,24 +17943,21 @@ func (ec *executionContext) _K8SProbe_probeTimeout(ctx context.Context, field gr ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ProbeTimeout, nil + return obj.ProbePollingInterval, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _K8SProbe_interval(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesCMDProbe_initialDelay(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesCMDProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17601,7 +17965,7 @@ func (ec *executionContext) _K8SProbe_interval(ctx context.Context, field graphq } }() fc := &graphql.FieldContext{ - Object: "K8SProbe", + Object: "KubernetesCMDProbe", Field: field, Args: nil, IsMethod: false, @@ -17610,24 +17974,21 @@ func (ec *executionContext) _K8SProbe_interval(ctx context.Context, field graphq ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Interval, nil + return obj.InitialDelay, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _K8SProbe_retry(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesCMDProbe_evaluationTimeout(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesCMDProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17635,7 +17996,7 @@ func (ec *executionContext) _K8SProbe_retry(ctx context.Context, field graphql.C } }() fc := &graphql.FieldContext{ - Object: "K8SProbe", + Object: "KubernetesCMDProbe", Field: field, Args: nil, IsMethod: false, @@ -17644,7 +18005,7 @@ func (ec *executionContext) _K8SProbe_retry(ctx context.Context, field graphql.C ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Retry, nil + return obj.EvaluationTimeout, nil }) if err != nil { ec.Error(ctx, err) @@ -17653,12 +18014,12 @@ func (ec *executionContext) _K8SProbe_retry(ctx context.Context, field graphql.C if resTmp == nil { return graphql.Null } - res := resTmp.(*int) + res := resTmp.(*string) fc.Result = res - return ec.marshalOInt2ᚖint(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _K8SProbe_attempt(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesCMDProbe_stopOnFailure(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesCMDProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17666,7 +18027,7 @@ func (ec *executionContext) _K8SProbe_attempt(ctx context.Context, field graphql } }() fc := &graphql.FieldContext{ - Object: "K8SProbe", + Object: "KubernetesCMDProbe", Field: field, Args: nil, IsMethod: false, @@ -17675,7 +18036,7 @@ func (ec *executionContext) _K8SProbe_attempt(ctx context.Context, field graphql ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Attempt, nil + return obj.StopOnFailure, nil }) if err != nil { ec.Error(ctx, err) @@ -17684,12 +18045,12 @@ func (ec *executionContext) _K8SProbe_attempt(ctx context.Context, field graphql if resTmp == nil { return graphql.Null } - res := resTmp.(*int) + res := resTmp.(*bool) fc.Result = res - return ec.marshalOInt2ᚖint(ctx, field.Selections, res) + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } -func (ec *executionContext) _K8SProbe_probePollingInterval(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesCMDProbe_command(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesCMDProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17697,7 +18058,7 @@ func (ec *executionContext) _K8SProbe_probePollingInterval(ctx context.Context, } }() fc := &graphql.FieldContext{ - Object: "K8SProbe", + Object: "KubernetesCMDProbe", Field: field, Args: nil, IsMethod: false, @@ -17706,21 +18067,24 @@ func (ec *executionContext) _K8SProbe_probePollingInterval(ctx context.Context, ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ProbePollingInterval, nil + return obj.Command, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _K8SProbe_initialDelay(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesCMDProbe_comparator(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesCMDProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17728,7 +18092,7 @@ func (ec *executionContext) _K8SProbe_initialDelay(ctx context.Context, field gr } }() fc := &graphql.FieldContext{ - Object: "K8SProbe", + Object: "KubernetesCMDProbe", Field: field, Args: nil, IsMethod: false, @@ -17737,21 +18101,24 @@ func (ec *executionContext) _K8SProbe_initialDelay(ctx context.Context, field gr ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InitialDelay, nil + return obj.Comparator, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*model.Comparator) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNComparator2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐComparator(ctx, field.Selections, res) } -func (ec *executionContext) _K8SProbe_evaluationTimeout(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesCMDProbe_source(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesCMDProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17759,7 +18126,7 @@ func (ec *executionContext) _K8SProbe_evaluationTimeout(ctx context.Context, fie } }() fc := &graphql.FieldContext{ - Object: "K8SProbe", + Object: "KubernetesCMDProbe", Field: field, Args: nil, IsMethod: false, @@ -17768,7 +18135,7 @@ func (ec *executionContext) _K8SProbe_evaluationTimeout(ctx context.Context, fie ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.EvaluationTimeout, nil + return obj.Source, nil }) if err != nil { ec.Error(ctx, err) @@ -17782,7 +18149,7 @@ func (ec *executionContext) _K8SProbe_evaluationTimeout(ctx context.Context, fie return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _K8SProbe_stopOnFailure(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesHTTPProbe_probeTimeout(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesHTTPProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17790,7 +18157,7 @@ func (ec *executionContext) _K8SProbe_stopOnFailure(ctx context.Context, field g } }() fc := &graphql.FieldContext{ - Object: "K8SProbe", + Object: "KubernetesHTTPProbe", Field: field, Args: nil, IsMethod: false, @@ -17799,52 +18166,24 @@ func (ec *executionContext) _K8SProbe_stopOnFailure(ctx context.Context, field g ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.StopOnFailure, nil + return obj.ProbeTimeout, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - return graphql.Null - } - res := resTmp.(*bool) - fc.Result = res - return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) -} - -func (ec *executionContext) _K8SProbe_group(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") } - }() - fc := &graphql.FieldContext{ - Object: "K8SProbe", - Field: field, - Args: nil, - IsMethod: false, - } - - ctx = graphql.WithFieldContext(ctx, fc) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Group, nil - }) - if err != nil { - ec.Error(ctx, err) return graphql.Null } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _K8SProbe_version(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesHTTPProbe_interval(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesHTTPProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17852,7 +18191,7 @@ func (ec *executionContext) _K8SProbe_version(ctx context.Context, field graphql } }() fc := &graphql.FieldContext{ - Object: "K8SProbe", + Object: "KubernetesHTTPProbe", Field: field, Args: nil, IsMethod: false, @@ -17861,7 +18200,7 @@ func (ec *executionContext) _K8SProbe_version(ctx context.Context, field graphql ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Version, nil + return obj.Interval, nil }) if err != nil { ec.Error(ctx, err) @@ -17878,7 +18217,7 @@ func (ec *executionContext) _K8SProbe_version(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _K8SProbe_resource(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesHTTPProbe_retry(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesHTTPProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17886,7 +18225,7 @@ func (ec *executionContext) _K8SProbe_resource(ctx context.Context, field graphq } }() fc := &graphql.FieldContext{ - Object: "K8SProbe", + Object: "KubernetesHTTPProbe", Field: field, Args: nil, IsMethod: false, @@ -17895,24 +18234,21 @@ func (ec *executionContext) _K8SProbe_resource(ctx context.Context, field graphq ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Resource, nil + return obj.Retry, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*int) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } -func (ec *executionContext) _K8SProbe_namespace(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesHTTPProbe_attempt(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesHTTPProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17920,7 +18256,7 @@ func (ec *executionContext) _K8SProbe_namespace(ctx context.Context, field graph } }() fc := &graphql.FieldContext{ - Object: "K8SProbe", + Object: "KubernetesHTTPProbe", Field: field, Args: nil, IsMethod: false, @@ -17929,7 +18265,7 @@ func (ec *executionContext) _K8SProbe_namespace(ctx context.Context, field graph ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Namespace, nil + return obj.Attempt, nil }) if err != nil { ec.Error(ctx, err) @@ -17938,12 +18274,12 @@ func (ec *executionContext) _K8SProbe_namespace(ctx context.Context, field graph if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*int) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } -func (ec *executionContext) _K8SProbe_fieldSelector(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesHTTPProbe_probePollingInterval(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesHTTPProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17951,7 +18287,7 @@ func (ec *executionContext) _K8SProbe_fieldSelector(ctx context.Context, field g } }() fc := &graphql.FieldContext{ - Object: "K8SProbe", + Object: "KubernetesHTTPProbe", Field: field, Args: nil, IsMethod: false, @@ -17960,7 +18296,7 @@ func (ec *executionContext) _K8SProbe_fieldSelector(ctx context.Context, field g ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.FieldSelector, nil + return obj.ProbePollingInterval, nil }) if err != nil { ec.Error(ctx, err) @@ -17974,7 +18310,7 @@ func (ec *executionContext) _K8SProbe_fieldSelector(ctx context.Context, field g return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _K8SProbe_labelSelector(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesHTTPProbe_initialDelay(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesHTTPProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -17982,7 +18318,7 @@ func (ec *executionContext) _K8SProbe_labelSelector(ctx context.Context, field g } }() fc := &graphql.FieldContext{ - Object: "K8SProbe", + Object: "KubernetesHTTPProbe", Field: field, Args: nil, IsMethod: false, @@ -17991,7 +18327,7 @@ func (ec *executionContext) _K8SProbe_labelSelector(ctx context.Context, field g ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.LabelSelector, nil + return obj.InitialDelay, nil }) if err != nil { ec.Error(ctx, err) @@ -18005,7 +18341,7 @@ func (ec *executionContext) _K8SProbe_labelSelector(ctx context.Context, field g return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _K8SProbe_operation(ctx context.Context, field graphql.CollectedField, obj *model.K8SProbe) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesHTTPProbe_evaluationTimeout(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesHTTPProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -18013,7 +18349,7 @@ func (ec *executionContext) _K8SProbe_operation(ctx context.Context, field graph } }() fc := &graphql.FieldContext{ - Object: "K8SProbe", + Object: "KubernetesHTTPProbe", Field: field, Args: nil, IsMethod: false, @@ -18022,24 +18358,21 @@ func (ec *executionContext) _K8SProbe_operation(ctx context.Context, field graph ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Operation, nil + return obj.EvaluationTimeout, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _KubeObject_namespace(ctx context.Context, field graphql.CollectedField, obj *model.KubeObject) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesHTTPProbe_stopOnFailure(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesHTTPProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -18047,7 +18380,7 @@ func (ec *executionContext) _KubeObject_namespace(ctx context.Context, field gra } }() fc := &graphql.FieldContext{ - Object: "KubeObject", + Object: "KubernetesHTTPProbe", Field: field, Args: nil, IsMethod: false, @@ -18056,24 +18389,21 @@ func (ec *executionContext) _KubeObject_namespace(ctx context.Context, field gra ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Namespace, nil + return obj.StopOnFailure, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*bool) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } -func (ec *executionContext) _KubeObject_data(ctx context.Context, field graphql.CollectedField, obj *model.KubeObject) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesHTTPProbe_url(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesHTTPProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -18081,7 +18411,7 @@ func (ec *executionContext) _KubeObject_data(ctx context.Context, field graphql. } }() fc := &graphql.FieldContext{ - Object: "KubeObject", + Object: "KubernetesHTTPProbe", Field: field, Args: nil, IsMethod: false, @@ -18090,7 +18420,7 @@ func (ec *executionContext) _KubeObject_data(ctx context.Context, field graphql. ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Data, nil + return obj.URL, nil }) if err != nil { ec.Error(ctx, err) @@ -18102,12 +18432,12 @@ func (ec *executionContext) _KubeObject_data(ctx context.Context, field graphql. } return graphql.Null } - res := resTmp.([]*model.ObjectData) + res := resTmp.(string) fc.Result = res - return ec.marshalNObjectData2ᚕᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐObjectData(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _KubeObjectResponse_infraID(ctx context.Context, field graphql.CollectedField, obj *model.KubeObjectResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesHTTPProbe_method(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesHTTPProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -18115,7 +18445,7 @@ func (ec *executionContext) _KubeObjectResponse_infraID(ctx context.Context, fie } }() fc := &graphql.FieldContext{ - Object: "KubeObjectResponse", + Object: "KubernetesHTTPProbe", Field: field, Args: nil, IsMethod: false, @@ -18124,7 +18454,7 @@ func (ec *executionContext) _KubeObjectResponse_infraID(ctx context.Context, fie ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InfraID, nil + return obj.Method, nil }) if err != nil { ec.Error(ctx, err) @@ -18136,12 +18466,12 @@ func (ec *executionContext) _KubeObjectResponse_infraID(ctx context.Context, fie } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*model.Method) fc.Result = res - return ec.marshalNID2string(ctx, field.Selections, res) + return ec.marshalNMethod2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐMethod(ctx, field.Selections, res) } -func (ec *executionContext) _KubeObjectResponse_kubeObj(ctx context.Context, field graphql.CollectedField, obj *model.KubeObjectResponse) (ret graphql.Marshaler) { +func (ec *executionContext) _KubernetesHTTPProbe_insecureSkipVerify(ctx context.Context, field graphql.CollectedField, obj *model.KubernetesHTTPProbe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -18149,7 +18479,7 @@ func (ec *executionContext) _KubeObjectResponse_kubeObj(ctx context.Context, fie } }() fc := &graphql.FieldContext{ - Object: "KubeObjectResponse", + Object: "KubernetesHTTPProbe", Field: field, Args: nil, IsMethod: false, @@ -18158,21 +18488,18 @@ func (ec *executionContext) _KubeObjectResponse_kubeObj(ctx context.Context, fie ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.KubeObj, nil + return obj.InsecureSkipVerify, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.([]*model.KubeObject) + res := resTmp.(*bool) fc.Result = res - return ec.marshalNKubeObject2ᚕᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubeObject(ctx, field.Selections, res) + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } func (ec *executionContext) _Link_name(ctx context.Context, field graphql.CollectedField, obj *model.Link) (ret graphql.Marshaler) { @@ -21526,7 +21853,7 @@ func (ec *executionContext) _Probe_type(ctx context.Context, field graphql.Colle return ec.marshalNProbeType2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐProbeType(ctx, field.Selections, res) } -func (ec *executionContext) _Probe_httpProperties(ctx context.Context, field graphql.CollectedField, obj *model.Probe) (ret graphql.Marshaler) { +func (ec *executionContext) _Probe_infrastructureType(ctx context.Context, field graphql.CollectedField, obj *model.Probe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -21543,21 +21870,24 @@ func (ec *executionContext) _Probe_httpProperties(ctx context.Context, field gra ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.HTTPProperties, nil + return obj.InfrastructureType, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*model.HTTPProbe) + res := resTmp.(model.InfrastructureType) fc.Result = res - return ec.marshalOHTTPProbe2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐHTTPProbe(ctx, field.Selections, res) + return ec.marshalNInfrastructureType2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐInfrastructureType(ctx, field.Selections, res) } -func (ec *executionContext) _Probe_cmdProperties(ctx context.Context, field graphql.CollectedField, obj *model.Probe) (ret graphql.Marshaler) { +func (ec *executionContext) _Probe_kubernetesHTTPProperties(ctx context.Context, field graphql.CollectedField, obj *model.Probe) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -21574,7 +21904,7 @@ func (ec *executionContext) _Probe_cmdProperties(ctx context.Context, field grap ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.CmdProperties, nil + return obj.KubernetesHTTPProperties, nil }) if err != nil { ec.Error(ctx, err) @@ -21583,9 +21913,40 @@ func (ec *executionContext) _Probe_cmdProperties(ctx context.Context, field grap if resTmp == nil { return graphql.Null } - res := resTmp.(*model.CMDProbe) + res := resTmp.(*model.KubernetesHTTPProbe) fc.Result = res - return ec.marshalOCMDProbe2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐCMDProbe(ctx, field.Selections, res) + return ec.marshalOKubernetesHTTPProbe2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubernetesHTTPProbe(ctx, field.Selections, res) +} + +func (ec *executionContext) _Probe_kubernetesCMDProperties(ctx context.Context, field graphql.CollectedField, obj *model.Probe) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Probe", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.KubernetesCMDProperties, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.KubernetesCMDProbe) + fc.Result = res + return ec.marshalOKubernetesCMDProbe2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubernetesCMDProbe(ctx, field.Selections, res) } func (ec *executionContext) _Probe_k8sProperties(ctx context.Context, field graphql.CollectedField, obj *model.Probe) (ret graphql.Marshaler) { @@ -22125,7 +22486,7 @@ func (ec *executionContext) _Query_getExperimentRun(ctx context.Context, field g fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().GetExperimentRun(rctx, args["projectID"].(string), args["experimentRunID"].(string)) + return ec.resolvers.Query().GetExperimentRun(rctx, args["projectID"].(string), args["experimentRunID"].(*string), args["notifyID"].(*string)) }) if err != nil { ec.Error(ctx, err) @@ -23372,7 +23733,7 @@ func (ec *executionContext) _Query_listProbes(ctx context.Context, field graphql resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().ListProbes(rctx, args["projectID"].(string), args["probeNames"].([]string), args["filter"].(*model.ProbeFilterInput)) + return ec.resolvers.Query().ListProbes(rctx, args["projectID"].(string), args["infrastructureType"].(*model.InfrastructureType), args["probeNames"].([]string), args["filter"].(*model.ProbeFilterInput)) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Authorized == nil { @@ -24113,6 +24474,40 @@ func (ec *executionContext) _RecentExperimentRun_updatedBy(ctx context.Context, return ec.marshalOUserDetails2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐUserDetails(ctx, field.Selections, res) } +func (ec *executionContext) _RecentExperimentRun_runSequence(ctx context.Context, field graphql.CollectedField, obj *model.RecentExperimentRun) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "RecentExperimentRun", + Field: field, + Args: nil, + IsMethod: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RunSequence, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + func (ec *executionContext) _RegisterInfraResponse_token(ctx context.Context, field graphql.CollectedField, obj *model.RegisterInfraResponse) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -27712,45 +28107,219 @@ func (ec *executionContext) unmarshalInputK8SProbeRequest(ctx context.Context, o if err != nil { return it, err } - case "group": - var err error - it.Group, err = ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - case "version": - var err error - it.Version, err = ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - case "resource": - var err error - it.Resource, err = ec.unmarshalNString2string(ctx, v) - if err != nil { - return it, err - } - case "namespace": - var err error - it.Namespace, err = ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - case "fieldSelector": + case "group": + var err error + it.Group, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "version": + var err error + it.Version, err = ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + case "resource": + var err error + it.Resource, err = ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + case "namespace": + var err error + it.Namespace, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "fieldSelector": + var err error + it.FieldSelector, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "labelSelector": + var err error + it.LabelSelector, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "operation": + var err error + it.Operation, err = ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputKubeGVRRequest(ctx context.Context, obj interface{}) (model.KubeGVRRequest, error) { + var it model.KubeGVRRequest + var asMap = obj.(map[string]interface{}) + + for k, v := range asMap { + switch k { + case "group": + var err error + it.Group, err = ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + case "version": + var err error + it.Version, err = ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + case "resource": + var err error + it.Resource, err = ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputKubeObjectData(ctx context.Context, obj interface{}) (model.KubeObjectData, error) { + var it model.KubeObjectData + var asMap = obj.(map[string]interface{}) + + for k, v := range asMap { + switch k { + case "requestID": + var err error + it.RequestID, err = ec.unmarshalNID2string(ctx, v) + if err != nil { + return it, err + } + case "infraID": + var err error + it.InfraID, err = ec.unmarshalNInfraIdentity2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐInfraIdentity(ctx, v) + if err != nil { + return it, err + } + case "kubeObj": + var err error + it.KubeObj, err = ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputKubeObjectRequest(ctx context.Context, obj interface{}) (model.KubeObjectRequest, error) { + var it model.KubeObjectRequest + var asMap = obj.(map[string]interface{}) + + for k, v := range asMap { + switch k { + case "infraID": + var err error + it.InfraID, err = ec.unmarshalNID2string(ctx, v) + if err != nil { + return it, err + } + case "kubeObjRequest": + var err error + it.KubeObjRequest, err = ec.unmarshalOKubeGVRRequest2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubeGVRRequest(ctx, v) + if err != nil { + return it, err + } + case "objectType": + var err error + it.ObjectType, err = ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + case "workloads": + var err error + it.Workloads, err = ec.unmarshalOWorkload2ᚕᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐWorkload(ctx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputKubernetesCMDProbeRequest(ctx context.Context, obj interface{}) (model.KubernetesCMDProbeRequest, error) { + var it model.KubernetesCMDProbeRequest + var asMap = obj.(map[string]interface{}) + + for k, v := range asMap { + switch k { + case "probeTimeout": + var err error + it.ProbeTimeout, err = ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + case "interval": + var err error + it.Interval, err = ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + case "retry": + var err error + it.Retry, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "attempt": + var err error + it.Attempt, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + case "probePollingInterval": + var err error + it.ProbePollingInterval, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "initialDelay": + var err error + it.InitialDelay, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "evaluationTimeout": + var err error + it.EvaluationTimeout, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "stopOnFailure": + var err error + it.StopOnFailure, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + case "command": var err error - it.FieldSelector, err = ec.unmarshalOString2ᚖstring(ctx, v) + it.Command, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - case "labelSelector": + case "comparator": var err error - it.LabelSelector, err = ec.unmarshalOString2ᚖstring(ctx, v) + it.Comparator, err = ec.unmarshalNComparatorInput2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐComparatorInput(ctx, v) if err != nil { return it, err } - case "operation": + case "source": var err error - it.Operation, err = ec.unmarshalNString2string(ctx, v) + it.Source, err = ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } @@ -27760,93 +28329,75 @@ func (ec *executionContext) unmarshalInputK8SProbeRequest(ctx context.Context, o return it, nil } -func (ec *executionContext) unmarshalInputKubeGVRRequest(ctx context.Context, obj interface{}) (model.KubeGVRRequest, error) { - var it model.KubeGVRRequest +func (ec *executionContext) unmarshalInputKubernetesHTTPProbeRequest(ctx context.Context, obj interface{}) (model.KubernetesHTTPProbeRequest, error) { + var it model.KubernetesHTTPProbeRequest var asMap = obj.(map[string]interface{}) for k, v := range asMap { switch k { - case "group": + case "probeTimeout": var err error - it.Group, err = ec.unmarshalNString2string(ctx, v) + it.ProbeTimeout, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - case "version": + case "interval": var err error - it.Version, err = ec.unmarshalNString2string(ctx, v) + it.Interval, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - case "resource": + case "retry": var err error - it.Resource, err = ec.unmarshalNString2string(ctx, v) + it.Retry, err = ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputKubeObjectData(ctx context.Context, obj interface{}) (model.KubeObjectData, error) { - var it model.KubeObjectData - var asMap = obj.(map[string]interface{}) - - for k, v := range asMap { - switch k { - case "requestID": + case "attempt": var err error - it.RequestID, err = ec.unmarshalNID2string(ctx, v) + it.Attempt, err = ec.unmarshalOInt2ᚖint(ctx, v) if err != nil { return it, err } - case "infraID": + case "probePollingInterval": var err error - it.InfraID, err = ec.unmarshalNInfraIdentity2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐInfraIdentity(ctx, v) + it.ProbePollingInterval, err = ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - case "kubeObj": + case "initialDelay": var err error - it.KubeObj, err = ec.unmarshalNString2string(ctx, v) + it.InitialDelay, err = ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - } - } - - return it, nil -} - -func (ec *executionContext) unmarshalInputKubeObjectRequest(ctx context.Context, obj interface{}) (model.KubeObjectRequest, error) { - var it model.KubeObjectRequest - var asMap = obj.(map[string]interface{}) - - for k, v := range asMap { - switch k { - case "infraID": + case "evaluationTimeout": var err error - it.InfraID, err = ec.unmarshalNID2string(ctx, v) + it.EvaluationTimeout, err = ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - case "kubeObjRequest": + case "stopOnFailure": var err error - it.KubeObjRequest, err = ec.unmarshalOKubeGVRRequest2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubeGVRRequest(ctx, v) + it.StopOnFailure, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - case "objectType": + case "url": var err error - it.ObjectType, err = ec.unmarshalNString2string(ctx, v) + it.URL, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } - case "workloads": + case "method": var err error - it.Workloads, err = ec.unmarshalOWorkload2ᚕᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐWorkload(ctx, v) + it.Method, err = ec.unmarshalNMethodRequest2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐMethodRequest(ctx, v) + if err != nil { + return it, err + } + case "insecureSkipVerify": + var err error + it.InsecureSkipVerify, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } @@ -28408,15 +28959,21 @@ func (ec *executionContext) unmarshalInputProbeRequest(ctx context.Context, obj if err != nil { return it, err } - case "httpProperties": + case "infrastructureType": var err error - it.HTTPProperties, err = ec.unmarshalOHTTPProbeRequest2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐHTTPProbeRequest(ctx, v) + it.InfrastructureType, err = ec.unmarshalNInfrastructureType2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐInfrastructureType(ctx, v) if err != nil { return it, err } - case "cmdProperties": + case "kubernetesHTTPProperties": var err error - it.CmdProperties, err = ec.unmarshalOCMDProbeRequest2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐCMDProbeRequest(ctx, v) + it.KubernetesHTTPProperties, err = ec.unmarshalOKubernetesHTTPProbeRequest2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubernetesHTTPProbeRequest(ctx, v) + if err != nil { + return it, err + } + case "kubernetesCMDProperties": + var err error + it.KubernetesCMDProperties, err = ec.unmarshalOKubernetesCMDProbeRequest2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubernetesCMDProbeRequest(ctx, v) if err != nil { return it, err } @@ -28896,13 +29453,13 @@ func (ec *executionContext) _CommonProbeProperties(ctx context.Context, sel ast. switch obj := (obj).(type) { case nil: return graphql.Null - case model.CMDProbe: - return ec._CMDProbe(ctx, sel, &obj) - case *model.CMDProbe: + case model.KubernetesCMDProbe: + return ec._KubernetesCMDProbe(ctx, sel, &obj) + case *model.KubernetesCMDProbe: if obj == nil { return graphql.Null } - return ec._CMDProbe(ctx, sel, obj) + return ec._KubernetesCMDProbe(ctx, sel, obj) case model.PROMProbe: return ec._PROMProbe(ctx, sel, &obj) case *model.PROMProbe: @@ -28910,13 +29467,13 @@ func (ec *executionContext) _CommonProbeProperties(ctx context.Context, sel ast. return graphql.Null } return ec._PROMProbe(ctx, sel, obj) - case model.HTTPProbe: - return ec._HTTPProbe(ctx, sel, &obj) - case *model.HTTPProbe: + case model.KubernetesHTTPProbe: + return ec._KubernetesHTTPProbe(ctx, sel, &obj) + case *model.KubernetesHTTPProbe: if obj == nil { return graphql.Null } - return ec._HTTPProbe(ctx, sel, obj) + return ec._KubernetesHTTPProbe(ctx, sel, obj) case model.K8SProbe: return ec._K8SProbe(ctx, sel, &obj) case *model.K8SProbe: @@ -29082,62 +29639,6 @@ func (ec *executionContext) _Annotation(ctx context.Context, sel ast.SelectionSe return out } -var cMDProbeImplementors = []string{"CMDProbe", "CommonProbeProperties"} - -func (ec *executionContext) _CMDProbe(ctx context.Context, sel ast.SelectionSet, obj *model.CMDProbe) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, cMDProbeImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("CMDProbe") - case "probeTimeout": - out.Values[i] = ec._CMDProbe_probeTimeout(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "interval": - out.Values[i] = ec._CMDProbe_interval(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "retry": - out.Values[i] = ec._CMDProbe_retry(ctx, field, obj) - case "attempt": - out.Values[i] = ec._CMDProbe_attempt(ctx, field, obj) - case "probePollingInterval": - out.Values[i] = ec._CMDProbe_probePollingInterval(ctx, field, obj) - case "initialDelay": - out.Values[i] = ec._CMDProbe_initialDelay(ctx, field, obj) - case "evaluationTimeout": - out.Values[i] = ec._CMDProbe_evaluationTimeout(ctx, field, obj) - case "stopOnFailure": - out.Values[i] = ec._CMDProbe_stopOnFailure(ctx, field, obj) - case "command": - out.Values[i] = ec._CMDProbe_command(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "comparator": - out.Values[i] = ec._CMDProbe_comparator(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "source": - out.Values[i] = ec._CMDProbe_source(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - var chaosExperimentResponseImplementors = []string{"ChaosExperimentResponse"} func (ec *executionContext) _ChaosExperimentResponse(ctx context.Context, sel ast.SelectionSet, obj *model.ChaosExperimentResponse) graphql.Marshaler { @@ -29639,6 +30140,16 @@ func (ec *executionContext) _ExecutionHistory(ctx context.Context, sel ast.Selec switch field.Name { case "__typename": out.Values[i] = graphql.MarshalString("ExecutionHistory") + case "mode": + out.Values[i] = ec._ExecutionHistory_mode(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "faultName": + out.Values[i] = ec._ExecutionHistory_faultName(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } case "status": out.Values[i] = ec._ExecutionHistory_status(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -29869,6 +30380,13 @@ func (ec *executionContext) _ExperimentRun(ctx context.Context, sel ast.Selectio out.Values[i] = ec._ExperimentRun_updatedBy(ctx, field, obj) case "createdBy": out.Values[i] = ec._ExperimentRun_createdBy(ctx, field, obj) + case "notifyID": + out.Values[i] = ec._ExperimentRun_notifyID(ctx, field, obj) + case "runSequence": + out.Values[i] = ec._ExperimentRun_runSequence(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -30337,62 +30855,6 @@ func (ec *executionContext) _GitConfigResponse(ctx context.Context, sel ast.Sele return out } -var hTTPProbeImplementors = []string{"HTTPProbe", "CommonProbeProperties"} - -func (ec *executionContext) _HTTPProbe(ctx context.Context, sel ast.SelectionSet, obj *model.HTTPProbe) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, hTTPProbeImplementors) - - out := graphql.NewFieldSet(fields) - var invalids uint32 - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("HTTPProbe") - case "probeTimeout": - out.Values[i] = ec._HTTPProbe_probeTimeout(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "interval": - out.Values[i] = ec._HTTPProbe_interval(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "retry": - out.Values[i] = ec._HTTPProbe_retry(ctx, field, obj) - case "attempt": - out.Values[i] = ec._HTTPProbe_attempt(ctx, field, obj) - case "probePollingInterval": - out.Values[i] = ec._HTTPProbe_probePollingInterval(ctx, field, obj) - case "initialDelay": - out.Values[i] = ec._HTTPProbe_initialDelay(ctx, field, obj) - case "evaluationTimeout": - out.Values[i] = ec._HTTPProbe_evaluationTimeout(ctx, field, obj) - case "stopOnFailure": - out.Values[i] = ec._HTTPProbe_stopOnFailure(ctx, field, obj) - case "url": - out.Values[i] = ec._HTTPProbe_url(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "method": - out.Values[i] = ec._HTTPProbe_method(ctx, field, obj) - if out.Values[i] == graphql.Null { - invalids++ - } - case "insecureSkipVerify": - out.Values[i] = ec._HTTPProbe_insecureSkipVerify(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch() - if invalids > 0 { - return graphql.Null - } - return out -} - var imageRegistryImplementors = []string{"ImageRegistry"} func (ec *executionContext) _ImageRegistry(ctx context.Context, sel ast.SelectionSet, obj *model.ImageRegistry) graphql.Marshaler { @@ -30850,6 +31312,118 @@ func (ec *executionContext) _KubeObjectResponse(ctx context.Context, sel ast.Sel return out } +var kubernetesCMDProbeImplementors = []string{"KubernetesCMDProbe", "CommonProbeProperties"} + +func (ec *executionContext) _KubernetesCMDProbe(ctx context.Context, sel ast.SelectionSet, obj *model.KubernetesCMDProbe) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, kubernetesCMDProbeImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("KubernetesCMDProbe") + case "probeTimeout": + out.Values[i] = ec._KubernetesCMDProbe_probeTimeout(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "interval": + out.Values[i] = ec._KubernetesCMDProbe_interval(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "retry": + out.Values[i] = ec._KubernetesCMDProbe_retry(ctx, field, obj) + case "attempt": + out.Values[i] = ec._KubernetesCMDProbe_attempt(ctx, field, obj) + case "probePollingInterval": + out.Values[i] = ec._KubernetesCMDProbe_probePollingInterval(ctx, field, obj) + case "initialDelay": + out.Values[i] = ec._KubernetesCMDProbe_initialDelay(ctx, field, obj) + case "evaluationTimeout": + out.Values[i] = ec._KubernetesCMDProbe_evaluationTimeout(ctx, field, obj) + case "stopOnFailure": + out.Values[i] = ec._KubernetesCMDProbe_stopOnFailure(ctx, field, obj) + case "command": + out.Values[i] = ec._KubernetesCMDProbe_command(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "comparator": + out.Values[i] = ec._KubernetesCMDProbe_comparator(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "source": + out.Values[i] = ec._KubernetesCMDProbe_source(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var kubernetesHTTPProbeImplementors = []string{"KubernetesHTTPProbe", "CommonProbeProperties"} + +func (ec *executionContext) _KubernetesHTTPProbe(ctx context.Context, sel ast.SelectionSet, obj *model.KubernetesHTTPProbe) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, kubernetesHTTPProbeImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("KubernetesHTTPProbe") + case "probeTimeout": + out.Values[i] = ec._KubernetesHTTPProbe_probeTimeout(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "interval": + out.Values[i] = ec._KubernetesHTTPProbe_interval(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "retry": + out.Values[i] = ec._KubernetesHTTPProbe_retry(ctx, field, obj) + case "attempt": + out.Values[i] = ec._KubernetesHTTPProbe_attempt(ctx, field, obj) + case "probePollingInterval": + out.Values[i] = ec._KubernetesHTTPProbe_probePollingInterval(ctx, field, obj) + case "initialDelay": + out.Values[i] = ec._KubernetesHTTPProbe_initialDelay(ctx, field, obj) + case "evaluationTimeout": + out.Values[i] = ec._KubernetesHTTPProbe_evaluationTimeout(ctx, field, obj) + case "stopOnFailure": + out.Values[i] = ec._KubernetesHTTPProbe_stopOnFailure(ctx, field, obj) + case "url": + out.Values[i] = ec._KubernetesHTTPProbe_url(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "method": + out.Values[i] = ec._KubernetesHTTPProbe_method(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "insecureSkipVerify": + out.Values[i] = ec._KubernetesHTTPProbe_insecureSkipVerify(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + var linkImplementors = []string{"Link"} func (ec *executionContext) _Link(ctx context.Context, sel ast.SelectionSet, obj *model.Link) graphql.Marshaler { @@ -31551,10 +32125,15 @@ func (ec *executionContext) _Probe(ctx context.Context, sel ast.SelectionSet, ob if out.Values[i] == graphql.Null { invalids++ } - case "httpProperties": - out.Values[i] = ec._Probe_httpProperties(ctx, field, obj) - case "cmdProperties": - out.Values[i] = ec._Probe_cmdProperties(ctx, field, obj) + case "infrastructureType": + out.Values[i] = ec._Probe_infrastructureType(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "kubernetesHTTPProperties": + out.Values[i] = ec._Probe_kubernetesHTTPProperties(ctx, field, obj) + case "kubernetesCMDProperties": + out.Values[i] = ec._Probe_kubernetesCMDProperties(ctx, field, obj) case "k8sProperties": out.Values[i] = ec._Probe_k8sProperties(ctx, field, obj) case "promProperties": @@ -32181,6 +32760,11 @@ func (ec *executionContext) _RecentExperimentRun(ctx context.Context, sel ast.Se out.Values[i] = ec._RecentExperimentRun_createdBy(ctx, field, obj) case "updatedBy": out.Values[i] = ec._RecentExperimentRun_updatedBy(ctx, field, obj) + case "runSequence": + out.Values[i] = ec._RecentExperimentRun_runSequence(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -34776,29 +35360,6 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast return ec.marshalOBoolean2bool(ctx, sel, *v) } -func (ec *executionContext) marshalOCMDProbe2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐCMDProbe(ctx context.Context, sel ast.SelectionSet, v model.CMDProbe) graphql.Marshaler { - return ec._CMDProbe(ctx, sel, &v) -} - -func (ec *executionContext) marshalOCMDProbe2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐCMDProbe(ctx context.Context, sel ast.SelectionSet, v *model.CMDProbe) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._CMDProbe(ctx, sel, v) -} - -func (ec *executionContext) unmarshalOCMDProbeRequest2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐCMDProbeRequest(ctx context.Context, v interface{}) (model.CMDProbeRequest, error) { - return ec.unmarshalInputCMDProbeRequest(ctx, v) -} - -func (ec *executionContext) unmarshalOCMDProbeRequest2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐCMDProbeRequest(ctx context.Context, v interface{}) (*model.CMDProbeRequest, error) { - if v == nil { - return nil, nil - } - res, err := ec.unmarshalOCMDProbeRequest2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐCMDProbeRequest(ctx, v) - return &res, err -} - func (ec *executionContext) unmarshalOChaosExperimentRequest2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐChaosExperimentRequest(ctx context.Context, v interface{}) (model.ChaosExperimentRequest, error) { return ec.unmarshalInputChaosExperimentRequest(ctx, v) } @@ -35192,29 +35753,6 @@ func (ec *executionContext) marshalOGetProbesInExperimentRunResponse2ᚖgithub return ec._GetProbesInExperimentRunResponse(ctx, sel, v) } -func (ec *executionContext) marshalOHTTPProbe2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐHTTPProbe(ctx context.Context, sel ast.SelectionSet, v model.HTTPProbe) graphql.Marshaler { - return ec._HTTPProbe(ctx, sel, &v) -} - -func (ec *executionContext) marshalOHTTPProbe2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐHTTPProbe(ctx context.Context, sel ast.SelectionSet, v *model.HTTPProbe) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec._HTTPProbe(ctx, sel, v) -} - -func (ec *executionContext) unmarshalOHTTPProbeRequest2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐHTTPProbeRequest(ctx context.Context, v interface{}) (model.HTTPProbeRequest, error) { - return ec.unmarshalInputHTTPProbeRequest(ctx, v) -} - -func (ec *executionContext) unmarshalOHTTPProbeRequest2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐHTTPProbeRequest(ctx context.Context, v interface{}) (*model.HTTPProbeRequest, error) { - if v == nil { - return nil, nil - } - res, err := ec.unmarshalOHTTPProbeRequest2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐHTTPProbeRequest(ctx, v) - return &res, err -} - func (ec *executionContext) unmarshalOID2string(ctx context.Context, v interface{}) (string, error) { return graphql.UnmarshalID(v) } @@ -35553,6 +36091,52 @@ func (ec *executionContext) marshalOKubeObject2ᚖgithubᚗcomᚋlitmuschaosᚋl return ec._KubeObject(ctx, sel, v) } +func (ec *executionContext) marshalOKubernetesCMDProbe2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubernetesCMDProbe(ctx context.Context, sel ast.SelectionSet, v model.KubernetesCMDProbe) graphql.Marshaler { + return ec._KubernetesCMDProbe(ctx, sel, &v) +} + +func (ec *executionContext) marshalOKubernetesCMDProbe2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubernetesCMDProbe(ctx context.Context, sel ast.SelectionSet, v *model.KubernetesCMDProbe) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._KubernetesCMDProbe(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOKubernetesCMDProbeRequest2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubernetesCMDProbeRequest(ctx context.Context, v interface{}) (model.KubernetesCMDProbeRequest, error) { + return ec.unmarshalInputKubernetesCMDProbeRequest(ctx, v) +} + +func (ec *executionContext) unmarshalOKubernetesCMDProbeRequest2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubernetesCMDProbeRequest(ctx context.Context, v interface{}) (*model.KubernetesCMDProbeRequest, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalOKubernetesCMDProbeRequest2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubernetesCMDProbeRequest(ctx, v) + return &res, err +} + +func (ec *executionContext) marshalOKubernetesHTTPProbe2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubernetesHTTPProbe(ctx context.Context, sel ast.SelectionSet, v model.KubernetesHTTPProbe) graphql.Marshaler { + return ec._KubernetesHTTPProbe(ctx, sel, &v) +} + +func (ec *executionContext) marshalOKubernetesHTTPProbe2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubernetesHTTPProbe(ctx context.Context, sel ast.SelectionSet, v *model.KubernetesHTTPProbe) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._KubernetesHTTPProbe(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOKubernetesHTTPProbeRequest2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubernetesHTTPProbeRequest(ctx context.Context, v interface{}) (model.KubernetesHTTPProbeRequest, error) { + return ec.unmarshalInputKubernetesHTTPProbeRequest(ctx, v) +} + +func (ec *executionContext) unmarshalOKubernetesHTTPProbeRequest2ᚖgithubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubernetesHTTPProbeRequest(ctx context.Context, v interface{}) (*model.KubernetesHTTPProbeRequest, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalOKubernetesHTTPProbeRequest2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐKubernetesHTTPProbeRequest(ctx, v) + return &res, err +} + func (ec *executionContext) unmarshalOListChaosHubRequest2githubᚗcomᚋlitmuschaosᚋlitmusᚋchaoscenterᚋgraphqlᚋserverᚋgraphᚋmodelᚐListChaosHubRequest(ctx context.Context, v interface{}) (model.ListChaosHubRequest, error) { return ec.unmarshalInputListChaosHubRequest(ctx, v) } diff --git a/chaoscenter/graphql/server/graph/model/models_gen.go b/chaoscenter/graphql/server/graph/model/models_gen.go index 18c6f559954..0e8ac1132c5 100644 --- a/chaoscenter/graphql/server/graph/model/models_gen.go +++ b/chaoscenter/graphql/server/graph/model/models_gen.go @@ -39,34 +39,6 @@ type Annotation struct { ChartDescription string `json:"chartDescription"` } -// Defines the CMD probe properties -type CMDProbe struct { - // Timeout of the Probe - ProbeTimeout string `json:"probeTimeout"` - // Interval of the Probe - Interval string `json:"interval"` - // Retry interval of the Probe - Retry *int `json:"retry"` - // Attempt contains the total attempt count for the probe - Attempt *int `json:"attempt"` - // Polling interval of the Probe - ProbePollingInterval *string `json:"probePollingInterval"` - // Initial delay interval of the Probe in seconds - InitialDelay *string `json:"initialDelay"` - // EvaluationTimeout is the timeout window in which the SLO metrics - EvaluationTimeout *string `json:"evaluationTimeout"` - // Is stop on failure enabled in the Probe - StopOnFailure *bool `json:"stopOnFailure"` - // Command of the Probe - Command string `json:"command"` - // Comparator of the Probe - Comparator *Comparator `json:"comparator"` - // Source of the Probe - Source *string `json:"source"` -} - -func (CMDProbe) IsCommonProbeProperties() {} - // Defines the input for CMD probe properties type CMDProbeRequest struct { // Timeout of the Probe @@ -410,6 +382,10 @@ type ExecutedByExperiment struct { // Defines the Execution History of experiment referenced by the Probe type ExecutionHistory struct { + // Probe Mode + Mode Mode `json:"mode"` + // Fault Name + FaultName string `json:"faultName"` // Fault Status Status *Status `json:"status"` // Fault executed by which experiment @@ -537,6 +513,10 @@ type ExperimentRun struct { UpdatedBy *UserDetails `json:"updatedBy"` // User who has created the experiment run CreatedBy *UserDetails `json:"createdBy"` + // Notify ID of the experiment run + NotifyID *string `json:"notifyID"` + // runSequence is the sequence number of experiment run + RunSequence int `json:"runSequence"` } func (ExperimentRun) IsAudit() {} @@ -758,34 +738,6 @@ type GitConfigResponse struct { SSHPrivateKey *string `json:"sshPrivateKey"` } -// Defines the HTTP probe properties -type HTTPProbe struct { - // Timeout of the Probe - ProbeTimeout string `json:"probeTimeout"` - // Interval of the Probe - Interval string `json:"interval"` - // Retry interval of the Probe - Retry *int `json:"retry"` - // Attempt contains the total attempt count for the probe - Attempt *int `json:"attempt"` - // Polling interval of the Probe - ProbePollingInterval *string `json:"probePollingInterval"` - // Initial delay interval of the Probe in seconds - InitialDelay *string `json:"initialDelay"` - // EvaluationTimeout is the timeout window in which the SLO metrics - EvaluationTimeout *string `json:"evaluationTimeout"` - // Is stop on failure enabled in the Probe - StopOnFailure *bool `json:"stopOnFailure"` - // URL of the Probe - URL string `json:"url"` - // HTTP method of the Probe - Method *Method `json:"method"` - // If Insecure HTTP verification should be skipped - InsecureSkipVerify *bool `json:"insecureSkipVerify"` -} - -func (HTTPProbe) IsCommonProbeProperties() {} - // Defines the input for HTTP probe properties type HTTPProbeRequest struct { // Timeout of the Probe @@ -1089,6 +1041,114 @@ type KubeObjectResponse struct { KubeObj []*KubeObject `json:"kubeObj"` } +// Defines the CMD probe properties +type KubernetesCMDProbe struct { + // Timeout of the Probe + ProbeTimeout string `json:"probeTimeout"` + // Interval of the Probe + Interval string `json:"interval"` + // Retry interval of the Probe + Retry *int `json:"retry"` + // Attempt contains the total attempt count for the probe + Attempt *int `json:"attempt"` + // Polling interval of the Probe + ProbePollingInterval *string `json:"probePollingInterval"` + // Initial delay interval of the Probe in seconds + InitialDelay *string `json:"initialDelay"` + // EvaluationTimeout is the timeout window in which the SLO metrics + EvaluationTimeout *string `json:"evaluationTimeout"` + // Is stop on failure enabled in the Probe + StopOnFailure *bool `json:"stopOnFailure"` + // Command of the Probe + Command string `json:"command"` + // Comparator of the Probe + Comparator *Comparator `json:"comparator"` + // Source of the Probe + Source *string `json:"source"` +} + +func (KubernetesCMDProbe) IsCommonProbeProperties() {} + +// Defines the input for Kubernetes CMD probe properties +type KubernetesCMDProbeRequest struct { + // Timeout of the Probe + ProbeTimeout string `json:"probeTimeout"` + // Interval of the Probe + Interval string `json:"interval"` + // Retry interval of the Probe + Retry *int `json:"retry"` + // Attempt contains the total attempt count for the probe + Attempt *int `json:"attempt"` + // Polling interval of the Probe + ProbePollingInterval *string `json:"probePollingInterval"` + // Initial delay interval of the Probe in seconds + InitialDelay *string `json:"initialDelay"` + // EvaluationTimeout is the timeout window in which the SLO metrics + EvaluationTimeout *string `json:"evaluationTimeout"` + // Is stop on failure enabled in the Probe + StopOnFailure *bool `json:"stopOnFailure"` + // Command of the Probe + Command string `json:"command"` + // Comparator of the Probe + Comparator *ComparatorInput `json:"comparator"` + // Source of the Probe + Source *string `json:"source"` +} + +// Defines the Kubernetes HTTP probe properties +type KubernetesHTTPProbe struct { + // Timeout of the Probe + ProbeTimeout string `json:"probeTimeout"` + // Interval of the Probe + Interval string `json:"interval"` + // Retry interval of the Probe + Retry *int `json:"retry"` + // Attempt contains the total attempt count for the probe + Attempt *int `json:"attempt"` + // Polling interval of the Probe + ProbePollingInterval *string `json:"probePollingInterval"` + // Initial delay interval of the Probe in seconds + InitialDelay *string `json:"initialDelay"` + // EvaluationTimeout is the timeout window in which the SLO metrics + EvaluationTimeout *string `json:"evaluationTimeout"` + // Is stop on failure enabled in the Probe + StopOnFailure *bool `json:"stopOnFailure"` + // URL of the Probe + URL string `json:"url"` + // HTTP method of the Probe + Method *Method `json:"method"` + // If Insecure HTTP verification should be skipped + InsecureSkipVerify *bool `json:"insecureSkipVerify"` +} + +func (KubernetesHTTPProbe) IsCommonProbeProperties() {} + +// Defines the input for Kubernetes HTTP probe properties +type KubernetesHTTPProbeRequest struct { + // Timeout of the Probe + ProbeTimeout string `json:"probeTimeout"` + // Interval of the Probe + Interval string `json:"interval"` + // Retry interval of the Probe + Retry *int `json:"retry"` + // Attempt contains the total attempt count for the probe + Attempt *int `json:"attempt"` + // Polling interval of the Probe + ProbePollingInterval *string `json:"probePollingInterval"` + // Initial delay interval of the Probe in seconds + InitialDelay *string `json:"initialDelay"` + // EvaluationTimeout is the timeout window in which the SLO metrics + EvaluationTimeout *string `json:"evaluationTimeout"` + // Is stop on failure enabled in the Probe + StopOnFailure *bool `json:"stopOnFailure"` + // URL of the Probe + URL string `json:"url"` + // HTTP method of the Probe + Method *MethodRequest `json:"method"` + // If Insecure HTTP verification should be skipped + InsecureSkipVerify *bool `json:"insecureSkipVerify"` +} + type Link struct { Name string `json:"name"` URL string `json:"url"` @@ -1392,10 +1452,12 @@ type Probe struct { Tags []string `json:"tags"` // Type of the Probe [From list of ProbeType enum] Type ProbeType `json:"type"` - // HTTP Properties of the specific type of the Probe - HTTPProperties *HTTPProbe `json:"httpProperties"` - // CMD Properties of the specific type of the Probe - CmdProperties *CMDProbe `json:"cmdProperties"` + // Infrastructure type of the Probe + InfrastructureType InfrastructureType `json:"infrastructureType"` + // Kubernetes HTTP Properties of the specific type of the Probe + KubernetesHTTPProperties *KubernetesHTTPProbe `json:"kubernetesHTTPProperties"` + // Kubernetes CMD Properties of the specific type of the Probe + KubernetesCMDProperties *KubernetesCMDProbe `json:"kubernetesCMDProperties"` // K8S Properties of the specific type of the Probe K8sProperties *K8SProbe `json:"k8sProperties"` // PROM Properties of the specific type of the Probe @@ -1447,10 +1509,12 @@ type ProbeRequest struct { Tags []string `json:"tags"` // Type of the Probe [From list of ProbeType enum] Type ProbeType `json:"type"` + // Infrastructure type of the Probe + InfrastructureType InfrastructureType `json:"infrastructureType"` // HTTP Properties of the specific type of the Probe - HTTPProperties *HTTPProbeRequest `json:"httpProperties"` + KubernetesHTTPProperties *KubernetesHTTPProbeRequest `json:"kubernetesHTTPProperties"` // CMD Properties of the specific type of the Probe - CmdProperties *CMDProbeRequest `json:"cmdProperties"` + KubernetesCMDProperties *KubernetesCMDProbeRequest `json:"kubernetesCMDProperties"` // K8S Properties of the specific type of the Probe K8sProperties *K8SProbeRequest `json:"k8sProperties"` // PROM Properties of the specific type of the Probe @@ -1486,6 +1550,8 @@ type RecentExperimentRun struct { CreatedBy *UserDetails `json:"createdBy"` // User who updated the experiment run UpdatedBy *UserDetails `json:"updatedBy"` + // runSequence is the sequence number of experiment run + RunSequence int `json:"runSequence"` } func (RecentExperimentRun) IsAudit() {} @@ -2129,18 +2195,16 @@ func (e ImagePullPolicy) MarshalGQL(w io.Writer) { type InfrastructureType string const ( - InfrastructureTypeInternal InfrastructureType = "INTERNAL" - InfrastructureTypeExternal InfrastructureType = "EXTERNAL" + InfrastructureTypeKubernetes InfrastructureType = "Kubernetes" ) var AllInfrastructureType = []InfrastructureType{ - InfrastructureTypeInternal, - InfrastructureTypeExternal, + InfrastructureTypeKubernetes, } func (e InfrastructureType) IsValid() bool { switch e { - case InfrastructureTypeInternal, InfrastructureTypeExternal: + case InfrastructureTypeKubernetes: return true } return false diff --git a/chaoscenter/graphql/server/graph/probe.resolvers.go b/chaoscenter/graphql/server/graph/probe.resolvers.go index cfaca1ffef4..82d9749605c 100644 --- a/chaoscenter/graphql/server/graph/probe.resolvers.go +++ b/chaoscenter/graphql/server/graph/probe.resolvers.go @@ -29,7 +29,7 @@ func (r *mutationResolver) AddProbe(ctx context.Context, request model.ProbeRequ // Validate if probe type and probe properties match for the selected probe // HTTP Probe type and Property validation - if request.Type == model.ProbeTypeHTTPProbe && request.HTTPProperties == nil { + if request.Type == model.ProbeTypeHTTPProbe && request.KubernetesHTTPProperties == nil { err := "probe type and properties don't match, selected http Probe but http properties are empty" logrus.WithFields(logFields).Error(err) return nil, errors.New(err) @@ -41,7 +41,7 @@ func (r *mutationResolver) AddProbe(ctx context.Context, request model.ProbeRequ return nil, errors.New(err) } // CMD Probe type and Property validation - if request.Type == model.ProbeTypeCmdProbe && request.CmdProperties == nil { + if request.Type == model.ProbeTypeCmdProbe && request.KubernetesCMDProperties == nil { err := "probe type and properties don't match, selected cmd Probe but cmd properties are empty" logrus.WithFields(logFields).Error(err) return nil, errors.New(err) @@ -112,7 +112,7 @@ func (r *mutationResolver) DeleteProbe(ctx context.Context, probeName string, pr return response, err } -func (r *queryResolver) ListProbes(ctx context.Context, projectID string, probeNames []string, filter *model.ProbeFilterInput) ([]*model.Probe, error) { +func (r *queryResolver) ListProbes(ctx context.Context, projectID string, infrastructureType *model.InfrastructureType, probeNames []string, filter *model.ProbeFilterInput) ([]*model.Probe, error) { logFields := logrus.Fields{ "projectId": projectID, "probeNames": probeNames, @@ -127,7 +127,7 @@ func (r *queryResolver) ListProbes(ctx context.Context, projectID string, probeN } p := probe.NewProbeRepository(projectID) - response, err := p.ListProbes(ctx, probeNames, filter) + response, err := p.ListProbes(ctx, probeNames, infrastructureType, filter) if err != nil { logrus.WithFields(logFields).Error(err) return nil, err diff --git a/chaoscenter/graphql/server/pkg/authorization/roles.go b/chaoscenter/graphql/server/pkg/authorization/roles.go index 9b658fefe61..4e06885e5cc 100644 --- a/chaoscenter/graphql/server/pkg/authorization/roles.go +++ b/chaoscenter/graphql/server/pkg/authorization/roles.go @@ -156,4 +156,5 @@ var MutationRbacRules = map[RoleQuery][]string{ UpdateProbe: {MemberRoleOwnerString, MemberRoleEditorString}, GetProbe: {MemberRoleOwnerString, MemberRoleEditorString, MemberRoleViewerString}, ListProbes: {MemberRoleOwnerString, MemberRoleEditorString, MemberRoleViewerString}, + DeleteProbe: {MemberRoleOwnerString, MemberRoleEditorString}, } diff --git a/chaoscenter/graphql/server/pkg/chaos_experiment/handler/handler.go b/chaoscenter/graphql/server/pkg/chaos_experiment/handler/handler.go index 428670b9bb5..abc010032db 100644 --- a/chaoscenter/graphql/server/pkg/chaos_experiment/handler/handler.go +++ b/chaoscenter/graphql/server/pkg/chaos_experiment/handler/handler.go @@ -396,8 +396,9 @@ func (c *ChaosExperimentHandler) GetExperiment(ctx context.Context, projectID st CreatedBy: &model.UserDetails{ UserID: v.CreatedBy, }, - UpdatedAt: strconv.FormatInt(v.UpdatedAt, 10), - CreatedAt: strconv.FormatInt(v.CreatedAt, 10), + UpdatedAt: strconv.FormatInt(v.UpdatedAt, 10), + CreatedAt: strconv.FormatInt(v.CreatedAt, 10), + RunSequence: v.RunSequence, }) } } @@ -758,8 +759,9 @@ func (c *ChaosExperimentHandler) ListExperiment(projectID string, request model. CreatedBy: &model.UserDetails{ Username: v.UpdatedBy, }, - UpdatedAt: strconv.FormatInt(v.UpdatedAt, 10), - CreatedAt: strconv.FormatInt(v.CreatedAt, 10), + UpdatedAt: strconv.FormatInt(v.UpdatedAt, 10), + CreatedAt: strconv.FormatInt(v.CreatedAt, 10), + RunSequence: v.RunSequence, }) } } diff --git a/chaoscenter/graphql/server/pkg/choas_experiment_run/handler/handler.go b/chaoscenter/graphql/server/pkg/choas_experiment_run/handler/handler.go index 89d883fad95..536b77f7c8a 100644 --- a/chaoscenter/graphql/server/pkg/choas_experiment_run/handler/handler.go +++ b/chaoscenter/graphql/server/pkg/choas_experiment_run/handler/handler.go @@ -74,20 +74,39 @@ func NewChaosExperimentRunHandler( } // GetExperimentRun returns details of a requested experiment run -func (c *ChaosExperimentRunHandler) GetExperimentRun(ctx context.Context, projectID string, experimentRunID string) (*model.ExperimentRun, error) { +func (c *ChaosExperimentRunHandler) GetExperimentRun(ctx context.Context, projectID string, experimentRunID *string, notifyID *string) (*model.ExperimentRun, error) { var pipeline mongo.Pipeline + if experimentRunID == nil && notifyID == nil { + return nil, errors.New("experimentRunID or notifyID not provided") + } + // Matching with identifiers - matchIdentifiersStage := bson.D{ - { - "$match", bson.D{ - {"experiment_run_id", experimentRunID}, - {"project_id", projectID}, - {"is_removed", false}, + if experimentRunID != nil && *experimentRunID != "" { + matchIdentifiersStage := bson.D{ + { + "$match", bson.D{ + {"experiment_run_id", experimentRunID}, + {"project_id", projectID}, + {"is_removed", false}, + }, }, - }, + } + pipeline = append(pipeline, matchIdentifiersStage) + } + + if notifyID != nil && *notifyID != "" { + matchIdentifiersStage := bson.D{ + { + "$match", bson.D{ + {"notify_id", notifyID}, + {"project_id", projectID}, + {"is_removed", false}, + }, + }, + } + pipeline = append(pipeline, matchIdentifiersStage) } - pipeline = append(pipeline, matchIdentifiersStage) // Adds details of experiment addExperimentDetails := bson.D{ @@ -214,6 +233,7 @@ func (c *ChaosExperimentRunHandler) GetExperimentRun(ctx context.Context, projec ExperimentName: wfRun.ExperimentDetails[0].ExperimentName, ExperimentID: wfRun.ExperimentID, ExperimentRunID: wfRun.ExperimentRunID, + NotifyID: wfRun.NotifyID, Weightages: weightages, ExperimentManifest: workflowRunManifest, ProjectID: wfRun.ProjectID, @@ -228,6 +248,8 @@ func (c *ChaosExperimentRunHandler) GetExperimentRun(ctx context.Context, projec TotalFaults: wfRun.TotalFaults, ExecutionData: wfRun.ExecutionData, IsRemoved: &wfRun.IsRemoved, + RunSequence: int(wfRun.RunSequence), + UpdatedBy: &model.UserDetails{ Username: wfRun.UpdatedBy, }, @@ -601,8 +623,9 @@ func (c *ChaosExperimentRunHandler) ListExperimentRun(projectID string, request UpdatedBy: &model.UserDetails{ Username: workflow.UpdatedBy, }, - UpdatedAt: strconv.FormatInt(workflow.UpdatedAt, 10), - CreatedAt: strconv.FormatInt(workflow.CreatedAt, 10), + UpdatedAt: strconv.FormatInt(workflow.UpdatedAt, 10), + CreatedAt: strconv.FormatInt(workflow.CreatedAt, 10), + RunSequence: int(workflow.RunSequence), } result = append(result, &newExperimentRun) } @@ -778,13 +801,13 @@ func (c *ChaosExperimentRunHandler) RunChaosWorkFlow(ctx context.Context, projec logrus.Errorf("failed to start mongo session transaction %v", err) return err } - expRunDetail := []dbChaosExperiment.ExperimentRunDetail{ { - Phase: executionData.Phase, - Completed: false, - ProjectID: projectID, - NotifyID: ¬ifyID, + Phase: executionData.Phase, + Completed: false, + ProjectID: projectID, + NotifyID: ¬ifyID, + RunSequence: workflow.TotalExperimentRuns + 1, Audit: mongodb.Audit{ IsRemoved: false, CreatedAt: currentTime, @@ -838,6 +861,7 @@ func (c *ChaosExperimentRunHandler) RunChaosWorkFlow(ctx context.Context, projec Completed: false, ResiliencyScore: &resScore, ExecutionData: string(parsedData), + RunSequence: workflow.TotalExperimentRuns + 1, Probes: probes, }) if err != nil { @@ -862,6 +886,18 @@ func (c *ChaosExperimentRunHandler) RunChaosWorkFlow(ctx context.Context, projec session.EndSession(ctx) + // Convert updated manifest to string + manifestString, err := json.Marshal(workflowManifest) + if err != nil { + return nil, fmt.Errorf("failed to marshal experiment manifest, err: %v", err) + } + + // Generate Probe in the manifest + workflowManifest, err = probe.GenerateExperimentManifestWithProbes(string(manifestString), projectID) + if err != nil { + return nil, fmt.Errorf("failed to generate probes in workflow manifest, err: %v", err) + } + manifest, err := yaml.Marshal(workflowManifest) if err != nil { return nil, err @@ -1041,6 +1077,12 @@ func (c *ChaosExperimentRunHandler) ChaosExperimentRunEvent(event model.Experime logrus.WithFields(logFields).Info("new workflow event received") + expType := experiment.ExperimentType + probes, err := probe.ParseProbesFromManifestForRuns(&expType, experiment.Revision[len(experiment.Revision)-1].ExperimentManifest) + if err != nil { + return "", fmt.Errorf("unable to parse probes %v", err.Error()) + } + var ( executionData types.ExecutionData exeData []byte @@ -1114,7 +1156,6 @@ func (c *ChaosExperimentRunHandler) ChaosExperimentRunEvent(event model.Experime if err != nil { return err } - fmt.Println("event", event.UpdatedBy) updatedBy, err := base64.RawURLEncoding.DecodeString(event.UpdatedBy) if err != nil { logrus.Fatalf("Failed to parse updated by field %v", err) @@ -1125,6 +1166,7 @@ func (c *ChaosExperimentRunHandler) ChaosExperimentRunEvent(event model.Experime ResiliencyScore: &workflowRunMetrics.ResiliencyScore, ExperimentRunID: event.ExperimentRunID, Completed: false, + RunSequence: experiment.TotalExperimentRuns + 1, Audit: mongodb.Audit{ IsRemoved: false, CreatedAt: time.Now().UnixMilli(), @@ -1211,6 +1253,8 @@ func (c *ChaosExperimentRunHandler) ChaosExperimentRunEvent(event model.Experime ExecutionData: string(exeData), RevisionID: event.RevisionID, Completed: event.Completed, + Probes: probes, + RunSequence: experiment.TotalExperimentRuns + 1, Audit: mongodb.Audit{ IsRemoved: isRemoved, UpdatedAt: currentTime.UnixMilli(), diff --git a/chaoscenter/graphql/server/pkg/database/mongodb/chaos_experiment/schema.go b/chaoscenter/graphql/server/pkg/database/mongodb/chaos_experiment/schema.go index 977c429c0b6..cfb2a60f706 100644 --- a/chaoscenter/graphql/server/pkg/database/mongodb/chaos_experiment/schema.go +++ b/chaoscenter/graphql/server/pkg/database/mongodb/chaos_experiment/schema.go @@ -23,6 +23,7 @@ type ExperimentRunDetail struct { NotifyID *string `bson:"notify_id"` ResiliencyScore *float64 `bson:"resiliency_score,omitempty"` Completed bool `bson:"completed"` + RunSequence int `bson:"run_sequence"` } // ChaosExperimentRequest contains the required fields to be stored in the database for a chaos experiment input @@ -125,6 +126,7 @@ type FlattenedExperimentRun struct { RevisionID string `bson:"revision_id"` InfraID string `bson:"infra_id"` Phase string `bson:"phase"` + NotifyID *string `bson:"notify_id"` KubernetesInfraDetails []chaos_infrastructure.ChaosInfra `bson:"kubernetesInfraDetails,omitempty"` ExperimentDetails []ExperimentDetails `bson:"experiment"` ResiliencyScore *float64 `bson:"resiliency_score,string,omitempty"` @@ -137,6 +139,7 @@ type FlattenedExperimentRun struct { IsCustomExperiment bool `bson:"is_custom_experiment"` Completed bool `bson:"completed"` IsRemoved bool `bson:"is_removed"` + RunSequence int64 `bson:"run_sequence"` } type ExperimentDetails struct { diff --git a/chaoscenter/graphql/server/pkg/database/mongodb/chaos_experiment_run/schema.go b/chaoscenter/graphql/server/pkg/database/mongodb/chaos_experiment_run/schema.go index 54cf1f653d2..8aa7e25d857 100644 --- a/chaoscenter/graphql/server/pkg/database/mongodb/chaos_experiment_run/schema.go +++ b/chaoscenter/graphql/server/pkg/database/mongodb/chaos_experiment_run/schema.go @@ -22,6 +22,7 @@ type ChaosExperimentRun struct { FaultsStopped *int `bson:"faults_stopped,omitempty"` FaultsNA *int `bson:"faults_na,omitempty"` TotalFaults *int `bson:"total_faults,omitempty"` + RunSequence int `bson:"run_sequence"` Completed bool `bson:"completed"` } diff --git a/chaoscenter/graphql/server/pkg/database/mongodb/probe/schema.go b/chaoscenter/graphql/server/pkg/database/mongodb/probe/schema.go index 0fa77bccab3..c63230a4d11 100644 --- a/chaoscenter/graphql/server/pkg/database/mongodb/probe/schema.go +++ b/chaoscenter/graphql/server/pkg/database/mongodb/probe/schema.go @@ -2,6 +2,7 @@ package probe import ( "encoding/json" + "fmt" "strconv" "github.com/litmuschaos/litmus/chaoscenter/graphql/server/graph/model" @@ -17,8 +18,9 @@ type Probe struct { mongodb.ResourceDetails `bson:",inline"` mongodb.Audit `bson:",inline"` Type ProbeType `bson:"type"` - HTTPProperties *HTTPProbe `bson:"http_properties,omitempty"` - CMDProperties *CMDProbe `bson:"cmd_properties,omitempty"` + InfrastructureType model.InfrastructureType `bson:"infrastructure_type"` + KubernetesHTTPProperties *KubernetesHTTPProbe `bson:"kubernetes_http_properties,omitempty"` + KubernetesCMDProperties *KubernetesCMDProbe `bson:"kubernetes_cmd_properties,omitempty"` PROMProperties *PROMProbe `bson:"prom_properties,omitempty"` K8SProperties *K8SProbe `bson:"k8s_properties,omitempty"` RecentExecutions []*model.ProbeRecentExecutions `bson:"recent_executions"` @@ -30,7 +32,8 @@ type ProbeResponseDetails struct { } type Probes struct { - FaultName string `bson:"fault_name"` + FaultName string `bson:"fault_name"` + ProbeNames []string `bson:"probe_names"` } type ExecutionHistory struct { @@ -44,16 +47,8 @@ type ExecutionHistory struct { } type ProbeWithExecutionHistory struct { - ProjectID string `bson:"project_id"` - mongodb.ResourceDetails `bson:",inline"` - mongodb.Audit `bson:",inline"` - Type ProbeType `bson:"type"` - HTTPProperties *HTTPProbe `bson:"http_properties,omitempty"` - CMDProperties *CMDProbe `bson:"cmd_properties,omitempty"` - PROMProperties *PROMProbe `bson:"prom_properties,omitempty"` - K8SProperties *K8SProbe `bson:"k8s_properties,omitempty"` - AverageSuccessPercentage float64 `bson:"average_success_percentage"` - ExecutionHistory []ExecutionHistory `bson:"execution_history"` + Probe `bson:",inline"` + ExecutionHistory []ExecutionHistory `bson:"execution_history"` } type CommonProbeProperties struct { @@ -67,7 +62,7 @@ type CommonProbeProperties struct { StopOnFailure *bool `bson:"stop_on_failure,omitempty"` } -type HTTPProbe struct { +type KubernetesHTTPProbe struct { URL string `bson:"url"` ProbeTimeout string `bson:"probe_timeout"` Interval string `bson:"interval"` @@ -96,7 +91,7 @@ type PROMProbe struct { StopOnFailure *bool `bson:"stop_on_failure,omitempty"` } -type CMDProbe struct { +type KubernetesCMDProbe struct { Command string `bson:"command"` ProbeTimeout string `bson:"probe_timeout"` Interval string `bson:"interval"` @@ -156,125 +151,128 @@ type Comparator struct { // GetOutputProbe func (probe *Probe) GetOutputProbe() *model.Probe { probeResponse := &model.Probe{ - ProjectID: probe.ProjectID, - Name: probe.Name, - Description: &probe.Description, - Tags: probe.Tags, - RecentExecutions: probe.RecentExecutions, - CreatedAt: strconv.Itoa(int(probe.CreatedAt)), - UpdatedAt: strconv.Itoa(int(probe.UpdatedAt)), - Type: model.ProbeType(probe.Type), + ProjectID: probe.ProjectID, + Name: probe.Name, + Description: &probe.Description, + Tags: probe.Tags, + RecentExecutions: probe.RecentExecutions, + CreatedAt: strconv.Itoa(int(probe.CreatedAt)), + UpdatedAt: strconv.Itoa(int(probe.UpdatedAt)), + Type: model.ProbeType(probe.Type), + InfrastructureType: probe.InfrastructureType, CreatedBy: &model.UserDetails{ - UserID: probe.CreatedBy, + Username: probe.CreatedBy, }, UpdatedBy: &model.UserDetails{ - UserID: probe.UpdatedBy, + Username: probe.UpdatedBy, }, } + if probe.InfrastructureType == model.InfrastructureTypeKubernetes { + if model.ProbeType(probe.Type) == model.ProbeTypeHTTPProbe { + probeResponse.KubernetesHTTPProperties = &model.KubernetesHTTPProbe{ + ProbeTimeout: probe.KubernetesHTTPProperties.ProbeTimeout, + Interval: probe.KubernetesHTTPProperties.Interval, + Attempt: probe.KubernetesHTTPProperties.Attempt, + Retry: probe.KubernetesHTTPProperties.Retry, + ProbePollingInterval: probe.KubernetesHTTPProperties.PollingInterval, + InitialDelay: probe.KubernetesHTTPProperties.InitialDelay, + EvaluationTimeout: probe.KubernetesHTTPProperties.EvaluationTimeout, + StopOnFailure: probe.KubernetesHTTPProperties.StopOnFailure, + URL: probe.KubernetesHTTPProperties.URL, + Method: &model.Method{}, + } - if model.ProbeType(probe.Type) == model.ProbeTypeHTTPProbe { - probeResponse.HTTPProperties = &model.HTTPProbe{ - ProbeTimeout: probe.HTTPProperties.ProbeTimeout, - Interval: probe.HTTPProperties.Interval, - Attempt: probe.HTTPProperties.Attempt, - Retry: probe.HTTPProperties.Retry, - ProbePollingInterval: probe.HTTPProperties.PollingInterval, - InitialDelay: probe.HTTPProperties.InitialDelay, - EvaluationTimeout: probe.HTTPProperties.EvaluationTimeout, - StopOnFailure: probe.HTTPProperties.StopOnFailure, - URL: probe.HTTPProperties.URL, - Method: &model.Method{}, - } + if probeResponse.KubernetesHTTPProperties.InsecureSkipVerify != nil { + probeResponse.KubernetesHTTPProperties.InsecureSkipVerify = probe.KubernetesHTTPProperties.InsecureSkipVerify + } - if probeResponse.HTTPProperties.InsecureSkipVerify != nil { - probeResponse.HTTPProperties.InsecureSkipVerify = probe.HTTPProperties.InsecureSkipVerify - } + if probe.KubernetesHTTPProperties.Method.GET != nil { + probeResponse.KubernetesHTTPProperties.Method.Get = &model.Get{ + Criteria: probe.KubernetesHTTPProperties.Method.GET.Criteria, + ResponseCode: probe.KubernetesHTTPProperties.Method.GET.ResponseCode, + } + } else if probe.KubernetesHTTPProperties.Method.POST != nil { + probeResponse.KubernetesHTTPProperties.Method.Post = &model.Post{ + Criteria: probe.KubernetesHTTPProperties.Method.POST.Criteria, + ResponseCode: probe.KubernetesHTTPProperties.Method.POST.ResponseCode, + } + + if probeResponse.KubernetesHTTPProperties.Method.Post.ContentType != nil { + probeResponse.KubernetesHTTPProperties.Method.Post.ContentType = probe.KubernetesHTTPProperties.Method.POST.ContentType + } - if probe.HTTPProperties.Method.GET != nil { - probeResponse.HTTPProperties.Method.Get = &model.Get{ - Criteria: probe.HTTPProperties.Method.GET.Criteria, - ResponseCode: probe.HTTPProperties.Method.GET.ResponseCode, + if probeResponse.KubernetesHTTPProperties.Method.Post.Body != nil { + probeResponse.KubernetesHTTPProperties.Method.Post.Body = probe.KubernetesHTTPProperties.Method.POST.Body + } + + if probeResponse.KubernetesHTTPProperties.Method.Post.BodyPath != nil { + probeResponse.KubernetesHTTPProperties.Method.Post.BodyPath = probe.KubernetesHTTPProperties.Method.POST.BodyPath + } } - } else if probe.HTTPProperties.Method.POST != nil { - probeResponse.HTTPProperties.Method.Post = &model.Post{ - Criteria: probe.HTTPProperties.Method.POST.Criteria, - ResponseCode: probe.HTTPProperties.Method.POST.ResponseCode, + } else if model.ProbeType(probe.Type) == model.ProbeTypeCmdProbe { + probeResponse.KubernetesCMDProperties = &model.KubernetesCMDProbe{ + ProbeTimeout: probe.KubernetesCMDProperties.ProbeTimeout, + Interval: probe.KubernetesCMDProperties.Interval, + Attempt: probe.KubernetesCMDProperties.Attempt, + Retry: probe.KubernetesCMDProperties.Retry, + ProbePollingInterval: probe.KubernetesCMDProperties.PollingInterval, + InitialDelay: probe.KubernetesCMDProperties.InitialDelay, + EvaluationTimeout: probe.KubernetesCMDProperties.EvaluationTimeout, + StopOnFailure: probe.KubernetesCMDProperties.StopOnFailure, + Command: probe.KubernetesCMDProperties.Command, + Comparator: &model.Comparator{ + Type: probe.KubernetesCMDProperties.Comparator.Type, + Value: probe.KubernetesCMDProperties.Comparator.Value, + Criteria: probe.KubernetesCMDProperties.Comparator.Criteria, + }, } - if probeResponse.HTTPProperties.Method.Post.ContentType != nil { - probeResponse.HTTPProperties.Method.Post.ContentType = probe.HTTPProperties.Method.POST.ContentType + // CMD Probe -> Source + if probe.KubernetesCMDProperties.Source != nil { + jsonSource, _ := json.Marshal(probe.KubernetesCMDProperties.Source) + source := string(jsonSource) + fmt.Println("string source", source) + probeResponse.KubernetesCMDProperties.Source = &source } - if probeResponse.HTTPProperties.Method.Post.Body != nil { - probeResponse.HTTPProperties.Method.Post.Body = probe.HTTPProperties.Method.POST.Body + } else if model.ProbeType(probe.Type) == model.ProbeTypePromProbe { + probeResponse.PromProperties = &model.PROMProbe{ + ProbeTimeout: probe.PROMProperties.ProbeTimeout, + Interval: probe.PROMProperties.Interval, + Attempt: probe.PROMProperties.Attempt, + Retry: probe.PROMProperties.Retry, + ProbePollingInterval: probe.PROMProperties.PollingInterval, + InitialDelay: probe.PROMProperties.InitialDelay, + EvaluationTimeout: probe.PROMProperties.EvaluationTimeout, + StopOnFailure: probe.PROMProperties.StopOnFailure, + Endpoint: probe.PROMProperties.Endpoint, + Query: &probe.PROMProperties.Query, + QueryPath: probe.PROMProperties.QueryPath, + Comparator: &model.Comparator{ + Type: probe.PROMProperties.Comparator.Type, + Value: probe.PROMProperties.Comparator.Value, + Criteria: probe.PROMProperties.Comparator.Criteria, + }, } - - if probeResponse.HTTPProperties.Method.Post.BodyPath != nil { - probeResponse.HTTPProperties.Method.Post.BodyPath = probe.HTTPProperties.Method.POST.BodyPath + } else if model.ProbeType(probe.Type) == model.ProbeTypeK8sProbe { + probeResponse.K8sProperties = &model.K8SProbe{ + ProbeTimeout: probe.K8SProperties.ProbeTimeout, + Interval: probe.K8SProperties.Interval, + Attempt: probe.K8SProperties.Attempt, + Retry: probe.K8SProperties.Retry, + ProbePollingInterval: probe.K8SProperties.PollingInterval, + InitialDelay: probe.K8SProperties.InitialDelay, + EvaluationTimeout: probe.K8SProperties.EvaluationTimeout, + StopOnFailure: probe.K8SProperties.StopOnFailure, + Group: probe.K8SProperties.Group, + Version: probe.K8SProperties.Version, + Resource: probe.K8SProperties.Resource, + Namespace: probe.K8SProperties.Namespace, + FieldSelector: probe.K8SProperties.FieldSelector, + LabelSelector: probe.K8SProperties.LabelSelector, + Operation: probe.K8SProperties.Operation, } } - } else if model.ProbeType(probe.Type) == model.ProbeTypeCmdProbe { - probeResponse.CmdProperties = &model.CMDProbe{ - ProbeTimeout: probe.CMDProperties.ProbeTimeout, - Interval: probe.CMDProperties.Interval, - Attempt: probe.CMDProperties.Attempt, - Retry: probe.CMDProperties.Retry, - ProbePollingInterval: probe.CMDProperties.PollingInterval, - InitialDelay: probe.CMDProperties.InitialDelay, - EvaluationTimeout: probe.CMDProperties.EvaluationTimeout, - StopOnFailure: probe.CMDProperties.StopOnFailure, - Command: probe.CMDProperties.Command, - Comparator: &model.Comparator{ - Type: probe.CMDProperties.Comparator.Type, - Value: probe.CMDProperties.Comparator.Value, - Criteria: probe.CMDProperties.Comparator.Criteria, - }, - } - - // CMD Probe -> Source - if probe.CMDProperties.Source != nil { - jsonSource, _ := json.Marshal(probe.CMDProperties.Source) - source := string(jsonSource) - probeResponse.CmdProperties.Source = &source - } - - } else if model.ProbeType(probe.Type) == model.ProbeTypePromProbe { - probeResponse.PromProperties = &model.PROMProbe{ - ProbeTimeout: probe.PROMProperties.ProbeTimeout, - Interval: probe.PROMProperties.Interval, - Attempt: probe.PROMProperties.Attempt, - Retry: probe.PROMProperties.Retry, - ProbePollingInterval: probe.PROMProperties.PollingInterval, - InitialDelay: probe.PROMProperties.InitialDelay, - EvaluationTimeout: probe.PROMProperties.EvaluationTimeout, - StopOnFailure: probe.PROMProperties.StopOnFailure, - Endpoint: probe.PROMProperties.Endpoint, - Query: &probe.PROMProperties.Query, - QueryPath: probe.PROMProperties.QueryPath, - Comparator: &model.Comparator{ - Type: probe.PROMProperties.Comparator.Type, - Value: probe.PROMProperties.Comparator.Value, - Criteria: probe.PROMProperties.Comparator.Criteria, - }, - } - } else if model.ProbeType(probe.Type) == model.ProbeTypeK8sProbe { - probeResponse.K8sProperties = &model.K8SProbe{ - ProbeTimeout: probe.K8SProperties.ProbeTimeout, - Interval: probe.K8SProperties.Interval, - Attempt: probe.K8SProperties.Attempt, - Retry: probe.K8SProperties.Retry, - ProbePollingInterval: probe.K8SProperties.PollingInterval, - InitialDelay: probe.K8SProperties.InitialDelay, - EvaluationTimeout: probe.K8SProperties.EvaluationTimeout, - StopOnFailure: probe.K8SProperties.StopOnFailure, - Group: probe.K8SProperties.Group, - Version: probe.K8SProperties.Version, - Resource: probe.K8SProperties.Resource, - Namespace: probe.K8SProperties.Namespace, - FieldSelector: probe.K8SProperties.FieldSelector, - LabelSelector: probe.K8SProperties.LabelSelector, - Operation: probe.K8SProperties.Operation, - } } return probeResponse diff --git a/chaoscenter/graphql/server/pkg/probe/respository.go b/chaoscenter/graphql/server/pkg/probe/respository.go index b9d12e9b159..19e03a6e7a7 100644 --- a/chaoscenter/graphql/server/pkg/probe/respository.go +++ b/chaoscenter/graphql/server/pkg/probe/respository.go @@ -8,6 +8,8 @@ import ( "strconv" "time" + "github.com/litmuschaos/litmus/chaoscenter/graphql/server/utils" + "github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/chaos_experiment" "github.com/litmuschaos/chaos-operator/api/litmuschaos/v1alpha1" @@ -27,7 +29,7 @@ import ( type ProbeInterface interface { AddProbe(ctx context.Context, probe model.ProbeRequest) (*model.Probe, error) UpdateProbe(ctx context.Context, probe model.ProbeRequest) (string, error) - ListProbes(ctx context.Context, probeNames []string, filter *model.ProbeFilterInput) ([]*model.Probe, error) + ListProbes(ctx context.Context, probeNames []string, infrastructureType *model.InfrastructureType, filter *model.ProbeFilterInput) ([]*model.Probe, error) DeleteProbe(ctx context.Context, probeName string) (bool, error) GetProbe(ctx context.Context, probeName string) (*model.Probe, error) GetProbeReference(ctx context.Context, probeName string) (*model.GetProbeReferenceResponse, error) @@ -85,21 +87,21 @@ func (p *probe) AddProbe(ctx context.Context, probe model.ProbeRequest) (*model. CreatedBy: username, UpdatedBy: username, }, - Type: dbSchemaProbe.ProbeType(probe.Type), + Type: dbSchemaProbe.ProbeType(probe.Type), + InfrastructureType: probe.InfrastructureType, } - // Check the respective probe type and modify the property response based on the type - if probe.Type == model.ProbeTypeHTTPProbe && probe.HTTPProperties != nil { - addHTTPProbeProperties(newProbe, probe) - } else if probe.Type == model.ProbeTypeCmdProbe && probe.CmdProperties != nil { - addCMDProbeProperties(newProbe, probe) + if probe.Type == model.ProbeTypeHTTPProbe && probe.KubernetesHTTPProperties != nil { + addKubernetesHTTPProbeProperties(newProbe, probe) + } else if probe.Type == model.ProbeTypeCmdProbe && probe.KubernetesCMDProperties != nil { + addKubernetesCMDProbeProperties(newProbe, probe) } else if probe.Type == model.ProbeTypePromProbe && probe.PromProperties != nil { addPROMProbeProperties(newProbe, probe) } else if probe.Type == model.ProbeTypeK8sProbe && probe.K8sProperties != nil { addK8SProbeProperties(newProbe, probe) - } else if probe.Type == model.ProbeTypeHTTPProbe && probe.HTTPProperties == nil { + } else if probe.Type == model.ProbeTypeHTTPProbe && probe.KubernetesHTTPProperties == nil { return nil, Error(logFields, "http probe type's properties are empty") - } else if probe.Type == model.ProbeTypeCmdProbe && probe.CmdProperties == nil { + } else if probe.Type == model.ProbeTypeCmdProbe && probe.KubernetesCMDProperties == nil { return nil, Error(logFields, "cmd probe type's properties are empty") } else if probe.Type == model.ProbeTypePromProbe && probe.PromProperties == nil { return nil, Error(logFields, "prom probe type's properties are empty") @@ -126,21 +128,6 @@ func (p *probe) UpdateProbe(ctx context.Context, request model.ProbeRequest) (st return "", err } - logFields := logrus.Fields{ - "projectId": p.ProjectID, - "probeName": pr.Name, - } - uniqueProbe, err := p.ValidateUniqueProbe(ctx, request.Name) - if err != nil { - return "", err - } else if uniqueProbe == true { - return "", Error(logFields, "probe name doesn't exist") - } - - if request.Type != model.ProbeType(pr.Type) { - return "", Error(logFields, "mismatched probe types") - } - // Shared Properties newProbe := &dbSchemaProbe.Probe{ ResourceDetails: mongodb.ResourceDetails{ @@ -156,21 +143,26 @@ func (p *probe) UpdateProbe(ctx context.Context, request model.ProbeRequest) (st CreatedBy: pr.CreatedBy, UpdatedBy: username, }, - Type: pr.Type, + Type: pr.Type, + InfrastructureType: pr.InfrastructureType, } - // Check the respective probe type and modify the property response based on the type - if request.Type == model.ProbeTypeHTTPProbe && request.HTTPProperties != nil { - addHTTPProbeProperties(newProbe, request) - } else if request.Type == model.ProbeTypeCmdProbe && request.CmdProperties != nil { - addCMDProbeProperties(newProbe, request) - } else if request.Type == model.ProbeTypePromProbe && request.PromProperties != nil { - addPROMProbeProperties(newProbe, request) - } else if request.Type == model.ProbeTypeK8sProbe && request.K8sProperties != nil { - addK8SProbeProperties(newProbe, request) - } else if request.Type == model.ProbeTypeHTTPProbe && request.HTTPProperties == nil { + if pr.InfrastructureType == model.InfrastructureTypeKubernetes { + switch model.ProbeType(pr.Type) { + case model.ProbeTypeHTTPProbe: + addKubernetesHTTPProbeProperties(newProbe, request) + case model.ProbeTypeCmdProbe: + addKubernetesCMDProbeProperties(newProbe, request) + case model.ProbeTypePromProbe: + addPROMProbeProperties(newProbe, request) + case model.ProbeTypeK8sProbe: + addK8SProbeProperties(newProbe, request) + } + } + + if request.Type == model.ProbeTypeHTTPProbe && request.KubernetesHTTPProperties == nil { return "", errors.New("http probe type's properties are empty") - } else if request.Type == model.ProbeTypeCmdProbe && request.CmdProperties == nil { + } else if request.Type == model.ProbeTypeCmdProbe && request.KubernetesCMDProperties == nil { return "", errors.New("cmd probe type's properties are empty") } else if request.Type == model.ProbeTypePromProbe && request.PromProperties == nil { return "", errors.New("prom probe type's properties are empty") @@ -224,72 +216,72 @@ func (p *probe) GetProbeYAMLData(ctx context.Context, probeRequest model.GetProb _probe.Type = string(probe.Type) _probe.Mode = string(probeRequest.Mode) _probe.HTTPProbeInputs = v1alpha1.HTTPProbeInputs{ - URL: probe.HTTPProperties.URL, + URL: probe.KubernetesHTTPProperties.URL, } - if probe.HTTPProperties.InsecureSkipVerify != nil { - _probe.HTTPProbeInputs.InsecureSkipVerify = *probe.HTTPProperties.InsecureSkipVerify + if probe.KubernetesHTTPProperties.InsecureSkipVerify != nil { + _probe.HTTPProbeInputs.InsecureSkipVerify = *probe.KubernetesHTTPProperties.InsecureSkipVerify } - if probe.HTTPProperties.Method.GET != nil { + if probe.KubernetesHTTPProperties.Method.GET != nil { _probe.HTTPProbeInputs = v1alpha1.HTTPProbeInputs{ Method: v1alpha1.HTTPMethod{ Get: &v1alpha1.GetMethod{ - Criteria: probe.HTTPProperties.Method.GET.Criteria, - ResponseCode: probe.HTTPProperties.Method.GET.ResponseCode, + Criteria: probe.KubernetesHTTPProperties.Method.GET.Criteria, + ResponseCode: probe.KubernetesHTTPProperties.Method.GET.ResponseCode, }, }, } - } else if probe.HTTPProperties.Method.POST != nil { + } else if probe.KubernetesHTTPProperties.Method.POST != nil { _probe.HTTPProbeInputs = v1alpha1.HTTPProbeInputs{ Method: v1alpha1.HTTPMethod{ Post: &v1alpha1.PostMethod{ - Criteria: probe.HTTPProperties.Method.POST.Criteria, - ResponseCode: probe.HTTPProperties.Method.POST.ResponseCode, + Criteria: probe.KubernetesHTTPProperties.Method.POST.Criteria, + ResponseCode: probe.KubernetesHTTPProperties.Method.POST.ResponseCode, }, }, } - if probe.HTTPProperties.Method.POST.ContentType != nil { - _probe.HTTPProbeInputs.Method.Post.ContentType = *probe.HTTPProperties.Method.POST.ContentType + if probe.KubernetesHTTPProperties.Method.POST.ContentType != nil { + _probe.HTTPProbeInputs.Method.Post.ContentType = *probe.KubernetesHTTPProperties.Method.POST.ContentType } - if probe.HTTPProperties.Method.POST.Body != nil { - _probe.HTTPProbeInputs.Method.Post.Body = *probe.HTTPProperties.Method.POST.Body + if probe.KubernetesHTTPProperties.Method.POST.Body != nil { + _probe.HTTPProbeInputs.Method.Post.Body = *probe.KubernetesHTTPProperties.Method.POST.Body } - if probe.HTTPProperties.Method.POST.BodyPath != nil { - _probe.HTTPProbeInputs.Method.Post.BodyPath = *probe.HTTPProperties.Method.POST.BodyPath + if probe.KubernetesHTTPProperties.Method.POST.BodyPath != nil { + _probe.HTTPProbeInputs.Method.Post.BodyPath = *probe.KubernetesHTTPProperties.Method.POST.BodyPath } } _probe.RunProperties = v1alpha1.RunProperty{ - ProbeTimeout: probe.HTTPProperties.ProbeTimeout, - Interval: probe.HTTPProperties.Interval, + ProbeTimeout: probe.KubernetesHTTPProperties.ProbeTimeout, + Interval: probe.KubernetesHTTPProperties.Interval, } - if probe.HTTPProperties.Retry != nil { - _probe.RunProperties.Retry = *probe.HTTPProperties.Retry + if probe.KubernetesHTTPProperties.Retry != nil { + _probe.RunProperties.Retry = *probe.KubernetesHTTPProperties.Retry } - if probe.HTTPProperties.Attempt != nil { - _probe.RunProperties.Attempt = *probe.HTTPProperties.Attempt + if probe.KubernetesHTTPProperties.Attempt != nil { + _probe.RunProperties.Attempt = *probe.KubernetesHTTPProperties.Attempt } - if probe.HTTPProperties.PollingInterval != nil { - _probe.RunProperties.ProbePollingInterval = *probe.HTTPProperties.PollingInterval + if probe.KubernetesHTTPProperties.PollingInterval != nil { + _probe.RunProperties.ProbePollingInterval = *probe.KubernetesHTTPProperties.PollingInterval } - if probe.HTTPProperties.EvaluationTimeout != nil { - _probe.RunProperties.EvaluationTimeout = *probe.HTTPProperties.EvaluationTimeout + if probe.KubernetesHTTPProperties.EvaluationTimeout != nil { + _probe.RunProperties.EvaluationTimeout = *probe.KubernetesHTTPProperties.EvaluationTimeout } - if probe.HTTPProperties.InitialDelay != nil { - _probe.RunProperties.InitialDelay = *probe.HTTPProperties.InitialDelay + if probe.KubernetesHTTPProperties.InitialDelay != nil { + _probe.RunProperties.InitialDelay = *probe.KubernetesHTTPProperties.InitialDelay } - if probe.HTTPProperties.StopOnFailure != nil { - _probe.RunProperties.StopOnFailure = *probe.HTTPProperties.StopOnFailure + if probe.KubernetesHTTPProperties.StopOnFailure != nil { + _probe.RunProperties.StopOnFailure = *probe.KubernetesHTTPProperties.StopOnFailure } y, err := yaml.Marshal(_probe) @@ -306,59 +298,59 @@ func (p *probe) GetProbeYAMLData(ctx context.Context, probeRequest model.GetProb _probe.Type = string(probe.Type) _probe.Mode = string(probeRequest.Mode) _probe.CmdProbeInputs = v1alpha1.CmdProbeInputs{ - Command: probe.CMDProperties.Command, + Command: probe.KubernetesCMDProperties.Command, Comparator: v1alpha1.ComparatorInfo{ - Type: probe.CMDProperties.Comparator.Type, - Criteria: probe.CMDProperties.Comparator.Criteria, - Value: probe.CMDProperties.Comparator.Value, + Type: probe.KubernetesCMDProperties.Comparator.Type, + Criteria: probe.KubernetesCMDProperties.Comparator.Criteria, + Value: probe.KubernetesCMDProperties.Comparator.Value, }, } - if probe.CMDProperties.Source != nil { + if probe.KubernetesCMDProperties.Source != nil { // TODO: Add source volume and volume mount types _probe.CmdProbeInputs.Source = &v1alpha1.SourceDetails{ - Image: probe.CMDProperties.Source.Image, - HostNetwork: probe.CMDProperties.Source.HostNetwork, - InheritInputs: probe.CMDProperties.Source.InheritInputs, - Args: probe.CMDProperties.Source.Args, - ENVList: probe.CMDProperties.Source.ENVList, - Labels: probe.CMDProperties.Source.Labels, - Annotations: probe.CMDProperties.Source.Annotations, - Command: probe.CMDProperties.Source.Command, - ImagePullPolicy: probe.CMDProperties.Source.ImagePullPolicy, - Privileged: probe.CMDProperties.Source.Privileged, - NodeSelector: probe.CMDProperties.Source.NodeSelector, - ImagePullSecrets: probe.CMDProperties.Source.ImagePullSecrets, + Image: probe.KubernetesCMDProperties.Source.Image, + HostNetwork: probe.KubernetesCMDProperties.Source.HostNetwork, + InheritInputs: probe.KubernetesCMDProperties.Source.InheritInputs, + Args: probe.KubernetesCMDProperties.Source.Args, + ENVList: probe.KubernetesCMDProperties.Source.ENVList, + Labels: probe.KubernetesCMDProperties.Source.Labels, + Annotations: probe.KubernetesCMDProperties.Source.Annotations, + Command: probe.KubernetesCMDProperties.Source.Command, + ImagePullPolicy: probe.KubernetesCMDProperties.Source.ImagePullPolicy, + Privileged: probe.KubernetesCMDProperties.Source.Privileged, + NodeSelector: probe.KubernetesCMDProperties.Source.NodeSelector, + ImagePullSecrets: probe.KubernetesCMDProperties.Source.ImagePullSecrets, } } _probe.RunProperties = v1alpha1.RunProperty{ - ProbeTimeout: probe.CMDProperties.ProbeTimeout, - Interval: probe.CMDProperties.Interval, + ProbeTimeout: probe.KubernetesCMDProperties.ProbeTimeout, + Interval: probe.KubernetesCMDProperties.Interval, } - if probe.CMDProperties.Retry != nil { - _probe.RunProperties.Retry = *probe.CMDProperties.Retry + if probe.KubernetesCMDProperties.Retry != nil { + _probe.RunProperties.Retry = *probe.KubernetesCMDProperties.Retry } - if probe.CMDProperties.Attempt != nil { - _probe.RunProperties.Attempt = *probe.CMDProperties.Attempt + if probe.KubernetesCMDProperties.Attempt != nil { + _probe.RunProperties.Attempt = *probe.KubernetesCMDProperties.Attempt } - if probe.CMDProperties.PollingInterval != nil { - _probe.RunProperties.ProbePollingInterval = *probe.CMDProperties.PollingInterval + if probe.KubernetesCMDProperties.PollingInterval != nil { + _probe.RunProperties.ProbePollingInterval = *probe.KubernetesCMDProperties.PollingInterval } - if probe.CMDProperties.EvaluationTimeout != nil { - _probe.RunProperties.EvaluationTimeout = *probe.CMDProperties.EvaluationTimeout + if probe.KubernetesCMDProperties.EvaluationTimeout != nil { + _probe.RunProperties.EvaluationTimeout = *probe.KubernetesCMDProperties.EvaluationTimeout } - if probe.CMDProperties.InitialDelay != nil { - _probe.RunProperties.InitialDelay = *probe.CMDProperties.InitialDelay + if probe.KubernetesCMDProperties.InitialDelay != nil { + _probe.RunProperties.InitialDelay = *probe.KubernetesCMDProperties.InitialDelay } - if probe.CMDProperties.StopOnFailure != nil { - _probe.RunProperties.StopOnFailure = *probe.CMDProperties.StopOnFailure + if probe.KubernetesCMDProperties.StopOnFailure != nil { + _probe.RunProperties.StopOnFailure = *probe.KubernetesCMDProperties.StopOnFailure } y, err := yaml.Marshal(_probe) @@ -495,7 +487,7 @@ func (p *probe) GetProbeYAMLData(ctx context.Context, probeRequest model.GetProb } // ListProbes - List a single/all Probes -func (p *probe) ListProbes(ctx context.Context, probeNames []string, filter *model.ProbeFilterInput) ([]*model.Probe, error) { +func (p *probe) ListProbes(ctx context.Context, probeNames []string, infrastructureType *model.InfrastructureType, filter *model.ProbeFilterInput) ([]*model.Probe, error) { var pipeline mongo.Pipeline // Match the Probe Names from the input array @@ -513,6 +505,18 @@ func (p *probe) ListProbes(ctx context.Context, probeNames []string, filter *mod pipeline = append(pipeline, matchProbeName) } + // Match the Infra from the input array + if infrastructureType != nil { + matchProbeInfra := bson.D{ + { + Key: "$match", Value: bson.D{ + {"infrastructure_type", *infrastructureType}, + }, + }, + } + + pipeline = append(pipeline, matchProbeInfra) + } // Match Filter options if filter != nil { // Filtering based on multi-select probe type @@ -618,8 +622,6 @@ func GetProbeExecutionHistoryInExperimentRuns(projectID string, probeName string var ( pipeline mongo.Pipeline expRuns []dbChaosExperimentRun.ChaosExperimentRun - executionData chaos_experiment.ExecutionData - probeStatusMap = map[string]model.ProbeVerdict{} recentExecutions []*model.ProbeRecentExecutions ) @@ -645,59 +647,56 @@ func GetProbeExecutionHistoryInExperimentRuns(projectID string, probeName string } for _, execution := range expRuns { - faultName := execution.Probes[0].FaultName - - probeStatusMap = make(map[string]model.ProbeVerdict) - - if err = json.Unmarshal([]byte(execution.ExecutionData), &executionData); err != nil { - return nil, errors.New("failed to unmarshal experiment manifest") + var executionData chaos_experiment.ExecutionData + if execution.ExecutionData != "" { + err = json.Unmarshal([]byte(execution.ExecutionData), &executionData) + if err != nil { + continue + } } + for _, fault := range execution.Probes { + probeVerdict := model.ProbeVerdictNa - probeStatusMap[probeName] = model.ProbeVerdictNa - - for _, probe := range execution.Probes { - if faultName == probe.FaultName { - if len(executionData.Nodes) > 0 { - - for _, nodeData := range executionData.Nodes { - if nodeData.Name == faultName { - if nodeData.Type == "ChaosEngine" && nodeData.ChaosExp == nil { - probeStatusMap[probeName] = model.ProbeVerdictNa - } else if nodeData.Type == "ChaosEngine" && nodeData.ChaosExp != nil { - probeStatusMap[probeName] = model.ProbeVerdictNa - - if nodeData.ChaosExp.ChaosResult != nil { - probeStatusMap[probeName] = model.ProbeVerdictAwaited - probeStatuses := nodeData.ChaosExp.ChaosResult.Status.ProbeStatuses - - for _, probeStatus := range probeStatuses { - - if probeStatus.Name == probeName { + if !utils.ContainsString(fault.ProbeNames, probeName) { + continue + } - switch probeStatus.Status.Verdict { - case v1alpha1.ProbeVerdictPassed: - probeStatusMap[probeName] = model.ProbeVerdictPassed - case v1alpha1.ProbeVerdictFailed: - probeStatusMap[probeName] = model.ProbeVerdictFailed - case v1alpha1.ProbeVerdictAwaited: - probeStatusMap[probeName] = model.ProbeVerdictAwaited - default: - probeStatusMap[probeName] = model.ProbeVerdictNa - } + if len(executionData.Nodes) > 0 { + for _, nodeData := range executionData.Nodes { + if fault.FaultName == nodeData.Name { + if (nodeData.Type == "ChaosEngine" || nodeData.Type == "LinuxTask") && nodeData.ChaosExp == nil { + probeVerdict = model.ProbeVerdictNa + } else if (nodeData.Type == "ChaosEngine" || nodeData.Type == "LinuxTask") && nodeData.ChaosExp != nil { + probeVerdict = model.ProbeVerdictNa + + if nodeData.ChaosExp.ChaosResult != nil { + probeVerdict = model.ProbeVerdictAwaited + probeStatuses := nodeData.ChaosExp + for _, probeStatus := range probeStatuses.ChaosResult.Status.ProbeStatuses { + if probeStatus.Name == probeName { + switch probeStatus.Status.Verdict { + case v1alpha1.ProbeVerdictPassed: + probeVerdict = model.ProbeVerdictPassed + case v1alpha1.ProbeVerdictFailed: + probeVerdict = model.ProbeVerdictFailed + case v1alpha1.ProbeVerdictAwaited: + probeVerdict = model.ProbeVerdictAwaited + default: + probeVerdict = model.ProbeVerdictNa } - } } } } } } + status := &model.Status{ + Verdict: probeVerdict, + } - recentExecutions = append(recentExecutions, &model.ProbeRecentExecutions{ - FaultName: faultName, - Status: &model.Status{ - Verdict: probeStatusMap[probeName], - }, + recentExecution := &model.ProbeRecentExecutions{ + FaultName: fault.FaultName, + Status: status, ExecutedByExperiment: &model.ExecutedByExperiment{ ExperimentID: execution.ExperimentID, ExperimentName: execution.ExperimentName, @@ -706,8 +705,8 @@ func GetProbeExecutionHistoryInExperimentRuns(projectID string, probeName string Username: execution.UpdatedBy, }, }, - }) - + } + recentExecutions = append(recentExecutions, recentExecution) } } } @@ -785,6 +784,7 @@ func (p *probe) GetProbeReference(ctx context.Context, probeName string) (*model {"$project", bson.D{ {"experiment_name", 1}, {"probes.fault_name", 1}, + {"probes.probe_names", 1}, {"phase", 1}, {"updated_at", 1}, {"updated_by", 1}, @@ -807,63 +807,59 @@ func (p *probe) GetProbeReference(ctx context.Context, probeName string) (*model } var ( - totalRuns = 0 - executionData chaos_experiment.ExecutionData - probeRuns []dbSchemaProbe.ProbeWithExecutionHistory - recentExecutions []*model.RecentExecutions - recentExecutionsMap = make(map[string][]*model.RecentExecutions) + totalRuns = 0 + probeRuns []dbSchemaProbe.ProbeWithExecutionHistory + recentExecutions []*model.RecentExecutions + recentExecutionsMap = make(map[string][]*model.RecentExecutions) + executionHistoryResponse []*model.ExecutionHistory ) if err = probeCursor.All(context.Background(), &probeRuns); err != nil { return nil, err } - for _, individualExecution := range probeRuns[0].ExecutionHistory { - - faultName := individualExecution.Probes[0].FaultName - mode := "SOT" - + for _, runs := range probeRuns[0].ExecutionHistory { totalRuns++ - var executionHistoryResponse []*model.ExecutionHistory - - for _, execution := range probeRuns[0].ExecutionHistory { - - status := model.ProbeVerdictNa - - if err = json.Unmarshal([]byte(execution.ExecutionData), &executionData); err != nil { - return nil, errors.New("failed to unmarshal experiment manifest") - } - - for _, probe := range execution.Probes { - if faultName == probe.FaultName { - if len(executionData.Nodes) > 0 { - for _, nodeData := range executionData.Nodes { - if nodeData.Name == faultName { - if nodeData.Type == "ChaosEngine" && nodeData.ChaosExp == nil { - status = model.ProbeVerdictNa - } else if nodeData.Type == "ChaosEngine" && nodeData.ChaosExp != nil { - status = model.ProbeVerdictNa - - if nodeData.ChaosExp.ChaosResult != nil { - status = model.ProbeVerdictAwaited - probeStatuses := nodeData.ChaosExp.ChaosResult.Status.ProbeStatuses - - for _, probeStatus := range probeStatuses { - if probeStatus.Name == probeRuns[0].Name { - mode = probeStatus.Mode - switch probeStatus.Status.Verdict { - case v1alpha1.ProbeVerdictPassed: - status = model.ProbeVerdictPassed - break - case v1alpha1.ProbeVerdictFailed: - status = model.ProbeVerdictFailed - break - case v1alpha1.ProbeVerdictAwaited: - status = model.ProbeVerdictAwaited - break - default: - status = model.ProbeVerdictNa - break + if len(runs.Probes) != 0 { + for _, fault := range runs.Probes { + if utils.ContainsString(fault.ProbeNames, probeName) { + var executionData chaos_experiment.ExecutionData + status := model.ProbeVerdictNa + mode := model.ModeSot + if runs.ExecutionData != "" { + err := json.Unmarshal([]byte(runs.ExecutionData), &executionData) + if err != nil { + continue + } + if len(executionData.Nodes) > 0 { + for _, nodeData := range executionData.Nodes { + if nodeData.Name == fault.FaultName { + if (nodeData.Type == "ChaosEngine" || nodeData.Type == "LinuxTask") && nodeData.ChaosExp == nil { + status = model.ProbeVerdictNa + } else if (nodeData.Type == "ChaosEngine" || nodeData.Type == "LinuxTask") && nodeData.ChaosExp != nil { + status = model.ProbeVerdictNa + + if nodeData.ChaosExp.ChaosResult != nil { + status = model.ProbeVerdictAwaited + probeStatuses := nodeData.ChaosExp.ChaosResult.Status.ProbeStatuses + + for _, probeStatus := range probeStatuses { + if probeStatus.Name == probeName { + mode = model.Mode(probeStatus.Mode) + switch probeStatus.Status.Verdict { + case v1alpha1.ProbeVerdictPassed: + status = model.ProbeVerdictPassed + break + case v1alpha1.ProbeVerdictFailed: + status = model.ProbeVerdictFailed + break + case v1alpha1.ProbeVerdictAwaited: + status = model.ProbeVerdictAwaited + break + default: + status = model.ProbeVerdictNa + break + } } } } @@ -871,39 +867,53 @@ func (p *probe) GetProbeReference(ctx context.Context, probeName string) (*model } } } + executionHistoryResponse = append(executionHistoryResponse, &model.ExecutionHistory{ + Mode: mode, + FaultName: fault.FaultName, + Status: &model.Status{ + Verdict: status, + }, + ExecutedByExperiment: &model.ExecutedByExperiment{ + ExperimentID: runs.ExperimentID, + ExperimentName: runs.ExperimentName, + UpdatedAt: runs.UpdatedAt, + UpdatedBy: &model.UserDetails{ + Username: runs.UpdatedBy, + }, + }, + }) } - executionHistoryResponse = append(executionHistoryResponse, &model.ExecutionHistory{ - Status: &model.Status{ - Verdict: status, - }, - ExecutedByExperiment: &model.ExecutedByExperiment{ - ExperimentID: execution.ExperimentID, - ExperimentName: execution.ExperimentName, - UpdatedAt: execution.UpdatedAt, - //UpdatedBy: harness.FilterUserDetails(execution.UpdatedBy, userDetails), - }, - }) } } } - for i, j := 0, len(executionHistoryResponse)-1; i < j; i, j = i+1, j-1 { - j := len(executionHistoryResponse) - i - 1 - executionHistoryResponse[i], executionHistoryResponse[j] = executionHistoryResponse[j], executionHistoryResponse[i] - } + } - recentExecutionsMap[faultName] = append(recentExecutionsMap[faultName], &model.RecentExecutions{ - FaultName: faultName, - Mode: model.Mode(mode), - ExecutionHistory: executionHistoryResponse, + for _, exeHistory := range executionHistoryResponse { + recentExecutionsMap[exeHistory.FaultName] = append(recentExecutionsMap[exeHistory.FaultName], &model.RecentExecutions{ + FaultName: exeHistory.FaultName, + Mode: exeHistory.Mode, }) } - for fault := range recentExecutionsMap { - if len(recentExecutionsMap[fault]) != 0 { - recentExecutions = append(recentExecutions, recentExecutionsMap[fault][0]) + for name := range recentExecutionsMap { + var lastTenExecutions []*model.ExecutionHistory + for _, exeHistory := range executionHistoryResponse { + if exeHistory.FaultName == name { + lastTenExecutions = append(lastTenExecutions, exeHistory) + } } + + // Reverse the order to make the latest execution shift to the right + sort.Slice(lastTenExecutions, func(i, j int) bool { + return lastTenExecutions[i].ExecutedByExperiment.UpdatedAt > lastTenExecutions[j].ExecutedByExperiment.UpdatedAt + }) + if len(lastTenExecutions) > 10 { + lastTenExecutions = lastTenExecutions[:10] + } + recentExecutionsMap[name][0].ExecutionHistory = lastTenExecutions + recentExecutions = append(recentExecutions, recentExecutionsMap[name][0]) } sort.Slice(recentExecutions, func(i, j int) bool { @@ -926,7 +936,6 @@ func (p *probe) ValidateUniqueProbe(ctx context.Context, probeName string) (bool query := bson.D{ {"name", probeName}, {"project_id", p.ProjectID}, - {"is_removed", false}, } isUnique, err := dbSchemaProbe.IsProbeUnique(ctx, query) diff --git a/chaoscenter/graphql/server/pkg/probe/utils.go b/chaoscenter/graphql/server/pkg/probe/utils.go index 643ad10ea5d..64c244f8e80 100644 --- a/chaoscenter/graphql/server/pkg/probe/utils.go +++ b/chaoscenter/graphql/server/pkg/probe/utils.go @@ -8,6 +8,10 @@ import ( "strings" "time" + "github.com/sirupsen/logrus" + + dbChaosExperimentRun "github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/database/mongodb/chaos_experiment_run" + argoTypes "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1" "github.com/litmuschaos/litmus/chaoscenter/graphql/server/graph/model" dbChaosExperiment "github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/database/mongodb/chaos_experiment" @@ -17,100 +21,104 @@ import ( "github.com/litmuschaos/chaos-operator/api/litmuschaos/v1alpha1" ) -func addHTTPProbeProperties(newProbe *dbSchemaProbe.Probe, request model.ProbeRequest) *dbSchemaProbe.Probe { +func addKubernetesHTTPProbeProperties(newProbe *dbSchemaProbe.Probe, request model.ProbeRequest) *dbSchemaProbe.Probe { - newProbe.HTTPProperties = &dbSchemaProbe.HTTPProbe{ + newProbe.KubernetesHTTPProperties = &dbSchemaProbe.KubernetesHTTPProbe{ // Common Probe Properties - ProbeTimeout: request.HTTPProperties.ProbeTimeout, - Interval: request.HTTPProperties.Interval, - EvaluationTimeout: request.HTTPProperties.EvaluationTimeout, + ProbeTimeout: request.KubernetesHTTPProperties.ProbeTimeout, + Interval: request.KubernetesHTTPProperties.Interval, + EvaluationTimeout: request.KubernetesHTTPProperties.EvaluationTimeout, // Unique Properties for HTTP Probe - URL: request.HTTPProperties.URL, + URL: request.KubernetesHTTPProperties.URL, Method: dbSchemaProbe.Method{}, } // HTTP Probe -> Attempt - newProbe.HTTPProperties.Attempt = request.HTTPProperties.Attempt + newProbe.KubernetesHTTPProperties.Attempt = request.KubernetesHTTPProperties.Attempt // HTTP Probe -> Retry - newProbe.HTTPProperties.Retry = request.HTTPProperties.Retry + newProbe.KubernetesHTTPProperties.Retry = request.KubernetesHTTPProperties.Retry // HTTP Probe -> ProbePollingInterval - newProbe.HTTPProperties.PollingInterval = request.HTTPProperties.ProbePollingInterval + newProbe.KubernetesHTTPProperties.PollingInterval = request.KubernetesHTTPProperties.ProbePollingInterval // HTTP Probe -> EvaluationTimeout - newProbe.HTTPProperties.EvaluationTimeout = request.HTTPProperties.EvaluationTimeout + newProbe.KubernetesHTTPProperties.EvaluationTimeout = request.KubernetesHTTPProperties.EvaluationTimeout // HTTP Probe -> InitialDelay - newProbe.HTTPProperties.InitialDelay = request.HTTPProperties.InitialDelay + newProbe.KubernetesHTTPProperties.InitialDelay = request.KubernetesHTTPProperties.InitialDelay // HTTP Probe -> StopOnFailureEnabled - newProbe.HTTPProperties.StopOnFailure = request.HTTPProperties.StopOnFailure + newProbe.KubernetesHTTPProperties.StopOnFailure = request.KubernetesHTTPProperties.StopOnFailure // HTTP Probe -> InsecureSkipVerify - newProbe.HTTPProperties.InsecureSkipVerify = request.HTTPProperties.InsecureSkipVerify + newProbe.KubernetesHTTPProperties.InsecureSkipVerify = request.KubernetesHTTPProperties.InsecureSkipVerify // HTTP Probe -> Method [GET or POST] - if request.HTTPProperties.Method.Get != nil { - newProbe.HTTPProperties.Method.GET = &dbSchemaProbe.GET{ - Criteria: request.HTTPProperties.Method.Get.Criteria, - ResponseCode: request.HTTPProperties.Method.Get.ResponseCode, + if request.KubernetesHTTPProperties.Method.Get != nil { + newProbe.KubernetesHTTPProperties.Method.GET = &dbSchemaProbe.GET{ + Criteria: request.KubernetesHTTPProperties.Method.Get.Criteria, + ResponseCode: request.KubernetesHTTPProperties.Method.Get.ResponseCode, } - } else if request.HTTPProperties.Method.Post != nil { - newProbe.HTTPProperties.Method.POST = &dbSchemaProbe.POST{ - Criteria: request.HTTPProperties.Method.Post.Criteria, - ResponseCode: request.HTTPProperties.Method.Post.ResponseCode, + } else if request.KubernetesHTTPProperties.Method.Post != nil { + newProbe.KubernetesHTTPProperties.Method.POST = &dbSchemaProbe.POST{ + Criteria: request.KubernetesHTTPProperties.Method.Post.Criteria, + ResponseCode: request.KubernetesHTTPProperties.Method.Post.ResponseCode, } - newProbe.HTTPProperties.Method.POST.ContentType = request.HTTPProperties.Method.Post.ContentType + newProbe.KubernetesHTTPProperties.Method.POST.ContentType = request.KubernetesHTTPProperties.Method.Post.ContentType - newProbe.HTTPProperties.Method.POST.Body = request.HTTPProperties.Method.Post.Body + newProbe.KubernetesHTTPProperties.Method.POST.Body = request.KubernetesHTTPProperties.Method.Post.Body - newProbe.HTTPProperties.Method.POST.BodyPath = request.HTTPProperties.Method.Post.BodyPath + newProbe.KubernetesHTTPProperties.Method.POST.BodyPath = request.KubernetesHTTPProperties.Method.Post.BodyPath } return newProbe } -func addCMDProbeProperties(newProbe *dbSchemaProbe.Probe, request model.ProbeRequest) *dbSchemaProbe.Probe { - newProbe.CMDProperties = &dbSchemaProbe.CMDProbe{ +func addKubernetesCMDProbeProperties(newProbe *dbSchemaProbe.Probe, request model.ProbeRequest) *dbSchemaProbe.Probe { + newProbe.KubernetesCMDProperties = &dbSchemaProbe.KubernetesCMDProbe{ // Common Probe Properties - ProbeTimeout: request.CmdProperties.ProbeTimeout, - Interval: request.CmdProperties.Interval, + ProbeTimeout: request.KubernetesCMDProperties.ProbeTimeout, + Interval: request.KubernetesCMDProperties.Interval, // Unique Properties for CMD Probe - Command: request.CmdProperties.Command, + Command: request.KubernetesCMDProperties.Command, Comparator: dbSchemaProbe.Comparator{ - Type: request.CmdProperties.Comparator.Type, - Value: request.CmdProperties.Comparator.Value, - Criteria: request.CmdProperties.Comparator.Criteria, + Type: request.KubernetesCMDProperties.Comparator.Type, + Value: request.KubernetesCMDProperties.Comparator.Value, + Criteria: request.KubernetesCMDProperties.Comparator.Criteria, }, } // CMD Probe -> Attempt - newProbe.CMDProperties.Attempt = request.CmdProperties.Attempt + newProbe.KubernetesCMDProperties.Attempt = request.KubernetesCMDProperties.Attempt // CMD Probe -> Retry - newProbe.CMDProperties.Retry = request.CmdProperties.Retry + newProbe.KubernetesCMDProperties.Retry = request.KubernetesCMDProperties.Retry // CMD Probe -> ProbePollingInterval - newProbe.CMDProperties.PollingInterval = request.CmdProperties.ProbePollingInterval + newProbe.KubernetesCMDProperties.PollingInterval = request.KubernetesCMDProperties.ProbePollingInterval // CMD Probe -> EvaluationTimeout - newProbe.CMDProperties.EvaluationTimeout = request.CmdProperties.EvaluationTimeout + newProbe.KubernetesCMDProperties.EvaluationTimeout = request.KubernetesCMDProperties.EvaluationTimeout // CMD Probe -> InitialDelaySeconds - newProbe.CMDProperties.InitialDelay = request.CmdProperties.InitialDelay + newProbe.KubernetesCMDProperties.InitialDelay = request.KubernetesCMDProperties.InitialDelay // CMD Probe -> StopOnFailureEnabled - newProbe.CMDProperties.StopOnFailure = request.CmdProperties.StopOnFailure + newProbe.KubernetesCMDProperties.StopOnFailure = request.KubernetesCMDProperties.StopOnFailure // CMD Probe -> Source - if request.CmdProperties.Source != nil { + if request.KubernetesCMDProperties.Source != nil { var source *v1alpha1.SourceDetails - err := json.Unmarshal([]byte(*request.CmdProperties.Source), &source) + fmt.Println("source", []byte(*request.KubernetesCMDProperties.Source), *request.KubernetesCMDProperties.Source) + + err := json.Unmarshal([]byte(*request.KubernetesCMDProperties.Source), &source) if err != nil { + logrus.Errorf("error unmarshalling soruce: %s", err.Error()) return nil } - newProbe.CMDProperties.Source = &v1alpha1.SourceDetails{ + + newProbe.KubernetesCMDProperties.Source = &v1alpha1.SourceDetails{ Image: source.Image, HostNetwork: source.HostNetwork, InheritInputs: source.InheritInputs, @@ -216,78 +224,78 @@ func addK8SProbeProperties(newProbe *dbSchemaProbe.Probe, request model.ProbeReq func GenerateProbeManifest(probe *model.Probe, mode model.Mode) (string, error) { if probe.Type == model.ProbeTypeHTTPProbe { - httpProbeURL := probe.HTTPProperties.URL + httpProbeURL := probe.KubernetesHTTPProperties.URL var _probe HTTPProbeAttributes _probe.Name = probe.Name _probe.Type = string(probe.Type) _probe.Mode = string(mode) - if probe.HTTPProperties.InsecureSkipVerify != nil { + if probe.KubernetesHTTPProperties.InsecureSkipVerify != nil { _probe.HTTPProbeInputs = v1alpha1.HTTPProbeInputs{ - InsecureSkipVerify: *probe.HTTPProperties.InsecureSkipVerify, + InsecureSkipVerify: *probe.KubernetesHTTPProperties.InsecureSkipVerify, } } - if probe.HTTPProperties.Method.Get != nil { + if probe.KubernetesHTTPProperties.Method.Get != nil { _probe.HTTPProbeInputs = v1alpha1.HTTPProbeInputs{ URL: httpProbeURL, Method: v1alpha1.HTTPMethod{ Get: &v1alpha1.GetMethod{ - Criteria: probe.HTTPProperties.Method.Get.Criteria, - ResponseCode: probe.HTTPProperties.Method.Get.ResponseCode, + Criteria: probe.KubernetesHTTPProperties.Method.Get.Criteria, + ResponseCode: probe.KubernetesHTTPProperties.Method.Get.ResponseCode, }, }, } - } else if probe.HTTPProperties.Method.Post != nil { + } else if probe.KubernetesHTTPProperties.Method.Post != nil { _probe.HTTPProbeInputs = v1alpha1.HTTPProbeInputs{ URL: httpProbeURL, Method: v1alpha1.HTTPMethod{ Post: &v1alpha1.PostMethod{ - Criteria: probe.HTTPProperties.Method.Post.Criteria, - ResponseCode: probe.HTTPProperties.Method.Post.ResponseCode, + Criteria: probe.KubernetesHTTPProperties.Method.Post.Criteria, + ResponseCode: probe.KubernetesHTTPProperties.Method.Post.ResponseCode, }, }, } - if probe.HTTPProperties.Method.Post.ContentType != nil { - _probe.HTTPProbeInputs.Method.Post.ContentType = *probe.HTTPProperties.Method.Post.ContentType + if probe.KubernetesHTTPProperties.Method.Post.ContentType != nil { + _probe.HTTPProbeInputs.Method.Post.ContentType = *probe.KubernetesHTTPProperties.Method.Post.ContentType } - if probe.HTTPProperties.Method.Post.Body != nil { - _probe.HTTPProbeInputs.Method.Post.Body = *probe.HTTPProperties.Method.Post.Body + if probe.KubernetesHTTPProperties.Method.Post.Body != nil { + _probe.HTTPProbeInputs.Method.Post.Body = *probe.KubernetesHTTPProperties.Method.Post.Body } - if probe.HTTPProperties.Method.Post.BodyPath != nil { - _probe.HTTPProbeInputs.Method.Post.BodyPath = *probe.HTTPProperties.Method.Post.BodyPath + if probe.KubernetesHTTPProperties.Method.Post.BodyPath != nil { + _probe.HTTPProbeInputs.Method.Post.BodyPath = *probe.KubernetesHTTPProperties.Method.Post.BodyPath } } _probe.RunProperties = v1alpha1.RunProperty{ - ProbeTimeout: probe.HTTPProperties.ProbeTimeout, - Interval: probe.HTTPProperties.Interval, + ProbeTimeout: probe.KubernetesHTTPProperties.ProbeTimeout, + Interval: probe.KubernetesHTTPProperties.Interval, } - if probe.HTTPProperties.Attempt != nil { - _probe.RunProperties.Attempt = *probe.HTTPProperties.Attempt + if probe.KubernetesHTTPProperties.Attempt != nil { + _probe.RunProperties.Attempt = *probe.KubernetesHTTPProperties.Attempt } - if probe.HTTPProperties.Retry != nil { - _probe.RunProperties.Retry = *probe.HTTPProperties.Retry + if probe.KubernetesHTTPProperties.Retry != nil { + _probe.RunProperties.Retry = *probe.KubernetesHTTPProperties.Retry } - if probe.HTTPProperties.ProbePollingInterval != nil { - _probe.RunProperties.ProbePollingInterval = *probe.HTTPProperties.ProbePollingInterval + if probe.KubernetesHTTPProperties.ProbePollingInterval != nil { + _probe.RunProperties.ProbePollingInterval = *probe.KubernetesHTTPProperties.ProbePollingInterval } - if probe.HTTPProperties.EvaluationTimeout != nil { - _probe.RunProperties.EvaluationTimeout = *probe.HTTPProperties.EvaluationTimeout + if probe.KubernetesHTTPProperties.EvaluationTimeout != nil { + _probe.RunProperties.EvaluationTimeout = *probe.KubernetesHTTPProperties.EvaluationTimeout } - if probe.HTTPProperties.StopOnFailure != nil { - _probe.RunProperties.StopOnFailure = *probe.HTTPProperties.StopOnFailure + if probe.KubernetesHTTPProperties.StopOnFailure != nil { + _probe.RunProperties.StopOnFailure = *probe.KubernetesHTTPProperties.StopOnFailure } y, err := json.Marshal(_probe) @@ -304,41 +312,41 @@ func GenerateProbeManifest(probe *model.Probe, mode model.Mode) (string, error) _probe.Type = string(probe.Type) _probe.Mode = string(mode) _probe.CmdProbeInputs = v1alpha1.CmdProbeInputs{ - Command: probe.CmdProperties.Command, + Command: probe.KubernetesCMDProperties.Command, Comparator: v1alpha1.ComparatorInfo{ - Type: probe.CmdProperties.Comparator.Type, - Criteria: probe.CmdProperties.Comparator.Criteria, - Value: probe.CmdProperties.Comparator.Value, + Type: probe.KubernetesCMDProperties.Comparator.Type, + Criteria: probe.KubernetesCMDProperties.Comparator.Criteria, + Value: probe.KubernetesCMDProperties.Comparator.Value, }, } _probe.RunProperties = v1alpha1.RunProperty{ - ProbeTimeout: probe.CmdProperties.ProbeTimeout, - Interval: probe.CmdProperties.Interval, + ProbeTimeout: probe.KubernetesCMDProperties.ProbeTimeout, + Interval: probe.KubernetesCMDProperties.Interval, } - if probe.CmdProperties.Attempt != nil { - _probe.RunProperties.Attempt = *probe.CmdProperties.Attempt + if probe.KubernetesCMDProperties.Attempt != nil { + _probe.RunProperties.Attempt = *probe.KubernetesCMDProperties.Attempt } - if probe.CmdProperties.Retry != nil { - _probe.RunProperties.Retry = *probe.CmdProperties.Retry + if probe.KubernetesCMDProperties.Retry != nil { + _probe.RunProperties.Retry = *probe.KubernetesCMDProperties.Retry } - if probe.CmdProperties.ProbePollingInterval != nil { - _probe.RunProperties.ProbePollingInterval = *probe.CmdProperties.ProbePollingInterval + if probe.KubernetesCMDProperties.ProbePollingInterval != nil { + _probe.RunProperties.ProbePollingInterval = *probe.KubernetesCMDProperties.ProbePollingInterval } - if probe.CmdProperties.EvaluationTimeout != nil { - _probe.RunProperties.EvaluationTimeout = *probe.CmdProperties.EvaluationTimeout + if probe.KubernetesCMDProperties.EvaluationTimeout != nil { + _probe.RunProperties.EvaluationTimeout = *probe.KubernetesCMDProperties.EvaluationTimeout } - if probe.CmdProperties.InitialDelay != nil { - _probe.RunProperties.InitialDelay = *probe.CmdProperties.InitialDelay + if probe.KubernetesCMDProperties.InitialDelay != nil { + _probe.RunProperties.InitialDelay = *probe.KubernetesCMDProperties.InitialDelay } - if probe.CmdProperties.StopOnFailure != nil { - _probe.RunProperties.StopOnFailure = *probe.CmdProperties.StopOnFailure + if probe.KubernetesCMDProperties.StopOnFailure != nil { + _probe.RunProperties.StopOnFailure = *probe.KubernetesCMDProperties.StopOnFailure } y, err := json.Marshal(_probe) @@ -581,6 +589,115 @@ func ParseProbesFromManifest(wfType *dbChaosExperiment.ChaosExperimentType, mani return probes, nil } +// ParseProbesFromManifestForRuns - Parses the manifest to return probes which is stored in the DB +func ParseProbesFromManifestForRuns(wfType *dbChaosExperiment.ChaosExperimentType, manifest string) ([]dbChaosExperimentRun.Probes, error) { + var ( + probes []dbChaosExperimentRun.Probes + nonCronManifest argoTypes.Workflow + cronManifest argoTypes.CronWorkflow + ) + + if *wfType == "cronexperiment" { + err := json.Unmarshal([]byte(manifest), &cronManifest) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal experiment manifest, error: %v", err.Error()) + } + + for _, template := range cronManifest.Spec.WorkflowSpec.Templates { + artifact := template.Inputs.Artifacts + + if len(artifact) > 0 { + if artifact[0].Raw == nil { + continue + } + data := artifact[0].Raw.Data + if len(data) > 0 { + var ( + meta v1alpha1.ChaosEngine + annotation = make(map[string]string) + ) + + err := yaml.Unmarshal([]byte(data), &meta) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal chaosengine, error: %v", err.Error()) + } + if strings.ToLower(meta.Kind) == "chaosengine" { + if meta.Annotations != nil { + annotation = meta.Annotations + } + var annotationArray []string + for _, key := range annotation { + + var manifestAnnotation []dbChaosExperiment.ProbeAnnotations + err := json.Unmarshal([]byte(key), &manifestAnnotation) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal experiment annotation object, error: %v", err.Error()) + } + for _, annotationKey := range manifestAnnotation { + annotationArray = append(annotationArray, annotationKey.Name) + } + } + probes = append(probes, dbChaosExperimentRun.Probes{ + artifact[0].Name, + annotationArray, + }) + } + } + } + } + } else { + err := json.Unmarshal([]byte(manifest), &nonCronManifest) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal experiment manifest, error: %v", err.Error()) + } + + for _, template := range nonCronManifest.Spec.Templates { + artifact := template.Inputs.Artifacts + + if len(artifact) > 0 { + if artifact[0].Raw == nil { + continue + } + data := artifact[0].Raw.Data + if len(data) > 0 { + var ( + meta v1alpha1.ChaosEngine + annotation = make(map[string]string) + ) + + err := yaml.Unmarshal([]byte(data), &meta) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal chaosengine, error: %v", err.Error()) + } + if strings.ToLower(meta.Kind) == "chaosengine" { + if meta.Annotations != nil { + annotation = meta.Annotations + } + var annotationArray []string + for _, key := range annotation { + + var manifestAnnotation []dbChaosExperiment.ProbeAnnotations + err := json.Unmarshal([]byte(key), &manifestAnnotation) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal experiment annotation object, error: %v", err.Error()) + } + for _, annotationKey := range manifestAnnotation { + annotationArray = append(annotationArray, annotationKey.Name) + } + } + probes = append(probes, dbChaosExperimentRun.Probes{ + FaultName: artifact[0].Name, + ProbeNames: annotationArray, + }) + } + } + } + } + } + + return probes, nil +} + // GenerateExperimentManifestWithProbes - uses GenerateProbeManifest to get and store the respective probe attribute into Raw Data template for Non Cron Workflow func GenerateExperimentManifestWithProbes(manifest string, projectID string) (argoTypes.Workflow, error) { @@ -640,7 +757,7 @@ func GenerateExperimentManifestWithProbes(manifest string, projectID string) (ar if err != nil { return argoTypes.Workflow{}, fmt.Errorf("failed to fetch probe details, error: %s", err.Error()) } - + fmt.Println("probes", probes) probeManifestString, err := GenerateProbeManifest(probe.GetOutputProbe(), annotationKey.Mode) if err != nil { return argoTypes.Workflow{}, fmt.Errorf("failed to generate probe manifest, error: %s", err.Error()) diff --git a/chaoscenter/graphql/server/pkg/projects/project_handler.go b/chaoscenter/graphql/server/pkg/projects/project_handler.go index f4fb08c13b7..de93230702b 100644 --- a/chaoscenter/graphql/server/pkg/projects/project_handler.go +++ b/chaoscenter/graphql/server/pkg/projects/project_handler.go @@ -20,6 +20,8 @@ func ProjectInitializer(ctx context.Context, projectID string, role string, oper var bl_true = true + //self_deployer.StartDeployer(projectID, operator) + irOp := image_registry.NewImageRegistryOperator(operator) irService := image_registry2.NewImageRegistryService(irOp) _, err := irService.CreateImageRegistry(ctx, projectID, model.ImageRegistryInput{ diff --git a/chaoscenter/graphql/server/pkg/self-deployer/start.go b/chaoscenter/graphql/server/pkg/self-deployer/start.go index 2ad0f8af868..01774a838cb 100644 --- a/chaoscenter/graphql/server/pkg/self-deployer/start.go +++ b/chaoscenter/graphql/server/pkg/self-deployer/start.go @@ -49,7 +49,7 @@ func StartDeployer(projectID string, mongoOp mongodb.MongoOperator) { infraInput := model.RegisterInfraRequest{ Name: "Self-Infrastructure", - InfrastructureType: model.InfrastructureTypeInternal, + InfrastructureType: model.InfrastructureTypeKubernetes, PlatformName: "others", InfraScope: agentScope, InfraNamespace: &deployerNamespace, diff --git a/chaoscenter/web/src/api/core/experiments/getExperiment.ts b/chaoscenter/web/src/api/core/experiments/getExperiment.ts new file mode 100644 index 00000000000..758e8473a6a --- /dev/null +++ b/chaoscenter/web/src/api/core/experiments/getExperiment.ts @@ -0,0 +1,214 @@ +import { gql, useLazyQuery, useQuery } from '@apollo/client'; +import type { Experiment } from '@api/entities'; +import type { + GqlAPILazyQueryRequest, + GqlAPILazyQueryResponse, + GqlAPIQueryRequest, + GqlAPIQueryResponse +} from '../../types'; + +// Request for getExperiment Query +export interface GetExperimentRequest { + projectID: string; + experimentID: string; +} + +// Response for getExperiment Query +export interface GetExperimentResponse { + getExperiment: { + experimentDetails: Experiment; + averageResiliencyScore?: number; + }; +} + +export function getExperiment({ + // projectID + projectID, + // Params + experimentID, + // Options + options = {} +}: GqlAPIQueryRequest): GqlAPIQueryResponse< + GetExperimentResponse, + GetExperimentRequest +> { + const { data, loading, ...rest } = useQuery( + gql` + query getExperiment($projectID: ID!, $experimentID: String!) { + getExperiment(projectID: $projectID, experimentID: $experimentID) { + experimentDetails { + experimentID + cronSyntax + infra { + infraID + infraType + name + environmentID + infraNamespace + infraScope + isActive + isInfraConfirmed + } + experimentType + experimentManifest + name + description + tags + createdAt + createdBy { + username + } + updatedAt + updatedBy { + username + } + recentexperimentRunDetails { + experimentRunID + notifyID + phase + resiliencyScore + updatedAt + updatedBy { + username + } + } + eventsMetadata { + faultName + serviceIdentifier + environmentIdentifier + } + } + } + } + `, + { + variables: { + projectID, + experimentID + }, + fetchPolicy: options.fetchPolicy ?? 'cache-and-network', + ...options + } + ); + + return { + data, + loading, + exists: data ? Boolean(data.getExperiment) : undefined, + ...rest + }; +} + +export function getExperimentMinimal({ + // projectID + projectID, + // Params + experimentID, + // Options + options = {} +}: GqlAPIQueryRequest): GqlAPIQueryResponse< + GetExperimentResponse, + GetExperimentRequest +> { + const { data, loading, ...rest } = useQuery( + gql` + query getExperiment($projectID: ID!, $experimentID: String!) { + getExperiment(projectID: $projectID, experimentID: $experimentID) { + experimentDetails { + experimentID + name + description + tags + } + } + } + `, + { + variables: { + projectID, + experimentID + }, + fetchPolicy: options.fetchPolicy ?? 'cache-and-network', + ...options + } + ); + + return { + data, + loading, + exists: data ? Boolean(data.getExperiment) : undefined, + ...rest + }; +} + +export function getExperimentManifest({ + // projectID + projectID, + // Params + experimentID, + // Options + options = {} +}: GqlAPIQueryRequest): GqlAPIQueryResponse< + GetExperimentResponse, + GetExperimentRequest +> { + const { data, loading, ...rest } = useQuery( + gql` + query getExperiment($projectID: ID!, $experimentID: String!) { + getExperiment(projectID: $projectID, experimentID: $experimentID) { + experimentDetails { + experimentID + name + description + tags + experimentManifest + } + } + } + `, + { + variables: { + projectID, + experimentID + }, + fetchPolicy: options.fetchPolicy ?? 'cache-and-network', + ...options + } + ); + + return { + data, + loading, + exists: data ? Boolean(data.getExperiment) : undefined, + ...rest + }; +} + +export function getExperimentLazy({ + // Options + ...options +}: GqlAPILazyQueryRequest): GqlAPILazyQueryResponse< + GetExperimentResponse, + GetExperimentRequest +> { + const [getExperimentQuery, result] = useLazyQuery( + gql` + query getExperiment($projectID: ID!, $experimentID: String!) { + getExperiment(projectID: $projectID, experimentID: $experimentID) { + experimentDetails { + experimentID + recentExperimentRunDetails { + experimentRunID + } + } + averageResiliencyScore + } + } + `, + { + ...options + } + ); + + return [getExperimentQuery, result]; +} diff --git a/chaoscenter/web/src/api/core/experiments/getExperimentRun.ts b/chaoscenter/web/src/api/core/experiments/getExperimentRun.ts new file mode 100644 index 00000000000..b38212eb288 --- /dev/null +++ b/chaoscenter/web/src/api/core/experiments/getExperimentRun.ts @@ -0,0 +1,121 @@ +import { useQuery, gql } from '@apollo/client'; +import type { ExperimentRun } from '@api/entities'; +import type { GqlAPIQueryRequest, GqlAPIQueryResponse } from '@api/types'; + +export interface GetExperimentRunRequest { + projectID: string; + experimentRunID?: string; + notifyID?: string; +} + +export interface GetExperimentRunResponse { + getExperimentRun: ExperimentRun; +} + +export function getExperimentRun({ + // Identifiers + projectID, + // Experiment Run ID, + experimentRunID, + notifyID, + // Options + options = {} +}: GqlAPIQueryRequest): GqlAPIQueryResponse< + GetExperimentRunResponse, + GetExperimentRunRequest +> { + const { data, loading, ...rest } = useQuery( + gql` + query getExperimentRun($projectID: ID!, $experimentRunID: ID, $notifyID: ID) { + getExperimentRun(projectID: $projectID, experimentRunID: $experimentRunID, notifyID: $notifyID) { + experimentRunID + runSequence + notifyID + experimentID + updatedAt + infra { + environmentID + infraID + name + infraNamespace + infraScope + infraType + } + experimentName + experimentType + experimentManifest + phase + resiliencyScore + updatedBy { + username + } + weightages { + faultName + weightage + } + executionData + # errorResponse + } + } + `, + { + variables: { + projectID, + experimentRunID, + notifyID + }, + fetchPolicy: options.fetchPolicy ?? 'cache-and-network', + ...options + } + ); + + return { + data, + loading: loading, + exists: data ? Boolean(data.getExperimentRun) : undefined, + ...rest + }; +} + +export function getExperimentRunManifest({ + // Identifiers + projectID, + // Experiment Run ID, + experimentRunID, + notifyID, + // Options + options = {} +}: GqlAPIQueryRequest): GqlAPIQueryResponse< + GetExperimentRunResponse, + GetExperimentRunRequest +> { + const { data, loading, ...rest } = useQuery( + gql` + query getExperimentRun($projectID: ID!, $experimentRunID: String, $notifyID: String) { + getExperimentRun(projectID: $projectID, experimentRunID: $experimentRunID, notifyID: $notifyID) { + experimentID + experimentRunID + notifyID + experimentName + experimentManifest + } + } + `, + { + variables: { + projectID, + experimentRunID, + notifyID + }, + fetchPolicy: options.fetchPolicy ?? 'cache-and-network', + ...options + } + ); + + return { + data, + loading: loading, + exists: data ? Boolean(data.getExperimentRun) : undefined, + ...rest + }; +} diff --git a/chaoscenter/web/src/api/core/infrastructures/connectChaosInfra.ts b/chaoscenter/web/src/api/core/infrastructures/connectChaosInfra.ts index be78b788ee2..300f10ef503 100644 --- a/chaoscenter/web/src/api/core/infrastructures/connectChaosInfra.ts +++ b/chaoscenter/web/src/api/core/infrastructures/connectChaosInfra.ts @@ -1,7 +1,7 @@ import { gql, useMutation } from '@apollo/client'; import type { GqlAPIMutationRequest, GqlAPIMutationResponse } from '@api/types'; import type { Toleration } from '@models'; -import type { InfrastructureInstallationType } from '@api/entities'; +import type { InfrastructureType } from '@api/entities'; export interface connectChaosInfraRequest { projectID: string; @@ -18,7 +18,7 @@ export interface connectChaosInfraRequest { skipSsl?: boolean; nodeSelector?: string; tolerations?: Array; - infrastructureType?: InfrastructureInstallationType; + infrastructureType?: InfrastructureType; tags?: Array; }; } diff --git a/chaoscenter/web/src/api/core/probe/addProbe.ts b/chaoscenter/web/src/api/core/probe/addProbe.ts index 0569111ed5c..20a428b5f74 100644 --- a/chaoscenter/web/src/api/core/probe/addProbe.ts +++ b/chaoscenter/web/src/api/core/probe/addProbe.ts @@ -1,18 +1,21 @@ import { gql, useMutation } from '@apollo/client'; -import type { Identifiers, Probe, ProbeType } from '@api/entities'; +import type { InfrastructureType, Probe, ProbeType } from '@api/entities'; import type { GqlAPIMutationRequest, GqlAPIMutationResponse } from '@api/types'; export interface AddProbeRequest { - identifiers: Identifiers; + projectID: string; request: { - probeId?: string; name: string; description?: string; tags?: Array; type: ProbeType; - httpProperties?: Probe['httpProperties']; - cmdProperties?: Probe['cmdProperties']; + infrastructureType: InfrastructureType; + kubernetesHTTPProperties?: Probe['kubernetesHTTPProperties']; + // CMD + kubernetesCMDProperties?: Probe['kubernetesCMDProperties']; + // K8S k8sProperties?: Probe['k8sProperties']; + // PROM promProperties?: Probe['promProperties']; }; } @@ -21,18 +24,17 @@ export interface AddProbeResponse { addProbe: Probe; } -export function addHTTPProbe( +export function addKubernetesHTTPProbe( options?: GqlAPIMutationRequest ): GqlAPIMutationResponse { - const [addHTTPProbeMutation, result] = useMutation( + const [addKubernetesHTTPProbeMutation, result] = useMutation( gql` - mutation addHTTPProbe($request: ProbeRequest!, $identifiers: IdentifiersRequest!) { - addProbe(request: $request, identifiers: $identifiers) { - probeId + mutation addKubernetesHTTPProbe($projectID: ID!, $request: ProbeRequest!) { + addProbe(projectID: $projectID, request: $request) { name description type - httpProperties { + kubernetesHTTPProperties { probeTimeout interval url @@ -44,21 +46,20 @@ export function addHTTPProbe( options ); - return [addHTTPProbeMutation, result]; + return [addKubernetesHTTPProbeMutation, result]; } -export function addCMDProbe( +export function addKubernetesCMDProbe( options?: GqlAPIMutationRequest ): GqlAPIMutationResponse { - const [addCMDProbeMutation, result] = useMutation( + const [addKubernetesCMDProbeMutation, result] = useMutation( gql` - mutation addCMDProbe($request: ProbeRequest!, $identifiers: IdentifiersRequest!) { - addProbe(request: $request, identifiers: $identifiers) { - probeId + mutation addKubernetesCMDProbe($projectID: ID!, $request: ProbeRequest!) { + addProbe(projectID: $projectID, request: $request) { name description type - cmdProperties { + kubernetesCMDProperties { probeTimeout interval command @@ -73,7 +74,7 @@ export function addCMDProbe( options ); - return [addCMDProbeMutation, result]; + return [addKubernetesCMDProbeMutation, result]; } export function addPROMProbe( @@ -81,9 +82,8 @@ export function addPROMProbe( ): GqlAPIMutationResponse { const [addPROMProbeMutation, result] = useMutation( gql` - mutation addPROMProbe($request: ProbeRequest!, $identifiers: IdentifiersRequest!) { - addProbe(request: $request, identifiers: $identifiers) { - probeId + mutation addPROMProbe($projectID: ID!, $request: ProbeRequest!) { + addProbe(projectID: $projectID, request: $request) { name description type @@ -110,9 +110,8 @@ export function addK8SProbe( ): GqlAPIMutationResponse { const [addK8SProbeMutation, result] = useMutation( gql` - mutation addK8SProbe($request: ProbeRequest!, $identifiers: IdentifiersRequest!) { - addProbe(request: $request, identifiers: $identifiers) { - probeId + mutation addK8SProbe($projectID: ID!, $request: ProbeRequest!) { + addProbe(projectID: $projectID, request: $request) { name description type diff --git a/chaoscenter/web/src/api/core/probe/deleteProbe.ts b/chaoscenter/web/src/api/core/probe/deleteProbe.ts index cd5b0bcc67d..20923aa3b4b 100644 --- a/chaoscenter/web/src/api/core/probe/deleteProbe.ts +++ b/chaoscenter/web/src/api/core/probe/deleteProbe.ts @@ -1,10 +1,9 @@ import { gql, useMutation } from '@apollo/client'; -import type { Identifiers } from '@api/entities'; import type { GqlAPIMutationRequest, GqlAPIMutationResponse } from '@api/types'; export interface DeleteProbeRequest { - identifiers: Identifiers; - probeID: string; + projectID: string; + probeName: string; } export interface DeleteProbeResponse { @@ -16,8 +15,8 @@ export function deleteProbe( ): GqlAPIMutationResponse { const [deleteProbeMutation, result] = useMutation( gql` - mutation deleteChaosHub($probeID: ID!, $identifiers: IdentifiersRequest!) { - deleteProbe(probeID: $probeID, identifiers: $identifiers) + mutation deleteProbe($probeName: ID!, $projectID: ID!) { + deleteProbe(probeName: $probeName, projectID: $projectID) } `, options diff --git a/chaoscenter/web/src/api/core/probe/getProbe.ts b/chaoscenter/web/src/api/core/probe/getProbe.ts index 021599b78fc..a2301efec87 100644 --- a/chaoscenter/web/src/api/core/probe/getProbe.ts +++ b/chaoscenter/web/src/api/core/probe/getProbe.ts @@ -1,10 +1,15 @@ import { gql, useQuery, useLazyQuery } from '@apollo/client'; -import type { GqlAPIQueryResponse, GqlAPIQueryRequest, GqlAPILazyQueryResponse } from '@api/types'; -import type { Identifiers, Probe } from '@api/entities'; +import type { + GqlAPIQueryResponse, + GqlAPIQueryRequest, + GqlAPILazyQueryResponse, + GqlAPILazyQueryRequest +} from '@api/types'; +import type { Probe } from '@api/entities'; export interface GetProbeRequest { - identifiers: Identifiers; - probeID: string; + projectID: string; + probeName: string; } export interface GetProbeResponse { @@ -15,21 +20,18 @@ export function getProbe({ // Identifiers projectID, // Params - probeID, + probeName, // Options options = {} -}: GqlAPIQueryRequest>): GqlAPIQueryResponse< - GetProbeResponse, - GetProbeRequest -> { +}: GqlAPIQueryRequest): GqlAPIQueryResponse { const { data, loading, ...rest } = useQuery( gql` - query getProbe($probeID: ID!, $identifiers: IdentifiersRequest!) { - getProbe(probeID: $probeID, identifiers: $identifiers) { - probeId + query getProbe($probeName: ID!, $projectID: ID!) { + getProbe(probeName: $probeName, projectID: $projectID) { name description type + infrastructureType createdAt updatedAt } @@ -37,10 +39,8 @@ export function getProbe({ `, { variables: { - identifiers: { - projectID - }, - probeID + projectID, + probeName }, fetchPolicy: options.fetchPolicy ?? 'cache-and-network', ...options @@ -54,29 +54,134 @@ export function getProbe({ }; } -export function getHTTPProbeProperties({ +export function getLazyProbe({ + ...options +}: GqlAPILazyQueryRequest): GqlAPILazyQueryResponse< + GetProbeResponse, + GetProbeRequest +> { + // Query to get probe YAML + const [getLazyProbeQuery, result] = useLazyQuery( + gql` + query getProbe($probeName: ID!, $projectID: ID!) { + getProbe(probeName: $probeName, projectID: $projectID) { + name + description + type + tags + type + infrastructureType + kubernetesHTTPProperties { + probeTimeout + interval + retry + attempt + evaluationTimeout + probePollingInterval + initialDelay + stopOnFailure + url + method { + get { + criteria + responseCode + } + post { + contentType + body + bodyPath + criteria + responseCode + } + } + insecureSkipVerify + } + + promProperties { + probeTimeout + interval + retry + attempt + evaluationTimeout + probePollingInterval + initialDelay + stopOnFailure + endpoint + query + queryPath + comparator { + type + value + criteria + } + } + k8sProperties { + probeTimeout + interval + retry + attempt + evaluationTimeout + probePollingInterval + initialDelay + stopOnFailure + group + version + resource + namespace + fieldSelector + labelSelector + operation + } + kubernetesCMDProperties { + probeTimeout + interval + retry + attempt + evaluationTimeout + probePollingInterval + initialDelay + stopOnFailure + command + comparator { + type + value + criteria + } + source + } + } + } + `, + { + ...options + } + ); + + return [getLazyProbeQuery, result]; +} + +export function getKubernetesHTTPProbeProperties({ // Identifiers projectID, // Params - probeID, + probeName, // Options options = {} -}: GqlAPIQueryRequest< - GetProbeResponse, - GetProbeRequest, - Omit ->): GqlAPILazyQueryResponse { - const [getHTTPProbePropertiesQuery, result] = useLazyQuery( +}: GqlAPIQueryRequest): GqlAPILazyQueryResponse { + const [getKubernetesHTTPProbePropertiesQuery, result] = useLazyQuery( gql` - query getProbe($probeID: ID!, $identifiers: IdentifiersRequest!) { - getProbe(probeID: $probeID, identifiers: $identifiers) { + query getProbe($probeName: ID!, $projectID: ID!) { + getProbe(probeName: $probeName, projectID: $projectID) { type - httpProperties { + infrastructureType + kubernetesHTTPProperties { probeTimeout interval retry + attempt + evaluationTimeout probePollingInterval - initialDelaySeconds + initialDelay stopOnFailure url method { @@ -92,7 +197,6 @@ export function getHTTPProbeProperties({ responseCode } } - responseTimeout insecureSkipVerify } } @@ -100,42 +204,39 @@ export function getHTTPProbeProperties({ `, { variables: { - identifiers: { - projectID - }, - probeID + projectID, + probeName }, fetchPolicy: options.fetchPolicy ?? 'cache-and-network', ...options } ); - return [getHTTPProbePropertiesQuery, result]; + return [getKubernetesHTTPProbePropertiesQuery, result]; } export function getPROMProbeProperties({ // Identifiers projectID, // Params - probeID, + probeName, // Options options = {} -}: GqlAPIQueryRequest< - GetProbeResponse, - GetProbeRequest, - Omit ->): GqlAPILazyQueryResponse { +}: GqlAPIQueryRequest): GqlAPILazyQueryResponse { const [getPROMProbePropertiesQuery, result] = useLazyQuery( gql` - query getProbe($probeID: ID!, $identifiers: IdentifiersRequest!) { - getProbe(probeID: $probeID, identifiers: $identifiers) { + query getProbe($probeName: ID!, $projectID: ID!) { + getProbe(probeName: $probeName, projectID: $projectID) { type + infrastructureType promProperties { probeTimeout interval retry + attempt + evaluationTimeout probePollingInterval - initialDelaySeconds + initialDelay stopOnFailure endpoint query @@ -151,10 +252,8 @@ export function getPROMProbeProperties({ `, { variables: { - identifiers: { - projectID - }, - probeID + projectID, + probeName }, fetchPolicy: options.fetchPolicy ?? 'cache-and-network', ...options @@ -168,25 +267,24 @@ export function getK8SProbeProperties({ // Identifiers projectID, // Params - probeID, + probeName, // Options options = {} -}: GqlAPIQueryRequest< - GetProbeResponse, - GetProbeRequest, - Omit ->): GqlAPILazyQueryResponse { +}: GqlAPIQueryRequest): GqlAPILazyQueryResponse { const [getK8SProbePropertiesQuery, result] = useLazyQuery( gql` - query getProbe($probeID: ID!, $identifiers: IdentifiersRequest!) { - getProbe(probeID: $probeID, identifiers: $identifiers) { + query getProbe($probeName: ID!, $projectID: ID!) { + getProbe(probeName: $probeName, projectID: $projectID) { type + infrastructureType k8sProperties { probeTimeout interval retry + attempt + evaluationTimeout probePollingInterval - initialDelaySeconds + initialDelay stopOnFailure group version @@ -195,17 +293,14 @@ export function getK8SProbeProperties({ fieldSelector labelSelector operation - data } } } `, { variables: { - identifiers: { - projectID - }, - probeID + projectID, + probeName }, fetchPolicy: options.fetchPolicy ?? 'cache-and-network', ...options @@ -215,29 +310,28 @@ export function getK8SProbeProperties({ return [getK8SProbePropertiesQuery, result]; } -export function getCMDProbeProperties({ +export function getKubernetesCMDProbeProperties({ // Identifiers projectID, // Params - probeID, + probeName, // Options options = {} -}: GqlAPIQueryRequest< - GetProbeResponse, - GetProbeRequest, - Omit ->): GqlAPILazyQueryResponse { - const [getCMDProbePropertiesQuery, result] = useLazyQuery( +}: GqlAPIQueryRequest): GqlAPILazyQueryResponse { + const [getKubernetesCMDProbePropertiesQuery, result] = useLazyQuery( gql` - query getProbe($probeID: ID!, $identifiers: IdentifiersRequest!) { - getProbe(probeID: $probeID, identifiers: $identifiers) { + query getProbe($probeName: ID!, $projectID: ID!) { + getProbe(probeName: $probeName, projectID: $projectID) { type - cmdProperties { + infrastructureType + kubernetesCMDProperties { probeTimeout interval + attempt + evaluationTimeout retry probePollingInterval - initialDelaySeconds + initialDelay stopOnFailure command comparator { @@ -245,98 +339,51 @@ export function getCMDProbeProperties({ value criteria } - source { - image - hostNetwork - inheritInputs - args - envList { - name - value - valueFrom { - fieldRef { - apiVersion - fieldPath - } - resourceFieldRef { - containerName - resource - divisor - } - configMapKeyRef { - name { - name - } - key - optional - } - secretKeyRef { - name { - name - } - key - optional - } - } - } - labels - command - imagePullPolicy - privileged - nodeSelector - # volumes - # volumesMount - imagePullSecrets { - name - } - } + source } } } `, { variables: { - identifiers: { - projectID - }, - probeID + projectID, + probeName }, fetchPolicy: options.fetchPolicy ?? 'cache-and-network', ...options } ); - return [getCMDProbePropertiesQuery, result]; + return [getKubernetesCMDProbePropertiesQuery, result]; } export function getProbeAllProperties({ // Identifiers projectID, // Params - probeID, + probeName, // Options options = {} -}: GqlAPIQueryRequest>): GqlAPIQueryResponse< - GetProbeResponse, - GetProbeRequest -> { +}: GqlAPIQueryRequest): GqlAPIQueryResponse { // Query to list probes const { data, loading, ...rest } = useQuery( gql` - query getProbe($probeID: ID!, $identifiers: IdentifiersRequest!) { - getProbe(probeID: $probeID, identifiers: $identifiers) { + query getProbe($probeName: ID!, $projectID: ID!) { + getProbe(probeName: $probeName, projectID: $projectID) { name description type tags type - probeId - httpProperties { + infrastructureType + kubernetesHTTPProperties { probeTimeout interval retry + attempt + evaluationTimeout probePollingInterval - initialDelaySeconds + initialDelay stopOnFailure url method { @@ -352,15 +399,17 @@ export function getProbeAllProperties({ responseCode } } - responseTimeout insecureSkipVerify } + promProperties { probeTimeout interval retry + attempt + evaluationTimeout probePollingInterval - initialDelaySeconds + initialDelay stopOnFailure endpoint query @@ -371,12 +420,15 @@ export function getProbeAllProperties({ criteria } } + k8sProperties { probeTimeout interval retry + attempt + evaluationTimeout probePollingInterval - initialDelaySeconds + initialDelay stopOnFailure group version @@ -385,14 +437,15 @@ export function getProbeAllProperties({ fieldSelector labelSelector operation - data } - cmdProperties { + kubernetesCMDProperties { probeTimeout interval retry + attempt + evaluationTimeout probePollingInterval - initialDelaySeconds + initialDelay stopOnFailure command comparator { @@ -400,61 +453,15 @@ export function getProbeAllProperties({ value criteria } - source { - image - hostNetwork - inheritInputs - args - envList { - name - value - valueFrom { - fieldRef { - apiVersion - fieldPath - } - resourceFieldRef { - containerName - resource - divisor - } - configMapKeyRef { - name { - name - } - key - optional - } - secretKeyRef { - name { - name - } - key - optional - } - } - } - labels - command - imagePullPolicy - privileged - nodeSelector - # volumes - # volumesMount - imagePullSecrets { - name - } - } + source } } } `, { variables: { - identifiers: { - projectID - }, - probeID + projectID, + probeName }, fetchPolicy: options.fetchPolicy ?? 'cache-and-network', ...options diff --git a/chaoscenter/web/src/api/core/probe/getProbeReference.ts b/chaoscenter/web/src/api/core/probe/getProbeReference.ts new file mode 100644 index 00000000000..1b2a163b818 --- /dev/null +++ b/chaoscenter/web/src/api/core/probe/getProbeReference.ts @@ -0,0 +1,68 @@ +import { gql, useQuery } from '@apollo/client'; +import type { GqlAPIQueryResponse, GqlAPIQueryRequest } from '@api/types'; +import type { ProbeReference } from '@api/entities'; + +export interface GetProbeReferenceRequest { + projectID: string; + probeName: string; +} + +export interface GetProbeReferenceResponse { + getProbeReference: ProbeReference; +} + +export function getProbeReference({ + // Identifiers + projectID, + // Params + probeName, + // Options + options = {} +}: GqlAPIQueryRequest): GqlAPIQueryResponse< + GetProbeReferenceResponse, + GetProbeReferenceRequest +> { + // Query to List workflows + const { data, loading, ...rest } = useQuery( + gql` + query GetProbeReference($probeName: ID!, $projectID: ID!) { + getProbeReference(probeName: $probeName, projectID: $projectID) { + name + totalRuns + recentExecutions { + faultName + mode + executionHistory { + executedByExperiment { + experimentID + experimentName + updatedAt + updatedBy { + username + email + } + } + status { + verdict + } + } + } + } + } + `, + { + variables: { + projectID, + probeName + }, + fetchPolicy: options.fetchPolicy ?? 'cache-and-network', + ...options + } + ); + + return { + data, + loading: loading, + ...rest + }; +} diff --git a/chaoscenter/web/src/api/core/probe/getProbeYAML.ts b/chaoscenter/web/src/api/core/probe/getProbeYAML.ts index 0da2ac4a6a0..91712687366 100644 --- a/chaoscenter/web/src/api/core/probe/getProbeYAML.ts +++ b/chaoscenter/web/src/api/core/probe/getProbeYAML.ts @@ -1,9 +1,9 @@ import { gql, useLazyQuery } from '@apollo/client'; -import type { Identifiers, Mode } from '@api/entities'; +import type { Mode } from '@api/entities'; import type { GqlAPIQueryRequest, GqlAPILazyQueryResponse } from '@api/types'; export interface GetProbeYAMLRequest { - identifiers: Identifiers; + projectID: string; request: { probeID: string; mode: Mode; @@ -30,15 +30,13 @@ export function getProbeYAML({ // Query to get probe YAML const [getProbeYAMLQuery, result] = useLazyQuery( gql` - query getProbeYAML($request: GetProbeYAMLRequest!, $identifiers: IdentifiersRequest!) { - getProbeYAML(request: $request, identifiers: $identifiers) + query getProbeYAML($request: GetProbeYAMLRequest!, $projectID: ID!) { + getProbeYAML(request: $request, projectID: $projectID) } `, { variables: { - identifiers: { - projectID - }, + projectID, request: { probeID, mode diff --git a/chaoscenter/web/src/api/core/probe/getProbesInExperimentRun.ts b/chaoscenter/web/src/api/core/probe/getProbesInExperimentRun.ts new file mode 100644 index 00000000000..d95c00fef24 --- /dev/null +++ b/chaoscenter/web/src/api/core/probe/getProbesInExperimentRun.ts @@ -0,0 +1,132 @@ +import { gql, useLazyQuery } from '@apollo/client'; +import type { GqlAPILazyQueryRequest, GqlAPILazyQueryResponse } from '@api/types'; +import type { Mode, Probe, Status } from '@api/entities'; + +export interface GetProbesInExperimentRunRequest { + projectID: string; + experimentRunID: string; + faultName: string; +} + +export interface ProbeInRuns { + probe: Probe; + mode: Mode; + status: Status; +} + +export interface GetProbesInExperimentRunResponse { + getProbesInExperimentRun: ProbeInRuns[]; +} + +export function getProbesInExperimentRun({ + ...options +}: GqlAPILazyQueryRequest): GqlAPILazyQueryResponse< + GetProbesInExperimentRunResponse, + GetProbesInExperimentRunRequest +> { + // Query to List workflows + const [getProbesInExperimentRunQuery, result] = useLazyQuery< + GetProbesInExperimentRunResponse, + GetProbesInExperimentRunRequest + >( + gql` + query GetProbesInExperimentRun($projectID: ID!, $experimentRunID: String!, $faultName: String!) { + getProbesInExperimentRun(projectID: $projectID, experimentRunID: $experimentRunID, faultName: $faultName) { + probe { + name + type + infrastructureType + kubernetesHTTPProperties { + probeTimeout + interval + retry + probePollingInterval + initialDelay + stopOnFailure + url + method { + get { + criteria + responseCode + } + post { + contentType + body + bodyPath + criteria + responseCode + } + } + insecureSkipVerify + attempt + evaluationTimeout + } + promProperties { + probeTimeout + interval + retry + probePollingInterval + initialDelay + stopOnFailure + endpoint + query + queryPath + comparator { + type + value + criteria + } + attempt + evaluationTimeout + } + k8sProperties { + probeTimeout + interval + retry + probePollingInterval + initialDelay + stopOnFailure + group + version + resource + namespace + fieldSelector + labelSelector + operation + attempt + evaluationTimeout + } + kubernetesCMDProperties { + probeTimeout + interval + retry + attempt + probePollingInterval + initialDelay + stopOnFailure + command + comparator { + type + value + criteria + } + source + evaluationTimeout + } + } + mode + status { + verdict + description + } + } + } + `, + { + fetchPolicy: options.fetchPolicy ?? 'cache-and-network', + ...options + } + ); + + return [getProbesInExperimentRunQuery, result]; +} diff --git a/chaoscenter/web/src/api/core/probe/index.ts b/chaoscenter/web/src/api/core/probe/index.ts index a7450707628..109acf6c63f 100644 --- a/chaoscenter/web/src/api/core/probe/index.ts +++ b/chaoscenter/web/src/api/core/probe/index.ts @@ -4,3 +4,6 @@ export * from './listProbe'; export * from './deleteProbe'; export * from './addProbe'; export * from './updateProbe'; +export * from './getProbeReference'; +export * from './getProbesInExperimentRun'; +export * from './validateUniqueProbe'; diff --git a/chaoscenter/web/src/api/core/probe/listProbe.ts b/chaoscenter/web/src/api/core/probe/listProbe.ts index 125a12e98d5..4015a3b6489 100644 --- a/chaoscenter/web/src/api/core/probe/listProbe.ts +++ b/chaoscenter/web/src/api/core/probe/listProbe.ts @@ -1,10 +1,17 @@ -import { gql, useQuery } from '@apollo/client'; -import type { Identifiers, Probe } from '@api/entities'; -import type { GqlAPIQueryResponse, GqlAPIQueryRequest } from '@api/types'; +import { gql, useQuery, useLazyQuery } from '@apollo/client'; +import type { InfrastructureType, Probe, ProbeFilterRequest } from '@api/entities'; +import type { + GqlAPIQueryResponse, + GqlAPIQueryRequest, + GqlAPILazyQueryResponse, + GqlAPILazyQueryRequest +} from '@api/types'; export interface ListProbeRequest { - identifiers: Identifiers; - probeIDs?: Array; + projectID: string; + probeNames?: Array; + infrastructureType?: InfrastructureType; + filter?: ProbeFilterRequest; } export interface ListProbeResponse { @@ -14,29 +21,37 @@ export interface ListProbeResponse { export function listProbes({ // Identifiers projectID, - // Params - probeIDs, + probeNames, + infrastructureType, + filter, // Options options = {} -}: GqlAPIQueryRequest>): GqlAPIQueryResponse< - ListProbeResponse, - ListProbeRequest -> { +}: GqlAPIQueryRequest): GqlAPIQueryResponse { // Query to List Probes const { data, loading, ...rest } = useQuery( gql` - query listProbes($probeIDs: [ID!], $identifiers: IdentifiersRequest!) { - listProbes(probeIDs: $probeIDs, identifiers: $identifiers) { - probeId + query listProbes( + $probeNames: [ID!] + $infrastructureType: InfrastructureType + $projectID: ID! + $filter: ProbeFilterInput + ) { + listProbes( + probeNames: $probeNames + infrastructureType: $infrastructureType + projectID: $projectID + filter: $filter + ) { name description type - httpProperties { + infrastructureType + kubernetesHTTPProperties { probeTimeout interval url } - cmdProperties { + kubernetesCMDProperties { probeTimeout interval command @@ -45,6 +60,22 @@ export function listProbes({ probeTimeout interval } + recentExecutions { + faultName + status { + verdict + } + executedByExperiment { + experimentName + experimentID + updatedAt + updatedBy { + username + email + } + } + } + referencedBy updatedAt updatedBy { username @@ -55,10 +86,48 @@ export function listProbes({ `, { variables: { - identifiers: { - projectID - }, - probeIDs + projectID, + probeNames, + infrastructureType, + filter + }, + fetchPolicy: options.fetchPolicy ?? 'cache-and-network', + ...options + } + ); + return { + data, + loading: loading, + ...rest + }; +} + +export function minimalListProbes({ + // Identifiers + projectID, + // Params + probeNames, + infrastructureType, + filter, + // Options + options = {} +}: GqlAPIQueryRequest): GqlAPIQueryResponse { + // Query to List Probes + const { data, loading, ...rest } = useQuery( + gql` + query listProbes($probeNames: [ID!], $infrastructureType: InfrastructureType, $projectID: ID!) { + listProbes(probeNames: $probeNames, infrastructureType: $infrastructureType, projectID: $projectID) { + name + type + } + } + `, + { + variables: { + projectID, + probeNames, + infrastructureType, + filter }, fetchPolicy: options.fetchPolicy ?? 'cache-and-network', ...options @@ -71,3 +140,110 @@ export function listProbes({ ...rest }; } + +export function listLazyProbes({ + ...options +}: GqlAPILazyQueryRequest): GqlAPILazyQueryResponse< + ListProbeResponse, + ListProbeRequest +> { + // Query to List Probes + const [listLazyProbeQuery, result] = useLazyQuery( + gql` + query listProbes($probeNames: [ID!], $projectID: ID!, $filter: ProbeFilterInput) { + listProbes(probeNames: $probeNames, projectID: $projectID, filter: $filter) { + name + description + type + tags + type + updatedBy { + username + email + } + kubernetesHTTPProperties { + probeTimeout + interval + retry + attempt + evaluationTimeout + probePollingInterval + initialDelay + stopOnFailure + url + method { + get { + criteria + responseCode + } + post { + contentType + body + bodyPath + criteria + responseCode + } + } + insecureSkipVerify + } + promProperties { + probeTimeout + interval + retry + attempt + evaluationTimeout + probePollingInterval + initialDelay + stopOnFailure + endpoint + query + queryPath + comparator { + type + value + criteria + } + } + k8sProperties { + probeTimeout + interval + retry + attempt + evaluationTimeout + probePollingInterval + initialDelay + stopOnFailure + group + version + resource + namespace + fieldSelector + labelSelector + operation + } + kubernetesCMDProperties { + probeTimeout + interval + retry + attempt + evaluationTimeout + probePollingInterval + initialDelay + stopOnFailure + command + comparator { + type + value + criteria + } + } + } + } + `, + { + ...options + } + ); + + return [listLazyProbeQuery, result]; +} diff --git a/chaoscenter/web/src/api/core/probe/updateProbe.ts b/chaoscenter/web/src/api/core/probe/updateProbe.ts index a083dbc91c4..8e4a48c8507 100644 --- a/chaoscenter/web/src/api/core/probe/updateProbe.ts +++ b/chaoscenter/web/src/api/core/probe/updateProbe.ts @@ -1,18 +1,22 @@ import { gql, useMutation } from '@apollo/client'; -import type { Identifiers, Probe, ProbeType } from '@api/entities'; +import type { InfrastructureType, Probe, ProbeType } from '@api/entities'; import type { GqlAPIMutationRequest, GqlAPIMutationResponse } from '@api/types'; export interface UpdateProbeRequest { - identifiers: Identifiers; + projectID: string; request: { - probeId: string; name: string; description?: string; tags?: Array; type: ProbeType; - httpProperties?: Probe['httpProperties']; - cmdProperties?: Probe['cmdProperties']; + infrastructureType?: InfrastructureType; + // HTTP + kubernetesHTTPProperties?: Probe['kubernetesHTTPProperties']; + // CMD + kubernetesCMDProperties?: Probe['kubernetesCMDProperties']; + // K8S k8sProperties?: Probe['k8sProperties']; + // PROM promProperties?: Probe['promProperties']; }; } @@ -26,8 +30,8 @@ export function updateProbe( ): GqlAPIMutationResponse { const [updateProbeMutation, result] = useMutation( gql` - mutation updateProbe($request: ProbeRequest!, $identifiers: IdentifiersRequest!) { - updateProbe(request: $request, identifiers: $identifiers) + mutation updateProbe($request: ProbeRequest!, $projectID: ID!) { + updateProbe(request: $request, projectID: $projectID) } `, options diff --git a/chaoscenter/web/src/api/core/probe/validateUniqueProbe.ts b/chaoscenter/web/src/api/core/probe/validateUniqueProbe.ts new file mode 100644 index 00000000000..252e3e992dc --- /dev/null +++ b/chaoscenter/web/src/api/core/probe/validateUniqueProbe.ts @@ -0,0 +1,32 @@ +import { gql, useLazyQuery } from '@apollo/client'; +import type { GqlAPILazyQueryResponse, GqlAPILazyQueryRequest } from '@api/types'; + +export interface ValidateUniqueProbeRequest { + projectID: string; + probeName: string; +} + +export interface ValidateUniqueProbeResponse { + validateUniqueProbe: boolean; +} + +export function validateUniqueProbe({ + ...options +}: GqlAPILazyQueryRequest): GqlAPILazyQueryResponse< + ValidateUniqueProbeResponse, + ValidateUniqueProbeRequest +> { + const [validateUniqueProbeQuery, result] = useLazyQuery( + gql` + query IsProbeUnique($projectID: ID!, $probeName: ID!) { + validateUniqueProbe(projectID: $projectID, probeName: $probeName) + } + `, + { + fetchPolicy: options.fetchPolicy ?? 'cache-and-network', + ...options + } + ); + + return [validateUniqueProbeQuery, result]; +} diff --git a/chaoscenter/web/src/api/entities/common.ts b/chaoscenter/web/src/api/entities/common.ts index 3aab5194a4c..98817eff325 100644 --- a/chaoscenter/web/src/api/entities/common.ts +++ b/chaoscenter/web/src/api/entities/common.ts @@ -126,6 +126,7 @@ export enum FaultProbeStatus { PASSED = 'Passed', FAILED = 'Failed', AWAITED = 'Awaited', + NA = 'NA', 'N/A' = 'N/A' } diff --git a/chaoscenter/web/src/api/entities/probe.ts b/chaoscenter/web/src/api/entities/probe.ts index 34a4a0d3630..09e1f4584b9 100644 --- a/chaoscenter/web/src/api/entities/probe.ts +++ b/chaoscenter/web/src/api/entities/probe.ts @@ -1,30 +1,112 @@ -import type { CmdProbeInputs, HTTPProbeInputs, K8sProbeInputs, PromProbeInputs, RunProperty } from '@models'; -import type { Identifiers, Audit } from '.'; +import type { + HTTPProbeInputs, + K8sProbeInputs, + NewCmdProbeInputs, + ProbeVerdict, + PromProbeInputs, + RunProperty +} from '@models'; +import type { Identifiers, Audit, DateRange } from './common'; +import type { InfrastructureType, UserDetails } from '.'; export enum ProbeType { - HTTP = 'HTTP', - PROM = 'PROM', - K8S = 'K8S', - CMD = 'CMD' + HTTP = 'httpProbe', + PROM = 'promProbe', + K8S = 'k8sProbe', + CMD = 'cmdProbe' +} + +export enum ProbeStatus { + Running = 'Running', + Completed = 'Completed', + Stopped = 'Stopped', + Error = 'Error', + Queued = 'Queued', + NA = 'NA' } export enum Mode { - SoT = 'SoT', - EoT = 'EoT', + SoT = 'SOT', + EoT = 'EOT', Edge = 'Edge', Continuous = 'Continuous', OnChaos = 'OnChaos' } export interface Probe extends Audit { - identifiers: Identifiers; - probeId: string; + projectID: string; name: string; - description: string; - tags: Array; + description?: string; + tags?: Array; type: ProbeType; - httpProperties: HTTPProbeInputs & RunProperty; - cmdProperties: CmdProbeInputs & RunProperty; - k8sProperties: K8sProbeInputs & RunProperty; - promProperties: PromProbeInputs & RunProperty; + recentExecutions?: ProbeRecentExecutions[]; + referencedBy?: number; + infrastructureType: InfrastructureType; + // HTTP Probe + kubernetesHTTPProperties?: HTTPProbeInputs & RunProperty; + // CMD Probe + kubernetesCMDProperties?: NewCmdProbeInputs & RunProperty; + // K8s Probe + k8sProperties?: K8sProbeInputs & RunProperty; + // Prometheus Probe + promProperties?: PromProbeInputs & RunProperty; +} + +export interface ProbeRecentExecutions { + faultName: string; + status: Status; + executedByExperiment: ExecutedByExperiment; +} + +export interface RecentProbeRun { + executedByExperiment: ExecutedByExperiment; + status: Status; +} + +interface ExecutedByExperiment { + experimentID: string; + experimentName: string; + updatedBy: UserDetails; + updatedAt: number; +} + +export interface ExecutionHistory { + faultName: string; + status: Status; + executedByExperiment: ExecutedByExperiment; + mode: Mode; +} + +interface RecentExecutions { + faultName: string; + mode: Mode; + executionHistory: ExecutionHistory[]; +} + +export interface ProbeReference { + identifiers: Identifiers; + name: string; + totalRuns: number; + recentExecutions: RecentExecutions[]; +} + +export interface ProbeInput { + faultName: string; + probeNames: string[]; +} + +export interface Status { + verdict?: ProbeVerdict; + description?: string; +} + +export interface ProbeObj { + name: string; + mode: Mode; +} + +export interface ProbeFilterRequest { + name: string | undefined; + dateRange: DateRange | undefined; + type: ProbeType[] | undefined; } diff --git a/chaoscenter/web/src/api/entities/workflowRun.ts b/chaoscenter/web/src/api/entities/workflowRun.ts index 16af9a1a715..046dd0803a6 100644 --- a/chaoscenter/web/src/api/entities/workflowRun.ts +++ b/chaoscenter/web/src/api/entities/workflowRun.ts @@ -66,6 +66,7 @@ export interface ExperimentRun extends Audit { experimentType: ExperimentType; phase: ExperimentRunStatus; resiliencyScore?: number; + runSequence?: number; faultsPassed?: number; faultsFailed?: number; faultsAwaited?: number; diff --git a/chaoscenter/web/src/components/DefaultLayout/DefaultLayout.tsx b/chaoscenter/web/src/components/DefaultLayout/DefaultLayout.tsx index 45f6bd9649e..53e6ad45a47 100644 --- a/chaoscenter/web/src/components/DefaultLayout/DefaultLayout.tsx +++ b/chaoscenter/web/src/components/DefaultLayout/DefaultLayout.tsx @@ -39,54 +39,47 @@ export default function DefaultLayoutTemplate({ }: React.PropsWithChildren): React.ReactElement { const breadCrumb = ; return ( - - - - - {!hideSideNav && } - - - - - - {title ?? } - - - {subTitle && ( - - {subTitle} - - )} - - } - /> - - {subHeader && {subHeader}} - - - {children} - - + + + + {!hideSideNav && } + + + + + + {title ?? } + + + {subTitle && ( + + {subTitle} + + )} + + } + /> + + {subHeader && {subHeader}} + + + {children} + - - {rightSideBar && {rightSideBar}} + + {rightSideBar && {rightSideBar}} ); } diff --git a/chaoscenter/web/src/components/Drawer/Drawer.module.scss b/chaoscenter/web/src/components/Drawer/Drawer.module.scss index 497908d953b..d0dfbe80ac2 100644 --- a/chaoscenter/web/src/components/Drawer/Drawer.module.scss +++ b/chaoscenter/web/src/components/Drawer/Drawer.module.scss @@ -131,7 +131,7 @@ $top-offset: 110px; } .rightPanel { - width: 280px; + width: 400px; overflow: auto; margin-top: -57px !important; font-style: normal; diff --git a/chaoscenter/web/src/components/Drawer/Drawer.tsx b/chaoscenter/web/src/components/Drawer/Drawer.tsx index ec94183a814..13660e0a314 100644 --- a/chaoscenter/web/src/components/Drawer/Drawer.tsx +++ b/chaoscenter/web/src/components/Drawer/Drawer.tsx @@ -8,12 +8,16 @@ export enum DrawerTypes { ChaosHub = 'ChaosHub', TuneFault = 'TuneFault', AdvacedOptions = 'AdvacedOptions', - ViewManifest = 'ViewManifest' + AddProbe = 'AddProbe', + ViewManifest = 'ViewManifest', + SelectMode = 'SelectMode' } export const DrawerSizes: Record = { [DrawerTypes.ChaosHub]: 1200, [DrawerTypes.TuneFault]: 760, + [DrawerTypes.AddProbe]: 760, + [DrawerTypes.SelectMode]: 760, [DrawerTypes.AdvacedOptions]: 580, [DrawerTypes.ViewManifest]: 580 }; @@ -21,6 +25,8 @@ export const DrawerSizes: Record = { export const DrawerSizesWithHelpPanel: Record = { [DrawerTypes.ChaosHub]: 1200 + 400, [DrawerTypes.TuneFault]: 760 + 400, + [DrawerTypes.AddProbe]: 760 + 400, + [DrawerTypes.SelectMode]: 760 + 400, [DrawerTypes.AdvacedOptions]: 580 + 400, [DrawerTypes.ViewManifest]: 580 + 400 }; diff --git a/chaoscenter/web/src/components/NameIdDescriptionTags/NameIdDescriptionTags.tsx b/chaoscenter/web/src/components/NameIdDescriptionTags/NameIdDescriptionTags.tsx index b09bcea6bb4..2fef313b356 100644 --- a/chaoscenter/web/src/components/NameIdDescriptionTags/NameIdDescriptionTags.tsx +++ b/chaoscenter/web/src/components/NameIdDescriptionTags/NameIdDescriptionTags.tsx @@ -38,6 +38,11 @@ export interface NameDescriptionTagsProps { tagsProps?: Partial & { isOption?: boolean; }; + disabledFields?: { + name?: boolean; + description?: boolean; + tags?: boolean; + }; // eslint-disable-next-line @typescript-eslint/no-explicit-any formikProps: FormikProps; className?: string; @@ -48,6 +53,7 @@ export interface NameDescriptionTagsProps { interface NameProps { nameLabel?: string; // Strong default preference for "Name" vs. Contextual Name (e.g. "Service Name") unless approved otherwise namePlaceholder?: string; + isDisabled?: boolean; inputGroupProps?: IInputGroupProps; dataTooltipId?: string; placeholder?: string; @@ -64,13 +70,13 @@ interface NameIdProps { export const Name = (props: NameProps): JSX.Element => { const { getString } = useStrings(); - const { nameLabel = getString('name'), inputGroupProps = {} } = props; + const { nameLabel = getString('name'), inputGroupProps = {}, isDisabled } = props; const newInputGroupProps = { placeholder: props.namePlaceholder || getString('nameIdDescriptionTags.namePlaceholder'), ...inputGroupProps }; - return ; + return ; }; export const NameId = (props: NameIdProps): JSX.Element => { @@ -129,7 +135,7 @@ export const Description = (props: DescriptionComponentProps): JSX.Element => { }; export const Tags = (props: TagsComponentProps): JSX.Element => { - const { tagsProps, hasValue, isOptional = true } = props; + const { tagsProps, hasValue, isDisabled, isOptional = true } = props; const { getString } = useStrings(); const [isTagsOpen, setTagsOpen] = useState(hasValue || false); @@ -152,7 +158,7 @@ export const Tags = (props: TagsComponentProps): JSX.Element => { /> )} - {isTagsOpen && } + {isTagsOpen && } ); }; @@ -234,6 +240,7 @@ export default function NameDescriptionTags(props: NameDescriptionTagsProps): JS descriptionProps, tagsProps, formikProps, + disabledFields, inputGroupProps = {}, tooltipProps, marginBottom @@ -241,13 +248,15 @@ export default function NameDescriptionTags(props: NameDescriptionTagsProps): JS const newInputGroupProps = { placeholder: getString('nameIdDescriptionTags.namePlaceholder'), ...inputGroupProps }; return ( - + ; hasValue?: boolean; + isDisabled?: boolean; isOptional?: boolean; dataTooltipId?: string; } diff --git a/chaoscenter/web/src/components/PipelineDiagram/Nodes/ChaosExecutionNode/ChaosExecutionNode.tsx b/chaoscenter/web/src/components/PipelineDiagram/Nodes/ChaosExecutionNode/ChaosExecutionNode.tsx index b62738a5425..b5700a8f5cc 100644 --- a/chaoscenter/web/src/components/PipelineDiagram/Nodes/ChaosExecutionNode/ChaosExecutionNode.tsx +++ b/chaoscenter/web/src/components/PipelineDiagram/Nodes/ChaosExecutionNode/ChaosExecutionNode.tsx @@ -1,47 +1,37 @@ import React from 'react'; import cx from 'classnames'; import { defaultTo } from 'lodash-es'; -import { Text, Button, ButtonVariation, Container, Layout } from '@harnessio/uicore'; -import { Icon } from '@harnessio/icons'; -import type { IconName } from '@harnessio/icons'; -import { Color, FontVariation } from '@harnessio/design-system'; +import { Text, Button, ButtonVariation } from '@harnessio/uicore'; +import { Color } from '@harnessio/design-system'; +import { Icon, IconName } from '@harnessio/icons'; import { DynamicPopover, DynamicPopoverHandlerBinding } from '@components/PipelineDiagram/DynamicPopover/DynamicPopover'; -import type { ChaosResult } from '@models'; -import { useStrings } from '@strings'; -import ProbePassedFailedCount from '@components/ProbePassedFailedCount'; -import { ExperimentRunFaultStatus, FaultProbeStatus } from '@api/entities'; -import { phaseToUI } from '@utils'; +import { ExperimentRunFaultStatus } from '@api/entities'; import { getChaosStatusProps } from '../utils'; import { DiagramDrag, DiagramType, Event } from '../../Constants'; import type { BaseReactComponentProps } from '../../types'; import SVGMarker from '../SVGMarker'; +import { RenderNotStartedPopover, RenderPopover, ToolTipData } from './NodePopovers'; import css from './ChaosExecutionNode.module.scss'; interface ChaosExecutionNodeProps extends BaseReactComponentProps { status: string; } -interface ToolTipData { - nodeName: string; - phase: ExperimentRunFaultStatus; - chaosResult: ChaosResult | undefined; -} - function ChaosExecutionNode(props: ChaosExecutionNodeProps): JSX.Element { - const { getString } = useStrings(); - const nodeRef = React.useRef(null); const [dynamicPopoverHandler, setDynamicPopoverHandler] = React.useState< DynamicPopoverHandlerBinding | undefined >(); const stepStatus = defaultTo(props.status, ExperimentRunFaultStatus.NA); + const { secondaryIconProps, secondaryIcon, secondaryIconStyle } = getChaosStatusProps( stepStatus as ExperimentRunFaultStatus ); + const isSelectedNode = (): boolean => props.isSelected || props.id === props.selectedNodeId; const onDropEvent = (event: React.DragEvent): void => { @@ -58,62 +48,9 @@ function ChaosExecutionNode(props: ChaosExecutionNodeProps): JSX.Element { }); }; - const renderPopover = ({ nodeName, phase, chaosResult }: ToolTipData): JSX.Element => { - let probePassed = 0; - let probeFailed = 0; - - chaosResult?.status?.probeStatuses?.map(probe => { - if (probe?.status?.verdict === FaultProbeStatus.PASSED) probePassed++; - }); - - chaosResult?.status?.probeStatuses?.map(probe => { - if (probe?.status?.verdict === FaultProbeStatus.FAILED) probeFailed++; - }); - - return ( - - - - {nodeName} - - - - {getString('executionStatus')}: - - - {secondaryIcon && ( - - )} - - {phaseToUI(phase)} - - - - - {nodeName !== 'install-chaos-faults' && nodeName !== 'cleanup-chaos-resources' && ( - -
- - {getString('probeResult')} - - -
- )} -
- ); - }; + function didStepStartExecution(): boolean { + return stepStatus !== ExperimentRunFaultStatus.NA; + } return (
{ event.stopPropagation(); + if (!didStepStartExecution()) return; if (props.onClick) { props.onClick(event); return; @@ -154,102 +92,101 @@ function ChaosExecutionNode(props: ChaosExecutionNodeProps): JSX.Element {
-
{ - event.stopPropagation(); - props.fireEvent?.({ - type: Event.DragStart, - target: event.target, - data: { ...props } - }); - event.dataTransfer.setData(DiagramDrag.NodeDrag, JSON.stringify(props)); - // NOTE: onDragOver we cannot access dataTransfer data - // in order to detect if we can drop, we are setting and using "keys" and then - // checking in onDragOver if this type (AllowDropOnLink/AllowDropOnNode) exist we allow drop - event.dataTransfer.setData(DiagramDrag.AllowDropOnLink, '1'); - event.dataTransfer.setData(DiagramDrag.AllowDropOnNode, '1'); - event.dataTransfer.dropEffect = 'move'; - }} - onDragEnd={event => { - event.preventDefault(); - event.stopPropagation(); - }} - onMouseEnter={event => { - event.stopPropagation(); - dynamicPopoverHandler?.show( - nodeRef.current as Element, - { - nodeName: props.data.name, - phase: props.status as ExperimentRunFaultStatus, - chaosResult: props.data.chaosResult - }, - { - useArrows: true, - darkMode: true, - fixedPosition: false, - placement: 'top' - } - ); - }} - onMouseLeave={event => { - event.stopPropagation(); - dynamicPopoverHandler?.hide(); - props.fireEvent?.({ - type: Event.MouseLeaveNode, - target: event.target, - data: { ...props } - }); - }} - > -
- - {secondaryIcon && ( +
+
{ + event.stopPropagation(); + props.fireEvent?.({ + type: Event.DragStart, + target: event.target, + data: { ...props } + }); + event.dataTransfer.setData(DiagramDrag.NodeDrag, JSON.stringify(props)); + // NOTE: onDragOver we cannot access dataTransfer data + // in order to detect if we can drop, we are setting and using "keys" and then + // checking in onDragOver if this type (AllowDropOnLink/AllowDropOnNode) exist we allow drop + event.dataTransfer.setData(DiagramDrag.AllowDropOnLink, '1'); + event.dataTransfer.setData(DiagramDrag.AllowDropOnNode, '1'); + event.dataTransfer.dropEffect = 'move'; + }} + onDragEnd={event => { + event.preventDefault(); + event.stopPropagation(); + }} + onMouseEnter={event => { + event.stopPropagation(); + dynamicPopoverHandler?.show( + nodeRef.current as Element, + { + nodeName: props.name ?? props.data.name, + stepStatus: props.status as ExperimentRunFaultStatus, + chaosResult: props.data.chaosData?.chaosResult + }, + { + useArrows: true, + darkMode: true, + fixedPosition: false, + placement: 'top' + } + ); + }} + onMouseLeave={event => { + event.stopPropagation(); + dynamicPopoverHandler?.hide(); + props.fireEvent?.({ + type: Event.MouseLeaveNode, + target: event.target, + data: { ...props } + }); + }} + > +
- )} - {!props.readonly && ( -
@@ -270,7 +207,7 @@ function ChaosExecutionNode(props: ChaosExecutionNodeProps): JSX.Element { { + const { getString } = useStrings(); + + return ( + + + + {nodeName} + + + + {getString('executionStatus')}: + + + + + {getString('notStarted')} + + + + + + ); +}; + +export const RenderPopover = ({ nodeName, stepStatus, chaosResult }: ToolTipData): JSX.Element => { + const { getString } = useStrings(); + + const { secondaryIconProps, secondaryIcon, secondaryIconStyle } = getChaosStatusProps(stepStatus); + + let probePassed = 0; + let probeFailed = 0; + + chaosResult?.status?.probeStatuses?.map(probe => { + if (probe?.status?.verdict === FaultProbeStatus.PASSED) probePassed++; + if (probe?.status?.verdict === FaultProbeStatus.FAILED) probeFailed++; + }); + + return ( + + + + {nodeName} + + + + {getString('executionStatus')}: + + + {secondaryIcon && ( + + )} + + {phaseToUI(stepStatus)} + + + + + {nodeName !== 'install-chaos-faults' && nodeName !== 'cleanup-chaos-resources' && ( + +
+ + {getString('probeResult')} + + +
+ )} +
+ ); +}; diff --git a/chaoscenter/web/src/components/ProbeInformationCard/ProbeInformationCardFromAPI.tsx b/chaoscenter/web/src/components/ProbeInformationCard/ProbeInformationCardFromAPI.tsx new file mode 100644 index 00000000000..589809b5325 --- /dev/null +++ b/chaoscenter/web/src/components/ProbeInformationCard/ProbeInformationCardFromAPI.tsx @@ -0,0 +1,106 @@ +import React from 'react'; +import { Layout, Text } from '@harnessio/uicore'; +import { Color, FontVariation } from '@harnessio/design-system'; +import { useStrings } from '@strings'; +import { getProbeDetailsFromParsedProbe, getProbePropertiesFromParsedProbe } from '@utils'; +import type { Probe } from '@api/entities'; + +export enum ProbeInformationType { + DETAILS = 'DETAILS', + PROPERTIES = 'PROPERTIES' +} + +const ProbeInformationCardFromAPI = ({ + probe, + isVerbose = true, + hideTopBorder = false, + display, + inStudio, + inProbeSelectMode +}: { + probe: Probe; + isVerbose?: boolean; + hideTopBorder?: boolean; + display: ProbeInformationType; + inProbeSelectMode?: boolean; + inStudio?: boolean; +}): JSX.Element => { + const { getString } = useStrings(); + + /** + * Will remove deeply nested __typename fields efficiently from the payload + * Apollo Github Issue: https://github.com/apollographql/apollo-feature-requests/issues/6 + * */ + const probeData: Probe = JSON.parse( + JSON.stringify(probe, (name, val) => { + if (name === '__typename') { + delete val[name]; + } else if (val === null) { + return undefined; + } else { + return val; + } + }) + ); + const displayData = + display === ProbeInformationType.PROPERTIES + ? getProbePropertiesFromParsedProbe(probe) + : getProbeDetailsFromParsedProbe(probeData); + return ( + + {isVerbose && ( + + {display === ProbeInformationType.PROPERTIES ? getString('probeProperties') : getString('probeDetails')} + + )} + + {displayData.map(value => ( + + + + {value[0]}: + + + + + {value[1]} + + + + ))} + + + ); +}; + +export default ProbeInformationCardFromAPI; diff --git a/chaoscenter/web/src/components/SideNav/SideNav.tsx b/chaoscenter/web/src/components/SideNav/SideNav.tsx index 18c7c4bea7c..f9a0af0dff6 100644 --- a/chaoscenter/web/src/components/SideNav/SideNav.tsx +++ b/chaoscenter/web/src/components/SideNav/SideNav.tsx @@ -97,6 +97,7 @@ export default function SideNav(): ReactElement { + diff --git a/chaoscenter/web/src/components/YAMLBuilder/YAMLBuilder.tsx b/chaoscenter/web/src/components/YAMLBuilder/YAMLBuilder.tsx index 64ab67674ee..d14383a4e24 100644 --- a/chaoscenter/web/src/components/YAMLBuilder/YAMLBuilder.tsx +++ b/chaoscenter/web/src/components/YAMLBuilder/YAMLBuilder.tsx @@ -29,6 +29,7 @@ function YAMLBuilder(props: YAMLBuilderProps): React.ReactElement { onChange, theme = 'LIGHT', yamlSanityConfig, + renderCustomHeader, existingJSON, schema, fileName, @@ -169,7 +170,18 @@ function YAMLBuilder(props: YAMLBuilderProps): React.ReactElement { return (
- {renderHeader()} + + {defaultTo(renderCustomHeader, renderHeader)()} + React.ReactElement | null; customCss?: React.HTMLAttributes['className']; } export type CompletionItemInterface = Optional; diff --git a/chaoscenter/web/src/constants/SystemProbe.ts b/chaoscenter/web/src/constants/SystemProbe.ts new file mode 100644 index 00000000000..c6469e4584f --- /dev/null +++ b/chaoscenter/web/src/constants/SystemProbe.ts @@ -0,0 +1,46 @@ +import type { AddProbeRequest } from '@api/core'; +import { InfrastructureType, ProbeType } from '@api/entities'; + +const sourceObj = { + image: 'chaosnative/chaos-go-runner:ci', + inheritInputs: true +}; + +export const KUBERENTES_SYSTEM_PROBE_CONFIG: AddProbeRequest['request'] = { + // Name + name: 'System Probe', + // Description + description: 'A default system healthcheck probe', + // Tags + tags: ['default', 'healthcheck'], + // Static type of the probe + type: ProbeType.CMD, + // Infrastructure type of the Probe + infrastructureType: InfrastructureType.KUBERNETES, + // Default properties of healthcheck system probe + kubernetesCMDProperties: { + //ProbeTimeout contains timeout for the probe + probeTimeout: '180s', + // Interval contains the interval for the probe + interval: '1s', + // Attempt contains the attempt count for the probe + attempt: 0, + // Retry contains the retry count for the probe + retry: 0, + // Command need to be executed for the probe + command: './healthcheck', + // Comparator check for the correctness of the probe output + comparator: { + // type of data + // it can be int, float, string + type: 'string', + // Criteria for matching data + // it supports >=, <=, ==, >, <, != for int and float + // it supports equal, notEqual, contains for string + criteria: 'contains', + // Value contains relative value for criteria + value: '[P000]' + }, + source: JSON.stringify(sourceObj) + } +}; diff --git a/chaoscenter/web/src/constants/infrastructure.ts b/chaoscenter/web/src/constants/infrastructure.ts new file mode 100644 index 00000000000..e5ab9377c3b --- /dev/null +++ b/chaoscenter/web/src/constants/infrastructure.ts @@ -0,0 +1,12 @@ +import type { IconName } from '@harnessio/icons'; +import { InfrastructureType } from '@api/entities'; +import type { InfrastructurePlatform } from '@models'; + +export const KUBERNETES_INFRASTRUCTURE_PLATFORM: InfrastructurePlatform = { + value: InfrastructureType.KUBERNETES, + name: InfrastructureType.KUBERNETES, + image: 'service-kubernetes' as IconName, + count: undefined, + isActive: true, + supportedFaults: [] +}; diff --git a/chaoscenter/web/src/controllers/AddProbeModalWizard/AddProbeModalWizard.tsx b/chaoscenter/web/src/controllers/AddProbeModalWizard/AddProbeModalWizard.tsx new file mode 100644 index 00000000000..e15846868cc --- /dev/null +++ b/chaoscenter/web/src/controllers/AddProbeModalWizard/AddProbeModalWizard.tsx @@ -0,0 +1,90 @@ +import React from 'react'; +import { useToaster } from '@harnessio/uicore'; +import type { RefetchProbes } from '@controllers/ChaosProbes'; +import { getScope } from '@utils'; +import type { InfrastructureType } from '@api/entities'; +import { validateUniqueProbe } from '@api/core/probe/validateUniqueProbe'; +import { addK8SProbe, addKubernetesCMDProbe, addKubernetesHTTPProbe, addPROMProbe } from '@api/core'; +import AddProbeModalWizardView from '@views/AddProbeModalWizard'; + +interface AddHubModalWizardControllerProps extends RefetchProbes { + hideDarkModal: () => void; + infrastructureType: InfrastructureType | undefined; +} + +export default function AddProbeModalWizardController({ + hideDarkModal, + refetchProbes, + infrastructureType +}: AddHubModalWizardControllerProps): React.ReactElement { + const scope = getScope(); + const { showError } = useToaster(); + + const [validateUniqueProbeQuery] = validateUniqueProbe({ + ...scope, + onError: err => showError(err.message) + }); + + const [ + addKubernetesHTTPProbeMutation, + { loading: addKubernetesHTTPProbeMutationLoading, error: addKubernetesHTTPProbeMutationError } + ] = addKubernetesHTTPProbe({ + onCompleted: () => { + refetchProbes(); + }, + onError: err => showError(err.message) + }); + + const [ + addKubernetesCMDProbeMutation, + { loading: addKubernetesCMDProbeMutationLoading, error: addKubernetesCMDProbeMutationError } + ] = addKubernetesCMDProbe({ + onCompleted: () => { + refetchProbes(); + }, + onError: err => showError(err.message) + }); + + const [addK8SProbeMutation, { loading: addK8SProbeMutationLoading, error: addK8SProbeMutationError }] = addK8SProbe({ + onCompleted: () => { + refetchProbes(); + }, + onError: err => showError(err.message) + }); + + const [addPROMProbeMutation, { loading: addPROMProbeMutationLoading, error: addPROMProbeMutationError }] = + addPROMProbe({ + onCompleted: () => { + refetchProbes(); + }, + onError: err => showError(err.message) + }); + + const loading = + addKubernetesHTTPProbeMutationLoading || + addKubernetesCMDProbeMutationLoading || + addK8SProbeMutationLoading || + addPROMProbeMutationLoading; + const error = + addKubernetesHTTPProbeMutationError || + addKubernetesCMDProbeMutationError || + addK8SProbeMutationError || + addPROMProbeMutationError; + + return ( + + ); +} diff --git a/chaoscenter/web/src/controllers/AddProbeModalWizard/index.ts b/chaoscenter/web/src/controllers/AddProbeModalWizard/index.ts new file mode 100644 index 00000000000..ee686e013a5 --- /dev/null +++ b/chaoscenter/web/src/controllers/AddProbeModalWizard/index.ts @@ -0,0 +1,3 @@ +import AddProbeModalWizardController from './AddProbeModalWizard'; + +export default AddProbeModalWizardController; diff --git a/chaoscenter/web/src/controllers/ChaosProbe/ChaosProbe.tsx b/chaoscenter/web/src/controllers/ChaosProbe/ChaosProbe.tsx new file mode 100644 index 00000000000..11d89723d65 --- /dev/null +++ b/chaoscenter/web/src/controllers/ChaosProbe/ChaosProbe.tsx @@ -0,0 +1,24 @@ +import React from 'react'; +import { useParams } from 'react-router-dom'; +import { useToaster } from '@harnessio/uicore'; +import { getScope } from '@utils'; +import { getProbe } from '@api/core'; +import ChaosProbeView from '@views/ChaosProbe'; + +export default function ChaosProbeController(): React.ReactElement { + const scope = getScope(); + const { probeName } = useParams<{ probeName: string }>(); + const { showError } = useToaster(); + + const { data, loading } = getProbe({ + ...scope, + probeName: probeName, + options: { + onError: err => showError(err.message) + } + }); + + const probeData = data?.getProbe; + + return ; +} diff --git a/chaoscenter/web/src/controllers/ChaosProbe/index.ts b/chaoscenter/web/src/controllers/ChaosProbe/index.ts new file mode 100644 index 00000000000..fb74072ba05 --- /dev/null +++ b/chaoscenter/web/src/controllers/ChaosProbe/index.ts @@ -0,0 +1,3 @@ +import ChaosProbeController from './ChaosProbe'; + +export default ChaosProbeController; diff --git a/chaoscenter/web/src/controllers/ChaosProbeConfiguration/ChaosProbeConfiguration.tsx b/chaoscenter/web/src/controllers/ChaosProbeConfiguration/ChaosProbeConfiguration.tsx new file mode 100644 index 00000000000..11173accb47 --- /dev/null +++ b/chaoscenter/web/src/controllers/ChaosProbeConfiguration/ChaosProbeConfiguration.tsx @@ -0,0 +1,125 @@ +import React from 'react'; +import { useParams } from 'react-router-dom'; +import { useToaster } from '@harnessio/uicore'; +import { + getKubernetesCMDProbeProperties, + getKubernetesHTTPProbeProperties, + getK8SProbeProperties, + getPROMProbeProperties +} from '@api/core'; +import { getScope } from '@utils'; +import ChaosProbeConfigurationView from '@views/ChaosProbeConfiguration'; +import { InfrastructureType, ProbeType } from '@api/entities'; +import { useSearchParams } from '@hooks'; + +interface ChaosProbeConfigurationControllerProps { + type: ProbeType; +} + +export default function ChaosProbeConfigurationController({ + type +}: ChaosProbeConfigurationControllerProps): React.ReactElement { + const scope = getScope(); + const searchParams = useSearchParams(); + const { probeName } = useParams<{ probeName: string }>(); + const { showError } = useToaster(); + const infrastructureType = searchParams.get('infrastructureType') as InfrastructureType; + + // Lazy Get Kubernetes HTTP Properties query to avoid pre-rendering at component mounting + const [ + getKubernetesHTTPProbePropertiesQuery, + { loading: getKubernetesHTTPProbePropertiesLoading, data: kubernetesHTTPProperties } + ] = getKubernetesHTTPProbeProperties({ + ...scope, + probeName: probeName, + options: { + onError: err => showError(err.message), + nextFetchPolicy: 'cache-first' + } + }); + + // Lazy Get PROM Properties query to avoid pre-rendering at component mounting + const [getPROMProbePropertiesQuery, { loading: getPROMProbePropertiesLoading, data: promProperties }] = + getPROMProbeProperties({ + ...scope, + probeName: probeName, + options: { + onError: err => showError(err.message), + nextFetchPolicy: 'cache-first' + } + }); + + // Lazy Get K8S Properties query to avoid pre-rendering at component mounting + const [getK8SProbePropertiesQuery, { loading: getK8SProbePropertiesLoading, data: k8sProperties }] = + getK8SProbeProperties({ + ...scope, + probeName: probeName, + options: { + onError: err => showError(err.message), + nextFetchPolicy: 'cache-first' + } + }); + + // Lazy Get Kubernetes CMD Properties query to avoid pre-rendering at component mounting + const [ + getKubernetesCMDProbePropertiesQuery, + { loading: getKubernetesCMDProbePropertiesLoading, data: kubernetesCMDproperties } + ] = getKubernetesCMDProbeProperties({ + ...scope, + probeName: probeName, + options: { + onError: err => showError(err.message), + nextFetchPolicy: 'cache-first' + } + }); + + React.useMemo(() => { + if (infrastructureType === InfrastructureType.KUBERNETES) { + switch (type) { + case ProbeType.HTTP: + return getKubernetesHTTPProbePropertiesQuery({ + variables: { + projectID: scope.projectID, + probeName: probeName + } + }); + case ProbeType.PROM: + return getPROMProbePropertiesQuery({ + variables: { + projectID: scope.projectID, + probeName: probeName + } + }); + case ProbeType.K8S: + return getK8SProbePropertiesQuery({ + variables: { + projectID: scope.projectID, + probeName: probeName + } + }); + case ProbeType.CMD: + return getKubernetesCMDProbePropertiesQuery({ + variables: { + projectID: scope.projectID, + probeName: probeName + } + }); + } + } + }, [type, probeName, infrastructureType]); + + const probeData = + infrastructureType === InfrastructureType.KUBERNETES + ? kubernetesHTTPProperties?.getProbe || + promProperties?.getProbe || + k8sProperties?.getProbe || + kubernetesCMDproperties?.getProbe + : undefined; + const loading = + getKubernetesHTTPProbePropertiesLoading || + getPROMProbePropertiesLoading || + getK8SProbePropertiesLoading || + getKubernetesCMDProbePropertiesLoading; + + return ; +} diff --git a/chaoscenter/web/src/controllers/ChaosProbeConfiguration/index.ts b/chaoscenter/web/src/controllers/ChaosProbeConfiguration/index.ts new file mode 100644 index 00000000000..6fed6c7ff4f --- /dev/null +++ b/chaoscenter/web/src/controllers/ChaosProbeConfiguration/index.ts @@ -0,0 +1,3 @@ +import ChaosProbeConfigurationController from './ChaosProbeConfiguration'; + +export default ChaosProbeConfigurationController; diff --git a/chaoscenter/web/src/controllers/ChaosProbeExecutionHistory/ChaosProbeExecutionHistory.tsx b/chaoscenter/web/src/controllers/ChaosProbeExecutionHistory/ChaosProbeExecutionHistory.tsx new file mode 100644 index 00000000000..15742b1c092 --- /dev/null +++ b/chaoscenter/web/src/controllers/ChaosProbeExecutionHistory/ChaosProbeExecutionHistory.tsx @@ -0,0 +1,38 @@ +import React from 'react'; +import { useParams } from 'react-router-dom'; +import { useToaster } from '@harnessio/uicore'; +import { getScope } from '@utils'; +import ChaosProbeExecutionHistoryView from '@views/ChaosProbeExecutionHistory'; +import { getProbeReference } from '@api/core'; +import type { ChaosProbesExecutionHistoryTableProps } from './types'; +import { generateChaosProbesExecutionHistoryTableContent } from './helpers'; + +export default function ChaosProbeExecutionHistoryController(): React.ReactElement { + const scope = getScope(); + const { probeName } = useParams<{ probeName: string }>(); + const { showError } = useToaster(); + + const { data, loading, refetch } = getProbeReference({ + ...scope, + probeName: probeName, + options: { + onError: err => showError(err.message), + nextFetchPolicy: 'cache-first', + pollInterval: 10000 + } + }); + + const probeData = data?.getProbeReference; + + const chaosProbesExecutionHistoryTableData: ChaosProbesExecutionHistoryTableProps | undefined = probeData && { + content: generateChaosProbesExecutionHistoryTableContent(probeData) + }; + + return ( + + ); +} diff --git a/chaoscenter/web/src/controllers/ChaosProbeExecutionHistory/helpers.ts b/chaoscenter/web/src/controllers/ChaosProbeExecutionHistory/helpers.ts new file mode 100644 index 00000000000..f5fc98c2767 --- /dev/null +++ b/chaoscenter/web/src/controllers/ChaosProbeExecutionHistory/helpers.ts @@ -0,0 +1,24 @@ +import type { ProbeReference, RecentProbeRun } from '@api/entities'; +import type { RecentExecutions, ReferenceTableProps } from './types'; + +function generateRecentExecutionsData(probeRuns: Array | undefined): Array { + return probeRuns + ? probeRuns.map(individualRun => ({ + experimentID: individualRun.executedByExperiment.experimentID, + experimentName: individualRun.executedByExperiment.experimentName, + status: individualRun.status, + updatedBy: individualRun.executedByExperiment.updatedBy, + updatedAt: individualRun.executedByExperiment.updatedAt * 1000 + })) + : []; +} + +export function generateChaosProbesExecutionHistoryTableContent(probeData: ProbeReference): Array { + const content: ReferenceTableProps[] = probeData.recentExecutions.map(execution => ({ + totalRuns: probeData.totalRuns, + faultName: execution.faultName, + executionHistory: execution.executionHistory ? generateRecentExecutionsData(execution.executionHistory) : [], + mode: execution.mode + })); + return content; +} diff --git a/chaoscenter/web/src/controllers/ChaosProbeExecutionHistory/index.ts b/chaoscenter/web/src/controllers/ChaosProbeExecutionHistory/index.ts new file mode 100644 index 00000000000..d3ad2e18f98 --- /dev/null +++ b/chaoscenter/web/src/controllers/ChaosProbeExecutionHistory/index.ts @@ -0,0 +1,3 @@ +import ChaosProbeExecutionHistoryController from './ChaosProbeExecutionHistory'; + +export default ChaosProbeExecutionHistoryController; diff --git a/chaoscenter/web/src/controllers/ChaosProbeExecutionHistory/types.ts b/chaoscenter/web/src/controllers/ChaosProbeExecutionHistory/types.ts new file mode 100644 index 00000000000..04da53d2071 --- /dev/null +++ b/chaoscenter/web/src/controllers/ChaosProbeExecutionHistory/types.ts @@ -0,0 +1,26 @@ +import type { Mode, Status, UserDetails } from '@api/entities'; +import type { GqlAPIQueryResponse } from '@api/types'; +import type { GetProbeReferenceRequest, GetProbeReferenceResponse } from '@api/core'; + +export interface RecentExecutions { + experimentName: string; + experimentID: string; + status: Status | undefined; + updatedAt: number; + updatedBy: UserDetails; +} +export interface ReferenceTableProps { + totalRuns: number; + faultName: string; + executionHistory: Array; + mode: Mode; +} + +export interface ChaosProbesExecutionHistoryTableProps { + content: Array; + // pagination?: PaginationProps; TODO: support to be added +} + +export interface RefetchProbeReference { + refetchProbeReference: GqlAPIQueryResponse['refetch']; +} diff --git a/chaoscenter/web/src/controllers/ChaosProbes/ChaosProbeFilter.tsx b/chaoscenter/web/src/controllers/ChaosProbes/ChaosProbeFilter.tsx new file mode 100644 index 00000000000..4ccf4c15889 --- /dev/null +++ b/chaoscenter/web/src/controllers/ChaosProbes/ChaosProbeFilter.tsx @@ -0,0 +1,137 @@ +import React from 'react'; +import { + Button, + DateRangePickerButton, + ButtonVariation, + ButtonSize, + ExpandingSearchInputHandle, + ExpandingSearchInput, + MultiSelectDropDown, + MultiSelectOption +} from '@harnessio/uicore'; +import { ProbeFilter, ProbeFilterAction, ProbeFilterActionKind } from 'hooks/useProbeFilter'; +import { useStrings } from '@strings'; +import { ProbeType } from '@api/entities'; + +export interface ChaosProbeFilterProps { + state: ProbeFilter; + resetPage: () => void; + dispatch: React.Dispatch; +} + +export const ProbeTypeDropdown = ({ state, dispatch, resetPage }: ChaosProbeFilterProps): React.ReactElement => { + const { getString } = useStrings(); + + const probeTypeItems: MultiSelectOption[] = [ + { label: 'HTTP', value: ProbeType.HTTP }, + { label: 'CMD', value: ProbeType.CMD }, + { label: 'PROM', value: ProbeType.PROM }, + { label: 'K8S', value: ProbeType.K8S } + ]; + + return ( + ({ label: type, value: type } as MultiSelectOption)) + : [] + } + onChange={selectedItem => { + resetPage(); + dispatch({ + type: ProbeFilterActionKind.CHANGE_PROBE_TYPE, + payload: { + probeType: selectedItem.map(item => item.value as ProbeType) + } + }); + }} + /> + ); +}; + +export const DateRangePicker = ({ state, dispatch, resetPage }: ChaosProbeFilterProps): React.ReactElement => { + const { getString } = useStrings(); + // + const [render, forceRerender] = React.useState(0); + + React.useEffect(() => { + if (state.dateRange === undefined) forceRerender(oldState => oldState + 1); + }, [state]); + return ( + { + return `${selectedDates[0].toLocaleDateString()} - ${selectedDates[1].toLocaleDateString()}`; + }} + onChange={(selectedDates: [Date, Date]) => { + resetPage(); + dispatch({ + type: ProbeFilterActionKind.CHANGE_DATE_RANGE, + payload: { + dateRange: { + startDate: selectedDates[0].setHours(0, 0, 0).valueOf().toString(), + endDate: selectedDates[1].setHours(23, 59, 59).valueOf().toString() + } + } + }); + }} + /> + ); +}; + +export const ProbeSearchBar = ({ state, dispatch, resetPage }: ChaosProbeFilterProps): React.ReactElement => { + const { getString } = useStrings(); + const ref = React.useRef(); + React.useEffect(() => { + if (state.probeName === '' && ref.current) { + ref.current.clear(); + } + }, [state.probeName]); + return ( + { + if (!(state.probeName === probeName)) { + resetPage(); + dispatch({ + type: ProbeFilterActionKind.CHANGE_PROBE_NAME, + payload: { + probeName: probeName + } + }); + } + }} + /> + ); +}; + +export const ResetFilterButton = ({ dispatch, resetPage }: ChaosProbeFilterProps): React.ReactElement => { + const { getString } = useStrings(); + return ( + -
- ))} -
- ) : ( -
Loading...
- )} -
+ ); } diff --git a/chaoscenter/web/src/controllers/SelectProbesTab/helpers.ts b/chaoscenter/web/src/controllers/SelectProbesTab/helpers.ts new file mode 100644 index 00000000000..5e97f2698bb --- /dev/null +++ b/chaoscenter/web/src/controllers/SelectProbesTab/helpers.ts @@ -0,0 +1,13 @@ +import type { Probe } from '@api/entities'; +import type { ChaosProbesSelectionProps } from './types'; + +export function generateChaosProbesSelectionDashboardTableContent( + probeData: Array +): Array { + const content: ChaosProbesSelectionProps[] = probeData.map(probe => ({ + probeName: probe.name, + type: probe.type + })); + + return content; +} diff --git a/chaoscenter/web/src/controllers/SelectProbesTab/types.ts b/chaoscenter/web/src/controllers/SelectProbesTab/types.ts new file mode 100644 index 00000000000..baede4e402a --- /dev/null +++ b/chaoscenter/web/src/controllers/SelectProbesTab/types.ts @@ -0,0 +1,10 @@ +import type { ProbeType } from '@api/entities'; + +export interface ChaosProbesSelectionProps { + probeName: string; + type: ProbeType; +} + +export interface ChaosProbesSelectionTableProps { + content: Array; +} diff --git a/chaoscenter/web/src/controllers/UpdateProbeModalWizard/UpdateProbeModalWizard.tsx b/chaoscenter/web/src/controllers/UpdateProbeModalWizard/UpdateProbeModalWizard.tsx new file mode 100644 index 00000000000..4eee67e04aa --- /dev/null +++ b/chaoscenter/web/src/controllers/UpdateProbeModalWizard/UpdateProbeModalWizard.tsx @@ -0,0 +1,59 @@ +import React from 'react'; +import { useToaster } from '@harnessio/uicore'; +import { getProbeAllProperties, updateProbe, validateUniqueProbe } from '@api/core'; +import type { RefetchProbes } from '@controllers/ChaosProbes'; +import AddProbeModalWizardView from '@views/AddProbeModalWizard'; +import type { InfrastructureType } from '@api/entities'; +import { getScope } from '@utils'; + +interface UpdateHubModalWizardControllerProps extends RefetchProbes { + hideDarkModal: () => void; + probeName: string; + infrastructureType: InfrastructureType | undefined; +} + +export default function UpdateProbeModalWizardController({ + hideDarkModal, + refetchProbes, + probeName, + infrastructureType +}: UpdateHubModalWizardControllerProps): React.ReactElement { + const { showError, showSuccess } = useToaster(); + const scope = getScope(); + + const [validateUniqueProbeQuery] = validateUniqueProbe({ + ...scope, + onError: err => showError(err) + }); + + const [updateProbeMutation, { loading: updateProbeLoading, error }] = updateProbe({ + onCompleted: data => { + showSuccess(data.updateProbe); + refetchProbes(); + }, + onError: err => showError(err.message) + }); + + const { data: probeData, loading: getProbeLoading } = getProbeAllProperties({ + ...scope, + probeName: probeName, + options: { + onError: err => showError(err.message) + } + }); + + const loading = updateProbeLoading || getProbeLoading; + + return ( + + ); +} diff --git a/chaoscenter/web/src/controllers/UpdateProbeModalWizard/index.ts b/chaoscenter/web/src/controllers/UpdateProbeModalWizard/index.ts new file mode 100644 index 00000000000..d540ac12ab8 --- /dev/null +++ b/chaoscenter/web/src/controllers/UpdateProbeModalWizard/index.ts @@ -0,0 +1,3 @@ +import UpdateProbeModalWizardController from './UpdateProbeModalWizard'; + +export default UpdateProbeModalWizardController; diff --git a/chaoscenter/web/src/hooks/useProbeFilter.tsx b/chaoscenter/web/src/hooks/useProbeFilter.tsx new file mode 100644 index 00000000000..eb5e32fd191 --- /dev/null +++ b/chaoscenter/web/src/hooks/useProbeFilter.tsx @@ -0,0 +1,53 @@ +import React, { Dispatch } from 'react'; +import type { DateRange, ProbeType } from '@api/entities'; + +export enum ProbeFilterActionKind { + CHANGE_PROBE_NAME = 'CHANGE_PROBE_NAME', + CHANGE_PROBE_TYPE = 'CHANGE_PROBE_TYPE', + CHANGE_DATE_RANGE = 'CHANGE_DATE_RANGE', + RESET_FILTERS = 'RESET_FILTERS' +} + +// +export interface ProbeFilter { + probeName?: string | undefined; + probeType?: Array; + dateRange?: DateRange | undefined; +} + +export interface ProbeFilterAction { + type: ProbeFilterActionKind; + payload: ProbeFilter; +} + +interface ReducerReturn { + state: ProbeFilter; + dispatch: Dispatch; +} + +function reducer(state: ProbeFilter, action: ProbeFilterAction): ReducerReturn['state'] { + switch (action.type) { + case ProbeFilterActionKind.CHANGE_PROBE_NAME: + return { ...state, probeName: action.payload.probeName }; + case ProbeFilterActionKind.CHANGE_DATE_RANGE: + return { ...state, dateRange: action.payload.dateRange }; + case ProbeFilterActionKind.CHANGE_PROBE_TYPE: + return { ...state, probeType: action.payload.probeType }; + case ProbeFilterActionKind.RESET_FILTERS: + return { ...initialProbeFilterState }; + default: + throw new Error(); + } +} + +export const initialProbeFilterState: ProbeFilter = { + probeName: '', + probeType: undefined, + dateRange: undefined +}; + +export function useProbeFilter(): ReducerReturn { + const [state, dispatch] = React.useReducer(reducer, initialProbeFilterState); + + return { state, dispatch }; +} diff --git a/chaoscenter/web/src/images/ProbeCheck.png b/chaoscenter/web/src/images/ProbeCheck.png new file mode 100644 index 00000000000..74bcb84c5ff Binary files /dev/null and b/chaoscenter/web/src/images/ProbeCheck.png differ diff --git a/chaoscenter/web/src/images/ProbeFallback.svg b/chaoscenter/web/src/images/ProbeFallback.svg new file mode 100644 index 00000000000..1dcfc682a5b --- /dev/null +++ b/chaoscenter/web/src/images/ProbeFallback.svg @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/chaoscenter/web/src/images/emptyProbe.png b/chaoscenter/web/src/images/emptyProbe.png new file mode 100644 index 00000000000..6eed955f7b5 Binary files /dev/null and b/chaoscenter/web/src/images/emptyProbe.png differ diff --git a/chaoscenter/web/src/images/k8s.svg b/chaoscenter/web/src/images/k8s.svg new file mode 100644 index 00000000000..a3b99a2866a --- /dev/null +++ b/chaoscenter/web/src/images/k8s.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/chaoscenter/web/src/images/noProbes.svg b/chaoscenter/web/src/images/noProbes.svg new file mode 100644 index 00000000000..c019fdfc6ec --- /dev/null +++ b/chaoscenter/web/src/images/noProbes.svg @@ -0,0 +1,281 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/chaoscenter/web/src/images/prom.svg b/chaoscenter/web/src/images/prom.svg new file mode 100644 index 00000000000..68f68700f55 --- /dev/null +++ b/chaoscenter/web/src/images/prom.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/chaoscenter/web/src/models/chaosEngine.ts b/chaoscenter/web/src/models/chaosEngine.ts index 6ecb42a009e..fc6a5d13647 100644 --- a/chaoscenter/web/src/models/chaosEngine.ts +++ b/chaoscenter/web/src/models/chaosEngine.ts @@ -135,7 +135,7 @@ export interface ProbeAttributes { // Name of probe name: string; // Type of probe - type: string; + type?: string; // inputs needed for the k8s probe 'k8sProbe/inputs'?: K8sProbeInputs; // inputs needed for the http probe @@ -159,9 +159,9 @@ export interface K8sProbeInputs { // group of the resource group?: string; // apiversion of the resource - version?: string; + version: string; // kind of resource - resource?: string; + resource: string; // ResourceNames to get the resources using their list of comma separated names resourceNames?: string; // namespace of the resource @@ -172,7 +172,18 @@ export interface K8sProbeInputs { labelSelector?: string; // Operation performed by the k8s probe // it can be create, delete, present, absent - operation?: string; + operation: string; +} + +//CmdProbeInputs contains all the inputs required for cmd probe +export interface NewCmdProbeInputs { + // Command need to be executed for the probe + command: string; + // Comparator check for the correctness of the probe output + comparator: ComparatorInfo; + // The source where we have to run the command + // It will run in inline(inside experiment itself) mode if source is nil + source?: string; } //CmdProbeInputs contains all the inputs required for cmd probe @@ -232,6 +243,16 @@ export interface PromProbeInputs { comparator?: ComparatorInfo; } +// Identifier required for fetching details from the Platform APIs +export interface Identifier { + // AccountIdentifier for account ID + accountIdentifier?: string; + // OrgIdentifier for organization ID + orgIdentifier?: string; + // ProjectIdentifier for project ID + projectIdentifier?: string; +} + // ComparatorInfo contains the comparator details export interface ComparatorInfo { // type of data @@ -290,18 +311,20 @@ export interface PostMethod { //RunProperty contains timeout, retry and interval for the probe export interface RunProperty { //ProbeTimeout contains timeout for the probe - probeTimeout?: number; + probeTimeout?: string; // Interval contains the interval for the probe - interval?: number; + interval?: string; // Attempt contains the attempt count for the probe attempt?: number; // Retry contains the retry count for the probe retry?: number; - //ProbePollingInterval contains time interval, for which continuous probe should be sleep + // ProbePollingInterval contains time interval, for which continuous probe should be sleep // after each iteration - probePollingInterval?: number; - //InitialDelaySeconds time interval for which probe will wait before run - initialDelaySeconds?: number; + probePollingInterval?: string; + // InitialDelaySeconds time interval for which probe will wait before run + initialDelay?: string; + // EvaluationTimeout is the timeout window in which the SLO metrics + evaluationTimeout?: string; // StopOnFailure contains flag to stop/continue experiment execution, if probe fails // it will stop the experiment execution, if provided true // it will continue the experiment execution, if provided false or not provided(default case) diff --git a/chaoscenter/web/src/models/chaosInfrastructure.ts b/chaoscenter/web/src/models/chaosInfrastructure.ts index 9626d9a7249..db97f5ae64a 100644 --- a/chaoscenter/web/src/models/chaosInfrastructure.ts +++ b/chaoscenter/web/src/models/chaosInfrastructure.ts @@ -49,13 +49,6 @@ export enum EnvironmentType { PRODUCTION = 'Production', NON_PRODUCTION = 'PreProduction' } - -export enum ConnectorScope { - PROJECT = 'project', - ORG = 'org', - ACCOUNT = 'account' -} - export interface InitialValueProps { infraScope: DeploymentScopeOptions; name: string; @@ -126,3 +119,13 @@ export const initialValues: InitialValueProps = { export const kubernetesChaosInfrastructureCRDsEndpoint = 'https://raw.githubusercontent.com/litmuschaos/litmus/master/mkdocs/docs/3.0.0-beta10/litmus-portal-crds-3.0.0-beta10.yml'; + +type InfrastructurePlatformNameType = 'Kubernetes'; + +export interface InfrastructurePlatform extends CollapsableSelectOptions { + name: InfrastructurePlatformNameType; + image: IconName; + count: number | undefined; + isActive: boolean; + supportedFaults: Array; +} diff --git a/chaoscenter/web/src/models/chaosProbe.ts b/chaoscenter/web/src/models/chaosProbe.ts index dba753daaac..0f151da2d9c 100644 --- a/chaoscenter/web/src/models/chaosProbe.ts +++ b/chaoscenter/web/src/models/chaosProbe.ts @@ -1,4 +1,25 @@ +import type { LazyQueryResult, QueryLazyOptions } from '@apollo/client'; +import type { FaultData } from '@models'; +import type { GetProbeResponse, GetProbeRequest, GetProbeYAMLRequest, GetProbeYAMLResponse } from '@api/core'; + export enum ProbeTabs { EXECUTION_RESULTS = 'EXECUTION_RESULTS', CONFIGURATION = 'CONFIGURATION' } + +export interface GetProbe { + getProbeYAMLQuery: ( + options?: QueryLazyOptions | undefined + ) => Promise>; +} + +export interface GetLazyProbe { + getLazyProbeQuery: ( + options?: QueryLazyOptions | undefined + ) => Promise>; +} + +export interface FaultProps { + faultData: FaultData | undefined; + onSave: (data: Omit) => void; +} diff --git a/chaoscenter/web/src/models/chaosResult.ts b/chaoscenter/web/src/models/chaosResult.ts index d54816551bb..482f6a5b55d 100644 --- a/chaoscenter/web/src/models/chaosResult.ts +++ b/chaoscenter/web/src/models/chaosResult.ts @@ -27,7 +27,7 @@ export type ResultPhase = 'Running' | 'Completed' | 'Stopped'; // ResultVerdict is typecasted to string for supporting the values below. export type ResultVerdict = 'Pass' | 'Fail' | 'Stopped' | 'Awaited'; -export type ProbeVerdict = 'Passed' | 'Failed' | 'N/A' | 'Awaited'; +export type ProbeVerdict = 'Passed' | 'Failed' | 'N/A' | 'NA' | 'Awaited'; // ChaosResultStatus defines the observed state of ChaosResult export interface ChaosResultStatus { diff --git a/chaoscenter/web/src/models/experiment.ts b/chaoscenter/web/src/models/experiment.ts index 0a623f04b28..ec60461b99e 100644 --- a/chaoscenter/web/src/models/experiment.ts +++ b/chaoscenter/web/src/models/experiment.ts @@ -1,4 +1,5 @@ -import type { ChaosEngine } from './chaosEngine'; +import type { ProbeObj } from '@api/entities'; +import type { ChaosEngine, ProbeAttributes } from './chaosEngine'; import type { ChaosExperiment } from './chaosFaults'; import type { CronWorkflow } from './cronWorkflows'; import type { Workflow } from './workflows'; @@ -8,6 +9,7 @@ export type ExperimentManifest = KubernetesExperimentManifest; export interface FaultData { faultName: string; + probes?: ProbeObj[] | ProbeAttributes[]; faultCR?: ChaosExperiment; engineCR?: ChaosEngine; weight?: number; diff --git a/chaoscenter/web/src/models/index.ts b/chaoscenter/web/src/models/index.ts index 192a00d3209..93c6c1a6bac 100644 --- a/chaoscenter/web/src/models/index.ts +++ b/chaoscenter/web/src/models/index.ts @@ -12,4 +12,5 @@ export * from './user'; export * from './projectMembers'; export * from './token'; export * from './projects'; +export * from './chaosProbe'; export * from './gitops'; diff --git a/chaoscenter/web/src/models/workflows.ts b/chaoscenter/web/src/models/workflows.ts index cf1210cbe99..f9b67abd599 100644 --- a/chaoscenter/web/src/models/workflows.ts +++ b/chaoscenter/web/src/models/workflows.ts @@ -815,6 +815,17 @@ export interface WorkflowSpec { * This is able to be overridden by a nodeSelector specified in the template. */ nodeSelector?: { [key: string]: string }; + /** + * PodMetadata defines additional metadata that should be applied to workflow pods + */ + podMetadata?: { + annotations?: { + [key: string]: string; + }; + labels?: { + [key: string]: string; + }; + }; /** * OnExit is a template reference which is invoked at the end of the workflow, irrespective of the success, failure, or error of the primary workflow. */ diff --git a/chaoscenter/web/src/routes/RouteDefinitions.ts b/chaoscenter/web/src/routes/RouteDefinitions.ts index 40c03424678..a08daa4fa6e 100644 --- a/chaoscenter/web/src/routes/RouteDefinitions.ts +++ b/chaoscenter/web/src/routes/RouteDefinitions.ts @@ -16,7 +16,7 @@ export interface UseRouteDefinitionsProps { toChaosHubs(): string; toChaosHub(params: { hubID: string }): string; toChaosProbes(): string; - toChaosProbe(params: { probeID: string }): string; + toChaosProbe(params: { probeName: string }): string; toPredefinedExperiment(params: { hubID: string; experimentName: string }): string; toChaosFault(params: { hubID: string; faultName: string }): string; toEnvironments(): string; @@ -51,7 +51,7 @@ export const paths: UseRouteDefinitionsProps = { toChaosFault: ({ hubID, faultName }) => `/chaos-hubs/${hubID}/fault/${faultName}`, // Chaos Probe Routes toChaosProbes: () => '/probes', - toChaosProbe: ({ probeID }) => `/probes/${probeID}`, + toChaosProbe: ({ probeName }) => `/probes/${probeName}`, toEnvironments: () => '/environments', // Chaos Infrastructures Routes toChaosInfrastructures: ({ environmentID }) => `/environments/${environmentID}`, diff --git a/chaoscenter/web/src/routes/RouteDestinations.tsx b/chaoscenter/web/src/routes/RouteDestinations.tsx index efd5ee2b171..cae43934fe0 100644 --- a/chaoscenter/web/src/routes/RouteDestinations.tsx +++ b/chaoscenter/web/src/routes/RouteDestinations.tsx @@ -23,6 +23,8 @@ import ImageRegistryController from '@controllers/ImageRegistry'; import GitopsController from '@controllers/Gitops'; import AccountSettingsController from '@controllers/AccountSettings'; import ProjectMembersView from '@views/ProjectMembers'; +import ChaosProbesController from '@controllers/ChaosProbes'; +import ChaosProbeController from '@controllers/ChaosProbe'; const experimentID = ':experimentID'; const runID = ':runID'; @@ -33,6 +35,7 @@ const environmentID = ':environmentID'; const chaosInfrastructureID = ':chaosInfrastructureID'; const experimentKey = ':experimentKey'; const notifyID = ':notifyID'; +const probeName = ':probeName'; export function RoutesWithAuthentication(): React.ReactElement { const projectMatchPaths = useRouteDefinitionsMatch(); @@ -110,6 +113,8 @@ export function RoutesWithAuthentication(): React.ReactElement { path={projectMatchPaths.toKubernetesChaosInfrastructureDetails({ environmentID, chaosInfrastructureID })} component={KubernetesChaosInfrastructureDetailsController} /> + + {/* Project */} diff --git a/chaoscenter/web/src/services/experiment/ExperimentYamlService.ts b/chaoscenter/web/src/services/experiment/ExperimentYamlService.ts index bf87add362a..c9b6f5a2693 100644 --- a/chaoscenter/web/src/services/experiment/ExperimentYamlService.ts +++ b/chaoscenter/web/src/services/experiment/ExperimentYamlService.ts @@ -8,7 +8,7 @@ import { ImageRegistry } from '@db'; import type { ExperimentManifest, FaultData, FaultTunables, ProbeAttributes } from '@models'; -import { ExecutionData, Weightages, Node, ExperimentType } from '@api/entities'; +import { ExecutionData, Weightages, Node, ExperimentType, ProbeObj } from '@api/entities'; import type { PipelineGraphState } from '@components/PipelineDiagram/types'; export interface PreProcessChaosExperiment { @@ -171,7 +171,12 @@ export abstract class ExperimentYamlService extends ChaosIDB { preProcessExperimentManifestDetails: PreProcessChaosExperiment ): ExperimentManifest; - abstract extractProbeDetails( + abstract extractResilienceProbeDetails( + manifest: ExperimentManifest | undefined, + faultName: string + ): ProbeObj[] | undefined; + + abstract extractDeprecatedProbeDetails( manifest: ExperimentManifest | undefined, faultName: string ): ProbeAttributes[] | undefined; @@ -198,4 +203,10 @@ export abstract class ExperimentYamlService extends ChaosIDB { faultData: FaultData | undefined, faultTunables: FaultTunables | undefined ): FaultData | undefined; + + abstract doesProbeNameExist( + key: ChaosObjectStoresPrimaryKeys['experiments'], + faultName: string | undefined, + probeName: string | undefined + ): Promise; } diff --git a/chaoscenter/web/src/services/experiment/KubernetesYamlService.ts b/chaoscenter/web/src/services/experiment/KubernetesYamlService.ts index 6ba6ecbea6d..8de83821c4b 100644 --- a/chaoscenter/web/src/services/experiment/KubernetesYamlService.ts +++ b/chaoscenter/web/src/services/experiment/KubernetesYamlService.ts @@ -17,7 +17,7 @@ import { WorkflowToleration } from '@models'; import { yamlStringify } from '@utils'; -import { Weightages, InfrastructureType } from '@api/entities'; +import { Weightages, InfrastructureType, ProbeObj } from '@api/entities'; import type { PipelineGraphState } from '@components/PipelineDiagram/types'; import ExperimentFactory from './ExperimentFactory'; import { ExperimentYamlService, GetFaultTunablesOperation, PreProcessChaosExperiment } from './ExperimentYamlService'; @@ -74,7 +74,6 @@ export class KubernetesYamlService extends ExperimentYamlService { }); const [updatedChaosEngine] = this.postProcessChaosEngineManifest(engineCR, faultName); - const imageRegistry = experiment?.imageRegistry?.repo ?? 'chaosnative'; // Add engine to the templates templates?.push({ @@ -97,7 +96,7 @@ export class KubernetesYamlService extends ExperimentYamlService { }, container: { name: '', - image: `${imageRegistry}/litmus-checker:2.11.0`, + image: `docker.io/litmuschaos/litmus-checker:2.11.0`, args: [`-file=/tmp/chaosengine-${faultName}.yaml`, '-saveName=/tmp/engine-name'] } }); @@ -177,7 +176,7 @@ export class KubernetesYamlService extends ExperimentYamlService { async updateExperimentManifestWithFaultData( key: ChaosObjectStoresPrimaryKeys['experiments'], - { faultName, engineCR }: FaultData + { faultName, faultCR, engineCR, probes }: FaultData ): Promise { try { const tx = (await this.db).transaction(ChaosObjectStoreNameMap.EXPERIMENTS, 'readwrite'); @@ -187,17 +186,29 @@ export class KubernetesYamlService extends ExperimentYamlService { experiment.unsavedChanges = true; const [templates] = this.getTemplatesAndSteps(experiment?.manifest as KubernetesExperimentManifest); - const imageRegistry = experiment?.imageRegistry?.repo ?? 'chaosnative'; - // Remove engine from the templates let index = 0; let expWeight = '10'; templates?.map((template, i) => { + if (template.name === 'install-chaos-faults') { + template.inputs?.artifacts?.map(artifact => { + if (artifact.name === faultName) { + artifact.raw = { + data: yamlStringify(faultCR) + }; + } + }); + } if (template.name === faultName) { index = i; expWeight = template.metadata?.labels?.weight ?? '10'; } }); + + if (engineCR?.metadata?.annotations) { + engineCR.metadata.annotations.probeRef = JSON.stringify(probes); + } + // Add engine to the templates templates?.splice(index, 1, { name: faultName, @@ -219,7 +230,7 @@ export class KubernetesYamlService extends ExperimentYamlService { }, container: { name: '', - image: `${imageRegistry}/litmus-checker:2.11.0`, + image: `docker.io/litmuschaos/litmus-checker:2.11.0`, args: [`-file=/tmp/chaosengine-${faultName}.yaml`, '-saveName=/tmp/engine-name'] } }); @@ -515,6 +526,65 @@ export class KubernetesYamlService extends ExperimentYamlService { return [manifest]; } + checkProbesInExperimentManifest(manifest: KubernetesExperimentManifest | undefined): string | undefined { + const [templates] = this.getTemplatesAndSteps(manifest); + let name = undefined; + + templates?.map(template => { + if (template.inputs?.artifacts?.[0].raw?.data) { + const chaosEngineCR = parse(template.inputs.artifacts[0].raw.data ?? '') as ChaosEngine; + if (chaosEngineCR.kind === 'ChaosEngine') { + if (chaosEngineCR.metadata?.annotations === undefined) { + name = template.inputs.artifacts[0].name; + } else if ( + chaosEngineCR.metadata?.annotations && + chaosEngineCR.metadata?.annotations.probeRef === undefined + ) { + name = template.inputs.artifacts[0].name; + } + } + } + }); + + return name; + } + + doesProbeMetadataExists(manifest: KubernetesExperimentManifest | undefined): boolean { + const [templates] = this.getTemplatesAndSteps(manifest); + let doesProbeExists = false; + + templates?.map(template => { + if (template.inputs?.artifacts?.[0].raw?.data) { + const chaosEngineCR = parse(template.inputs.artifacts[0].raw.data ?? '') as ChaosEngine; + if (chaosEngineCR.kind === 'ChaosEngine') { + if (chaosEngineCR.spec?.experiments[0].spec.probe !== undefined) { + doesProbeExists = true; + } + } + } + }); + + return doesProbeExists; + } + + _probesInExperimentManifest(manifest: KubernetesExperimentManifest | undefined): string[] | undefined { + const [templates] = this.getTemplatesAndSteps(manifest); + const probes: string[] = []; + + templates?.map(template => { + if (template.inputs?.artifacts?.[0].raw?.data) { + const chaosEngineCR = parse(template.inputs.artifacts[0].raw.data ?? '') as ChaosEngine; + if (chaosEngineCR.kind === 'ChaosEngine') { + JSON.parse(chaosEngineCR.metadata!.annotations!.probeRef).map((probeObj: ProbeObj) => + probes.push(probeObj.name) + ); + } + } + }); + + return probes; + } + extractChaosFaultsWithWeights(manifest: KubernetesExperimentManifest | undefined): Weightages[] { const allFaults: Weightages[] = []; @@ -583,6 +653,26 @@ export class KubernetesYamlService extends ExperimentYamlService { return graphData; } + extractDeprecatedProbeDetails( + manifest: KubernetesExperimentManifest | undefined, + faultName: string + ): ProbeAttributes[] | undefined { + const [templates] = this.getTemplatesAndSteps(manifest); + + let probes: ProbeAttributes[] | undefined; + + templates?.map(template => { + if (template.name === faultName) { + if (!template.inputs?.artifacts?.[0].raw?.data) return; + + const chaosEngine = parse(template.inputs.artifacts[0].raw.data) as ChaosEngine; + probes = chaosEngine.spec?.experiments?.[0].spec.probe; + } + }); + + return probes; + } + getFaultData(manifest: KubernetesExperimentManifest | undefined, faultName: string): FaultData | undefined { if (!manifest) return; @@ -606,8 +696,17 @@ export class KubernetesYamlService extends ExperimentYamlService { // Get ChaosEngine CR form template templates?.map(template => { if (template.name === faultName) { - if (template.inputs?.artifacts?.[0].raw?.data) - faultData['engineCR'] = parse(template.inputs.artifacts[0].raw.data) as ChaosEngine; + if (template.inputs?.artifacts?.[0].raw?.data) { + const chaosEngine = parse(template.inputs.artifacts[0].raw.data) as ChaosEngine; + faultData['engineCR'] = chaosEngine; + + // Get probe details from manifest + const probeRef = chaosEngine.metadata?.annotations?.probeRef; + if (probeRef && probeRef !== '') { + faultData.probes = JSON.parse(probeRef) as ProbeObj[]; + } + } + //Get Fault Weight from template if (template.metadata?.labels?.['weight']) faultData['weight'] = parseInt(template.metadata.labels['weight']); } @@ -648,37 +747,58 @@ export class KubernetesYamlService extends ExperimentYamlService { return faultTunables; } - extractProbeDetails( + extractResilienceProbeDetails( manifest: KubernetesExperimentManifest | undefined, faultName: string - ): ProbeAttributes[] | undefined { + ): ProbeObj[] | undefined { const [templates] = this.getTemplatesAndSteps(manifest); - let probes; + let probes: ProbeObj[] | undefined; templates?.map(template => { if (template.name === faultName) { if (!template.inputs?.artifacts?.[0].raw?.data) return; const chaosEngine = parse(template.inputs.artifacts[0].raw.data) as ChaosEngine; - probes = chaosEngine.spec?.experiments?.[0].spec.probe; + + if (chaosEngine.metadata?.annotations?.probeRef) + probes = JSON.parse(chaosEngine.metadata?.annotations?.probeRef) as ProbeObj[]; } }); return probes; } - doesProbeNameExist(manifest: ChaosEngine | undefined, probeName: string): boolean { - if (!manifest) return false; + async doesProbeNameExist( + key: ChaosObjectStoresPrimaryKeys['experiments'], + faultName: string | undefined, + probeName: string | undefined + ): Promise { + try { + const tx = (await this.db).transaction(ChaosObjectStoreNameMap.EXPERIMENTS, 'readwrite'); + const store = tx.objectStore(ChaosObjectStoreNameMap.EXPERIMENTS); + const experiment = await store.get(key); + if (!experiment || !probeName || !faultName) return false; - let exists = false; - manifest.spec?.experiments?.[0].spec.probe?.map(probe => { - if (probe.name === probeName) exists = true; - }); + const manifest = experiment?.manifest as KubernetesExperimentManifest; + const [templates, ,] = this.getTemplatesAndSteps(manifest); - return exists; - } + templates?.map(template => { + if (template.name === faultName) { + const engineManifest = parse(template.inputs?.artifacts?.[0].raw?.data ?? '') as ChaosEngine; + engineManifest.spec?.experiments?.[0].spec.probe?.map(probe => { + if (probe.name === probeName) return true; + }); + } + }); + await tx.done; + return false; + } catch (_) { + this.handleIDBFailure(); + return false; + } + } doesNodeSelectorExist(manifest: KubernetesExperimentManifest | undefined): [boolean, { key: string; value: string }] { if (!manifest) return [false, { key: '', value: '' }]; @@ -737,6 +857,124 @@ export class KubernetesYamlService extends ExperimentYamlService { return faultData; } + async preProcessChaosEngineAndExperimentManifest( + key: ChaosObjectStoresPrimaryKeys['experiments'], + chaosEngine: ChaosEngine, + chaosExperiment: ChaosExperiment + ): Promise<{ chaosEngine: ChaosEngine; chaosExperiment: ChaosExperiment } | undefined> { + try { + const experiment = await (await this.db).get(ChaosObjectStoreNameMap.EXPERIMENTS, key); + const experimentImagePullSecrets = experiment?.imageRegistry?.secret + ? { + experimentImagePullSecrets: [{ name: experiment.imageRegistry.secret }] + } + : undefined; + + const metadata = chaosEngine.metadata; + if (metadata) { + metadata.namespace = '{{workflow.parameters.adminModeNamespace}}'; + metadata['labels'] = { + workflow_run_id: '{{ workflow.uid }}' + }; + metadata.annotations = { + probeRef: '' + }; + } + + const engineSpec = chaosEngine.spec; + const experimentSpec = chaosExperiment.spec; + + if (engineSpec) { + engineSpec['chaosServiceAccount'] = 'litmus-admin'; + + engineSpec.experiments[0].spec.components = { + ...engineSpec.experiments[0].spec.components, + + env: [...(experimentSpec?.definition.env ?? [])], + ...experimentImagePullSecrets + }; + + if (experiment?.imageRegistry?.secret) { + engineSpec.components = { + runner: { + ...engineSpec.components?.runner, + imagePullSecrets: [{ name: experiment.imageRegistry.secret }] + } + }; + } + + const annotationDetails = this.doesAnnotationExist(experiment?.manifest as KubernetesExperimentManifest); + + if (annotationDetails[0]) { + const updatedEngineCR = this.updateAnnotationsInChaosEngine(chaosEngine, annotationDetails[1], false); + if (updatedEngineCR) { + chaosEngine = updatedEngineCR; + } + } + } + + // if (experimentSpec) { + // experimentSpec.definition = { + // ...experimentSpec.definition, + // image: imageName + // }; + // } + + return { chaosEngine, chaosExperiment }; + } catch (_) { + this.handleIDBFailure(); + } + } + + private updateAnnotationsInChaosEngine( + manifest: ChaosEngine | undefined, + annotations: { [key: string]: string }, + remove: boolean + ): ChaosEngine | undefined { + if (!manifest?.spec) return; + + if (remove) { + Object.entries(annotations).forEach(([key, _]) => { + if (manifest.spec?.components?.runner?.runnerAnnotation) + delete manifest.spec?.components?.runner?.runnerAnnotation[key]; + if (manifest.spec?.experiments[0].spec.components?.experimentAnnotations) + delete manifest.spec.experiments[0].spec.components?.experimentAnnotations[key]; + }); + return manifest; + } + + manifest.spec.components = { + ...manifest.spec.components, + runner: { + runnerAnnotation: { + ...annotations + } + } + }; + manifest.spec.experiments[0].spec.components = { + ...manifest.spec.experiments[0].spec.components, + experimentAnnotations: { + ...annotations + } + }; + + return manifest; + } + + doesAnnotationExist(manifest: KubernetesExperimentManifest | undefined): [boolean, { [key: string]: string }] { + let annotations: { [key: string]: string } = {}; + if (!manifest) return [false, {}]; + + let exists = false; + const [, , spec] = this.getTemplatesAndSteps(manifest); + + if (spec && spec.podMetadata?.annotations && Object.keys(spec.podMetadata?.annotations).length) { + exists = true; + annotations = spec.podMetadata.annotations; + } + return [exists, annotations]; + } + async preProcessChaosEngineManifest( key: ChaosObjectStoresPrimaryKeys['experiments'], chaosEngine: ChaosEngine, diff --git a/chaoscenter/web/src/strings/strings.en.yaml b/chaoscenter/web/src/strings/strings.en.yaml index 4c598de0ab2..efdb4333d13 100644 --- a/chaoscenter/web/src/strings/strings.en.yaml +++ b/chaoscenter/web/src/strings/strings.en.yaml @@ -26,11 +26,16 @@ actualResilienceScore: Actual Resilience Score add: Add addExperimentToChaosHub: Add Experiment to ChaosHub addNewCluster: Add new cluster (Coming soon!) +addNewCustomizedProbes: Add new customized probes to the fault +addNewProbes: Select or Add new probes addNodeSelectorAgentDeployment: Add NodeSelector in Chaos Infrastructure deployment +addOrClick: Add a probe, or click on a probe to view its details addProbe: Add Probe addResilienceStep: Add Resilience Step addRow: Add Row +addSystemProbe: Add a System Probe addToChaosHub: Add to ChaosHub +addToFault: Add to Fault addToTemplate: Add to Template addTolerationAgentDeployment: Add Toleration in Chaos Infrastructure deployment addViewSummaryNotes: Add/View Summary Notes @@ -39,6 +44,7 @@ advanced: Advanced (Optional) advancedOptions: Advanced Options all: All allChaosEnabled: All Chaos Enabled Infrastructures +allExecutions: All Executions allFaultsExecuted: All your faults executed without any issue allRuns: All Runs alreadyExists: '{{value}} already exists' @@ -51,6 +57,7 @@ apply: Apply applyChanges: Apply Changes at: At atAGlance: At a Glance +attempt: Attempt authentication: Authentication authenticationType: Authentication Type averageResilienceScore: Average Resilience Score @@ -116,6 +123,7 @@ checkStatus: Check the status of your Chaos Infrastructure on your cluster chooseAccessType: Choose Access Type chooseAuthenticationType: Choose Authentication Type chooseHubAccess: Choose Hub Access +chooseProbeMode: Choose Mode for probe to be executed clickDownload: >- Click on the “Download” button below to download the YML file to a machine where you have kubectl installed and have access to your Kubernetes cluster. @@ -245,6 +253,7 @@ disableUser: Disable User disableUserDescription: Are you sure you want to disable this user? discard: Discard discardExperiment: Are you sure you want to discard the current experiment? +discardProbeConfiguration: Discard all probe configurations which are currently entered? disconnectDescriptionClusterMode: Disable Chaos for this cluster. disconnectDescriptionNamespaceMode: Disable Chaos for this namespace. disconnected: Disconnected @@ -314,11 +323,13 @@ environments: Environments error: Error errorApplyChanges: Error in Applying the Changes. Please enter correct input values. errorFetchName: Error in fetching the name. +evaluationTimeout: Evaluation timeout executedBy: Executed by executedOn: Executed on executionDetails: Execution details goes here executionError: Execution Error executionHistory: Execution History +executionID: Execution ID executionOverview: Execution Overview executionStatus: Execution Status exhausted: Exhausted @@ -416,6 +427,7 @@ hubEditedSuccessfully: Hub Edited Successfully hubName: Hub Name hubRepositoryBranch: Hub Repository Branch hubRepositoryURL: Repository URL +hypothesis: hypothesis id: ID idlowerCase: id imageRegistry: Image Registry @@ -438,6 +450,7 @@ infrastructureRegistered: >- Environment -> Infrastructure list. infrastructureStates: Learn more about the states of Infrastructure infrastructureType: Infrastructure type +initialDelay: Initial Delay initialDelaySeconds: Initial Delay Seconds insecureSkipVerify: Insecure skip verify installYaml: Install Chaos Infrastructure using YML @@ -515,6 +528,7 @@ manifestDownloadUnsuccessful: Manifest download is unavailable! manifestMissing: Manifest is missing! Please check your ChaosHub. manual: Manual manualInterruption: Manual Interruption needed +manually: '| Manually' markRunAsComplete: Mark Run as Complete markRunAsCompleteDescription: This will mark the run as complete and you will no longer be able to re-run. meetsExpectations: The resilience score has met the expectation. @@ -593,6 +607,7 @@ noData: title: No Data Found noDataCV: No Data noDataToDisplay: No data to display +noDescriptionProvided: No description provided noExpFound: No Predefined Chaos Experiments found using this Fault. noExperimentFoundMatchingSearch: No experiment found matching your search noExperimentSelected: No experiment selected @@ -615,6 +630,12 @@ noProbeDescription: >- Chaos Fault. The experiment pods execute these checks based on the mode they are defined in & factor their success as necessary conditions in determining the verdict of the experiment +noProbeExecution: No Probe executions found +noProbeExecutionDetails: + subtitle: >- + Probes are pluggable checks that can be defined within the ChaosEngine for + any Chaos Experiment + title: There are no executions for the selected probe in your project noProbes: No probes configured noProbesAvailable: No Probes available for this node noProbesFound: @@ -647,6 +668,7 @@ notMeetsExpectations: The resilience score didn't meet the expectation. notMeetsExpectationsInterventionNeeded: >- The resilience score did not meet the expectation. It needs the manual intervention. +notStarted: NOT STARTED notes: Notes numberOfExperiments: Number of Experiments objective: Objective @@ -689,22 +711,48 @@ phase: Phase platform: Platform pleaseComplete: Please complete all the steps pleaseSelectLeastOneExperiment: Please select at least one experiment +pleaseSpecifyYAMLValues: Please specify the values in the YAML script points: point(s) pollingInterval: Polling Interval preProd: Pre-Prod predefinedExperimentsNotFound: No Predefined Experiments found in this hub preview: Preview private: Private +probeAddedSuccessfully: Probe added successfully, please apply changes before closing probeConfiguration: Probe Configuration probeDetails: Probe Details +probeExecutionPreview: PROBE EXECUTION PREVIEW +probeInFault: Probe in fault +probeMetadataExists: >- + Probe metadata already exists in the experiment manifest, recommended to use + probe annotations instead otherwise you won't get any analytics probeMode: Probe Mode +probeModeAlreadyExists: is already present with the same mode probeModes: Continuous: Continuous + ContinuousDesc: >- + The probe is executed continuously, with a specified polling interval during + the chaos injection. EOT: EOT + EOTDesc: >- + The probe will check hypothesis at the End of the Test as a as a post-chaos + check. + EOTVerbose: End of Test (EOT) Edge: Edge + EdgeDesc: The probe will check hypothesis both before and after the Test. OnChaos: OnChaos + OnChaosDesc: >- + The probe is executed continuously, with a specified polling interval + strictly for chaos duration of chaos SOT: SOT + SOTDesc: >- + The probe will check hypothesis at the Start of the Test as a as a pre-chaos + check. + SOTVerbose: Start of Test (SOT) probeName: Probe Name +probeNotAttachedToRef: >- + is not attached to a proper reference, please add it to annotations as + probeRef probeOverview: Probe Overview probePassedSuccessfully: Probe passed successfully probeProperties: Probe Properties @@ -721,9 +769,10 @@ probeTypes: k8sProbe: K8S Probe promProbe: Prometheus Probe probeValidation: - body: POST body is a required field + accountIdentifier: Account identifier is a required field + apiTokenSecret: API Token Secret is a required field + apiTokenSecretName: API Token Secret Name is a required field command: Probe command is a required field - contentType: Content Type is a required field criteria: Comparator criteria is a required field endpoint: Probe endpoint is a required field getCriteria: GET Criteria is a required field @@ -731,17 +780,19 @@ probeValidation: interval: Probe interval is a required field method: Probe method is a required field name: Probe Name is a required field - namespace: Probe namespace is a required field - pollingInterval: Probe polling interval is a required field + operation: Probe operation is a required field + orgIdentifier: Organization identifier is a required field + platformEndpoint: Platform endpoint is a required field postCriteria: POST Criteria is a required field postResponseCode: POST Response Code is a required field - query: Probe query is a required field - responseTimeout: Probe response timeout is a required field - retry: Retry is a required field + projectIdentifier: Project identifier is a required field + resource: Probe resource is a required field + timeFrame: Time Frame is a required field timeout: Probe timeout is a required field type: Comparator type is a required field url: URL is a required field value: Comparator value is a required field + version: Probe version is a required field probes: Probes probesArePassed: probes are passed prod: Prod @@ -871,6 +922,7 @@ seeAllChaosHubs: See All ChaosHubs seeAllChaosInfrastructures: See All Infrastructures seeAllEnvironments: See All Environments seeAllFaults: See All Faults +selectAProbe: Select a Probe selectAppKind: Select App Kind selectAppLabel: Select App Label selectAppNamespace: Select App Namespace @@ -890,6 +942,7 @@ selectTimeframe: Select time frame selectYourProbe: Select your chaos probe selectYourProbeType: Select your probe type selectedExperiments: Selected Experiments +selectedProbe: Selected Probe sequence: Sequence serviceAccount: Service Account serviceAccountName: Service Account Name @@ -908,6 +961,10 @@ showingLastRuns: Showing last 50 runs only signOut: Sign Out singleRun: Single Run source: Source +sourceModeDesction: >- + Source mode is where the command execution is carried out from within a new + pod whose image is specified. This is preferred when application-specific + binaries are required. specificNamespaceAccess: Specific namespace access ssh: SSH sshKey: SSH Key @@ -943,6 +1000,7 @@ success: Success successSummary: Success Summary suggestion1: Here is what you can do summary: Summary +supportedFaultTypes: 'Supported fault types:' switchToBarChart: Switch to bar chart switchToLineChart: Switch to line chart syncLatestRun: Sync Latest Run @@ -960,9 +1018,12 @@ templateFromProjectDescription: Use experiments available in your Project templateFromProjectTitle: Templates from Project testConnection: Test Connection testSuccess: Chaos Infrastructure connection validated successfully +testYour1: Test your +testYour2: of the experiment against the result testingConnection: Testing Chaos Infrastructure Connection thisExperimentHasNoRuns: This experiment has no runs yet timeout: Timeout +toBeDefined: (To be defined) toleration: effectPlaceholder: Enter effect keyPlaceholder: Enter key diff --git a/chaoscenter/web/src/strings/types.ts b/chaoscenter/web/src/strings/types.ts index 642912a7d59..27e6ac7054b 100644 --- a/chaoscenter/web/src/strings/types.ts +++ b/chaoscenter/web/src/strings/types.ts @@ -29,11 +29,16 @@ export interface StringsMap { 'add': unknown 'addExperimentToChaosHub': unknown 'addNewCluster': unknown + 'addNewCustomizedProbes': unknown + 'addNewProbes': unknown 'addNodeSelectorAgentDeployment': unknown + 'addOrClick': unknown 'addProbe': unknown 'addResilienceStep': unknown 'addRow': unknown + 'addSystemProbe': unknown 'addToChaosHub': unknown + 'addToFault': unknown 'addToTemplate': unknown 'addTolerationAgentDeployment': unknown 'addViewSummaryNotes': unknown @@ -42,6 +47,7 @@ export interface StringsMap { 'advancedOptions': unknown 'all': unknown 'allChaosEnabled': unknown + 'allExecutions': unknown 'allFaultsExecuted': unknown 'allRuns': unknown 'alreadyExists': PrimitiveObject<'value'> @@ -54,6 +60,7 @@ export interface StringsMap { 'applyChanges': unknown 'at': unknown 'atAGlance': unknown + 'attempt': unknown 'authentication': unknown 'authenticationType': unknown 'averageResilienceScore': unknown @@ -111,6 +118,7 @@ export interface StringsMap { 'chooseAccessType': unknown 'chooseAuthenticationType': unknown 'chooseHubAccess': unknown + 'chooseProbeMode': unknown 'clickDownload': unknown 'clone': unknown 'cloneExperiment': unknown @@ -204,6 +212,7 @@ export interface StringsMap { 'disableUserDescription': unknown 'discard': unknown 'discardExperiment': unknown + 'discardProbeConfiguration': unknown 'disconnectDescriptionClusterMode': unknown 'disconnectDescriptionNamespaceMode': unknown 'disconnected': unknown @@ -265,11 +274,13 @@ export interface StringsMap { 'error': unknown 'errorApplyChanges': unknown 'errorFetchName': unknown + 'evaluationTimeout': unknown 'executedBy': unknown 'executedOn': unknown 'executionDetails': unknown 'executionError': unknown 'executionHistory': unknown + 'executionID': unknown 'executionOverview': unknown 'executionStatus': unknown 'exhausted': unknown @@ -348,6 +359,7 @@ export interface StringsMap { 'hubName': unknown 'hubRepositoryBranch': unknown 'hubRepositoryURL': unknown + 'hypothesis': unknown 'id': unknown 'idlowerCase': unknown 'imageRegistry': unknown @@ -363,6 +375,7 @@ export interface StringsMap { 'infrastructureRegistered': unknown 'infrastructureStates': unknown 'infrastructureType': unknown + 'initialDelay': unknown 'initialDelaySeconds': unknown 'insecureSkipVerify': unknown 'installYaml': unknown @@ -426,6 +439,7 @@ export interface StringsMap { 'manifestMissing': unknown 'manual': unknown 'manualInterruption': unknown + 'manually': unknown 'markRunAsComplete': unknown 'markRunAsCompleteDescription': unknown 'meetsExpectations': unknown @@ -491,6 +505,7 @@ export interface StringsMap { 'noData.title': unknown 'noDataCV': unknown 'noDataToDisplay': unknown + 'noDescriptionProvided': unknown 'noExpFound': unknown 'noExperimentFoundMatchingSearch': unknown 'noExperimentSelected': unknown @@ -506,6 +521,9 @@ export interface StringsMap { 'noLogs': unknown 'noMonitoredService': unknown 'noProbeDescription': unknown + 'noProbeExecution': unknown + 'noProbeExecutionDetails.subtitle': unknown + 'noProbeExecutionDetails.title': unknown 'noProbes': unknown 'noProbesAvailable': unknown 'noProbesFound.errorMessage': unknown @@ -529,6 +547,7 @@ export interface StringsMap { 'nonProd': unknown 'notMeetsExpectations': unknown 'notMeetsExpectationsInterventionNeeded': unknown + 'notStarted': unknown 'notes': unknown 'numberOfExperiments': unknown 'objective': unknown @@ -569,21 +588,35 @@ export interface StringsMap { 'platform': unknown 'pleaseComplete': unknown 'pleaseSelectLeastOneExperiment': unknown + 'pleaseSpecifyYAMLValues': unknown 'points': unknown 'pollingInterval': unknown 'preProd': unknown 'predefinedExperimentsNotFound': unknown 'preview': unknown 'private': unknown + 'probeAddedSuccessfully': unknown 'probeConfiguration': unknown 'probeDetails': unknown + 'probeExecutionPreview': unknown + 'probeInFault': unknown + 'probeMetadataExists': unknown 'probeMode': unknown + 'probeModeAlreadyExists': unknown 'probeModes.Continuous': unknown + 'probeModes.ContinuousDesc': unknown 'probeModes.EOT': unknown + 'probeModes.EOTDesc': unknown + 'probeModes.EOTVerbose': unknown 'probeModes.Edge': unknown + 'probeModes.EdgeDesc': unknown 'probeModes.OnChaos': unknown + 'probeModes.OnChaosDesc': unknown 'probeModes.SOT': unknown + 'probeModes.SOTDesc': unknown + 'probeModes.SOTVerbose': unknown 'probeName': unknown + 'probeNotAttachedToRef': unknown 'probeOverview': unknown 'probePassedSuccessfully': unknown 'probeProperties': unknown @@ -598,9 +631,10 @@ export interface StringsMap { 'probeTypes.httpProbe': unknown 'probeTypes.k8sProbe': unknown 'probeTypes.promProbe': unknown - 'probeValidation.body': unknown + 'probeValidation.accountIdentifier': unknown + 'probeValidation.apiTokenSecret': unknown + 'probeValidation.apiTokenSecretName': unknown 'probeValidation.command': unknown - 'probeValidation.contentType': unknown 'probeValidation.criteria': unknown 'probeValidation.endpoint': unknown 'probeValidation.getCriteria': unknown @@ -608,17 +642,19 @@ export interface StringsMap { 'probeValidation.interval': unknown 'probeValidation.method': unknown 'probeValidation.name': unknown - 'probeValidation.namespace': unknown - 'probeValidation.pollingInterval': unknown + 'probeValidation.operation': unknown + 'probeValidation.orgIdentifier': unknown + 'probeValidation.platformEndpoint': unknown 'probeValidation.postCriteria': unknown 'probeValidation.postResponseCode': unknown - 'probeValidation.query': unknown - 'probeValidation.responseTimeout': unknown - 'probeValidation.retry': unknown + 'probeValidation.projectIdentifier': unknown + 'probeValidation.resource': unknown + 'probeValidation.timeFrame': unknown 'probeValidation.timeout': unknown 'probeValidation.type': unknown 'probeValidation.url': unknown 'probeValidation.value': unknown + 'probeValidation.version': unknown 'probes': unknown 'probesArePassed': unknown 'prod': unknown @@ -734,6 +770,7 @@ export interface StringsMap { 'seeAllChaosInfrastructures': unknown 'seeAllEnvironments': unknown 'seeAllFaults': unknown + 'selectAProbe': unknown 'selectAppKind': unknown 'selectAppLabel': unknown 'selectAppNamespace': unknown @@ -753,6 +790,7 @@ export interface StringsMap { 'selectYourProbe': unknown 'selectYourProbeType': unknown 'selectedExperiments': unknown + 'selectedProbe': unknown 'sequence': unknown 'serviceAccount': unknown 'serviceAccountName': unknown @@ -769,6 +807,7 @@ export interface StringsMap { 'signOut': unknown 'singleRun': unknown 'source': unknown + 'sourceModeDesction': unknown 'specificNamespaceAccess': unknown 'ssh': unknown 'sshKey': unknown @@ -802,6 +841,7 @@ export interface StringsMap { 'successSummary': unknown 'suggestion1': unknown 'summary': unknown + 'supportedFaultTypes': unknown 'switchToBarChart': unknown 'switchToLineChart': unknown 'syncLatestRun': unknown @@ -817,9 +857,12 @@ export interface StringsMap { 'templateFromProjectTitle': unknown 'testConnection': unknown 'testSuccess': unknown + 'testYour1': unknown + 'testYour2': unknown 'testingConnection': unknown 'thisExperimentHasNoRuns': unknown 'timeout': unknown + 'toBeDefined': unknown 'toleration.effectPlaceholder': unknown 'toleration.keyPlaceholder': unknown 'toleration.operatorPlaceholder': unknown diff --git a/chaoscenter/web/src/utils/data.ts b/chaoscenter/web/src/utils/data.ts index 82b66f3f037..f8286b8acfc 100644 --- a/chaoscenter/web/src/utils/data.ts +++ b/chaoscenter/web/src/utils/data.ts @@ -3,6 +3,9 @@ * @remarks Use this only and only when when the apollo response is used directly/stringified or put into idb */ +import type { YamlSanityConfig } from '@components/YAMLBuilder/YAMLBuilderProps'; +import { DEFAULT_SANITY_CONFIG } from './JSONUtils'; + export function cleanApolloResponse(responseWithTypeName: object): object { return JSON.parse( JSON.stringify(responseWithTypeName, (name, val) => { @@ -14,3 +17,44 @@ export function cleanApolloResponse(responseWithTypeName: object): object { }) ); } + +export const sanitize = (obj: Record, sanityConfig?: YamlSanityConfig): Record => { + const { removeEmptyString, removeEmptyArray, removeEmptyObject } = { + ...DEFAULT_SANITY_CONFIG, + ...sanityConfig + }; + for (const key in obj) { + if (obj[key] === null || obj[key] === undefined) { + delete obj[key]; + } else if (removeEmptyString && obj[key] === '') { + delete obj[key]; + } else if (Object.prototype.toString.call(obj[key]) === '[object Object]') { + if (removeEmptyObject && Object.keys(obj[key]).length === 0) { + delete obj[key]; + } else { + sanitize(obj[key], sanityConfig); + } + } else if (Array.isArray(obj[key])) { + if (removeEmptyArray && obj[key].length == 0) { + delete obj[key]; + } else { + sanitize(obj[key], sanityConfig); + } + } + } + return obj; +}; + +export const destructure = (nestedObject: any): Record => { + const flattenedObject: Record = {}; + for (const key in nestedObject) { + const value = nestedObject[key]; + const type = typeof value; + if (['string', 'boolean'].includes(type) || (type === 'number' && !isNaN(value))) { + flattenedObject[key] = value; + } else if (type === 'object') { + Object.assign(flattenedObject, destructure(value)); + } + } + return flattenedObject; +}; diff --git a/chaoscenter/web/src/utils/getPropsBasedOnStatus.tsx b/chaoscenter/web/src/utils/getPropsBasedOnStatus.tsx index 8a7e4113ac8..0d46e432d31 100644 --- a/chaoscenter/web/src/utils/getPropsBasedOnStatus.tsx +++ b/chaoscenter/web/src/utils/getPropsBasedOnStatus.tsx @@ -143,16 +143,22 @@ export function getPropsBasedOnProbeStatus(status: Status): StatusProps { case FaultProbeStatus.PASSED: return { color: Color.GREEN_700, + iconName: 'execution-success', + iconSize: 14, bgColor: `var(--green-50)` }; case FaultProbeStatus.FAILED: return { color: Color.RED_700, + iconName: 'execution-warning', + iconSize: 14, bgColor: `var(--red-50)` }; case FaultProbeStatus.AWAITED: return { color: Color.YELLOW_700, + iconSize: 14, + iconColor: 'execution-waiting', bgColor: `var(--yellow-100)` }; default: diff --git a/chaoscenter/web/src/utils/index.ts b/chaoscenter/web/src/utils/index.ts index 96ea60b67a7..db0515b703f 100644 --- a/chaoscenter/web/src/utils/index.ts +++ b/chaoscenter/web/src/utils/index.ts @@ -1,5 +1,6 @@ export * from './cron'; export * from './dates'; +export * from './data'; export * from './getScope'; export * from './getFormattedFileName'; export * from './strings'; @@ -8,7 +9,6 @@ export * from './userDetails'; export * from './fileUpload'; export * from './transformArgoData'; export * from './colors'; -export * from './destructure'; export * from './probes'; export * from './reactTable'; export * from './getHash'; @@ -20,5 +20,3 @@ export * from './isOnPrem'; export * from './usePermissions'; export * from './setForwardedRef'; export * from './yamlUtils'; -export * from './JSONUtils'; -export * from './data'; diff --git a/chaoscenter/web/src/utils/probes.ts b/chaoscenter/web/src/utils/probes.ts index 0b182479f44..f3b5cae6f12 100644 --- a/chaoscenter/web/src/utils/probes.ts +++ b/chaoscenter/web/src/utils/probes.ts @@ -1,6 +1,14 @@ -import { ChaosData, FaultProbeStatus } from '@api/entities'; -import type { CmdProbeInputs, HTTPProbeInputs, K8sProbeInputs, ProbeAttributes, PromProbeInputs } from '@models'; -import { destructure } from './destructure'; +import type { IconName } from '@harnessio/icons'; +import { ProbeType, ChaosData, FaultProbeStatus, ProbeStatus, Probe, InfrastructureType } from '@api/entities'; +import type { + CmdProbeInputs, + HTTPProbeInputs, + K8sProbeInputs, + NewCmdProbeInputs, + ProbeAttributes, + PromProbeInputs +} from '@models'; +import { destructure } from './data'; export function getProbeDetails(probe: ProbeAttributes): string[][] { const probeDetails: string[][] = []; @@ -16,36 +24,139 @@ export function getProbeDetails(probe: ProbeAttributes): string[][] { return probeDetails; } +export function getProbeDetailsFromParsedProbe(probe: Probe): string[][] { + const probeDetails: string[][] = []; + + let inputs: PromProbeInputs | HTTPProbeInputs | NewCmdProbeInputs | K8sProbeInputs = {}; + + if (probe.type === ProbeType.K8S) + inputs = { + group: probe?.k8sProperties?.group, + version: probe?.k8sProperties?.version ?? '', + resource: probe?.k8sProperties?.resource ?? '', + resourceNames: probe?.k8sProperties?.resourceNames, + namespace: probe?.k8sProperties?.namespace, + fieldSelector: probe?.k8sProperties?.fieldSelector, + labelSelector: probe?.k8sProperties?.labelSelector, + operation: probe?.k8sProperties?.operation ?? '' + }; + if (probe.type === ProbeType.CMD && probe.infrastructureType === InfrastructureType.KUBERNETES) + inputs = { + command: probe.kubernetesCMDProperties?.command, + comparator: probe.kubernetesCMDProperties?.comparator, + source: probe.kubernetesCMDProperties?.source + }; + if (probe.type === ProbeType.HTTP && probe.infrastructureType === InfrastructureType.KUBERNETES) + inputs = { + url: probe.kubernetesHTTPProperties?.url ?? '', + insecureSkipVerify: probe.kubernetesHTTPProperties?.insecureSkipVerify, + method: probe.kubernetesHTTPProperties?.method ?? {} + }; + if (probe.type === ProbeType.PROM) + inputs = { + endpoint: probe?.promProperties?.endpoint, + query: probe?.promProperties?.query, + queryPath: probe?.promProperties?.queryPath, + comparator: probe?.promProperties?.comparator + }; + + Object.entries(destructure(inputs)).forEach(input => { + probeDetails.push([input[0], input[1].toString() !== '' ? input[1].toString() : '-']); + }); + return probeDetails; +} + export function getProbeProperties(probe: ProbeAttributes): string[][] { const probeProperties: string[][] = []; Object.entries(destructure(probe.runProperties)).forEach(property => { const key = property[0]; - const value = - probe.type === 'httpProbe' && property[0] === 'probeTimeout' - ? `${property[1]} ms` - : typeof property[1] != 'boolean' && property[0] !== 'retry' - ? `${property[1]} seconds` - : `${property[1].toString()}`; + const value = property[1].toString(); probeProperties.push([key, value]); }); return probeProperties; } -// export function getIcon(type: ProbeType): IconName { -// switch (type) { -// case ProbeType.HTTP: -// return 'http-probe'; -// case ProbeType.CMD: -// return 'cmd-probe'; -// case ProbeType.PROM: -// return 'service-prometheus'; -// case ProbeType.K8S: -// return 'app-kubernetes'; -// default: -// return 'custom-approval'; -// } -// } +export function getProbePropertiesFromParsedProbe(probe: Probe): string[][] { + const probeProperties: string[][] = []; + + const handleProbeProperties = (property: [string, string]): void => { + // Probe properties include both properties and details + // This if checks only allows properties + if ( + property[0] === 'probeTimeout' || + property[0] === 'interval' || + property[0] === 'attempt' || + property[0] === 'evaluationTimeout' || + property[0] === 'retry' || + property[0] === 'probePollingInterval' || + property[0] === 'initialDelay' || + property[0] === 'stopOnFailure' + ) { + const key = property[0]; + const value = property[1].toString(); + + probeProperties.push([key, value]); + } + }; + + if (probe.type === ProbeType.HTTP && probe.infrastructureType === InfrastructureType.KUBERNETES) + Object.entries(destructure(probe.kubernetesHTTPProperties)).forEach(property => handleProbeProperties(property)); + if (probe.type === ProbeType.CMD && probe.infrastructureType === InfrastructureType.KUBERNETES) + Object.entries(destructure(probe.kubernetesCMDProperties)).forEach(property => handleProbeProperties(property)); + if (probe.type === ProbeType.PROM) + Object.entries(destructure(probe.promProperties)).forEach(property => handleProbeProperties(property)); + if (probe.type === ProbeType.K8S) + Object.entries(destructure(probe.k8sProperties)).forEach(property => handleProbeProperties(property)); + + return probeProperties; +} + +export function getNormalizedProbeName(type: ProbeType): string { + switch (type) { + case ProbeType.HTTP: + return 'HTTP'; + case ProbeType.CMD: + return 'Command'; + case ProbeType.PROM: + return 'Prometheus'; + case ProbeType.K8S: + return 'Kubernetes'; + } +} + +export function getIcon(type: ProbeType): IconName { + switch (type) { + case ProbeType.HTTP: + return 'http-probe'; + case ProbeType.CMD: + return 'cmd-probe'; + default: + return 'custom-approval'; + } +} + +export function getInfraIcon(type: InfrastructureType): IconName { + switch (type) { + case InfrastructureType.KUBERNETES: + return 'custom-approval'; + } +} + +export function getProbeStatusIcon(status: ProbeStatus): IconName { + switch (status) { + case ProbeStatus.Completed: + return 'check'; + case ProbeStatus.Running: + return 'dry-run'; + case ProbeStatus.Error: + return 'error'; + case ProbeStatus.Queued: + return 'waiting'; + default: + return 'codebase-invalid'; + } +} export function calculateTotalProbeStatusFromChaosData(chaosData?: ChaosData): [number, number, number] { let totalPassedProbeCount = 0; diff --git a/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeInitialTypeContainer.module.scss b/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeInitialTypeContainer.module.scss new file mode 100644 index 00000000000..7fa351d1d21 --- /dev/null +++ b/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeInitialTypeContainer.module.scss @@ -0,0 +1,38 @@ +.card { + position: relative; + background-color: var(--white); + height: 64px; + width: 64px; + box-shadow: 0px 0px 2px rgba(40, 41, 61, 0.04), 0px 4px 8px rgba(96, 97, 112, 0.16); + border-radius: 5px; +} + +.cardSelect { + :global { + .bp3-card { + margin-right: 20px !important; + } + } +} + +.icon { + position: absolute; + left: 50%; + top: 50%; + -webkit-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); +} + +.grid { + display: grid; + grid-template-columns: repeat(4, 80px); + gap: 1rem; +} + +.box { + width: 100%; + height: 100%; + display: flex; + justify-content: center; + padding: var(--spacing-medium); +} diff --git a/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeInitialTypeContainer.module.scss.d.ts b/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeInitialTypeContainer.module.scss.d.ts new file mode 100644 index 00000000000..686fd3682c8 --- /dev/null +++ b/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeInitialTypeContainer.module.scss.d.ts @@ -0,0 +1,13 @@ +declare namespace AddProbeInitialTypeContainerModuleScssNamespace { + export interface IAddProbeInitialTypeContainerModuleScss { + box: string; + card: string; + cardSelect: string; + grid: string; + icon: string; + } +} + +declare const AddProbeInitialTypeContainerModuleScssModule: AddProbeInitialTypeContainerModuleScssNamespace.IAddProbeInitialTypeContainerModuleScss; + +export = AddProbeInitialTypeContainerModuleScssModule; diff --git a/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeInitialTypeContainer.tsx b/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeInitialTypeContainer.tsx new file mode 100644 index 00000000000..333f588f178 --- /dev/null +++ b/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeInitialTypeContainer.tsx @@ -0,0 +1,168 @@ +import React from 'react'; +import { Container, Layout, Text } from '@harnessio/uicore'; +import { Color, FontVariation } from '@harnessio/design-system'; +import { Icon, IconName } from '@harnessio/icons'; +import { InfrastructureType, ProbeType } from '@api/entities'; +import { useStrings } from '@strings'; +import { getIcon, getNormalizedProbeName } from '@utils'; +import k8s from '@images/k8s.svg'; +import prom from '@images/prom.svg'; +import { showDetails } from './ShowDetails'; +import css from './AddProbeInitialTypeContainer.module.scss'; + +interface AddProbeInitialTypeContainerProps { + hideInitialTypeModal: () => void; + openDarkModal: () => void; + infrastructureType: InfrastructureType | undefined; + setInfrastructureType: React.Dispatch>; +} + +interface CardProps { + icon: IconName; + type: ProbeType; + hideInitialTypeModal: () => void; + openDarkModal: () => void; + setHoverType: React.Dispatch>; +} + +function Card({ icon, type, hideInitialTypeModal, openDarkModal, setHoverType }: CardProps): React.ReactElement { + return ( + { + localStorage.setItem('probeType', type); + hideInitialTypeModal(); + openDarkModal(); + }} + onMouseEnter={() => { + setHoverType(type); + }} + width="64px" + > +
+ +
+ + {getNormalizedProbeName(type)} + +
+ ); +} + +function AddProbeInitialTypeContainer({ + hideInitialTypeModal, + openDarkModal, + infrastructureType +}: AddProbeInitialTypeContainerProps): React.ReactElement { + const { getString } = useStrings(); + const [hoverType, setHoverType] = React.useState(); + + return ( + + +
+ + {getString(`selectYourProbeType`)} + + {/* + + {getString('selectChaosInfrastructureType')} + + + data={infrastructureList} + cornerSelected + className={css.cardSelect} + renderItem={infrastructure => ( + + + {infrastructure.type && ( + + )} + + {infrastructure.type} + + + + + {getString('supportedFaultTypes')} + + + {infrastructure.supportedFaults.map(supportedFault => ( + + ))} + + + + )} + selected={infrastructureList.find(item => item.type === infrastructureType)} + onChange={selectedInfra => setInfrastructureType(selectedInfra.type)} + /> + */} + + + {getString(`selectYourProbe`)} + + + + + {infrastructureType === InfrastructureType.KUBERNETES && ( + + prom probe +
+ ) as any + } + type={ProbeType.PROM} + hideInitialTypeModal={hideInitialTypeModal} + openDarkModal={openDarkModal} + setHoverType={setHoverType} + /> + )} + {infrastructureType === InfrastructureType.KUBERNETES && ( + + k8s probe +
+ ) as any + } + type={ProbeType.K8S} + hideInitialTypeModal={hideInitialTypeModal} + openDarkModal={openDarkModal} + setHoverType={setHoverType} + /> + )} + + +
+ + + + {hoverType && showDetails(hoverType, getString)} + + + ); +} + +export default AddProbeInitialTypeContainer; diff --git a/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeModalWizard.module.scss b/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeModalWizard.module.scss new file mode 100644 index 00000000000..8690adb168a --- /dev/null +++ b/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeModalWizard.module.scss @@ -0,0 +1,106 @@ +.wrap { + display: flex; + flex-wrap: wrap; +} + +.horizontalFlex { + gap: 0.25rem; + align-items: center; +} + +.probeWizard { + :global { + .StepWizard--navBarList { + background-color: var(--primary-9) !important; + box-shadow: 0px 2px 4px rgba(40, 41, 61, 0.04), 0px 8px 16px rgba(96, 97, 112, 0.16) !important; + } + + .StepWizard--harnessWatermark { + background-image: none !important; + } + } + + .probeDetailsInnerContainer { + height: 60vh; + overflow: auto !important; + } +} + +.yamlBuilder { + height: 100%; + position: relative; +} + +.yamlBuilderBody { + height: 100%; + border: none; + border-right: 1px solid var(--grey-250) !important; + border-radius: 0px; + > div:first-child { + height: 100%; + padding-bottom: 0 !important; + } + :global { + .react-monaco-editor-container { + overflow: hidden; + height: calc(100%) !important; + } + .margin-view-overlays { + border-right: 1px solid var(--grey-250) !important; + background: var(--primary-bg); + } + } +} + +.repoType { + display: inline-block; + margin-top: 1rem; + padding: 4px 6px; + background: var(--grey-50); + color: var(--primary-9); + border-radius: 4px; + font-size: 10px; + border: 1px solid var(--grey-200); +} + +.card { + width: 350px; + margin: 1rem 0; + margin-right: 1rem; +} + +.cardBody { + width: 300px; + height: 100%; +} + +.menuItem { + cursor: pointer; + padding: 10px !important; + width: 100%; + color: var(--white) !important; + text-decoration: none !important; +} + +.hubStatus { + display: inline-block; + height: 6px; + width: 6px; + border-radius: 999px; + background: #0ab000; +} + +.successMessage { + img { + height: 20px; + width: 20px; + } +} + +.spaceTop { + margin-top: 2rem !important; +} + +.overlayContainer { + height: calc(100vh - 177px); +} diff --git a/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeModalWizard.module.scss.d.ts b/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeModalWizard.module.scss.d.ts new file mode 100644 index 00000000000..dd73c52c881 --- /dev/null +++ b/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeModalWizard.module.scss.d.ts @@ -0,0 +1,22 @@ +declare namespace AddProbeModalWizardModuleScssNamespace { + export interface IAddProbeModalWizardModuleScss { + card: string; + cardBody: string; + horizontalFlex: string; + hubStatus: string; + menuItem: string; + overlayContainer: string; + probeDetailsInnerContainer: string; + probeWizard: string; + repoType: string; + spaceTop: string; + successMessage: string; + wrap: string; + yamlBuilder: string; + yamlBuilderBody: string; + } +} + +declare const AddProbeModalWizardModuleScssModule: AddProbeModalWizardModuleScssNamespace.IAddProbeModalWizardModuleScss; + +export = AddProbeModalWizardModuleScssModule; diff --git a/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeModalWizard.tsx b/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeModalWizard.tsx new file mode 100644 index 00000000000..504036e8f76 --- /dev/null +++ b/chaoscenter/web/src/views/AddProbeModalWizard/AddProbeModalWizard.tsx @@ -0,0 +1,1254 @@ +import React from 'react'; +import { + Button, + ButtonVariation, + FlexExpander, + FormInput, + Layout, + StepWizard, + Container, + Text, + Switch, + SelectOption +} from '@harnessio/uicore'; +import { Form, Formik, FormikProps } from 'formik'; +import * as Yup from 'yup'; +import type { GotoStepArgs } from '@harnessio/uicore/dist/components/StepWizard/StepWizard'; +import type { ApolloError, LazyQueryResult, MutationFunction, QueryLazyOptions } from '@apollo/client'; +import { Color, FontVariation } from '@harnessio/design-system'; +import { noop, omit } from 'lodash-es'; +import { Divider } from '@blueprintjs/core'; +import { parse } from 'yaml'; +import { Icon } from '@harnessio/icons'; +import { getIcon, getScope } from '@utils'; +import { useStrings } from '@strings'; +import NameDescriptionTags from '@components/NameIdDescriptionTags'; +import type { + AddProbeRequest, + AddProbeResponse, + UpdateProbeRequest, + UpdateProbeResponse, + ValidateUniqueProbeRequest, + ValidateUniqueProbeResponse +} from '@api/core'; +import { ProbeType, Probe, InfrastructureType } from '@api/entities'; +import type { CmdProbeInputs, HTTPProbeInputs, K8sProbeInputs, PromProbeInputs, RunProperty } from '@models'; +import Loader from '@components/Loader'; +import YAMLBuilder from '@components/YAMLBuilder'; +import css from './AddProbeModalWizard.module.scss'; + +enum HTTPMethod { + GET = 'get', + POST = 'post' +} + +interface AddProbeModalWizardViewProps { + mutation: { + addKubernetesHTTPProbeMutation?: MutationFunction; + addKubernetesCMDProbeMutation?: MutationFunction; + addPROMProbeMutation?: MutationFunction; + addK8SProbeMutation?: MutationFunction; + updateProbeMutation?: MutationFunction; + }; + infrastructureType: InfrastructureType | undefined; + validateName: ( + options?: QueryLazyOptions | undefined + ) => Promise>; + probeData?: Probe; + loading: boolean; + error: ApolloError | undefined; + isEdit?: boolean; + hideDarkModal?: () => void; +} + +type TypeWithMethodDropdown = T & { + methodDropdown?: HTTPMethod; +}; + +interface AddProbeFormData { + name: string; + description?: string; + tags: string[]; + type: ProbeType | null; + infrastructureType: InfrastructureType | undefined; + kubernetesHTTPProperties: TypeWithMethodDropdown | undefined; + kubernetesCMDProperties: Probe['kubernetesCMDProperties'] | undefined; + promProperties: Probe['promProperties'] | undefined; + k8sProperties: Probe['k8sProperties'] | undefined; +} + +interface StepData { + value?: AddProbeFormData; +} + +interface StepProps { + name?: string | JSX.Element; + // These props will be passed by wizard + subTitle?: string | JSX.Element; + prevStepData?: PrevStepData; + formData: AddProbeFormData; + setFormData: React.Dispatch>; + currentStep?: () => number; + totalSteps?: () => number; + nextStep?: (data?: PrevStepData) => void; + previousStep?: (data?: PrevStepData) => void; + gotoStep?: (args: GotoStepArgs) => boolean; + firstStep?: (data?: PrevStepData) => void; + lastStep?: (data?: PrevStepData) => void; +} + +export let initialValues: AddProbeFormData = { + name: '', + description: '', + tags: [], + type: null, + infrastructureType: undefined, + kubernetesHTTPProperties: undefined, + kubernetesCMDProperties: undefined, + promProperties: undefined, + k8sProperties: undefined +}; + +const OverviewStep: React.FC< + StepProps & Pick +> = props => { + const { getString } = useStrings(); + const scope = getScope(); + const { hideDarkModal, validateName, isEdit } = props; + + // Checks for the type of probe from `ProbeType` and sets the data + const handleClick = (formikProps: FormikProps): void => { + // Stores the current form data + initialValues = { + ...props.formData, + name: formikProps.values.name, + description: formikProps.values.description, + tags: formikProps.values.tags + }; + + props.setFormData(initialValues); + + if (formikProps.values.name && !isEdit) { + validateName({ + variables: { + projectID: scope.projectID, + probeName: formikProps.values.name + } + }).then(result => { + if (result.data?.validateUniqueProbe === false) { + formikProps.setFieldError( + 'name', + `The name ${formikProps.values.name} is not unique and was already used before, please provide a unique name` + ); + } else { + props.nextStep?.(); + } + }); + } else { + // Validates the data and only if it is valid, goes through + formikProps.validateForm().then(errors => { + if (Object.keys(errors).length === 0) { + props.nextStep?.(); + } + }); + } + }; + + return ( + + + initialValues={initialValues} + onSubmit={noop} + validationSchema={Yup.object().shape({ + name: Yup.string().trim().required(getString(`probeValidation.name`)) + })} + > + {formikProps => { + return ( +
+ + + {getString('overview')} + + + + + + + +
+ ); +} + +function ProbeCardFromAPI({ probe, mode, probeStatus }: ProbeCardFromAPIProps): React.ReactElement { + const { getString } = useStrings(); + return ( +
+ + + + + {probe.name} + + + + + {getString('type')}{' '} + + {probe.type} + + + + {getString('mode')}{' '} + + {mode} + + + {probeStatus && (
@@ -69,22 +163,23 @@ function ProbeCard({ probe, probeStatus }: ProbeCardProps): React.ReactElement { details={ - {probeStatus?.status?.verdict === FaultProbeStatus.AWAITED ? ( + {(probeStatus as Status)?.verdict === FaultProbeStatus.AWAITED ? ( {getString('resultAfterExecution')} ) : (
- {probeStatus?.status?.verdict !== FaultProbeStatus['N/A'] && ( -
-
{getString('probeSummary')}
- - {probeStatus?.status?.description ?? getString('probeResultNotAvailable')} - -
- )} +
{getString('probeSummary')}
+ + {(probeStatus as Status)?.description ?? getString('probeResultNotAvailable')} +
)}
@@ -94,7 +189,9 @@ function ProbeCard({ probe, probeStatus }: ProbeCardProps): React.ReactElement { panelClassName={css.subPanel} summaryClassName={css.subPanelSummary} chevronClassName={css.chevron} - details={} + details={ + + } id={`${probe.name}-details`} summary={getString('viewProbeDetails')} /> @@ -102,7 +199,9 @@ function ProbeCard({ probe, probeStatus }: ProbeCardProps): React.ReactElement { panelClassName={css.subPanel} summaryClassName={css.subPanelSummary} chevronClassName={css.chevron} - details={} + details={ + + } id={`${probe.name}-properties`} summary={getString('viewProbeProperties')} /> @@ -111,27 +210,41 @@ function ProbeCard({ probe, probeStatus }: ProbeCardProps): React.ReactElement { ); } -function ProbesTab({ loading, manifest, nodeName, probeStatuses }: ProbesTabProps): React.ReactElement { +function ProbesTab({ loading, manifest, nodeName, probeData, probeStatuses }: ProbesTabProps): React.ReactElement { const { getString } = useStrings(); const parsedManifest = manifest ? (parse(manifest) as ExperimentManifest) : undefined; + const infrastructureType = getInfrastructureTypeFromExperimentKind(parsedManifest); const experimentHandler = experimentYamlService.getInfrastructureTypeHandler(InfrastructureType.KUBERNETES); - const probes = experimentHandler?.extractProbeDetails(parsedManifest, nodeName); + + // Backward compatibility for deprecated probes + let deprecatedProbes: ProbeAttributes[] | undefined; + if (infrastructureType === InfrastructureType.KUBERNETES) { + deprecatedProbes = (experimentHandler as KubernetesYamlService)?.extractDeprecatedProbeDetails( + parsedManifest as KubernetesExperimentManifest, + nodeName + ); + } return ( - {probes ? ( - - {probes?.map((probe, index) => ( - - ))} - - ) : ( + {!deprecatedProbes && (!probeData || probeData.length === 0) ? ( {getString('noProbesAvailable')} + ) : ( + + <> + {deprecatedProbes?.map((probe, index) => ( + + ))} + {probeData?.map(data => ( + + ))} + + )} diff --git a/chaoscenter/web/src/views/KubernetesChaosInfrastructureGreenfield/KubernetesChaosInfrastructureGreenfield.tsx b/chaoscenter/web/src/views/KubernetesChaosInfrastructureGreenfield/KubernetesChaosInfrastructureGreenfield.tsx index 38ed52a29b2..4201377d922 100644 --- a/chaoscenter/web/src/views/KubernetesChaosInfrastructureGreenfield/KubernetesChaosInfrastructureGreenfield.tsx +++ b/chaoscenter/web/src/views/KubernetesChaosInfrastructureGreenfield/KubernetesChaosInfrastructureGreenfield.tsx @@ -7,7 +7,7 @@ import { useStrings } from '@strings'; import { downloadYamlAsFile, getFormattedFileName, getScope } from '@utils'; import type { StepData } from '@views/KubernetesChaosInfrastructureCreationModal/KubernetesChaosInfrastructureStepWizardConfiguration'; import CodeBlock from '@components/CodeBlock'; -import { InfrastructureInstallationType } from '@api/entities'; +import { InfrastructureType } from '@api/entities'; import type { connectChaosInfraManifestModeResponse, connectChaosInfraRequest @@ -64,7 +64,7 @@ export default function KubernetesChaosInfrastructureGreenfieldView({ ? `${data.value.nodeSelectorValues[0].key.trim()}=${data.value.nodeSelectorValues[0].value.trim()}` : undefined, tags: data.value.tags ?? undefined, - infrastructureType: InfrastructureInstallationType.EXTERNAL + infrastructureType: InfrastructureType.KUBERNETES } }, onCompleted: (result: connectChaosInfraManifestModeResponse) => {