Skip to content

Commit

Permalink
feat(operator): add-pressure-exec replace job(get pod log)
Browse files Browse the repository at this point in the history
  • Loading branch information
moonman committed May 12, 2023
1 parent 828d9ea commit 7d6fc41
Show file tree
Hide file tree
Showing 9 changed files with 441 additions and 339 deletions.
21 changes: 16 additions & 5 deletions shardingsphere-operator/api/v1alpha1/shardingsphere_chaos_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,24 @@ type ShardingSphereChaos struct {

// ShardingSphereChaosSpec defines the desired state of ShardingSphereChaos
type ShardingSphereChaosSpec struct {
InjectJob JobSpec `json:"injectJob,omitempty"`
EmbedChaos `json:",inline"`
Expect Expect `json:"expect,omitempty"`
InjectJob JobSpec `json:"injectJob,omitempty"`
EmbedChaos `json:",inline"`
PressureCfg PressureCfg `json:"pressureCfg"`
}

type Expect struct {
Verify string `json:"verify,omitempty"`
type PressureCfg struct {
ZkHost string `json:"zkHost,omitempty"`
SsHost string `json:"ssHost"`
Duration metav1.Duration `json:"duration"`
ReqTime metav1.Duration `json:"reqTime"`
DistSQLs []DistSQL `json:"distSQLs,omitempty"`
ConcurrentNum int `json:"concurrentNum"`
ReqNum int `json:"reqNum"`
}

type DistSQL struct {
SQL string `json:"sql"`
Args []string `json:"args"`
}

type Script string
Expand Down
61 changes: 45 additions & 16 deletions shardingsphere-operator/api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"flag"
"strings"

"github.com/apache/shardingsphere-on-cloud/shardingsphere-operator/pkg/pressure"

"github.com/apache/shardingsphere-on-cloud/shardingsphere-operator/api/v1alpha1"
"github.com/apache/shardingsphere-on-cloud/shardingsphere-operator/pkg/controllers"
sschaos "github.com/apache/shardingsphere-on-cloud/shardingsphere-operator/pkg/kubernetes/chaosmesh"
Expand Down Expand Up @@ -179,14 +181,15 @@ var featureGatesHandlers = map[string]FeatureGateHandler{
return err
}
if err := (&controllers.ShardingSphereChaosReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Log: mgr.GetLogger(),
Chaos: sschaos.NewChaos(mgr.GetClient()),
Job: job.NewJob(mgr.GetClient()),
ConfigMap: configmap.NewConfigMapClient(mgr.GetClient()),
Events: mgr.GetEventRecorderFor("shardingsphere-chaos-controller"),
ClientSet: clientset,
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Log: mgr.GetLogger(),
Chaos: sschaos.NewChaos(mgr.GetClient()),
Job: job.NewJob(mgr.GetClient()),
ExecRecorder: make([]*pressure.Pressure, 0),
ConfigMap: configmap.NewConfigMapClient(mgr.GetClient()),
Events: mgr.GetEventRecorderFor("shardingsphere-chaos-controller"),
ClientSet: clientset,
}).SetupWithManager(mgr); err != nil {
logger.Error(err, "unable to create controller", "controller", "ShardingSphereChaos")
return err
Expand Down
3 changes: 2 additions & 1 deletion shardingsphere-operator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ require (
bou.ke/monkey v1.0.2
github.com/antlr/antlr4 v0.0.0-20181218183524-be58ebffde8e
github.com/chaos-mesh/chaos-mesh/api v0.0.0-20230410023700-25a841a23cd2
github.com/golang/mock v1.6.0
github.com/database-mesh/golang-sdk v0.0.0-20230420101548-53265cd9883a
github.com/go-logr/logr v1.2.4
github.com/golang/mock v1.6.0
github.com/onsi/ginkgo/v2 v2.8.0
github.com/onsi/gomega v1.26.0
github.com/prometheus/client_golang v1.14.0
Expand Down Expand Up @@ -50,6 +50,7 @@ require (
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-sql-driver/mysql v1.7.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
Expand Down
4 changes: 4 additions & 0 deletions shardingsphere-operator/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2Kv
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
Expand Down
Loading

0 comments on commit 7d6fc41

Please sign in to comment.