From c48be9054417bfe302b0c765461d40b43361d017 Mon Sep 17 00:00:00 2001 From: Cyril Scetbon Date: Thu, 3 Oct 2019 20:45:33 -0400 Subject: [PATCH 01/14] makefile-update - Refactoring and some cleaning --- Makefile | 107 ++++++++++++++++++------------------------------------- go.sum | 6 ++++ kube.mk | 20 ++++------- 3 files changed, 47 insertions(+), 86 deletions(-) diff --git a/Makefile b/Makefile index 73a23b446..dcda2d0f9 100644 --- a/Makefile +++ b/Makefile @@ -14,17 +14,11 @@ ################################################################################ - # Name of this service/application SERVICE_NAME := cassandra-k8s-operator - DOCKER_REPO_BASE ?= orangeopensource -#we could want to separate registry for branches DOCKER_REPO_BASE_TEST ?= orangeopensource - -# Docker image name for this project IMAGE_NAME := $(SERVICE_NAME) - BUILD_IMAGE ?= orangeopensource/casskop-build BOOTSTRAP_IMAGE ?= orangeopensource/cassandra-bootstrap:0.1.0 @@ -56,10 +50,10 @@ else endif endif -#Operator version is managed in go file -#BaseVersion is for dev docker image tag -BASEVERSION := $(shell cat version/version.go | awk -F\" '/Version =/ { print $$2}') -#Version is for binary, docker image and helm +# Operator version is managed in go file +# BaseVersion is for dev docker image tag +BASEVERSION := $(shell awk -F\" '/Version =/ { print $$2}' version/version.go) +# Version is for binary, docker image and helm ifdef CIRCLE_TAG VERSION := ${BRANCH} @@ -117,7 +111,6 @@ UID := $(shell id -u) # Commit hash from git COMMIT=$(shell git rev-parse HEAD) - # CMDs UNIT_TEST_CMD := KUBERNETES_CONFIG=`pwd`/config/test-kube-config.yaml POD_NAME=test go test --cover --coverprofile=coverage.out `go list ./... | grep -v e2e` > test-report.out UNIT_TEST_CMD_WITH_VENDOR := KUBERNETES_CONFIG=`pwd`/config/test-kube-config.yaml POD_NAME=test go test -mod=vendor --cover --coverprofile=coverage.out `go list -mod=vendor ./... | grep -v e2e` > test-report.out @@ -142,27 +135,19 @@ ifeq ($(UNAME_S),Darwin) GOOS = darwin endif -# Some other usefule make file for interracting with kubernetes +# Some other useful make file for interacting with kubernetes include kube.mk -# -# -################################################################################ - # The default action of this Makefile is to build the development docker image -.PHONY: default default: build .DEFAULT_GOAL := help help: @grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/' -## Example section -example_target: ## Description for example target - @does something - get-baseversion: @echo $(BASEVERSION) + get-version: @echo $(VERSION) @@ -187,10 +172,8 @@ build: ifdef PUSHLATEST docker tag $(REPOSITORY):$(VERSION) $(REPOSITORY):latest endif -# # Run a shell into the development docker image -.PHONY: docker-build docker-build: ## Build the Operator and it's Docker Image echo "Generate zzz-deepcopy objects" docker run --rm -v $(PWD):$(WORKDIR) -v $(GOPATH)/pkg/mod:/go/pkg/mod -v $(shell go env GOCACHE):/root/.cache/go-build --env GO111MODULE=on --env https_proxy=$(https_proxy) --env http_proxy=$(http_proxy) $(BUILD_IMAGE):$(OPERATOR_SDK_VERSION) /bin/bash -c 'operator-sdk generate k8s' @@ -201,7 +184,6 @@ ifdef PUSHLATEST endif # Build the docker development environment -.PHONY: build-ci-image build-ci-image: deps-development docker build --cache-from $(BUILD_IMAGE):latest \ --build-arg OPERATOR_SDK_VERSION=$(OPERATOR_SDK_VERSION) \ @@ -210,7 +192,6 @@ build-ci-image: deps-development -f $(DEV_DIR)/Dockerfile \ . -.PHONY: push-ci-image push-ci-image: deps-development docker push $(BUILD_IMAGE):$(OPERATOR_SDK_VERSION) ifdef PUSHLATEST @@ -238,59 +219,48 @@ circleci-validate: circleci config validate # Run a shell into the development docker image -.PHONY: shell shell: docker-dev-build docker run --env GO111MODULE=on -ti --rm -v ~/.kube:/.kube:ro -v $(PWD):$(WORKDIR) --name $(SERVICE_NAME) $(BUILD_IMAGE):$(OPERATOR_SDK_VERSION) /bin/bash - debug-port-forward: kubectl port-forward `kubectl get pod -l app=cassandra-k8s-operator -o jsonpath="{.items[0].metadata.name}"` 40000:40000 debug-pod-logs: kubectl logs -f `kubectl get pod -l app=cassandra-k8s-operator -o jsonpath="{.items[0].metadata.name}"` +define debug_telepresence + export TELEPRESENCE_REGISTRY=$(TELEPRESENCE_REGISTRY) + echo "execute : cat cassandra-operator.env" + sudo mkdir -p /var/run/secrets/kubernetes.io + sudo ln -s /tmp/known/var/run/secrets/kubernetes.io/serviceaccount /var/run/secrets/kubernetes.io/ + tdep=`kubectl get deployment -l app=cassandra-operator -o jsonpath='{.items[0].metadata.name}'` + telepresence --swap-deployment $$tdep --mount=/tmp/known --env-file cassandra-operator.env $1 $2 +endef + debug-telepresence: - export TELEPRESENCE_REGISTRY=$(TELEPRESENCE_REGISTRY) ; \ - echo "execute : cat cassandra-operator.env" ; \ - sudo mkdir -p /var/run/secrets/kubernetes.io ; \ - sudo ln -s /tmp/known/var/run/secrets/kubernetes.io/serviceaccount /var/run/secrets/kubernetes.io/ ; \ - tdep=$(shell kubectl get deployment -l app=cassandra-operator -o jsonpath='{.items[0].metadata.name}') ; \ - telepresence --swap-deployment $$tdep --mount=/tmp/known --env-file cassandra-operator.env + $(call debug_telepresence) debug-telepresence-with-alias: - export TELEPRESENCE_REGISTRY=$(TELEPRESENCE_REGISTRY) ; \ - echo "execute : cat cassandra-operator.env" ; \ - sudo mkdir -p /var/run/secrets/kubernetes.io ; \ - sudo ln -s /tmp/known/var/run/secrets/kubernetes.io/serviceaccount /var/run/secrets/kubernetes.io/ ; \ - tdep=$(shell kubectl get deployment -l app=cassandra-operator -o jsonpath='{.items[0].metadata.name}') ; \ - telepresence --swap-deployment $$tdep --mount=/tmp/known --env-file cassandra-operator.env \ - --also-proxy 10.40.0.0/16 -# --also-proxy 172.18.0.0/16 - + $(call debug_telepresence,--also-proxy,10.40.0.0/16) + # $(call debug_telepresence,--also-proxy,172.18.0.0/16) debug-kubesquash: kubesquash --container-repo $(KUBESQUASH_REGISTRY) - # Run the development environment (in local go env) in the background using local ~/.kube/config -.PHONY: run run: export POD_NAME=cassandra-k8s-operator; \ operator-sdk up local - -.PHONY: push push: docker push $(REPOSITORY):$(VERSION) ifdef PUSHLATEST docker push $(REPOSITORY):latest endif -.PHONY: tag tag: git tag $(VERSION) -.PHONY: publish publish: @COMMIT_VERSION="$$(git rev-list -n 1 $(VERSION))"; \ docker tag $(REPOSITORY):"$$COMMIT_VERSION" $(REPOSITORY):$(VERSION) @@ -299,45 +269,39 @@ ifdef PUSHLATEST docker push $(REPOSITORY):latest endif -.PHONY: release release: tag image publish # Test stuff in dev -.PHONY: docker-unit-test docker-unit-test: - docker run --env GO111MODULE=on --rm -v $(PWD):$(WORKDIR) -v $(GOPATH)/pkg/mod:/go/pkg/mod -v $(shell go env GOCACHE):/root/.cache/go-build $(BUILD_IMAGE):$(OPERATOR_SDK_VERSION) /bin/bash -c '$(UNIT_TEST_CMD); cat test-report.out; $(UNIT_TEST_COVERAGE)' -.PHONY: docker-unit-test-with-vendor + docker run --env GO111MODULE=on --rm -v $(PWD):$(WORKDIR) -v $(GOPATH)/pkg/mod:/go/pkg/mod -v $(shell go env GOCACHE):/root/.cache/go-build $(BUILD_IMAGE):$(OPERATOR_SDK_VERSION) /bin/bash -c '$(UNIT_TEST_CMD); cat test-report.out; $(UNIT_TEST_COVERAGE)' + docker-unit-test-with-vendor: - docker run --env GO111MODULE=on --rm -v $(PWD):$(WORKDIR) -v $(GOPATH)/pkg/mod:/go/pkg/mod -v $(shell go env GOCACHE):/root/.cache/go-build $(BUILD_IMAGE):$(OPERATOR_SDK_VERSION) /bin/bash -c '$(UNIT_TEST_CMD_WITH_VENDOR); cat test-report.out; $(UNIT_TEST_COVERAGE)' + docker run --env GO111MODULE=on --rm -v $(PWD):$(WORKDIR) -v $(GOPATH)/pkg/mod:/go/pkg/mod -v $(shell go env GOCACHE):/root/.cache/go-build $(BUILD_IMAGE):$(OPERATOR_SDK_VERSION) /bin/bash -c '$(UNIT_TEST_CMD_WITH_VENDOR); cat test-report.out; $(UNIT_TEST_COVERAGE)' -.PHONY: unit-test unit-test: $(UNIT_TEST_CMD) && echo "success!" || { echo "failure!"; cat test-report.out; exit 1; } cat test-report.out $(UNIT_TEST_COVERAGE) -.PHONY: unit-test-with-vendor unit-test-with-vendor: $(UNIT_TEST_CMD_WITH_VENDOR) && echo "success!" || { echo "failure!"; cat test-report.out; exit 1; } cat test-report.out $(UNIT_TEST_COVERAGE) +define run-operator-cmd + docker run --env GO111MODULE=on -ti --rm -v $(PWD):$(WORKDIR) -u $(UID):$(GID) --name $(SERVICE_NAME) $(BUILD_IMAGE):$(OPERATOR_SDK_VERSION) /bin/sh -c $1 +endef -.PHONY: docker-go-lint docker-go-lint: - docker run --env GO111MODULE=on -ti --rm -v $(PWD):$(WORKDIR) -u $(UID):$(GID) --name $(SERVICE_NAME) $(BUILD_IMAGE):$(OPERATOR_SDK_VERSION) /bin/sh -c '$(GO_LINT_CMD)' + $(call run-operator-cmd,$(GO_LINT_CMD)) # golint is not fully supported by modules yet - https://github.com/golang/lint/issues/409 -.PHONY: go-lint go-lint: $(GO_LINT_CMD) - -.PHONY: mocks mocks: docker run --env GO111MODULE=on -ti --rm -v $(PWD):$(WORKDIR) -u $(UID):$(GID) --name $(SERVICE_NAME) $(BUILD_IMAGE):$(OPERATOR_SDK_VERSION) /bin/sh -c '$(MOCKS_CMD)' -.PHONY: deps-development # Test if the dependencies we need to run this Makefile are installed deps-development: ifndef DOCKER @@ -345,47 +309,45 @@ ifndef DOCKER @exit 1 endif - #Generate dep for graph UNAME := $(shell uname -s) + dep-graph: ifeq ($(UNAME), Darwin) -# do something osxsd dep status -dot | dot -T png | open -f -a /Applications/Preview.app endif ifeq ($(UNAME), Linux) -# do something osx dep status -dot | dot -T png | display endif - count: git ls-files | xargs wc -l - image: echo $(REPOSITORY):$(VERSION) export CGO_ENABLED:=0 -.PHONY: e2e e2e-scaleup docker-e2e e2e: operator-sdk test local ./test/e2e --image $(E2EIMAGE) --go-test-flags "-v -timeout 40m" || { kubectl get events --all-namespaces --sort-by .metadata.creationTimestamp ; exit 1; } docker-e2e: docker run --env GO111MODULE=on --rm -v $(PWD):$(WORKDIR) -v $(KUBECONFIG):/root/.kube/config -v $(MINIKUBE_CONFIG):$(MINIKUBE_CONFIG_MOUNT) $(BUILD_IMAGE):$(OPERATOR_SDK_VERSION) /bin/bash -c 'operator-sdk test local ./test/e2e --debug --image $(E2EIMAGE) --go-test-flags "-v -timeout 40m"' || { kubectl get events --all-namespaces --sort-by .metadata.creationTimestamp ; exit 1; } + +define scale-test + operator-sdk test local ./test/e2e --image $(E2EIMAGE) --go-test-flags "-v -timeout 40m -run ^TestCassandraCluster$$/^group$$/^$1$$" || { kubectl get events --all-namespaces --sort-by .metadata.creationTimestamp ; exit 1; } +endef + e2e-scaleup: - operator-sdk test local ./test/e2e --image $(E2EIMAGE) --go-test-flags "-v -timeout 40m -run ^TestCassandraCluster$$/^group$$/^ClusterScaleUp$$" || { kubectl get events --all-namespaces --sort-by .metadata.creationTimestamp ; exit 1; } + $(call scale-test,ClusterScaleUp) e2e-scaledown: - operator-sdk test local ./test/e2e --image $(E2EIMAGE) --go-test-flags "-v -timeout 40m -run ^TestCassandraCluster$$/^group$$/^ClusterScaleDown$$" || { kubectl get events --all-namespaces --sort-by .metadata.creationTimestamp ; exit 1; } + $(call scale-test,ClusterScaleDown) e2e-empty: operator-sdk test local ./test/e2e --image $(E2EIMAGE) --go-test-flags "-v -timeout 40m -run ^empty$$" - -.PHONY: e2e-test-fix e2e-tet-fix-arg docker-e2e-test-fix docker-e2e-test-fix-arg e2e-test-fix: operator-sdk test local ./test/e2e --debug --image $(E2EIMAGE) --go-test-flags "-v -timeout 60m" --namespace cassandra-e2e || { kubectl get events --all-namespaces --sort-by .metadata.creationTimestamp ; exit 1; } @@ -393,6 +355,7 @@ ifeq (e2e-test-fix-arg,$(firstword $(MAKECMDGOALS))) E2E_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) $(eval $(E2E_ARGS):;@:) endif + e2e-test-fix-arg: ifeq ($(E2E_ARGS),) @echo "args are: RollingRestart ; ClusterScaleDown ; ClusterScaleUp ; ClusterScaleDownSimple" && exit 1 @@ -408,13 +371,13 @@ ifeq (docker-e2e-test-fix-arg,$(firstword $(MAKECMDGOALS))) E2E_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) $(eval $(E2E_ARGS):;@:) endif + docker-e2e-test-fix-arg: ifeq ($(E2E_ARGS),) @echo "args are: RollingRestart ; ClusterScaleDown ; ClusterScaleUp ; ClusterScaleDownSimple" && exit 1 endif docker run --rm --env GO111MODULE=on -v $(PWD):$(WORKDIR) -v $(KUBECONFIG):/root/.kube/config -v $(MINIKUBE_CONFIG):$(MINIKUBE_CONFIG_MOUNT) $(BUILD_IMAGE):$(OPERATOR_SDK_VERSION) /bin/bash -c 'operator-sdk test local ./test/e2e --debug --image $(E2EIMAGE) --go-test-flags "-v -timeout 60m -run ^TestCassandraCluster$$/^group$$/^$(E2E_ARGS)$$" --namespace cassandra-e2e' || { kubectl get events --all-namespaces --sort-by .metadata.creationTimestamp ; exit 1; } -.PHONY: e2e-test-fix e2e-test-fix-scale-down: operator-sdk test local ./test/e2e --image $(E2EIMAGE) --go-test-flags "-v -timeout 60m -run ^TestCassandraCluster$$/^group$$/^ClusterScaleDown$$" --namespace cassandra-e2e || { kubectl get events --all-namespaces --sort-by .metadata.creationTimestamp ; exit 1; } diff --git a/go.sum b/go.sum index 7597da375..05bd3a5bf 100644 --- a/go.sum +++ b/go.sum @@ -108,6 +108,8 @@ github.com/evanphx/json-patch v4.0.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi github.com/evanphx/json-patch v4.1.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/ewohltman/graphdot v0.1.1 h1:kB7YkdMxoGk9SJ5Nh3mnuDqJtTLrGavAmElcxL9DQQk= +github.com/ewohltman/graphdot v0.1.1/go.mod h1:ubGca4uEkZRP5Dz4vkdZa0xBif9gHyIwH0EGRKmD8eQ= github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZMPRZwes7CROmyNKgQzC3XPs6L/G2EJLHddWejkmf4= github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= @@ -475,6 +477,7 @@ golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTk golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -564,6 +567,9 @@ golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190703212419-2214986f1668 h1:3LJOYcj2ObWSZJXX21oGIIPv5SaOoi5JkzQTWnCXRhg= golang.org/x/tools v0.0.0-20190703212419-2214986f1668/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= +golang.org/x/tools v0.0.0-20191003235154-9cd7e18f8ef7 h1:QWds/6MH0OoyfHTSfnYZEhZrF7GtZMg03SiU9bBTotU= +golang.org/x/tools v0.0.0-20191003235154-9cd7e18f8ef7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20181220000619-583d854617af/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= diff --git a/kube.mk b/kube.mk index aa985e2d0..4cf60201e 100644 --- a/kube.mk +++ b/kube.mk @@ -29,7 +29,7 @@ ifeq (nodetool,$(firstword $(MAKECMDGOALS))) $(eval $(NODETOOL_ARGS):;@:) endif -ifeq (kube-namespace,$(firstword $(MAKECMDGOALS))) +ifeq (kube-set-namespace,$(firstword $(MAKECMDGOALS))) # use the rest as arguments for "run" KUBENAMESPACE_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) # ...and turn them into do-nothing targets @@ -100,11 +100,11 @@ list-app-by-nodes: kubectl describe node $$node | egrep "$(APP)|namespace" ; \ done -#Force kubectl to use the NAMESPACE by default -kubectl-change-namespace: - kubectl config set-context $$(kubectl config current-context) --namespace=$(NAMESPACE) +# Change current namespace +kube-set-namespace: + kubectl config set-context $$(kubectl config current-context) --namespace=$(KUBENAMESPACE_ARGS) -# Supprime le namespace +# Delete a namespace delete: kubectl delete namespace $(NAMESPACE) @@ -133,7 +133,7 @@ hostname: for pod in $$KUBE_PODS; do kubectl -n $(NAMESPACE) exec -it $$pod -- sh -c 'hostname'; done # Go into each Cassandra pods, and create a /var/lib/cassandra/name file with the host name -fullfil: +fulfill: KUBE_PODS=`kubectl -n $(NAMESPACE) get pods -o jsonpath='{range .items[*]}{.metadata.name}{" "}'` ; \ for pod in $$KUBE_PODS; do kubectl -n $(NAMESPACE) exec -it $$pod -- sh -c "echo $$(hostname) > /var/lib/cassandra/$(NAMESPACE)-$$pod"; done @@ -214,7 +214,6 @@ check-pvc: echo "" ; \ done - #Usage make node 'ls -la' node: KUBE_IPS=`kubectl get nodes -l node-role.kubernetes.io/node=true -o jsonpath='{range .items[*]}{.status.addresses[0].address}{" "}'` ; \ @@ -223,14 +222,12 @@ node: ssh -q cloudwatt-k8s "ssh $$x '$(NODE_ARGS)'" ; \ done; - annotate-upgradesstables: make check-annotations KUBE_PODS=`kubectl -n $(NAMESPACE) get pods -o jsonpath='{range .items[*]}{.metadata.name}{" "}'` ; \ for x in $$KUBE_PODS; do kubectl -n $(NAMESPACE) annotate --overwrite pods $$x cc-action=upgradesstables; done make check-annotations - os: echo $(GOOS) @@ -238,11 +235,6 @@ check-env: echo "working on OS type $(GOOS)" echo " Working with docker repository $(REPOSITORY)" -#usage: kube-namespace -#permet de changer le namespace par default de kubectl -kube-namespace: - kubectl config set-context $$(kubectl config current-context) --namespace=$(KUBENAMESPACE_ARGS) - #list all resources in current namespace list-all: kubectl api-resources --verbs=list --namespaced -o name | grep -v events | xargs -n 1 kubectl get --show-kind --ignore-not-found From 398bdb615cce7867b6a603683121255bffe4daa4 Mon Sep 17 00:00:00 2001 From: Cyril Scetbon Date: Sun, 6 Oct 2019 12:26:09 -0400 Subject: [PATCH 02/14] makefile-update - Follow best practices --- docker/circleci/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docker/circleci/Dockerfile b/docker/circleci/Dockerfile index e4d4c8353..2016075e2 100644 --- a/docker/circleci/Dockerfile +++ b/docker/circleci/Dockerfile @@ -103,12 +103,10 @@ RUN mkdir -p $GOPATH/src/github.com/operator-framework \ && rm -rf /root/.cache \ && rm -rf /go/pkg/dep/sources/ - - # END IMAGE CUSTOMIZATIONS #USER circleci -WORKDIR cassandra-k8s-operator +WORKDIR /go/cassandra-k8s-operator CMD ["/bin/sh"] From 3430b3bc6a10f52e6eeba0be8f54583b8900358d Mon Sep 17 00:00:00 2001 From: Cyril Scetbon Date: Sun, 6 Oct 2019 12:42:22 -0400 Subject: [PATCH 03/14] makefile-update - Fix case and remove useless comments --- docker/circleci/Dockerfile | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/docker/circleci/Dockerfile b/docker/circleci/Dockerfile index 2016075e2..44a3217d6 100644 --- a/docker/circleci/Dockerfile +++ b/docker/circleci/Dockerfile @@ -1,7 +1,7 @@ #https://github.com/CircleCI-Public/circleci-dockerfiles/blob/master/golang/images/1.12.4/Dockerfile FROM golang:1.12.4 -# make Apt non-interactive +# Make Apt non-interactive RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \ && echo 'DPkg::Options "--force-confnew";' >> /etc/apt/apt.conf.d/90circleci @@ -29,7 +29,6 @@ RUN apt-get update \ locales sudo openssh-client ca-certificates tar gzip \ net-tools netcat unzip zip bzip2 gnupg curl wget - # Set timezone to UTC by default RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime @@ -37,24 +36,13 @@ RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime RUN locale-gen C.UTF-8 || true ENV LANG=C.UTF-8 -# install jq +# Install jq RUN JQ_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/jq-latest" \ && curl --silent --show-error --location --fail --retry 3 --output /usr/bin/jq $JQ_URL \ && chmod +x /usr/bin/jq \ && jq --version # Install Docker - -# Docker.com returns the URL of the latest binary when you hit a directory listing -# We curl this URL and `grep` the version out. -# The output looks like this: - -#> # To install, run the following commands as root: -#> curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-17.05.0-ce.tgz && tar --strip-components=1 -xvzf docker-17.05.0-ce.tgz -C /usr/local/bin -#> -#> # Then start docker in daemon mode: -#> /usr/local/bin/dockerd - RUN set -ex \ && export DOCKER_VERSION=$(curl --silent --fail --retry 3 https://download.docker.com/linux/static/stable/x86_64/ | grep -o -e 'docker-[.0-9]*\.tgz' | sort -r | head -n 1) \ && DOCKER_URL="https://download.docker.com/linux/static/stable/x86_64/${DOCKER_VERSION}" \ @@ -67,32 +55,27 @@ RUN set -ex \ && which docker \ && (docker version || true) - RUN groupadd --gid 3434 circleci \ && useradd --uid 3434 --gid circleci --shell /bin/bash --create-home circleci \ && echo 'circleci ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-circleci \ && echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep -# BEGIN IMAGE CUSTOMIZATIONS - RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | INSTALL_DIRECTORY=/usr/local/bin sh RUN curl -sSL https://github.com/gotestyourself/gotestsum/releases/download/v0.3.4/gotestsum_0.3.4_linux_amd64.tar.gz | \ tar -xz -C /usr/local/bin gotestsum - -#Add kubectl cli +# Install kubectl cli RUN curl -L https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl \ && chmod +x /usr/local/bin/kubectl - -#Add helm client +# Install helm client RUN curl -L https://storage.googleapis.com/kubernetes-helm/helm-v2.12.2-linux-amd64.tar.gz -o helm.tar.gz \ && tar zxf helm.tar.gz \ && mv linux-amd64/helm /usr/local/bin \ && rm -rf helm.tar.gz linux-amd64 -ARG OPERATOR_SDK_VERSION # Install Operator SDK +ARG OPERATOR_SDK_VERSION RUN mkdir -p $GOPATH/src/github.com/operator-framework \ && go get -u github.com/operator-framework/operator-sdk || true \ && cd $GOPATH/src/github.com/operator-framework/operator-sdk \ @@ -103,10 +86,6 @@ RUN mkdir -p $GOPATH/src/github.com/operator-framework \ && rm -rf /root/.cache \ && rm -rf /go/pkg/dep/sources/ -# END IMAGE CUSTOMIZATIONS - -#USER circleci - WORKDIR /go/cassandra-k8s-operator CMD ["/bin/sh"] From a2049b9ff092daeb77bad1bd734fd415e70e7f77 Mon Sep 17 00:00:00 2001 From: Cyril Scetbon Date: Sun, 6 Oct 2019 12:38:31 -0400 Subject: [PATCH 04/14] makefile-update - Install golint --- docker/circleci/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/circleci/Dockerfile b/docker/circleci/Dockerfile index 44a3217d6..c460bc7b6 100644 --- a/docker/circleci/Dockerfile +++ b/docker/circleci/Dockerfile @@ -63,6 +63,7 @@ RUN groupadd --gid 3434 circleci \ RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | INSTALL_DIRECTORY=/usr/local/bin sh RUN curl -sSL https://github.com/gotestyourself/gotestsum/releases/download/v0.3.4/gotestsum_0.3.4_linux_amd64.tar.gz | \ tar -xz -C /usr/local/bin gotestsum +RUN go get -u golang.org/x/lint/golint # Install kubectl cli RUN curl -L https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl \ From 5e61af52033bdeaeec3f76615947f7a42b82b070 Mon Sep 17 00:00:00 2001 From: Cyril Scetbon Date: Mon, 7 Oct 2019 22:48:44 -0400 Subject: [PATCH 05/14] makefile-update - Refactoring --- kube.mk | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/kube.mk b/kube.mk index 4cf60201e..5c3c3a986 100644 --- a/kube.mk +++ b/kube.mk @@ -71,8 +71,7 @@ ifeq (get,$(firstword $(MAKECMDGOALS))) $(eval $(GET_ARGS):;@:) endif -.PHONY: nodetool node get - +.PHONY: debug watch cc watch-pods get-pods nodetool node get debug: curl -ssLO https://raw.githubusercontent.com/kubernetes/contrib/master/scratch-debugger/debug.sh @@ -80,10 +79,10 @@ debug: #watch cassandracluster object watch: watch 'kubectl get -o yaml cassandracluster $(WATCH_ARGS)' + cc: kubectl get -o yaml cassandracluster $(STATUS_ARGS) -.PHONY: debug watch cc watch-pods get-pods watch-pods: watch "kubectl get pods -o=go-template='{{\"NAME NODE IP READY REASON\n\"}}{{range .items}}\ {{printf \"%.30s\" .metadata.name}} \ @@ -92,13 +91,12 @@ watch-pods: {{range .status.containerStatuses}}{{.ready}}{{\" \"}}{{if .state.running}}{{\"running\"}}{{else}}{{ .state.waiting.reason}}{{end}}{{end}} \ {{\"\n\"}}{{end}}' | column -t" - list-app-by-nodes: KUBE_NODES=`kubectl get nodes -l node-role.kubernetes.io/node=true -o jsonpath='{range .items[*]}{.metadata.name}{" "}'` ; \ for node in $$KUBE_NODES; do \ echo "node $$node" ; \ kubectl describe node $$node | egrep "$(APP)|namespace" ; \ - done + done # Change current namespace kube-set-namespace: @@ -116,7 +114,6 @@ create: kubectl -n $(NAMESPACE) apply -f cassandra-PodDisruptionBudget.yaml make apply - delete-pvc: kubectl get pvc -o jsonpath='{.items[*].metadata.name}' | xargs k delete pvc @@ -161,7 +158,6 @@ check-seeds-env: echo "" ; \ done - # for each cassandra pods, extract the docker image name from metadata check-version: kubectl -n $(NAMESPACE) get pods -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.spec.containers[0].image}{"\n"}{.spec.initContainers[1].image}{"\n"}' @@ -194,7 +190,6 @@ nodetool-repair-full2: KUBE_PODS=`kubectl -n $(NAMESPACE) get pods -l app=cassandracluster -o jsonpath='{range .items[*]}{.metadata.name}{" "}'` ; \ echo $$KUBE_PODS | xargs -I XX kubectl -n $(NAMESPACE) exec -it XX -- sh -c 'echo "$$HOSTNAME:"; echo nodetool repair -full' - pod-repartition: echo to implement From 6df25034b4c1c5fb4194f11a252e84a8eeb1020a Mon Sep 17 00:00:00 2001 From: Cyril Scetbon Date: Tue, 8 Oct 2019 13:57:27 -0400 Subject: [PATCH 06/14] makefile-update - Remove mocks generation --- Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Makefile b/Makefile index dcda2d0f9..aa316d20e 100644 --- a/Makefile +++ b/Makefile @@ -117,7 +117,6 @@ UNIT_TEST_CMD_WITH_VENDOR := KUBERNETES_CONFIG=`pwd`/config/test-kube-config.yam UNIT_TEST_COVERAGE := go tool cover -html=coverage.out -o coverage.html GO_GENERATE_CMD := go generate `go list ./... | grep -v /vendor/` GO_LINT_CMD := golint `go list ./... | grep -v /vendor/` -MOCKS_CMD := go generate ./mocks # environment dirs DEV_DIR := docker/circleci @@ -299,9 +298,6 @@ docker-go-lint: go-lint: $(GO_LINT_CMD) -mocks: - docker run --env GO111MODULE=on -ti --rm -v $(PWD):$(WORKDIR) -u $(UID):$(GID) --name $(SERVICE_NAME) $(BUILD_IMAGE):$(OPERATOR_SDK_VERSION) /bin/sh -c '$(MOCKS_CMD)' - # Test if the dependencies we need to run this Makefile are installed deps-development: ifndef DOCKER From a633297c42f016c1f9fe166f86336ec4aa2fc423 Mon Sep 17 00:00:00 2001 From: Cyril Scetbon Date: Tue, 8 Oct 2019 14:03:49 -0400 Subject: [PATCH 07/14] makefile-update - Move cassandra-stress out of tests folder --- Makefile | 6 +++--- .../cassandra-stress => cassandra-stress}/big_stress.yaml | 0 .../cassandra-stress-big.yaml | 0 .../cassandra-stress-huge.yaml | 0 .../cassandra-stress-medium.yaml | 0 .../cassandra-stress-normal.yaml | 0 .../cassandra-stress-pig.yaml | 0 .../cassandra-stress-small.yaml | 0 .../cassandra-stress.yaml | 0 .../cassandra-stress => cassandra-stress}/huge_stress.yaml | 0 .../medium_stress.yaml | 0 .../normal_stress.yaml | 0 .../cassandra-stress => cassandra-stress}/small_stress.yaml | 0 13 files changed, 3 insertions(+), 3 deletions(-) rename {tests/cassandra-stress => cassandra-stress}/big_stress.yaml (100%) rename {tests/cassandra-stress => cassandra-stress}/cassandra-stress-big.yaml (100%) rename {tests/cassandra-stress => cassandra-stress}/cassandra-stress-huge.yaml (100%) rename {tests/cassandra-stress => cassandra-stress}/cassandra-stress-medium.yaml (100%) rename {tests/cassandra-stress => cassandra-stress}/cassandra-stress-normal.yaml (100%) rename {tests/cassandra-stress => cassandra-stress}/cassandra-stress-pig.yaml (100%) rename {tests/cassandra-stress => cassandra-stress}/cassandra-stress-small.yaml (100%) rename {tests/cassandra-stress => cassandra-stress}/cassandra-stress.yaml (100%) rename {tests/cassandra-stress => cassandra-stress}/huge_stress.yaml (100%) rename {tests/cassandra-stress => cassandra-stress}/medium_stress.yaml (100%) rename {tests/cassandra-stress => cassandra-stress}/normal_stress.yaml (100%) rename {tests/cassandra-stress => cassandra-stress}/small_stress.yaml (100%) diff --git a/Makefile b/Makefile index aa316d20e..009c677b3 100644 --- a/Makefile +++ b/Makefile @@ -403,13 +403,13 @@ PASSWORD ?= cassandra cassandra-stress: kubectl delete configmap cassandra-stress-$(STRESS_TYPE) || true - cp tests/cassandra-stress/$(STRESS_TYPE)_stress.yaml /tmp/ + cp cassandra-stress/$(STRESS_TYPE)_stress.yaml /tmp/ echo Using replication factor $(REPLICATION_FACTOR) with DC $(DC) in cassandra-stress profile file sed -i -e "s/'dc1': '3'/'$(DC)': '$(REPLICATION_FACTOR)'/" /tmp/$(STRESS_TYPE)_stress.yaml kubectl create configmap cassandra-stress-$(STRESS_TYPE) --from-file=/tmp/$(STRESS_TYPE)_stress.yaml - kubectl delete -f tests/cassandra-stress/cassandra-stress-$(STRESS_TYPE).yaml --wait=false || true + kubectl delete -f cassandra-stress/cassandra-stress-$(STRESS_TYPE).yaml --wait=false || true while kubectl get pod cassandra-stress-$(STRESS_TYPE)>/dev/null; do echo -n "."; sleep 1 ; done - cp tests/cassandra-stress/cassandra-stress-$(STRESS_TYPE).yaml /tmp/ + cp cassandra-stress/cassandra-stress-$(STRESS_TYPE).yaml /tmp/ sed -i -e 's/user=[a-zA-Z]* password=[a-zA-Z]*/user=$(USERNAME) password=$(PASSWORD)/' /tmp/cassandra-stress-$(STRESS_TYPE).yaml ifdef CASSANDRA_IMAGE echo "using Cassandra image $(CASSANDRA_IMAGE)" diff --git a/tests/cassandra-stress/big_stress.yaml b/cassandra-stress/big_stress.yaml similarity index 100% rename from tests/cassandra-stress/big_stress.yaml rename to cassandra-stress/big_stress.yaml diff --git a/tests/cassandra-stress/cassandra-stress-big.yaml b/cassandra-stress/cassandra-stress-big.yaml similarity index 100% rename from tests/cassandra-stress/cassandra-stress-big.yaml rename to cassandra-stress/cassandra-stress-big.yaml diff --git a/tests/cassandra-stress/cassandra-stress-huge.yaml b/cassandra-stress/cassandra-stress-huge.yaml similarity index 100% rename from tests/cassandra-stress/cassandra-stress-huge.yaml rename to cassandra-stress/cassandra-stress-huge.yaml diff --git a/tests/cassandra-stress/cassandra-stress-medium.yaml b/cassandra-stress/cassandra-stress-medium.yaml similarity index 100% rename from tests/cassandra-stress/cassandra-stress-medium.yaml rename to cassandra-stress/cassandra-stress-medium.yaml diff --git a/tests/cassandra-stress/cassandra-stress-normal.yaml b/cassandra-stress/cassandra-stress-normal.yaml similarity index 100% rename from tests/cassandra-stress/cassandra-stress-normal.yaml rename to cassandra-stress/cassandra-stress-normal.yaml diff --git a/tests/cassandra-stress/cassandra-stress-pig.yaml b/cassandra-stress/cassandra-stress-pig.yaml similarity index 100% rename from tests/cassandra-stress/cassandra-stress-pig.yaml rename to cassandra-stress/cassandra-stress-pig.yaml diff --git a/tests/cassandra-stress/cassandra-stress-small.yaml b/cassandra-stress/cassandra-stress-small.yaml similarity index 100% rename from tests/cassandra-stress/cassandra-stress-small.yaml rename to cassandra-stress/cassandra-stress-small.yaml diff --git a/tests/cassandra-stress/cassandra-stress.yaml b/cassandra-stress/cassandra-stress.yaml similarity index 100% rename from tests/cassandra-stress/cassandra-stress.yaml rename to cassandra-stress/cassandra-stress.yaml diff --git a/tests/cassandra-stress/huge_stress.yaml b/cassandra-stress/huge_stress.yaml similarity index 100% rename from tests/cassandra-stress/huge_stress.yaml rename to cassandra-stress/huge_stress.yaml diff --git a/tests/cassandra-stress/medium_stress.yaml b/cassandra-stress/medium_stress.yaml similarity index 100% rename from tests/cassandra-stress/medium_stress.yaml rename to cassandra-stress/medium_stress.yaml diff --git a/tests/cassandra-stress/normal_stress.yaml b/cassandra-stress/normal_stress.yaml similarity index 100% rename from tests/cassandra-stress/normal_stress.yaml rename to cassandra-stress/normal_stress.yaml diff --git a/tests/cassandra-stress/small_stress.yaml b/cassandra-stress/small_stress.yaml similarity index 100% rename from tests/cassandra-stress/small_stress.yaml rename to cassandra-stress/small_stress.yaml From 63548b8f40caadabf9eb1fbfd6d55ff59c9aa236 Mon Sep 17 00:00:00 2001 From: Cyril Scetbon Date: Thu, 10 Oct 2019 20:47:50 -0400 Subject: [PATCH 08/14] makefile-update - Remove default option in logrus.SetFormatter --- test/e2e/cassandracluster_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/e2e/cassandracluster_test.go b/test/e2e/cassandracluster_test.go index 9d5088878..ad0532a0d 100644 --- a/test/e2e/cassandracluster_test.go +++ b/test/e2e/cassandracluster_test.go @@ -37,8 +37,7 @@ func TestCassandraCluster(t *testing.T) { } logrus.SetFormatter(&logrus.TextFormatter{ - FullTimestamp: true, - DisableColors: false, + FullTimestamp: true }) logrus.SetReportCaller(true) logrus.SetOutput(os.Stdout) From 02efbe20da8e0367a5d154bb939f430a5fcda679 Mon Sep 17 00:00:00 2001 From: Cyril Scetbon Date: Thu, 10 Oct 2019 22:35:26 -0400 Subject: [PATCH 09/14] makefile-update - Remove duplicate files from paths --- .circleci/config.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 061034d27..4b6245395 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -132,7 +132,6 @@ jobs: paths: - build/_output - pkg/apis/db/v1alpha1/zz_generated.deepcopy.go - - pkg/apis/db/v1alpha1/zz_generated.deepcopy.go - vendor - deploy: @@ -151,7 +150,6 @@ jobs: paths: - build/_output - pkg/apis/db/v1alpha1/zz_generated.deepcopy.go - - pkg/apis/db/v1alpha1/zz_generated.deepcopy.go - vendor unit-test: From 4973ea8c66fbfd1835cea47b5b00dca1e6e8ed38 Mon Sep 17 00:00:00 2001 From: Cyril Scetbon Date: Thu, 10 Oct 2019 22:36:14 -0400 Subject: [PATCH 10/14] makefile-update - Save Sonar cache after install --- .circleci/config.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4b6245395..e291a578b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -212,11 +212,18 @@ jobs: - sonar-scanner-3.3.0.1492-linux - run: - name: Download SonarQube Scanner (if still necessary) + name: Download SonarQube Scanner command: | chmod +x .circleci/install_sonar-scanner.sh ./.circleci/install_sonar-scanner.sh + - save_cache: + name: Cache SonarQube Scanner + key: sonar-scanner-3.3.0.1492-linux + paths: + - sonar-scanner-3.3.0.1492-linux + - /home/circleci/cassandra-k8s-operator/.sonar + - run: name: Sonarcloud Scan command: | @@ -244,12 +251,6 @@ jobs: -Dsonar.log.level=INFO cat -n .scannerwork/report-task.txt - - save_cache: - name: Cache SonarQube Scanner - key: sonar-scanner-3.3.0.1492-linux - paths: - - sonar-scanner-3.3.0.1492-linux - - /home/circleci/cassandra-k8s-operator/.sonar - store_test_results: path: reports From 97a1737c346157a7e742ae9255fc1e171e754b32 Mon Sep 17 00:00:00 2001 From: Cyril Scetbon Date: Thu, 10 Oct 2019 22:36:29 -0400 Subject: [PATCH 11/14] makefile-update - Remove duplicate option --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e291a578b..dfffc2a8a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -247,7 +247,6 @@ jobs: -Dsonar.go.coverage.reportPaths=coverage.out \ -Dsonar.go.tests.reportPaths=test-report.out \ -Dsonar.coverage.dtdVerification=false \ - -Dsonar.login=${SONAR_LOGIN} \ -Dsonar.log.level=INFO cat -n .scannerwork/report-task.txt From 353ccdd8edded3baa2385e9905f3e54b2e248c2c Mon Sep 17 00:00:00 2001 From: Cyril Scetbon Date: Wed, 16 Oct 2019 18:31:29 -0400 Subject: [PATCH 12/14] makefile-update - Generate reports for all tags --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index dfffc2a8a..3c46c5bc2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -283,6 +283,8 @@ workflows: requires: - unit-test filters: + tags: + only: /.*/ branches: # report sonar only from canonical repository only: /^(?!pull\/).*$/ # https://stackoverflow.com/a/5334825/358804 From 8ab7c441256e28dd5ffe5fc6e8a573804de17197 Mon Sep 17 00:00:00 2001 From: Cyril Scetbon Date: Thu, 17 Oct 2019 21:54:25 -0400 Subject: [PATCH 13/14] makefile-update - Update modules --- go.mod | 1 - go.sum | 6 ------ 2 files changed, 7 deletions(-) diff --git a/go.mod b/go.mod index 9f16e6f82..5f6bced3f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.12 require ( contrib.go.opencensus.io/exporter/ocagent v0.4.12 // indirect - github.com/NYTimes/gziphandler v1.0.1 // indirect github.com/banzaicloud/k8s-objectmatcher v1.0.1 github.com/emicklei/go-restful v2.9.6+incompatible // indirect github.com/ghodss/yaml v1.0.0 diff --git a/go.sum b/go.sum index 05bd3a5bf..5aa990c31 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,3 @@ -# Version v1 bitbucket.org/ww/goautoneg v0.0.0-20120707110453-75cd24fc2f2c/go.mod h1:1vhO7Mn/FZMgOgDVGLy5X1mE6rq1HbkBdkF/yj8zkcg= cloud.google.com/go v0.0.0-20160913182117-3b1ae45394a2/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= @@ -108,8 +107,6 @@ github.com/evanphx/json-patch v4.0.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi github.com/evanphx/json-patch v4.1.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/ewohltman/graphdot v0.1.1 h1:kB7YkdMxoGk9SJ5Nh3mnuDqJtTLrGavAmElcxL9DQQk= -github.com/ewohltman/graphdot v0.1.1/go.mod h1:ubGca4uEkZRP5Dz4vkdZa0xBif9gHyIwH0EGRKmD8eQ= github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZMPRZwes7CROmyNKgQzC3XPs6L/G2EJLHddWejkmf4= github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= @@ -567,9 +564,6 @@ golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190703212419-2214986f1668 h1:3LJOYcj2ObWSZJXX21oGIIPv5SaOoi5JkzQTWnCXRhg= golang.org/x/tools v0.0.0-20190703212419-2214986f1668/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= -golang.org/x/tools v0.0.0-20191003235154-9cd7e18f8ef7 h1:QWds/6MH0OoyfHTSfnYZEhZrF7GtZMg03SiU9bBTotU= -golang.org/x/tools v0.0.0-20191003235154-9cd7e18f8ef7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20181220000619-583d854617af/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= From a72769f4dbb8d528ecb4a54df6ef3f7d5b770938 Mon Sep 17 00:00:00 2001 From: Cyril Scetbon Date: Fri, 18 Oct 2019 08:39:30 -0400 Subject: [PATCH 14/14] makefile-update - Fix syntax error and indentation --- test/e2e/cassandracluster_test.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/test/e2e/cassandracluster_test.go b/test/e2e/cassandracluster_test.go index ad0532a0d..b5c957935 100644 --- a/test/e2e/cassandracluster_test.go +++ b/test/e2e/cassandracluster_test.go @@ -37,7 +37,7 @@ func TestCassandraCluster(t *testing.T) { } logrus.SetFormatter(&logrus.TextFormatter{ - FullTimestamp: true + FullTimestamp: true, }) logrus.SetReportCaller(true) logrus.SetOutput(os.Stdout) @@ -182,7 +182,7 @@ func cassandraClusterServiceTest(t *testing.T, f *framework.Framework, ctx *fram services, err := listServices(namespace, metav1.ListOptions{ LabelSelector: labels.FormatLabels(map[string]string{ - "app": "cassandracluster", + "app": "cassandracluster", "cassandracluster": cluster.Name, }), }, f) @@ -226,7 +226,7 @@ func cassandraClusterServiceTest(t *testing.T, f *framework.Framework, ctx *fram func cassandraClusterUpdateConfigMapTest(t *testing.T, f *framework.Framework, ctx *framework.TestCtx) { namespace, err := ctx.GetNamespace() - if err != nil{ + if err != nil { t.Fatalf("Could not get namespace: %v", err) } @@ -238,7 +238,7 @@ func cassandraClusterUpdateConfigMapTest(t *testing.T, f *framework.Framework, c logrus.Debugf("Creating cluster") if err := f.Client.Create(goctx.TODO(), cluster, &framework.CleanupOptions{ - TestContext: ctx, + TestContext: ctx, Timeout: mye2eutil.CleanupTimeout, RetryInterval: mye2eutil.CleanupRetryInterval}); err != nil && !apierrors.IsAlreadyExists(err) { t.Fatalf("Error Creating CassandraCluster: %v", err) @@ -333,8 +333,8 @@ func cassandraClusterCleanupTest(t *testing.T, f *framework.Framework, ctx *fram dcRack := "dc1-" + rack nodeName := fmt.Sprintf("%s-%s-%d", clusterName, dcRack, node) - dcRackStatus, found :=cc.Status.CassandraRackStatus[dcRack] - _, found =cc.Status.CassandraRackStatus[dcRack] + dcRackStatus, found := cc.Status.CassandraRackStatus[dcRack] + _, found = cc.Status.CassandraRackStatus[dcRack] if !found { return false, fmt.Errorf("Did not find rack status for %s", rack) } @@ -390,7 +390,6 @@ func cassandraClusterCleanupTest(t *testing.T, f *framework.Framework, ctx *fram return false, nil } - endTimeLabel, exists := pod.Labels["operation-end"] if !exists { t.Logf("Expected to find label operation-end on %s", nodeName) @@ -434,13 +433,13 @@ func cassandraClusterCleanupTest(t *testing.T, f *framework.Framework, ctx *fram } logrus.Infof("Wait for cleanup to finish in rack1\n") - err = mye2eutil.WaitForStatusChange(t, f, namespace, clusterName, 1 * time.Second, 60 * time.Second, checkRack1) + err = mye2eutil.WaitForStatusChange(t, f, namespace, clusterName, 1*time.Second, 60*time.Second, checkRack1) if err != nil { t.Errorf("WaitForStatusChange failed: %s", err) } logrus.Infof("Wait for cleanup to finish in rack2\n") - err = mye2eutil.WaitForStatusChange(t, f, namespace, clusterName, 1 * time.Second, 60 * time.Second, checkRack2) + err = mye2eutil.WaitForStatusChange(t, f, namespace, clusterName, 1*time.Second, 60*time.Second, checkRack2) if err != nil { t.Errorf("WaitForStatusChange failed: %s", err) } @@ -516,4 +515,4 @@ func waitForClusterToBeReady(cluster *api.CassandraCluster, f *framework.Framewo if err := mye2eutil.WaitForStatusDone(t, f, cluster.Namespace, cluster.Name, mye2eutil.RetryInterval, mye2eutil.Timeout); err != nil { t.Fatalf("Waiting for cluster status change to Done failed: %v", err) } -} \ No newline at end of file +}