-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
68 changed files
with
4,322 additions
and
1,237 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# we only want to take build/ into the image | ||
# so we ignore everything else here | ||
cmd/ | ||
deploy/ | ||
pkg/ | ||
* | ||
!build | ||
|
||
# make sure we ignore vendor explicitly | ||
vendor/ | ||
version/ |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
SDK_VERSION="v0.9.0" | ||
SDK_RELEASE="https://github.com/operator-framework/operator-sdk/releases/download/${SDK_VERSION}/operator-sdk-${SDK_VERSION}-x86_64-linux-gnu" | ||
|
||
echo "install-sdk - installing version ${SDK_VERSION}" | ||
curl "${SDK_RELEASE}" -Lo $GOPATH/bin/operator-sdk | ||
chmod +x $GOPATH/bin/operator-sdk | ||
$GOPATH/bin/operator-sdk version |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sudo apt-get update | ||
sudo apt-get install python3-venv | ||
curl -O https://bootstrap.pypa.io/get-pip.py | ||
sudo python3 get-pip.py |
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 |
---|---|---|
@@ -1,97 +1,143 @@ | ||
VERSION ?= 0.1.0 | ||
# Required build-tools: | ||
# - go | ||
# - git | ||
# - python3 | ||
# - minikube | ||
# - operator-sdk | ||
|
||
VERSION ?= $(shell go run cmd/version/main.go) | ||
IMAGE ?= noobaa/noobaa-operator:$(VERSION) | ||
REPO ?= github.com/noobaa/noobaa-operator | ||
|
||
GO_FLAGS ?= CGO_ENABLED=0 GO111MODULE=on | ||
GO_LINUX_FLAGS ?= GOOS=linux GOARCH=amd64 | ||
GO ?= CGO_ENABLED=0 GO111MODULE=on go | ||
GO_LINUX ?= GOOS=linux GOARCH=amd64 $(GO) | ||
GO_LIST ?= ./cmd/... ./pkg/... ./test/... ./version/... | ||
GOHOSTOS ?= $(shell go env GOHOSTOS) | ||
|
||
OUTPUT = build/_output | ||
BIN = $(OUTPUT)/bin | ||
BUNDLE = $(OUTPUT)/bundle | ||
VENV = $(OUTPUT)/venv | ||
OUTPUT ?= build/_output | ||
BIN ?= $(OUTPUT)/bin | ||
OLM ?= $(OUTPUT)/olm | ||
VENV ?= $(OUTPUT)/venv | ||
BUNDLE ?= $(OUTPUT)/bundle | ||
|
||
# Default tasks: | ||
|
||
all: build | ||
@echo "@@@ All Done." | ||
.PHONY: all | ||
|
||
# Developer tasks: | ||
#------------# | ||
#- Building -# | ||
#------------# | ||
|
||
lint: | ||
@echo Linting... | ||
go get -u golang.org/x/lint/golint | ||
golint -set_exit_status=1 $(shell go list ./cmd/... ./pkg/...) | ||
.PHONY: lint | ||
all: local build | ||
@echo "all - done." | ||
.PHONY: all | ||
|
||
build: cli image | ||
@echo "@@@ Build Done." | ||
build: image olm | ||
@echo "build - done." | ||
.PHONY: build | ||
|
||
cli: vendor | ||
${GO_FLAGS} go generate cmd/cli/cli.go | ||
${GO_FLAGS} go build -mod=vendor -o $(BIN)/kubectl-noobaa $(REPO)/cmd/cli | ||
.PHONY: cli | ||
|
||
dev: operator | ||
WATCH_NAMESPACE=noobaa OPERATOR_NAME=noobaa-operator $(BIN)/noobaa-operator-local | ||
.PHONY: dev | ||
|
||
operator: vendor | ||
go build -mod=vendor -o $(BIN)/noobaa-operator-local $(REPO)/cmd/manager | ||
.PHONY: operator | ||
image: gen | ||
operator-sdk build $(IMAGE) | ||
.PHONY: image | ||
|
||
gen: vendor | ||
operator-sdk generate k8s | ||
operator-sdk generate openapi | ||
gen: vendor $(BUNDLE)/deploy.go | ||
.PHONY: gen | ||
|
||
$(BUNDLE)/deploy.go: pkg/bundle/bundle.go $(shell find deploy/ -type f) | ||
mkdir -p $(BUNDLE) | ||
$(GO) run pkg/bundle/bundle.go deploy/ $(BUNDLE)/deploy.go | ||
|
||
vendor: | ||
${GO_FLAGS} go mod vendor | ||
$(GO) mod vendor | ||
.PHONY: vendor | ||
|
||
image: | ||
${GO_FLAGS} ${GO_LINUX_FLAGS} go build -mod=vendor -o $(BIN)/noobaa-operator $(REPO)/cmd/manager | ||
docker build -f build/Dockerfile -t $(IMAGE) . | ||
.PHONY: image | ||
olm: | ||
rm -rf $(OLM) | ||
mkdir -p $(OLM) | ||
cp deploy/olm-catalog/package/* $(OLM)/ | ||
cp deploy/crds/*crd.yaml $(OLM)/ | ||
python3 -m venv $(VENV) | ||
( \ | ||
. $(VENV)/bin/activate && \ | ||
pip3 install --upgrade pip && \ | ||
pip3 install operator-courier && \ | ||
operator-courier verify --ui_validate_io $(OLM) \ | ||
) | ||
@echo "olm - ready at $(OLM)" | ||
.PHONY: olm | ||
|
||
|
||
#-----------# | ||
#- Testing -# | ||
#-----------# | ||
|
||
test: lint unittest | ||
@echo "test - done." | ||
.PHONY: test | ||
|
||
bundle: | ||
mkdir -p $(BUNDLE) | ||
cp deploy/olm-catalog/noobaa-operator/*.yaml $(BUNDLE)/ | ||
cp deploy/olm-catalog/noobaa-operator/$(VERSION)/*.yaml $(BUNDLE)/ | ||
cp deploy/crds/*crd.yaml $(BUNDLE)/ | ||
( python3 -m venv $(VENV) && . $(VENV)/bin/activate && pip install operator-courier >/dev/null ) | ||
( . $(VENV)/bin/activate && operator-courier verify --ui_validate_io $(BUNDLE) ) | ||
.PHONY: bundle | ||
|
||
push: | ||
@echo TODO: To which tag do we want to push here? | ||
test-integ: scorecard test-e2e | ||
@echo "test-integ - done." | ||
.PHONY: test-integ | ||
|
||
lint: gen | ||
go get -u golang.org/x/lint/golint | ||
golint -set_exit_status=0 ./cmd/... ./pkg/... ./test/... ./version/... | ||
.PHONY: lint | ||
|
||
unittest: gen | ||
go test ./cmd/... ./pkg/... ./version/... | ||
.PHONY: unittest | ||
|
||
test-e2e: gen | ||
# TODO fix test-e2e ! | ||
# operator-sdk test local ./test/e2e \ | ||
# --global-manifest deploy/cluster_role_binding.yaml \ | ||
# --debug \ | ||
# --go-test-flags "-v -parallel=1" | ||
.PHONY: test-e2e | ||
|
||
scorecard: gen | ||
kubectl create ns test-noobaa-operator-scorecard | ||
operator-sdk scorecard \ | ||
--cr-manifest deploy/crds/noobaa_v1alpha1_noobaa_cr.yaml \ | ||
--cr-manifest deploy/crds/noobaa_v1alpha1_backingstore_cr.yaml \ | ||
--cr-manifest deploy/crds/noobaa_v1alpha1_bucketclass_cr.yaml \ | ||
--csv-path deploy/olm-catalog/package/noobaa-operator.v$(VERSION).clusterserviceversion.yaml \ | ||
--namespace test-noobaa-operator-scorecard | ||
.PHONY: scorecard | ||
|
||
|
||
#-------------# | ||
#- Releasing -# | ||
#-------------# | ||
|
||
push-image: | ||
@echo "push-image - It is too risky to push like this, because it easily overrides. | ||
@echo version from version/version.go? master? git describe? | ||
# docker push $(IMAGE) | ||
.PHONY: push | ||
.PHONY: push-image | ||
|
||
test: vendor | ||
go test ./cli/... ./pkg/... | ||
.PHONY: test | ||
|
||
test-e2e: vendor | ||
operator-sdk test local ./test/e2e \ | ||
--global-manifest deploy/cluster_role_binding.yaml \ | ||
--debug \ | ||
--go-test-flags "-v -parallel=1" | ||
.PHONY: test | ||
#--------------# | ||
#- Developing -# | ||
#--------------# | ||
|
||
clean: | ||
rm $(BIN)/* | ||
rm -rf vendor/ | ||
.PHONY: clean | ||
local: gen | ||
operator-sdk up local &>/dev/null | ||
.PHONY: local | ||
|
||
run: gen | ||
operator-sdk up local --operator-flags "operator run" | ||
.PHONY: run | ||
|
||
# Deps | ||
gen-api: gen | ||
operator-sdk generate k8s | ||
operator-sdk generate openapi | ||
.PHONY: gen-api | ||
|
||
install-sdk: | ||
@echo Installing SDK ${SDK_VERSION} | ||
curl https://github.com/operator-framework/operator-sdk/releases/download/${SDK_VERSION}/operator-sdk-${SDK_VERSION}-x86_64-linux-gnu -sLo ${GOPATH}/bin/operator-sdk | ||
chmod +x ${GOPATH}/bin/operator-sdk | ||
.PHONY: install-sdk | ||
ensure-gen-api-is-noop: gen-api | ||
git diff -s --exit-code pkg/apis/noobaa/v1alpha1/zz_generated.deepcopy.go || (echo "Build failed: API has been changed but the deep copy functions aren't up to date. Run 'make gen-api' and update your PR." && exit 1) | ||
git diff -s --exit-code pkg/apis/noobaa/v1alpha1/zz_generated.openapi.go || (echo "Build failed: API has been changed but the deep copy functions aren't up to date. Run 'make gen-api' and update your PR." && exit 1) | ||
.PHONY: ensure-gen-api-is-noop | ||
|
||
#TODO scorecard | ||
clean: | ||
rm -rf $(OUTPUT) | ||
rm -rf vendor/ | ||
.PHONY: clean |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
repo = github.com/noobaa/noobaa-operator |
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 |
---|---|---|
@@ -1 +1,32 @@ | ||
# noobaa-operator | ||
# NooBaa Operator | ||
|
||
NooBaa is an object data service for hybrid and multi cloud environments. NooBaa runs on kubernetes, provides an S3 object store service (and Lambda with bucket triggers) to clients both inside and outside the cluster, and uses storage resources from within or outside the cluster, with flexible placement policies to automate data use cases. | ||
|
||
[About NooBaa](doc/about-noobaa.md) | ||
|
||
# Using the operator as CLI | ||
|
||
- Download the compiled operator binary from the [releases page](/releases) | ||
- Run: `noobaa --help` for CLI usage | ||
- Install the operator and noobaa with: `noobaa install` | ||
|
||
# Operator Design | ||
|
||
CRDs | ||
- [NooBaa](doc/noobaa-crd.md) - The basic CRD to deploy a NooBaa system. | ||
- [BackingStore](doc/backing-store-crd.md) - Connection to cloud or local storage to use in policies. | ||
- [BucketClass](doc/bucket-class-crd.md) - Policies applied to a class of buckets. | ||
|
||
Applications | ||
- [S3 Account](doc/s3-account.md) - Method to obtain S3 account credentials for native S3 applications. | ||
- [OBC Provisioner](doc/obc-provisioner.md) - Method to claim a new/existing bucket. | ||
|
||
# Developing | ||
|
||
- Fork and clone the repo: `git clone https://github.com/<username>/noobaa-operator` | ||
- Use minikube: `minikube start` | ||
- Source the devenv into your shell: `. devenv.sh` | ||
- Build the project: `make` | ||
- Test with the alias `nb` that runs the local operator from `build/_output/bin` (alias created by devenv) | ||
- `nb install` | ||
- ... |
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.
Oops, something went wrong.