diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index f8fcf5a..3544986 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -24,59 +24,12 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InfrastructureSpec) DeepCopyInto(out *InfrastructureSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InfrastructureSpec. -func (in *InfrastructureSpec) DeepCopy() *InfrastructureSpec { - if in == nil { - return nil - } - out := new(InfrastructureSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LeaderDownloadSpec) DeepCopyInto(out *LeaderDownloadSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LeaderDownloadSpec. -func (in *LeaderDownloadSpec) DeepCopy() *LeaderDownloadSpec { - if in == nil { - return nil - } - out := new(LeaderDownloadSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LeaderSpec) DeepCopyInto(out *LeaderSpec) { - *out = *in - out.Download = in.Download - out.Resources = in.Resources -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LeaderSpec. -func (in *LeaderSpec) DeepCopy() *LeaderSpec { - if in == nil { - return nil - } - out := new(LeaderSpec) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LocustCluster) DeepCopyInto(out *LocustCluster) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) + out.Spec = in.Spec out.Status = in.Status } @@ -133,21 +86,6 @@ func (in *LocustClusterList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LocustClusterSpec) DeepCopyInto(out *LocustClusterSpec) { *out = *in - out.Leader = in.Leader - in.Worker.DeepCopyInto(&out.Worker) - out.Metrics = in.Metrics - if in.Infrastructure != nil { - in, out := &in.Infrastructure, &out.Infrastructure - *out = make([]InfrastructureSpec, len(*in)) - copy(*out, *in) - } - if in.Secrets != nil { - in, out := &in.Secrets, &out.Secrets - *out = make([]SecretsSpec, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocustClusterSpec. @@ -174,147 +112,3 @@ func (in *LocustClusterStatus) DeepCopy() *LocustClusterStatus { in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MetricsSpec) DeepCopyInto(out *MetricsSpec) { - *out = *in - out.Mosaic = in.Mosaic -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricsSpec. -func (in *MetricsSpec) DeepCopy() *MetricsSpec { - if in == nil { - return nil - } - out := new(MetricsSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MosaicSpec) DeepCopyInto(out *MosaicSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MosaicSpec. -func (in *MosaicSpec) DeepCopy() *MosaicSpec { - if in == nil { - return nil - } - out := new(MosaicSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ResourcesSpec) DeepCopyInto(out *ResourcesSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcesSpec. -func (in *ResourcesSpec) DeepCopy() *ResourcesSpec { - if in == nil { - return nil - } - out := new(ResourcesSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SecretsKeys) DeepCopyInto(out *SecretsKeys) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretsKeys. -func (in *SecretsKeys) DeepCopy() *SecretsKeys { - if in == nil { - return nil - } - out := new(SecretsKeys) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SecretsSpec) DeepCopyInto(out *SecretsSpec) { - *out = *in - if in.SecretsKeys != nil { - in, out := &in.SecretsKeys, &out.SecretsKeys - *out = make([]SecretsKeys, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretsSpec. -func (in *SecretsSpec) DeepCopy() *SecretsSpec { - if in == nil { - return nil - } - out := new(SecretsSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TestsSpecs) DeepCopyInto(out *TestsSpecs) { - *out = *in - if in.TestSettings != nil { - in, out := &in.TestSettings, &out.TestSettings - *out = make([]WorkerEnv, len(*in)) - copy(*out, *in) - } - if in.TestCommand != nil { - in, out := &in.TestCommand, &out.TestCommand - *out = make([]string, len(*in)) - copy(*out, *in) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TestsSpecs. -func (in *TestsSpecs) DeepCopy() *TestsSpecs { - if in == nil { - return nil - } - out := new(TestsSpecs) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WorkerEnv) DeepCopyInto(out *WorkerEnv) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkerEnv. -func (in *WorkerEnv) DeepCopy() *WorkerEnv { - if in == nil { - return nil - } - out := new(WorkerEnv) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WorkerSpec) DeepCopyInto(out *WorkerSpec) { - *out = *in - if in.Tests != nil { - in, out := &in.Tests, &out.Tests - *out = make([]TestsSpecs, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - out.Resources = in.Resources -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkerSpec. -func (in *WorkerSpec) DeepCopy() *WorkerSpec { - if in == nil { - return nil - } - out := new(WorkerSpec) - in.DeepCopyInto(out) - return out -} diff --git a/config/crd/bases/locust.io_locustclusters.yaml b/config/crd/bases/locust.io_locustclusters.yaml index a038c26..c03a0dc 100644 --- a/config/crd/bases/locust.io_locustclusters.yaml +++ b/config/crd/bases/locust.io_locustclusters.yaml @@ -37,167 +37,85 @@ spec: metadata: type: object spec: - description: LocustClusterSpec defines the desired state of LocustCluster - properties: - infrastructure: - items: - properties: - endpoint: - type: string - prometheusEndpoint: - type: string - prometheusJobName: - type: string - prometheusPort: - type: integer - required: - - endpoint - type: object - type: array - leader: - properties: - download: - properties: - bucket: - type: string - filename: - type: string - required: - - bucket - - filename - type: object - image: - type: string - leaderFile: - type: string - priorityClass: - type: string - resources: - properties: - maxCpu: - type: string - maxMem: - type: string - minCpu: - type: string - minMem: - type: string - type: object - type: object - metrics: - properties: - mosaic: - properties: - grafanaEndpoint: - type: string - groupEmail: - type: string - mtls: - type: boolean - nameSpace: - type: string - prometheusTag: - type: string - publishing_endpoint: - type: string - workSpace: - type: string - required: - - groupEmail - - nameSpace - - prometheusTag - - workSpace - type: object - type: object - secrets: - items: - properties: - secretKeys: - items: - properties: - secretKey: - type: string - required: - - secretKey - type: object - type: array - secretName: - type: string - required: - - secretKeys - - secretName - type: object - type: array - worker: - properties: - clients: - type: integer - hatchRate: - type: integer - nodes: - type: integer - priorityClass: - type: string - resources: - properties: - maxCpu: - type: string - maxMem: - type: string - minCpu: - type: string - minMem: - type: string - type: object - scenarioName: - type: string - testContainer: - type: string - testLanguage: - type: string - testPath: - type: string - tests: - items: - properties: - env: - items: - properties: - name: - type: string - value: - type: string - required: - - name - - value - type: object - type: array - runTime: - type: string - testCommand: - items: - type: string - type: array - testName: - type: string - required: - - runTime - - testName - type: object - type: array - required: - - clients - - hatchRate - - nodes - - scenarioName - - testContainer - - testLanguage - - testPath - - tests - type: object - required: - - metrics - - worker + description: |- + LocustClusterSpec defines the desired state of LocustCluster. + + type ResourcesSpec struct { + MaxCpu string `json:"maxCpu,omitempty" protobuf:"bytes,1,name=maxCpu"` + MinCpu string `json:"minCpu,omitempty" protobuf:"bytes,2,name=minCpu"` + MaxMem string `json:"maxMem,omitempty" protobuf:"bytes,3,name=maxMem"` + MinMem string `json:"minMem,omitempty" protobuf:"bytes,4,name=minMem"` + } + + type LeaderSpec struct { + TestFile string `json:"leaderFile,omitempty" protobuf:"bytes,1,name=leaderFile"` + PriorityClass string `json:"priorityClass,omitempty" protobuf:"bytes,2,name=priorityClass"` + Download LeaderDownloadSpec `json:"download,omitempty" protobuf:"bytes,3,rep,name=download"` + Resources ResourcesSpec `json:"resources,omitempty" protobuf:"bytes,4,rep,name=resources"` + Image string `json:"image,omitempty" protobuf:"bytes,5,name=image"` + } + + type LeaderDownloadSpec struct { + Bucket string `json:"bucket" protobuf:"bytes,1,name=bucket"` + Filename string `json:"filename" protobuf:"bytes,2,name=filename"` + } + + type WorkerEnv struct { + Name string `json:"name" protobuf:"bytes,1,name=name"` + Value string `json:"value" protobuf:"bytes,2,name=value"` + } + + type TestsSpecs struct { + TestName string `json:"testName" protobuf:"bytes,1,name=testName"` + RunTime string `json:"runTime" protobuf:"bytes,2,name=runTime"` + TestSettings []WorkerEnv `json:"env,omitempty" protobuf:"bytes,3,rep,name=env"` + TestCommand []string `json:"testCommand,omitempty" protobuf:"bytes,4,name=testCommand"` + } + + type WorkerSpec struct { + HatchRate int `json:"hatchRate" protobuf:"varint,1,name=hatchRate"` + TestContainer string `json:"testContainer" protobuf:"bytes,2,name=testContainer"` + ScenarioName string `json:"scenarioName" protobuf:"bytes,3,name=scenarioName"` + TestLanguage string `json:"testLanguage" protobuf:"bytes,4,name=testLanguage"` + TestPath string `json:"testPath" protobuf:"bytes,5,name=testPath"` + Tests []TestsSpecs `json:"tests" protobuf:"bytes,6,rep,name=tests"` + Clients int `json:"clients" protobuf:"varint,7,name=clients"` + Nodes int `json:"nodes" protobuf:"varint,8,name=nodes"` + PriorityClass string `json:"priorityClass,omitempty" protobuf:"bytes,9,name=priorityClass"` + Resources ResourcesSpec `json:"resources,omitempty" protobuf:"bytes,10,rep,name=resources"` + } + + type MosaicSpec struct { + WorkSpace string `json:"workSpace" protobuf:"bytes,1,name=workSpace"` + NameSpace string `json:"nameSpace" protobuf:"bytes,2,name=nameSpace"` + PublishingEndpoint string `json:"publishing_endpoint,omitempty" protobuf:"bytes,3,name=publishingEndpoint"` + Mtls bool `json:"mtls,omitempty" protobuf:"bool,4,name=mtls"` + PrometheusTag string `json:"prometheusTag" protobuf:"bytes,3,name=prometheusTag"` + GroupEmail string `json:"groupEmail" protobuf:"bytes,4,name=groupEmail"` + GrafanaEndpoint string `json:"grafanaEndpoint,omitempty" protobuf:"bytes,5,name=grafanaEndpoint"` + } + + type MetricsSpec struct { + Mosaic MosaicSpec `json:"mosaic,omitempty" protobuf:"bytes,1,rep,name=mosaic"` + } + + type InfrastructureSpec struct { + Endpoint string `json:"endpoint" protobuf:"bytes,1,name=endpoint"` + PrometheusJobName string `json:"prometheusJobName,omitempty" protobuf:"bytes,2,name=prometheusJobName"` + PrometheusPort int `json:"prometheusPort,omitempty" protobuf:"varint,3,name=prometheusPort"` + PrometheusEndpoint string `json:"prometheusEndpoint,omitempty" protobuf:"bytes,4,name=prometheusEndpoint"` + } + + type SecretsKeys struct { + SecretKey string `json:"secretKey" protobuf:"bytes,1,name=secretKey"` + } + + type SecretsSpec struct { + SecretName string `json:"secretName" protobuf:"bytes,1,name=secretName"` + SecretsKeys []SecretsKeys `json:"secretKeys" protobuf:"bytes,2,name=secretKeys"` + } + + LocustClusterSpec defines the desired state of LocustCluster type: object status: description: LocustClusterStatus defines the observed state of LocustCluster. diff --git a/go.mod b/go.mod index 713cb0f..ae70dee 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,12 @@ go 1.23.0 godebug default=go1.23 require ( + github.com/go-logr/logr v1.4.2 + github.com/go-logr/zapr v1.3.0 github.com/onsi/ginkgo/v2 v2.22.0 github.com/onsi/gomega v1.36.1 + go.uber.org/zap v1.27.0 + gopkg.in/natefinch/lumberjack.v2 v2.2.1 k8s.io/apimachinery v0.32.1 k8s.io/client-go v0.32.1 sigs.k8s.io/controller-runtime v0.20.4 @@ -26,9 +30,7 @@ require ( github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fxamacker/cbor/v2 v2.7.0 // indirect - github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-logr/zapr v1.3.0 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.23.0 // indirect @@ -68,7 +70,6 @@ require ( go.opentelemetry.io/otel/trace v1.28.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.27.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.30.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect diff --git a/go.sum b/go.sum index 3719e6c..a7ff839 100644 --- a/go.sum +++ b/go.sum @@ -214,6 +214,8 @@ gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSP gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=