-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from cscetbon/bundle-validate
Bundle validate
- Loading branch information
Showing
15 changed files
with
24 additions
and
446 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ RUN curl -L https://github.com/gotestyourself/gotestsum/releases/download/v0.3.4 | |
RUN go get -u golang.org/x/lint/golint | ||
RUN go get sigs.k8s.io/controller-tools/cmd/[email protected] | ||
RUN go get sigs.k8s.io/kustomize/kustomize/[email protected] | ||
RUN go install github.com/mikefarah/yq/v4@latest | ||
|
||
# Install kubectl cli | ||
RUN curl -o /usr/local/bin/kubectl -L https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl \ | ||
|
@@ -59,7 +60,7 @@ RUN curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | | |
|
||
# Install Operator SDK | ||
ARG OPERATOR_SDK_VERSION | ||
RUN curl -o /usr/local/bin/operator-sdk -L https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk-${OPERATOR_SDK_VERSION}-x86_64-linux-gnu \ | ||
RUN curl -o /usr/local/bin/operator-sdk -L https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk_linux_amd64 \ | ||
&& chmod +x /usr/local/bin/operator-sdk | ||
|
||
WORKDIR /go/casskop | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,12 +26,6 @@ KUBESQUASH_REGISTRY:= | |
|
||
KUBECONFIG ?= ~/.kube/config | ||
|
||
MINIKUBE_CONFIG ?= ~/.minikube | ||
MINIKUBE_CONFIG_MOUNT ?= /home/ci/.minikube | ||
|
||
HELM_VERSION := $(shell cat helm/multi-casskop/Chart.yaml| grep version | awk -F"version: " '{print $$2}') | ||
HELM_TARGET_DIR ?= ../docs/helm | ||
|
||
params: | ||
@echo "CIRCLE_BRANCH = '$(CIRCLE_BRANCH)'" | ||
@echo "CIRCLE_TAG = '$(CIRCLE_TAG)'" | ||
|
@@ -41,24 +35,13 @@ params: | |
# CMDs | ||
MOCKS_CMD := go generate ./mocks | ||
|
||
|
||
# | ||
# | ||
################################################################################ | ||
|
||
# The default action of this Makefile is to build the development docker image | ||
default: build | ||
|
||
clean: | ||
@rm -rf $(OUT_BIN) || true | ||
@rm -f apis/db/v2/zz_generated.deepcopy.go || true | ||
|
||
helm-package: | ||
@echo Packaging $(HELM_VERSION) | ||
helm package helm/multi-casskop | ||
mv multi-casskop-$(HELM_VERSION).tgz $(HELM_TARGET_DIR) | ||
helm repo index $(HELM_TARGET_DIR)/ | ||
|
||
# Build casskop executable file in local go env | ||
|
||
export CGO_ENABLED:=0 | ||
|
@@ -71,50 +54,19 @@ CRD_V1 = deploy/crds/multicluster_v1alpha1_cassandramulticluster_crd.yaml | |
CRD = config/crd/bases/db.orange.com_multicasskops.yaml | ||
FIRST_VERSION = .spec.versions[0] | ||
|
||
.PHONY: update-crds | ||
update-crds: | ||
echo Update CRD - Remove protocol and set config type to object CRD | ||
# # We checkout v1alpha1 CRD and add it to v2 CRD as it must be known to do an upgrade | ||
git show v1.1.5-release:./$(CRD_V1) > /tmp/$$(basename $(CRD)) | ||
sed -e '1,/versions/d' $(CRD) >> /tmp/$$(basename $(CRD)) | ||
cp /tmp/$$(basename $(CRD)) $(CRD) | ||
yq -i e '$(FIRST_VERSION).storage = false' $(CRD) | ||
cp -v config/crd/bases/* helm/*/crds/ | ||
|
||
include ../shared.mk | ||
include ../kube.mk | ||
|
||
BUILD_CMD = docker build -f multi-casskop/Dockerfile . -t $(REPOSITORY):$(VERSION) --build-arg https_proxy=$$https_proxy --build-arg http_proxy=$$http_proxy | ||
|
||
DOCKER_BUILD = docker run --rm -v $(MOUNTDIR):$(WORKDIR) -v $(GOPATH)/pkg/mod:/go/pkg/mod:delegated \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v $(shell go env GOCACHE):/root/.cache/go-build:delegated \ | ||
--env CGO_ENABLED=$(CGO_ENABLED) --env GOOS=linux --env GOARCH=amd64 \ | ||
--env https_proxy=$(https_proxy) --env http_proxy=$(http_proxy) \ | ||
$(BUILD_IMAGE):$(OPERATOR_SDK_VERSION) /bin/bash -c | ||
|
||
docker-generate-files: | ||
cd ../ && make docker-generate-files | ||
cp -v ../config/crd/bases/* helm/*/crds/ | ||
$(MAKE) docker-generate-k8s | ||
$(DOCKER_BUILD) 'cd $(BUILD_FOLDER); $(GENERATE_CMD)' | ||
cp config/crd/bases/* helm/*/crds/ | ||
|
||
docker-build-operator: | ||
echo "Build Cassandra Operator. Using cache from "$(shell go env GOCACHE) | ||
$(DOCKER_BUILD) '$(BUILD_CMD)' | ||
|
||
# Build the Operator and its Docker Image | ||
docker-build: docker-generate-files docker-build-operator | ||
|
||
# Override generate as controller-gen crashes | ||
.PHONY: generate | ||
generate: | ||
cd .. && make generate | ||
cp -v ../config/crd/bases/* helm/*/crds/ | ||
$(MAKE) -C .. generate | ||
cp -v ../config/crd/bases/*.yaml ../charts/multi-casskop/crds/ | ||
$(MAKE) generate-k8s | ||
$(GENERATE_CMD) | ||
cp config/crd/bases/* helm/*/crds/ | ||
cp config/crd/bases/*.yaml ../charts/multi-casskop/crds/ | ||
|
||
docker-generate: | ||
docker run --rm -ti -v $PWD:/go/casskop ghcr.io/cscetbon/casskop-build:latest make -C multi-casskop generate | ||
|
||
# Build CassKop executable file in local go env | ||
.PHONY: build | ||
|
@@ -125,7 +77,6 @@ ifdef PUSHLATEST | |
docker tag $(REPOSITORY):$(VERSION) $(REPOSITORY):latest | ||
endif | ||
|
||
|
||
build-local: generate | ||
@echo "Build Cassandra Operator for $(GOOS)" | ||
go build -o build/_output/bin/multi-casskop-$(GOOS) -gcflags all=-trimpath=github.com/cscetbon -asmflags all=-trimpath=github.com/cscetbon github.com/cscetbon/casskop/multi-casskop/cmd/manager | ||
|
@@ -186,28 +137,3 @@ release: tag image publish | |
|
||
unit-test-with-vendor: | ||
echo TODO | ||
|
||
kustomize: | ||
ifeq (, $(shell which kustomize)) | ||
@{ \ | ||
set -e ;\ | ||
KUSTOMIZE_GEN_TMP_DIR=$$(mktemp -d) ;\ | ||
cd $$KUSTOMIZE_GEN_TMP_DIR ;\ | ||
go mod init tmp ;\ | ||
go get sigs.k8s.io/kustomize/kustomize/[email protected] ;\ | ||
rm -rf $$KUSTOMIZE_GEN_TMP_DIR ;\ | ||
} | ||
KUSTOMIZE=$(GOBIN)/kustomize | ||
else | ||
KUSTOMIZE=$(shell which kustomize) | ||
endif | ||
|
||
# Generate bundle manifests and metadata, then validate generated files. | ||
bundle: manifests | ||
operator-sdk generate kustomize manifests -q | ||
kustomize build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS) | ||
operator-sdk bundle validate ./bundle | ||
|
||
# Build the bundle image. | ||
bundle-build: | ||
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.