From 753842a7639e6fc9464348259b07ce5300da1906 Mon Sep 17 00:00:00 2001 From: Israel Blancas Date: Mon, 12 Jun 2023 16:58:11 +0200 Subject: [PATCH 1/4] Increase reliability of the autoscaler E2E test (#2227) * Increase reliability of the autoscaller E2E test #2223 Signed-off-by: Israel Blancas * Fix some problems with the E2E test Signed-off-by: Israel Blancas * Add another fix Signed-off-by: Israel Blancas --------- Signed-off-by: Israel Blancas --- .../miscellaneous/collector-autoscale/02-assert.yaml | 7 ------- .../collector-autoscale/02-wait-for-hpa.yaml | 4 ++++ .../{03-assert.yaml => 04-assert.yaml} | 0 .../miscellaneous/collector-autoscale/wait-for-hpa.sh | 10 ++++++++++ tests/e2e/miscellaneous/render.sh | 5 ++--- tests/e2e/render-utils.sh | 2 +- 6 files changed, 17 insertions(+), 11 deletions(-) delete mode 100644 tests/e2e/miscellaneous/collector-autoscale/02-assert.yaml create mode 100644 tests/e2e/miscellaneous/collector-autoscale/02-wait-for-hpa.yaml rename tests/e2e/miscellaneous/collector-autoscale/{03-assert.yaml => 04-assert.yaml} (100%) create mode 100755 tests/e2e/miscellaneous/collector-autoscale/wait-for-hpa.sh diff --git a/tests/e2e/miscellaneous/collector-autoscale/02-assert.yaml b/tests/e2e/miscellaneous/collector-autoscale/02-assert.yaml deleted file mode 100644 index a665b96fd..000000000 --- a/tests/e2e/miscellaneous/collector-autoscale/02-assert.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# Assert the Jaeger collector scaled to 5 replicas -apiVersion: apps/v1 -kind: Deployment -metadata: - name: simple-prod-collector -status: - readyReplicas: 5 diff --git a/tests/e2e/miscellaneous/collector-autoscale/02-wait-for-hpa.yaml b/tests/e2e/miscellaneous/collector-autoscale/02-wait-for-hpa.yaml new file mode 100644 index 000000000..28e51d5cd --- /dev/null +++ b/tests/e2e/miscellaneous/collector-autoscale/02-wait-for-hpa.yaml @@ -0,0 +1,4 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: "./wait-for-hpa.sh" \ No newline at end of file diff --git a/tests/e2e/miscellaneous/collector-autoscale/03-assert.yaml b/tests/e2e/miscellaneous/collector-autoscale/04-assert.yaml similarity index 100% rename from tests/e2e/miscellaneous/collector-autoscale/03-assert.yaml rename to tests/e2e/miscellaneous/collector-autoscale/04-assert.yaml diff --git a/tests/e2e/miscellaneous/collector-autoscale/wait-for-hpa.sh b/tests/e2e/miscellaneous/collector-autoscale/wait-for-hpa.sh new file mode 100755 index 000000000..047df785b --- /dev/null +++ b/tests/e2e/miscellaneous/collector-autoscale/wait-for-hpa.sh @@ -0,0 +1,10 @@ +#!/bin/bash +exit_code=0 + +while [ "$exit_code" == 0 ] +do + kubectl get hpa -n $NAMESPACE | grep "/90% /90%" -q + exit_code=$? + echo "Some HPA metrics are not known yet" + sleep 1 +done \ No newline at end of file diff --git a/tests/e2e/miscellaneous/render.sh b/tests/e2e/miscellaneous/render.sh index 707de9349..9729fabac 100755 --- a/tests/e2e/miscellaneous/render.sh +++ b/tests/e2e/miscellaneous/render.sh @@ -43,8 +43,7 @@ fi ELASTICSEARCH_NODECOUNT="1" render_install_jaeger "$jaeger_name" "$jaeger_deploy_mode" "01" # Change the resource limits for the Jaeger deployment -$YQ e -i '.spec.collector.resources.requests.memory="20Mi"' 01-install.yaml -$YQ e -i '.spec.collector.resources.requests.memory="300m"' 01-install.yaml +$YQ e -i '.spec.collector.resources.requests.memory="200m"' 01-install.yaml # Enable autoscale $YQ e -i '.spec.collector.autoscale=true' 01-install.yaml @@ -52,7 +51,7 @@ $YQ e -i '.spec.collector.minReplicas=1' 01-install.yaml $YQ e -i '.spec.collector.maxReplicas=2' 01-install.yaml # Deploy Tracegen instance to generate load in the Jaeger collector -render_install_tracegen "$jaeger_name" "02" +render_install_tracegen "$jaeger_name" "03" ############################################################################### diff --git a/tests/e2e/render-utils.sh b/tests/e2e/render-utils.sh index 50fef64f6..3c82c8817 100644 --- a/tests/e2e/render-utils.sh +++ b/tests/e2e/render-utils.sh @@ -600,7 +600,7 @@ function render_install_tracegen() { step=$2 # We detected this value is good enough to make the operator scale - replicas=4 + replicas=1 $GOMPLATE -f $EXAMPLES_DIR/tracegen.yaml -o ./$step-install.yaml $YQ e -i ".spec.replicas=$replicas" ./$step-install.yaml From 5244636e501fcbc6a4d12bc11cde56ebb95f4199 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 15:25:26 +0000 Subject: [PATCH 2/4] Bump docker/setup-buildx-action from 2.5.0 to 2.6.0 (#2233) Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.5.0 to 2.6.0. - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](https://github.com/docker/setup-buildx-action/compare/v2.5.0...v2.6.0) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/publish-images.yaml | 2 +- .github/workflows/release.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-images.yaml b/.github/workflows/publish-images.yaml index c0d071c08..a9222d5c9 100644 --- a/.github/workflows/publish-images.yaml +++ b/.github/workflows/publish-images.yaml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v3 - uses: docker/setup-qemu-action@v2.1.0 - - uses: docker/setup-buildx-action@v2.5.0 + - uses: docker/setup-buildx-action@v2.6.0 - name: "publishes the images" env: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d9a51d9d2..cfbdb020c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -25,7 +25,7 @@ jobs: run: ./hack/install/install-kustomize.sh - uses: docker/setup-qemu-action@v2.1.0 - - uses: docker/setup-buildx-action@v2.5.0 + - uses: docker/setup-buildx-action@v2.6.0 - name: "generate release resources" run: make release-artifacts USER=jaegertracing From 6538461954bdc8d4c6edb290c688b8411d110901 Mon Sep 17 00:00:00 2001 From: Israel Blancas Date: Wed, 14 Jun 2023 13:36:55 +0200 Subject: [PATCH 3/4] Remove resource limitation for the operator pod (#2221) * Remove the resource limitation #2220 Signed-off-by: Israel Blancas * Trigger build Signed-off-by: Israel Blancas --------- Signed-off-by: Israel Blancas --- bundle/manifests/jaeger-operator.clusterserviceversion.yaml | 5 +---- config/manager/manager.yaml | 3 --- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/bundle/manifests/jaeger-operator.clusterserviceversion.yaml b/bundle/manifests/jaeger-operator.clusterserviceversion.yaml index 093962b9d..702f603ac 100644 --- a/bundle/manifests/jaeger-operator.clusterserviceversion.yaml +++ b/bundle/manifests/jaeger-operator.clusterserviceversion.yaml @@ -19,7 +19,7 @@ metadata: categories: Logging & Tracing certified: "false" containerImage: quay.io/jaegertracing/jaeger-operator - createdAt: "2023-05-16T04:47:12Z" + createdAt: "2023-05-29T15:36:04Z" description: Provides tracing, monitoring and troubleshooting for microservices-based distributed systems operators.openshift.io/infrastructure-features: '["disconnected"]' @@ -422,9 +422,6 @@ spec: initialDelaySeconds: 5 periodSeconds: 10 resources: - limits: - cpu: 500m - memory: 512Mi requests: cpu: 100m memory: 128Mi diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 7065b0cdb..de8c63051 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -37,9 +37,6 @@ spec: initialDelaySeconds: 5 periodSeconds: 10 resources: - limits: - cpu: 500m - memory: 512Mi requests: cpu: 100m memory: 128Mi From 723105ff90f5dbe2d49258adfbcce9a217f7399c Mon Sep 17 00:00:00 2001 From: Michal Schott Date: Wed, 14 Jun 2023 15:55:09 +0200 Subject: [PATCH 4/4] Properly set imagePullPolicy and containerSecurityContext for EsIndexCleaner cronjob container (#2224) Signed-off-by: Michal Schott Co-authored-by: Ben B --- pkg/cronjob/es_index_cleaner.go | 16 +++++++------- pkg/cronjob/es_index_cleaner_test.go | 31 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/pkg/cronjob/es_index_cleaner.go b/pkg/cronjob/es_index_cleaner.go index 25b4e9162..ae4fbac9c 100644 --- a/pkg/cronjob/es_index_cleaner.go +++ b/pkg/cronjob/es_index_cleaner.go @@ -75,13 +75,15 @@ func CreateEsIndexCleaner(jaeger *v1.Jaeger) runtime.Object { Spec: corev1.PodSpec{ Containers: []corev1.Container{ { - Name: util.Truncate(name, 63), - Image: util.ImageName(jaeger.Spec.Storage.EsIndexCleaner.Image, "jaeger-es-index-cleaner-image"), - Args: []string{strconv.Itoa(*jaeger.Spec.Storage.EsIndexCleaner.NumberOfDays), esUrls}, - Env: util.RemoveEmptyVars(envs), - EnvFrom: envFromSource, - Resources: commonSpec.Resources, - VolumeMounts: commonSpec.VolumeMounts, + Name: util.Truncate(name, 63), + Image: util.ImageName(jaeger.Spec.Storage.EsIndexCleaner.Image, "jaeger-es-index-cleaner-image"), + ImagePullPolicy: jaeger.Spec.Storage.EsIndexCleaner.ImagePullPolicy, + Args: []string{strconv.Itoa(*jaeger.Spec.Storage.EsIndexCleaner.NumberOfDays), esUrls}, + Env: util.RemoveEmptyVars(envs), + EnvFrom: envFromSource, + SecurityContext: jaeger.Spec.Storage.EsIndexCleaner.ContainerSecurityContext, + Resources: commonSpec.Resources, + VolumeMounts: commonSpec.VolumeMounts, }, }, ImagePullSecrets: commonSpec.ImagePullSecrets, diff --git a/pkg/cronjob/es_index_cleaner_test.go b/pkg/cronjob/es_index_cleaner_test.go index 1ffb6ce79..1eda61bea 100644 --- a/pkg/cronjob/es_index_cleaner_test.go +++ b/pkg/cronjob/es_index_cleaner_test.go @@ -269,3 +269,34 @@ func TestEsIndexCleanerImagePullSecrets(t *testing.T) { assert.Equal(t, pullSecret, esIndexCleaner.Spec.JobTemplate.Spec.Template.Spec.ImagePullSecrets[0].Name) } + +func TestEsIndexCleanerImagePullPolicy(t *testing.T) { + jaeger := v1.NewJaeger(types.NamespacedName{Name: "TestEsIndexCleanerImagePullPolicy"}) + days := 0 + jaeger.Spec.Storage.EsIndexCleaner.NumberOfDays = &days + + const ImagePullPolicy = corev1.PullPolicy("Always") + jaeger.Spec.Storage.EsIndexCleaner.NumberOfDays = &days + jaeger.Spec.Storage.EsIndexCleaner.ImagePullPolicy = corev1.PullPolicy("Always") + + esIndexCleaner := CreateEsIndexCleaner(jaeger).(*batchv1.CronJob) + + assert.Equal(t, ImagePullPolicy, esIndexCleaner.Spec.JobTemplate.Spec.Template.Spec.Containers[0].ImagePullPolicy) +} + +func TestEsIndexCleaneContainerSecurityContext(t *testing.T) { + jaeger := v1.NewJaeger(types.NamespacedName{Name: "TestEsIndexCleanerContainerSecurityContext"}) + days := 0 + jaeger.Spec.Storage.EsIndexCleaner.NumberOfDays = &days + + true := true + ContainerSecurityContext := &corev1.SecurityContext{ + ReadOnlyRootFilesystem: &true, + } + jaeger.Spec.Storage.EsIndexCleaner.NumberOfDays = &days + jaeger.Spec.Storage.EsIndexCleaner.ContainerSecurityContext = ContainerSecurityContext + + esIndexCleaner := CreateEsIndexCleaner(jaeger).(*batchv1.CronJob) + + assert.Equal(t, ContainerSecurityContext, esIndexCleaner.Spec.JobTemplate.Spec.Template.Spec.Containers[0].SecurityContext) +}