add logging to the operator
Some checks failed
Build images / Run e2e tests (push) Failing after 1m57s
Build images / Run lint test (push) Failing after 7m27s
Lint / Run on Ubuntu (push) Failing after 6m47s
Build images / Run unit test (push) Failing after 8m53s
Build images / Build docker image (push) Has been skipped
E2E Tests / Run on Ubuntu (push) Failing after 1m50s
Tests / Run on Ubuntu (push) Failing after 3m1s

add logging
This commit is contained in:
Chris Richardson
2025-07-02 12:48:45 -04:00
parent d9a945efd4
commit 4d9663fe60
7 changed files with 719 additions and 31 deletions

View File

@@ -24,12 +24,89 @@ import (
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// LocustClusterSpec defines the desired state of LocustCluster.
type LocustClusterSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
// Foo is an example field of LocustCluster. Edit locustcluster_types.go to remove/update
Foo string `json:"foo,omitempty"`
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 LocustClusterSpec struct {
Leader LeaderSpec `json:"leader,omitempty" protobuf:"bytes,1,rep,name=leader"`
Worker WorkerSpec `json:"worker" protobuf:"bytes,2,rep,name=worker"`
Metrics MetricsSpec `json:"metrics" protobuf:"bytes,3,rep,name=metrics"`
Infrastructure []InfrastructureSpec `json:"infrastructure,omitempty" protobuf:"bytes,4,rep,name=infrastructure"`
Secrets []SecretsSpec `json:"secrets,omitempty" protobuf:"bytes,5,rep,name=secrets"`
}
// LocustClusterStatus defines the observed state of LocustCluster.

View File

@@ -24,12 +24,59 @@ 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)
out.Spec = in.Spec
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
}
@@ -86,6 +133,21 @@ 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.
@@ -112,3 +174,147 @@ 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
}