From e8dea2d618a880abfd60f669653d8dea2c67a005 Mon Sep 17 00:00:00 2001 From: Olha Yevtushenko Date: Fri, 20 Jan 2023 14:34:51 +0200 Subject: [PATCH] envoy: scuttle logging is true by default so change CRD setting to disable it instead --- api/v1alpha1/k6_types.go | 2 +- api/v1alpha1/zz_generated.deepcopy.go | 7 +++++++ config/crd/bases/k6.io_k6s.yaml | 12 ++++++++++-- pkg/resources/jobs/helpers.go | 4 ++-- pkg/resources/jobs/helpers_test.go | 6 +++--- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/api/v1alpha1/k6_types.go b/api/v1alpha1/k6_types.go index 30ad5b8b..445d0fd3 100644 --- a/api/v1alpha1/k6_types.go +++ b/api/v1alpha1/k6_types.go @@ -45,7 +45,7 @@ type K6Scuttle struct { EnvoyAdminApi string `json:"envoyAdminApi,omitempty"` NeverKillIstio bool `json:"neverKillIstio,omitempty"` NeverKillIstioOnFailure bool `json:"neverKillIstioOnFailure,omitempty"` - ScuttleLogging bool `json:"scuttleLogging,omitempty"` + DisableLogging bool `json:"disableLogging,omitempty"` StartWithoutEnvoy bool `json:"startWithoutEnvoy,omitempty"` WaitForEnvoyTimeout string `json:"waitForEnvoyTimeout,omitempty"` IstioQuitApi string `json:"istioQuitApi,omitempty"` diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index bc7166b6..5c947af6 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -214,6 +214,13 @@ func (in *Pod) DeepCopyInto(out *Pod) { (*out)[key] = val } } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]v1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } in.Resources.DeepCopyInto(&out.Resources) in.SecurityContext.DeepCopyInto(&out.SecurityContext) if in.EnvFrom != nil { diff --git a/config/crd/bases/k6.io_k6s.yaml b/config/crd/bases/k6.io_k6s.yaml index aae74d73..f0925d7c 100644 --- a/config/crd/bases/k6.io_k6s.yaml +++ b/config/crd/bases/k6.io_k6s.yaml @@ -848,6 +848,10 @@ spec: type: array image: type: string + imagePullPolicy: + description: PullPolicy describes a policy for if/when to pull + a container image + type: string imagePullSecrets: items: description: LocalObjectReference contains enough information @@ -1102,6 +1106,8 @@ spec: type: object scuttle: properties: + disableLogging: + type: boolean enabled: type: string envoyAdminApi: @@ -1116,8 +1122,6 @@ spec: type: boolean quitWithoutEnvoyTimeout: type: string - scuttleLogging: - type: boolean startWithoutEnvoy: type: boolean waitForEnvoyTimeout: @@ -1888,6 +1892,10 @@ spec: type: array image: type: string + imagePullPolicy: + description: PullPolicy describes a policy for if/when to pull + a container image + type: string imagePullSecrets: items: description: LocalObjectReference contains enough information diff --git a/pkg/resources/jobs/helpers.go b/pkg/resources/jobs/helpers.go index 3a8110a1..b0d09b53 100644 --- a/pkg/resources/jobs/helpers.go +++ b/pkg/resources/jobs/helpers.go @@ -84,10 +84,10 @@ func newIstioEnvVar(istio v1alpha1.K6Scuttle, istioEnabled bool) []corev1.EnvVar }) } - if istio.ScuttleLogging { + if istio.DisableLogging { env = append(env, corev1.EnvVar{ Name: "SCUTTLE_LOGGING", - Value: strconv.FormatBool(istio.ScuttleLogging), + Value: strconv.FormatBool(false), }) } diff --git a/pkg/resources/jobs/helpers_test.go b/pkg/resources/jobs/helpers_test.go index 70def504..eee2eb27 100644 --- a/pkg/resources/jobs/helpers_test.go +++ b/pkg/resources/jobs/helpers_test.go @@ -110,7 +110,7 @@ func TestNewIstioEnvVarTrueValues(t *testing.T) { }, { Name: "SCUTTLE_LOGGING", - Value: "true", + Value: "false", }, } @@ -118,7 +118,7 @@ func TestNewIstioEnvVarTrueValues(t *testing.T) { EnvoyAdminApi: "", IstioQuitApi: "", WaitForEnvoyTimeout: "", - ScuttleLogging: true, + DisableLogging: true, }, true) if !reflect.DeepEqual(envVars, expectedOutcome) { @@ -146,7 +146,7 @@ func TestNewIstioEnvVarFalseValues(t *testing.T) { EnvoyAdminApi: "", IstioQuitApi: "", WaitForEnvoyTimeout: "", - ScuttleLogging: false, + DisableLogging: false, }, true) if !reflect.DeepEqual(envVars, expectedOutcome) {