diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2248fc8..47d3443 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v2 with: - go-version: '1.21' + go-version: '1.17' - run: go version @@ -67,7 +67,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v2 with: - go-version: '1.21' + go-version: '1.17' - name: Login to GitHub Container Registry uses: docker/login-action@v1 diff --git a/Dockerfile b/Dockerfile index 7505aaa..e79cac9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM golang:1.21-bullseye as builder +FROM golang:1.17 as builder WORKDIR /workspace # Copy the Go Modules manifests diff --git a/Dockerfile.dev b/Dockerfile.dev index 1cfd954..ab39f0f 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,6 +1,6 @@ FROM ubuntu:22.04 -ENV GO_VERSION 1.21.7 +ENV GO_VERSION 1.17.13 ENV KUBECTL_VERSION v1.21.10 # KEEP the value as arm64. @@ -12,26 +12,26 @@ ENV ETCD_UNSUPPORTED_ARCH arm64 # Development tools RUN apt-get update && apt-get upgrade -y && apt-get install -y \ - wget \ - git \ - make \ - gcc + wget \ + git \ + make \ + gcc # Docker CLI # Referring to https://docs.docker.com/engine/install/ubuntu/#installation-methods RUN apt-get install -y \ - ca-certificates \ - curl \ - gnupg \ + ca-certificates \ + curl \ + gnupg \ && install -m 0755 -d /etc/apt/keyrings \ && curl -fsSL https://download.docker.com/linux/ubuntu/gpg \ - | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \ + | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \ && chmod a+r /etc/apt/keyrings/docker.gpg \ && echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ - "$(. /etc/os-release && echo "${VERSION_CODENAME}")" stable" \ - | tee /etc/apt/sources.list.d/docker.list > /dev/null \ + "$(. /etc/os-release && echo "${VERSION_CODENAME}")" stable" \ + | tee /etc/apt/sources.list.d/docker.list > /dev/null \ && apt-get update && apt-get install -y \ - docker-ce-cli + docker-ce-cli # kubectl # Referring to https://kubernetes.io/ja/docs/tasks/tools/install-kubectl/ diff --git a/Makefile b/Makefile index f2d5fa3..b24e571 100644 --- a/Makefile +++ b/Makefile @@ -138,26 +138,26 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi CONTROLLER_GEN = $(shell pwd)/bin/controller-gen controller-gen: ## Download controller-gen locally if necessary. - $(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1) + $(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1) KUSTOMIZE = $(shell pwd)/bin/kustomize kustomize: ## Download kustomize locally if necessary. - $(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v3@v3.8.7) + $(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v3@v3.8.7) CRD_REF_DOCS = $(shell pwd)/bin/crd-ref-docs crd-ref-docs: ## Download crd-ref-docs locally if necessary. - $(call go-install-tool,$(CRD_REF_DOCS),github.com/elastic/crd-ref-docs@master) + $(call go-get-tool,$(CRD_REF_DOCS),github.com/elastic/crd-ref-docs@master) -# go-install-tool will 'go get' any package $2 and install it to $1. +# go-get-tool will 'go get' any package $2 and install it to $1. PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) -define go-install-tool +define go-get-tool @[ -f $(1) ] || { \ set -e ;\ TMP_DIR=$$(mktemp -d) ;\ cd $$TMP_DIR ;\ go mod init tmp ;\ echo "Downloading $(2)" ;\ -GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\ +GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\ rm -rf $$TMP_DIR ;\ } endef diff --git a/controllers/gatling_controller.go b/controllers/gatling_controller.go index 55c0845..07c302d 100644 --- a/controllers/gatling_controller.go +++ b/controllers/gatling_controller.go @@ -464,8 +464,8 @@ func (r *GatlingReconciler) newGatlingRunnerJobForCR(gatling *gatlingv1alpha1.Ga }, Spec: batchv1.JobSpec{ BackoffLimit: &noRestarts, - Parallelism: r.getGatlingRunnerJobParallelism(gatling), - Completions: r.getGatlingRunnerJobParallelism(gatling), + Parallelism: r.getGatlingRunnerJobParallelism(gatling), + Completions: r.getGatlingRunnerJobParallelism(gatling), Template: corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Name: r.getObjectMeta(gatling).Name, @@ -531,8 +531,8 @@ func (r *GatlingReconciler) newGatlingRunnerJobForCR(gatling *gatlingv1alpha1.Ga }, Spec: batchv1.JobSpec{ BackoffLimit: &noRestarts, - Parallelism: &gatling.Spec.TestScenarioSpec.Parallelism, - Completions: &gatling.Spec.TestScenarioSpec.Parallelism, + Parallelism: &gatling.Spec.TestScenarioSpec.Parallelism, + Completions: &gatling.Spec.TestScenarioSpec.Parallelism, Template: corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Name: r.getObjectMeta(gatling).Name, diff --git a/docs/build-guide.md b/docs/build-guide.md index 6d7f24b..2185df4 100644 --- a/docs/build-guide.md +++ b/docs/build-guide.md @@ -27,6 +27,7 @@ git clone https://github.com/st-tech/gatling-operator - [kubectl](https://kubernetes.io/docs/tasks/tools/) - [kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installation) - [go](https://go.dev/doc/install) + - go version must be 1.17 ## Create a Kubernetes cluster diff --git a/go.mod b/go.mod index e930250..575598c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/st-tech/gatling-operator -go 1.21 +go 1.17 require ( github.com/go-logr/logr v1.2.0 diff --git a/go.sum b/go.sum index 4404d90..d1151f2 100644 --- a/go.sum +++ b/go.sum @@ -87,6 +87,7 @@ github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2y github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=