mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-12 14:30:12 +01:00
Validating few parameters for the ZFSVolume custom resource - compression can be "on", "off", "lzjb", "gzip", "gzip-[1-9]", "zle" and "lz4" - encryption can be "on", "off", "aes-128-ccm", "aes-192-ccm", "aes-256-ccm", "aes-128-gcm", "aes-192-gcm", and "aes-256-gcm" - dedup can be "on" and "off" - poolname can be string - ownernodeid can be string - thinprovision can be "yes" and "no" - volumetype can be "DATASET" and "ZVOL" Also added required fields needed to create ZFSVolume CR - ownerNodeID - poolname - volumeType - capacity Signed-off-by: Pawan <pawan@mayadata.io>
168 lines
4.7 KiB
Makefile
168 lines
4.7 KiB
Makefile
# list only csi source code directories
|
|
PACKAGES = $(shell go list ./... | grep -v 'vendor\|pkg/generated')
|
|
|
|
UNIT_TEST_PACKAGES = $(shell go list ./... | grep -v 'vendor\|pkg/generated\|tests')
|
|
|
|
# Lint our code. Reference: https://golang.org/cmd/vet/
|
|
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods \
|
|
-nilfunc -printf -rangeloops -shift -structtags -unsafeptr
|
|
|
|
# Tools required for different make
|
|
# targets or for development purposes
|
|
EXTERNAL_TOOLS=\
|
|
github.com/golang/dep/cmd/dep \
|
|
golang.org/x/tools/cmd/cover \
|
|
github.com/axw/gocov/gocov \
|
|
gopkg.in/matm/v1/gocov-html \
|
|
github.com/ugorji/go/codec/codecgen \
|
|
github.com/onsi/ginkgo/ginkgo \
|
|
github.com/onsi/gomega/...
|
|
|
|
ifeq (${IMAGE_TAG}, )
|
|
IMAGE_TAG = ci
|
|
export IMAGE_TAG
|
|
endif
|
|
|
|
ifeq (${TRAVIS_TAG}, )
|
|
BASE_TAG = ci
|
|
export BASE_TAG
|
|
else
|
|
BASE_TAG = ${TRAVIS_TAG}
|
|
export BASE_TAG
|
|
endif
|
|
|
|
# Specify the name for the binary
|
|
CSI_DRIVER=zfs-driver
|
|
|
|
# Specify the date o build
|
|
BUILD_DATE = $(shell date +'%Y%m%d%H%M%S')
|
|
|
|
.PHONY: all
|
|
all: test zfs-driver-image
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
@echo "--> Cleaning Directory" ;
|
|
go clean -testcache
|
|
rm -rf bin
|
|
rm -rf ${GOPATH}/bin/${CSI_DRIVER}
|
|
rm -rf ${GOPATH}/pkg/*
|
|
|
|
.PHONY: format
|
|
format:
|
|
@echo "--> Running go fmt"
|
|
@go fmt $(PACKAGES)
|
|
|
|
.PHONY: test
|
|
test: format
|
|
@echo "--> Running go test" ;
|
|
@go test $(UNIT_TEST_PACKAGES)
|
|
|
|
# Bootstrap downloads tools required
|
|
# during build
|
|
.PHONY: bootstrap
|
|
bootstrap: controller-gen
|
|
@for tool in $(EXTERNAL_TOOLS) ; do \
|
|
echo "+ Installing $$tool" ; \
|
|
go get -u $$tool; \
|
|
done
|
|
|
|
.PHONY: controller-gen
|
|
controller-gen:
|
|
TMP_DIR=$(shell mktemp -d) && cd $$TMP_DIR && go mod init tmp && go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.8 && rm -rf $$TMP_DIR;
|
|
|
|
# SRC_PKG is the path of code files
|
|
SRC_PKG := github.com/openebs/zfs-localpv/pkg
|
|
|
|
# code generation for custom resources
|
|
.PHONY: kubegen
|
|
kubegen: kubegendelete deepcopy-install clientset-install lister-install informer-install
|
|
@GEN_SRC=openebs.io/zfs/v1alpha1 make deepcopy clientset lister informer
|
|
|
|
# deletes generated code by codegen
|
|
.PHONY: kubegendelete
|
|
kubegendelete:
|
|
@rm -rf pkg/generated/clientset
|
|
@rm -rf pkg/generated/lister
|
|
@rm -rf pkg/generated/informer
|
|
|
|
.PHONY: deepcopy-install
|
|
deepcopy-install:
|
|
@go install ./vendor/k8s.io/code-generator/cmd/deepcopy-gen
|
|
|
|
.PHONY: deepcopy
|
|
deepcopy:
|
|
@echo "+ Generating deepcopy funcs for $(GEN_SRC)"
|
|
@deepcopy-gen \
|
|
--input-dirs $(SRC_PKG)/apis/$(GEN_SRC) \
|
|
--output-file-base zz_generated.deepcopy \
|
|
--go-header-file ./buildscripts/custom-boilerplate.go.txt
|
|
|
|
.PHONY: clientset-install
|
|
clientset-install:
|
|
@go install ./vendor/k8s.io/code-generator/cmd/client-gen
|
|
|
|
.PHONY: clientset
|
|
clientset:
|
|
@echo "+ Generating clientsets for $(GEN_SRC)"
|
|
@client-gen \
|
|
--fake-clientset=true \
|
|
--input $(GEN_SRC) \
|
|
--input-base $(SRC_PKG)/apis \
|
|
--clientset-path $(SRC_PKG)/generated/clientset \
|
|
--go-header-file ./buildscripts/custom-boilerplate.go.txt
|
|
|
|
.PHONY: lister-install
|
|
lister-install:
|
|
@go install ./vendor/k8s.io/code-generator/cmd/lister-gen
|
|
|
|
.PHONY: lister
|
|
lister:
|
|
@echo "+ Generating lister for $(GEN_SRC)"
|
|
@lister-gen \
|
|
--input-dirs $(SRC_PKG)/apis/$(GEN_SRC) \
|
|
--output-package $(SRC_PKG)/generated/lister \
|
|
--go-header-file ./buildscripts/custom-boilerplate.go.txt
|
|
|
|
.PHONY: informer-install
|
|
informer-install:
|
|
@go install ./vendor/k8s.io/code-generator/cmd/informer-gen
|
|
|
|
.PHONY: informer
|
|
informer:
|
|
@echo "+ Generating informer for $(GEN_SRC)"
|
|
@informer-gen \
|
|
--input-dirs $(SRC_PKG)/apis/$(GEN_SRC) \
|
|
--versioned-clientset-package $(SRC_PKG)/generated/clientset/internalclientset \
|
|
--listers-package $(SRC_PKG)/generated/lister \
|
|
--output-package $(SRC_PKG)/generated/informer \
|
|
--go-header-file ./buildscripts/custom-boilerplate.go.txt
|
|
|
|
manifests:
|
|
@echo "+ Generating zfs localPV crds"
|
|
$(PWD)/buildscripts/generate-manifests.sh
|
|
|
|
.PHONY: zfs-driver
|
|
zfs-driver: format
|
|
@echo "--------------------------------"
|
|
@echo "--> Building ${CSI_DRIVER} "
|
|
@echo "--------------------------------"
|
|
@PNAME=${CSI_DRIVER} CTLNAME=${CSI_DRIVER} sh -c "'$(PWD)/buildscripts/build.sh'"
|
|
|
|
.PHONY: zfs-driver-image
|
|
zfs-driver-image: zfs-driver
|
|
@echo "--------------------------------"
|
|
@echo "+ Generating ${CSI_DRIVER} image"
|
|
@echo "--------------------------------"
|
|
@cp bin/${CSI_DRIVER}/${CSI_DRIVER} buildscripts/${CSI_DRIVER}/
|
|
cd buildscripts/${CSI_DRIVER} && sudo docker build -t openebs/${CSI_DRIVER}:${IMAGE_TAG} --build-arg BUILD_DATE=${BUILD_DATE} . && sudo docker tag openebs/${CSI_DRIVER}:${IMAGE_TAG} quay.io/openebs/${CSI_DRIVER}:${IMAGE_TAG}
|
|
@rm buildscripts/${CSI_DRIVER}/${CSI_DRIVER}
|
|
|
|
.PHONY: ci
|
|
ci:
|
|
@echo "--> Running ci test";
|
|
$(PWD)/ci/ci-test.sh
|
|
# Push images
|
|
deploy-images:
|
|
@DIMAGE="openebs/zfs-driver" ./buildscripts/push
|
|
|