st-tech / gatling-operator

Automating distributed Gatling load testing using Kubernetes operator
MIT License
70 stars 19 forks source link

Update go version to 1.21 #103

Closed gold-kou closed 7 months ago

gold-kou commented 8 months ago

Description

Provide a description of what has been changed

Checklist

Please check if applicable

Relevant issue #https://github.com/st-tech/gatling-operator/issues/87

gold-kou commented 8 months ago

I checked kind-deploy works correctly in local. You can see 1.21-bullseye is used.

$ make kind-create
$ kubectl config use-context kind-gatling-cluster
$ make build
$ make install-crd
$ make kind-deploy
Cluster already exists
/Users/koki.hatano/github/gold-kou/gatling-operator/bin/controller-gen "crd:trivialVersions=true,preserveUnknownFields=false" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/Users/koki.hatano/github/gold-kou/gatling-operator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
go fmt ./...
go vet ./...
mkdir -p /Users/koki.hatano/github/gold-kou/gatling-operator/testbin
test -f /Users/koki.hatano/github/gold-kou/gatling-operator/testbin/setup-envtest.sh || curl -sSLo /Users/koki.hatano/github/gold-kou/gatling-operator/testbin/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.8.3/hack/setup-envtest.sh
source /Users/koki.hatano/github/gold-kou/gatling-operator/testbin/setup-envtest.sh; fetch_envtest_tools /Users/koki.hatano/github/gold-kou/gatling-operator/testbin; setup_envtest_env /Users/koki.hatano/github/gold-kou/gatling-operator/testbin; go test ./... -coverprofile cover.out
Using cached envtest tools from /Users/koki.hatano/github/gold-kou/gatling-operator/testbin
setting up env vars
?       github.com/st-tech/gatling-operator [no test files]
?       github.com/st-tech/gatling-operator/api/v1alpha1    [no test files]
ok      github.com/st-tech/gatling-operator/controllers 11.247s coverage: 30.2% of statements
ok      github.com/st-tech/gatling-operator/pkg/cloudstorages   0.539s  coverage: 97.7% of statements
ok      github.com/st-tech/gatling-operator/pkg/commands    0.799s  coverage: 0.0% of statements [no tests to run]
ok      github.com/st-tech/gatling-operator/pkg/notificationservices    0.479s  coverage: 34.6% of statements
?       github.com/st-tech/gatling-operator/pkg/utils   [no test files]
docker build -t gatling-operator:20240124-210052 .
[+] Building 60.7s (18/18) FINISHED
 => [internal] load build definition from Dockerfile                                                        0.0s
 => => transferring dockerfile: 867B                                                                        0.0s
 => [internal] load .dockerignore                                                                           0.0s
 => => transferring context: 193B                                                                           0.0s
 => [internal] load metadata for gcr.io/distroless/static:nonroot                                           2.5s
 => [internal] load metadata for docker.io/library/golang:1.21-bullseye                                     3.6s
 => [builder  1/10] FROM docker.io/library/golang:1.21-bullseye@sha256:47fa179d4966a0950485ede2ef81567bb1  17.1s
 => => resolve docker.io/library/golang:1.21-bullseye@sha256:47fa179d4966a0950485ede2ef81567bb1cf62e1e87af  0.0s
 => => sha256:47fa179d4966a0950485ede2ef81567bb1cf62e1e87af07e9830e5c928d06cd0 1.64kB / 1.64kB              0.0s
 => => sha256:82bd267b68ffa0bc2d38c0522998ddb369692b034b380a951f1b6730660bb79c 2.90kB / 2.90kB              0.0s
 => => sha256:03907f4fdc0cfdbba98c090649721e21a05caadff75b560517a9df65c5dac1e5 1.79kB / 1.79kB              0.0s
 => => sha256:cf83973c4a096cce9f37c421ad6f19cf1ebf7ae4d8ea98dac4913bd2aef08d1c 53.71MB / 53.71MB            7.1s
 => => sha256:aebf2a961043d6b9dd703d0a485e216a2e302edf2e2525f7f410987d26905e71 15.75MB / 15.75MB            3.5s
 => => sha256:646806c0e22a1bfa60edc42bcc6170f0ccd02431e5871b9cec1962c34d610232 54.70MB / 54.70MB            8.7s
 => => sha256:1384342314dc62830ae0ac253605a76fe149a65677d3b7c7a4b77efed55e7896 81.51MB / 81.51MB           12.6s
 => => extracting sha256:cf83973c4a096cce9f37c421ad6f19cf1ebf7ae4d8ea98dac4913bd2aef08d1c                   2.4s
 => => sha256:f0601d8c4414583ea46920c5ec7f7deee1d8e7a76a4d5684d0cc3380418d4632 64.16MB / 64.16MB           13.1s
 => => sha256:79db655fb096ec64cbcc963a363fa00ebe0a77aef4e1f92891f7cbaeda94639a 174B / 174B                  9.0s
 => => sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 32B / 32B                    9.3s
 => => extracting sha256:aebf2a961043d6b9dd703d0a485e216a2e302edf2e2525f7f410987d26905e71                   0.6s
 => => extracting sha256:646806c0e22a1bfa60edc42bcc6170f0ccd02431e5871b9cec1962c34d610232                   2.7s
 => => extracting sha256:1384342314dc62830ae0ac253605a76fe149a65677d3b7c7a4b77efed55e7896                   1.6s
 => => extracting sha256:f0601d8c4414583ea46920c5ec7f7deee1d8e7a76a4d5684d0cc3380418d4632                   2.0s
 => => extracting sha256:79db655fb096ec64cbcc963a363fa00ebe0a77aef4e1f92891f7cbaeda94639a                   0.0s
 => => extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1                   0.0s
 => [stage-1 1/3] FROM gcr.io/distroless/static:nonroot@sha256:112a87f19e83c83711cc81ce8ed0b4d79acd6578968  1.8s
 => => resolve gcr.io/distroless/static:nonroot@sha256:112a87f19e83c83711cc81ce8ed0b4d79acd65789682a6a272d  0.0s
 => => sha256:112a87f19e83c83711cc81ce8ed0b4d79acd65789682a6a272df57c4a0858534 1.51kB / 1.51kB              0.0s
 => => sha256:82f8020461a454c498a3123a14df39563a4ae2e3522174f8fa0ad0cdd8590a65 1.65kB / 1.65kB              0.0s
 => => sha256:bc383793856cbb4f6b23c2e3c2580305e3f3e9d6ed2367756fe07f253049dce7 1.30kB / 1.30kB              0.0s
 => => sha256:b003b463d7505c8e5cfe7034cacbeed297d6463c8b7f468037ee76a289510b3a 103.74kB / 103.74kB          0.4s
 => => sha256:fe5ca62666f04366c8e7f605aa82997d71320183e99962fa76b3209fdfbb8b58 21.20kB / 21.20kB            0.5s
 => => sha256:280126c0e181aba326fc843e7f17918dc9d54ddbfd917f5a3e0b346cec57fb70 717.05kB / 717.05kB          0.9s
 => => extracting sha256:b003b463d7505c8e5cfe7034cacbeed297d6463c8b7f468037ee76a289510b3a                   0.0s
 => => sha256:e8c73c638ae9ec5ad70c49df7e484040d889cca6b4a9af056579c3d058ea93f0 198B / 198B                  0.7s
 => => sha256:fcb6f6d2c9986d9cd6a2ea3cc2936e5fc613e09f1af9042329011e43057f3265 317B / 317B                  0.7s
 => => extracting sha256:fe5ca62666f04366c8e7f605aa82997d71320183e99962fa76b3209fdfbb8b58                   0.0s
 => => sha256:1e3d9b7d145208fa8fa3ee1c9612d0adaac7255f1bbc9ddea7e461e0b317805c 113B / 113B                  0.9s
 => => sha256:4aa0ea1413d37a58615488592a0b827ea4b2e48fa5a77cf707d0e35f025e613f 385B / 385B                  1.0s
 => => extracting sha256:280126c0e181aba326fc843e7f17918dc9d54ddbfd917f5a3e0b346cec57fb70                   0.1s
 => => sha256:7c881f9ab25e0d86562a123b5fb56aebf8aa0ddd7d48ef602faf8d1e7cf43d8c 355B / 355B                  1.2s
 => => sha256:5627a970d25e752d971a501ec7e35d0d6fdcd4a3ce9e958715a686853024794a 130.56kB / 130.56kB          1.3s
 => => extracting sha256:fcb6f6d2c9986d9cd6a2ea3cc2936e5fc613e09f1af9042329011e43057f3265                   0.0s
 => => extracting sha256:e8c73c638ae9ec5ad70c49df7e484040d889cca6b4a9af056579c3d058ea93f0                   0.0s
 => => extracting sha256:1e3d9b7d145208fa8fa3ee1c9612d0adaac7255f1bbc9ddea7e461e0b317805c                   0.0s
 => => extracting sha256:4aa0ea1413d37a58615488592a0b827ea4b2e48fa5a77cf707d0e35f025e613f                   0.0s
 => => extracting sha256:7c881f9ab25e0d86562a123b5fb56aebf8aa0ddd7d48ef602faf8d1e7cf43d8c                   0.0s
 => => extracting sha256:5627a970d25e752d971a501ec7e35d0d6fdcd4a3ce9e958715a686853024794a                   0.0s
 => [internal] load build context                                                                           0.0s
 => => transferring context: 215.14kB                                                                       0.0s
 => [builder  2/10] WORKDIR /workspace                                                                      0.6s
 => [builder  3/10] COPY go.mod go.mod                                                                      0.0s
 => [builder  4/10] COPY go.sum go.sum                                                                      0.0s
 => [builder  5/10] RUN go mod download                                                                    17.4s
 => [builder  6/10] COPY main.go main.go                                                                    0.0s
 => [builder  7/10] COPY api/ api/                                                                          0.0s
 => [builder  8/10] COPY controllers/ controllers/                                                          0.0s
 => [builder  9/10] COPY pkg/ pkg/                                                                          0.0s
 => [builder 10/10] RUN CGO_ENABLED=0 GOOS=linux GOARCH=$(dpkg --print-architecture) go build -a -o manag  21.6s
 => [stage-1 2/3] COPY --from=builder /workspace/manager .                                                  0.1s
 => exporting to image                                                                                      0.1s
 => => exporting layers                                                                                     0.1s
 => => writing image sha256:f7306fe9f6838e0b2db3841b861a74b5f6e369d717fa311a489b5cc164e523aa                0.0s
 => => naming to docker.io/library/gatling-operator:20240124-210052                                         0.0s
Loading image into kind
kind load docker-image gatling-operator:20240124-210052 --name "gatling-cluster" -v 1
Image: "gatling-operator:20240124-210052" with ID "sha256:f7306fe9f6838e0b2db3841b861a74b5f6e369d717fa311a489b5cc164e523aa" not yet present on node "gatling-cluster-control-plane", loading...
Image: "gatling-operator:20240124-210052" with ID "sha256:f7306fe9f6838e0b2db3841b861a74b5f6e369d717fa311a489b5cc164e523aa" not yet present on node "gatling-cluster-worker", loading...
cd config/manager && /Users/koki.hatano/github/gold-kou/gatling-operator/bin/kustomize edit set image controller=gatling-operator:20240124-210052
/Users/koki.hatano/github/gold-kou/gatling-operator/bin/kustomize build config/default | kubectl apply -f -
namespace/gatling-system unchanged
customresourcedefinition.apiextensions.k8s.io/gatlings.gatling-operator.tech.zozo.com configured
serviceaccount/gatling-operator-controller-manager unchanged
role.rbac.authorization.k8s.io/gatling-operator-leader-election-role unchanged
clusterrole.rbac.authorization.k8s.io/gatling-operator-manager-role configured
rolebinding.rbac.authorization.k8s.io/gatling-operator-leader-election-rolebinding unchanged
clusterrolebinding.rbac.authorization.k8s.io/gatling-operator-manager-rolebinding unchanged
deployment.apps/gatling-operator-controller-manager configured

Also checked kind-sample-deploy works correctly.

$ make kind-sample-deploy
Cluster already exists
cd gatling && docker build -t gatling:20240124-210702 .
[+] Building 2.1s (13/13) FINISHED
 => [internal] load build definition from Dockerfile                                                        0.0s
 => => transferring dockerfile: 1.52kB                                                                      0.0s
 => [internal] load .dockerignore                                                                           0.0s
 => => transferring context: 2B                                                                             0.0s
 => [internal] load metadata for docker.io/library/openjdk:17-jdk-slim-bullseye                             1.9s
 => [1/8] FROM docker.io/library/openjdk:17-jdk-slim-bullseye@sha256:aaa3b3cb27e3e520b8f116863d0580c438ed5  0.0s
 => [internal] load build context                                                                           0.0s
 => => transferring context: 11.91kB                                                                        0.0s
 => CACHED [2/8] WORKDIR /opt                                                                               0.0s
 => CACHED [3/8] RUN mkdir -p gatling                                                                       0.0s
 => CACHED [4/8] RUN apt-get update && apt-get upgrade -y && apt-get install -y wget unzip &&    mkdir -p   0.0s
 => CACHED [5/8] WORKDIR  /opt/gatling                                                                      0.0s
 => CACHED [6/8] COPY user-files/simulations user-files/simulations                                         0.0s
 => CACHED [7/8] COPY user-files/resources user-files/resources                                             0.0s
 => CACHED [8/8] COPY conf conf                                                                             0.0s
 => exporting to image                                                                                      0.0s
 => => exporting layers                                                                                     0.0s
 => => writing image sha256:53ea0a5d4aeb72495811c2252ea5e46a4d07a896f214cb6f96cbe8d3be0fad64                0.0s
 => => naming to docker.io/library/gatling:20240124-210702                                                  0.0s
Loading sample image into kind
kind load docker-image gatling:20240124-210702 --name "gatling-cluster" -v 1
Image with ID: sha256:53ea0a5d4aeb72495811c2252ea5e46a4d07a896f214cb6f96cbe8d3be0fad64 already present on the node gatling-cluster-control-plane but is missing the tag docker.io/library/gatling:20240124-210702. re-tagging...
Image with ID: sha256:53ea0a5d4aeb72495811c2252ea5e46a4d07a896f214cb6f96cbe8d3be0fad64 already present on the node gatling-cluster-worker but is missing the tag docker.io/library/gatling:20240124-210702. re-tagging...
/Users/koki.hatano/github/gold-kou/gatling-operator/bin/kustomize build config/samples | sed -e "s,^\([[:space:]]*gatlingImage: \).*,\1gatling:20240124-210702,g" | kubectl apply -f -
serviceaccount/gatling-operator-worker unchanged
role.rbac.authorization.k8s.io/pod-reader unchanged
rolebinding.rbac.authorization.k8s.io/read-pods configured
secret/gatling-notification-slack-secrets unchanged
gatling.gatling-operator.tech.zozo.com/gatling-sample01 created

A runner showed this log. Seems good 🎉

│ Wait until 2024-01-24 12:07:11
│ GATLING_HOME is set to /opt/gatling
│ 12:07:17.976 [WARN ] i.g.c.ZincCompiler$ - -target is deprecated: Use -release instead to compile against the
│ 12:07:25.106 [WARN ] i.g.c.ZincCompiler$ - one warning found
│ Jan 24, 2024 12:07:28 PM java.util.prefs.FileSystemPreferences$1 run
│ INFO: Created user preferences directory.
│ Gatling 3.10.3 is available! (you're using 3.9.5)
│ Simulation MyBasicSimulation started...
│
│ ================================================================================
│ 2024-01-24 12:07:37                                           5s elapsed
│ ---- Requests ------------------------------------------------------------------
│ > Global                                                   (OK=2      KO=0     )
│ > request_1                                                (OK=1      KO=0     )
│ > request_1 Redirect 1                                     (OK=1      KO=0     )
│
│ ---- Scenario Name -------------------------------------------------------------
│ [--------------------------------------------------------------------------]  0%
│           waiting: 0      / active: 1      / done: 0
│ ================================================================================
│
│
│ ================================================================================
│ 2024-01-24 12:07:42                                          10s elapsed
│ ---- Requests ------------------------------------------------------------------
│ > Global                                                   (OK=3      KO=0     )
│ > request_1                                                (OK=1      KO=0     )
│ > request_1 Redirect 1                                     (OK=1      KO=0     )
│ > request_2                                                (OK=1      KO=0     )
│
│ ---- Scenario Name -------------------------------------------------------------
│ [--------------------------------------------------------------------------]  0%
│           waiting: 0      / active: 1      / done: 0
│ ================================================================================
│
│ ================================================================================
│ 2024-01-24 12:07:46                                          13s elapsed
│ ---- Requests ------------------------------------------------------------------
│ > Global                                                   (OK=6      KO=0     )
│ > request_1                                                (OK=1      KO=0     )
│ > request_1 Redirect 1                                     (OK=1      KO=0     )
│ > request_2                                                (OK=1      KO=0     )
│ > request_3                                                (OK=1      KO=0     )
│ > request_4                                                (OK=1      KO=0     )
│ > request_4 Redirect 1                                     (OK=1      KO=0     )
│
│ ---- Scenario Name -------------------------------------------------------------
│ [##########################################################################]100%
│           waiting: 0      / active: 0      / done: 1
│ ================================================================================
│
│ Simulation MyBasicSimulation completed in 13 seconds
│ Stream closed EOF for default/gatling-sample01-runner-5xld9 (gatling-runner)