diff --git a/.gitignore b/.gitignore index 9dea8a7ef..50253ed4b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,6 @@ vendor/ .idea/ deps/ .vscode/ -**/*.enterprise.go \ No newline at end of file +**/*.enterprise.go +**/enterprise/** +enterprise.mk \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index da85b4f98..0357e3723 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Add Watch to Lifecycle command - Add Topology Discovery - Add Support for StartupProbe +- Add ARM64 support for Operator Docker image ## [1.2.4](https://github.com/arangodb/kube-arangodb/tree/1.2.4) (2021-10-22) - Replace `beta.kubernetes.io/arch` Pod label with `kubernetes.io/arch` using Silent Rotation diff --git a/Dockerfile b/Dockerfile index ed5102923..1897af921 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,8 @@ LABEL name="kube-arangodb" \ ADD ./LICENSE /licenses/LICENSE -ADD bin/arangodb_operator /usr/bin/ +ARG RELEASE_MODE=community +ARG TARGETARCH=amd64 +ADD bin/${RELEASE_MODE}/linux/${TARGETARCH}/arangodb_operator /usr/bin/arangodb_operator ENTRYPOINT [ "/usr/bin/arangodb_operator" ] \ No newline at end of file diff --git a/Makefile b/Makefile index ca2d2f230..64a813014 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,10 @@ COMMIT := $(shell git rev-parse --short HEAD) DOCKERCLI := $(shell which docker) RELEASE_MODE ?= community +include $(ROOT)/$(RELEASE_MODE).mk + +MAIN_DIR := $(ROOT)/pkg/entry/$(RELEASE_MODE) + GOBUILDDIR := $(SCRIPTDIR)/.gobuild SRCDIR := $(SCRIPTDIR) CACHEVOL := $(PROJECT)-gocache @@ -119,14 +123,15 @@ endif BINNAME := $(PROJECT) BIN := $(BINDIR)/$(BINNAME) -VBIN := $(BINDIR)/$(RELEASE_MODE)/$(BINNAME) +VBIN_LINUX_AMD64 := $(BINDIR)/$(RELEASE_MODE)/linux/amd64/$(BINNAME) +VBIN_LINUX_ARM64 := $(BINDIR)/$(RELEASE_MODE)/linux/arm64/$(BINNAME) ifdef VERBOSE TESTVERBOSEOPTIONS := -v endif EXCLUDE_DIRS := tests vendor .gobuild deps tools -SOURCES_QUERY := find ./ -type f -name '*.go' $(foreach EXCLUDE_DIR,$(EXCLUDE_DIRS), ! -path "./$(EXCLUDE_DIR)/*") +SOURCES_QUERY := find ./ -type f -name '*.go' $(foreach EXCLUDE_DIR,$(EXCLUDE_DIRS), ! -path "*/$(EXCLUDE_DIR)/*") SOURCES := $(shell $(SOURCES_QUERY)) DASHBOARDSOURCES := $(shell find $(DASHBOARDDIR)/src -name '*.js') $(DASHBOARDDIR)/package.json LINT_EXCLUDES:= @@ -193,7 +198,7 @@ endif .PHONY: clean clean: - rm -Rf $(BIN) $(BINDIR) $(DASHBOARDDIR)/build $(DASHBOARDDIR)/node_modules + rm -Rf $(BIN) $(BINDIR) $(DASHBOARDDIR)/build $(DASHBOARDDIR)/node_modules $(VBIN_LINUX_AMD64) $(VBIN_LINUX_ARM64) .PHONY: check-vars check-vars: @@ -245,27 +250,33 @@ dashboard/assets.go: $(DASHBOARDBUILDIMAGE) $(GOPATH)/bin/go-assets-builder -s /dashboard/build/ -o dashboard/assets.go -p dashboard dashboard/build -.PHONY: bin +.PHONY: bin bin-all bin: $(BIN) +bin-all: $(BIN) $(VBIN_LINUX_AMD64) $(VBIN_LINUX_ARM64) -$(VBIN): $(SOURCES) dashboard/assets.go VERSION - @mkdir -p $(VBINDIR) - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build --tags "$(RELEASE_MODE)" -installsuffix netgo -ldflags "-X $(REPOPATH)/pkg/version.version=$(VERSION) -X $(REPOPATH)/pkg/version.buildDate=$(BUILDTIME) -X $(REPOPATH)/pkg/version.build=$(COMMIT)" -o $(VBIN) $(REPOPATH) +$(VBIN_LINUX_AMD64): $(SOURCES) dashboard/assets.go VERSION + @mkdir -p $(BINDIR)/$(RELEASE_MODE)/linux/amd64 + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build --tags "$(RELEASE_MODE)" -installsuffix netgo -ldflags "-X $(REPOPATH)/pkg/version.version=$(VERSION) -X $(REPOPATH)/pkg/version.buildDate=$(BUILDTIME) -X $(REPOPATH)/pkg/version.build=$(COMMIT)" -o $(VBIN_LINUX_AMD64) ./main.go -$(BIN): $(VBIN) - @cp "$(VBIN)" "$(BIN)" +$(VBIN_LINUX_ARM64): $(SOURCES) dashboard/assets.go VERSION + @mkdir -p $(BINDIR)/$(RELEASE_MODE)/linux/arm64 + CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build --tags "$(RELEASE_MODE)" -installsuffix netgo -ldflags "-X $(REPOPATH)/pkg/version.version=$(VERSION) -X $(REPOPATH)/pkg/version.buildDate=$(BUILDTIME) -X $(REPOPATH)/pkg/version.build=$(COMMIT)" -o $(VBIN_LINUX_ARM64) ./main.go + +$(BIN): $(VBIN_LINUX_AMD64) + @cp "$(VBIN_LINUX_AMD64)" "$(BIN)" .PHONY: docker -docker: check-vars $(BIN) - docker build --no-cache -f $(DOCKERFILE) --build-arg "VERSION=${VERSION_MAJOR_MINOR_PATCH}" -t $(OPERATORIMAGE) . +docker: check-vars $(VBIN_LINUX_AMD64) $(VBIN_LINUX_ARM64) ifdef PUSHIMAGES - docker push $(OPERATORIMAGE) + docker buildx build --no-cache -f $(DOCKERFILE) --build-arg "VERSION=${VERSION_MAJOR_MINOR_PATCH}" --build-arg "RELEASE_MODE=$(RELEASE_MODE)" --platform linux/amd64,linux/arm64 --push -t $(OPERATORIMAGE) . +else + docker buildx build --no-cache -f $(DOCKERFILE) --build-arg "VERSION=${VERSION_MAJOR_MINOR_PATCH}" --build-arg "RELEASE_MODE=$(RELEASE_MODE)" --platform linux/amd64,linux/arm64 -t $(OPERATORIMAGE) . endif .PHONY: docker-ubi -docker-ubi: check-vars $(BIN) - docker build --no-cache -f "$(DOCKERFILE).ubi" --build-arg "VERSION=${VERSION_MAJOR_MINOR_PATCH}" --build-arg "IMAGE=$(BASEUBIIMAGE)" -t $(OPERATORUBIIMAGE)-local-only-build . - docker build --no-cache -f $(DOCKERFILE) --build-arg "VERSION=${VERSION_MAJOR_MINOR_PATCH}" --build-arg "IMAGE=$(OPERATORUBIIMAGE)-local-only-build" -t $(OPERATORUBIIMAGE) . +docker-ubi: check-vars $(VBIN_LINUX_AMD64) + docker build --no-cache -f "$(DOCKERFILE).ubi" --build-arg "VERSION=${VERSION_MAJOR_MINOR_PATCH}" --build-arg "RELEASE_MODE=$(RELEASE_MODE)" --build-arg "IMAGE=$(BASEUBIIMAGE)" -t $(OPERATORUBIIMAGE)-local-only-build . + docker build --no-cache -f $(DOCKERFILE) --build-arg "VERSION=${VERSION_MAJOR_MINOR_PATCH}" --build-arg "RELEASE_MODE=$(RELEASE_MODE)" --build-arg "IMAGE=$(OPERATORUBIIMAGE)-local-only-build" -t $(OPERATORUBIIMAGE) . ifdef PUSHIMAGES docker push $(OPERATORUBIIMAGE) endif @@ -402,7 +413,7 @@ tools: update-vendor .PHONY: vendor vendor: @echo ">> Updating vendor" - @go mod vendor + @ go mod vendor set-deployment-api-version-v2alpha1: export API_VERSION=2alpha1 set-deployment-api-version-v2alpha1: set-api-version/deployment set-api-version/replication diff --git a/community.mk b/community.mk new file mode 100644 index 000000000..e69de29bb diff --git a/pkg/apis/deployment/v1/deployment_spec.go b/pkg/apis/deployment/v1/deployment_spec.go index ab57da1f8..1636c9146 100644 --- a/pkg/apis/deployment/v1/deployment_spec.go +++ b/pkg/apis/deployment/v1/deployment_spec.go @@ -251,9 +251,9 @@ func (s DeploymentSpec) IsDisableIPv6() bool { return util.BoolOrDefault(s.DisableIPv6) } -// IsNetworkAttachedVolumes returns the value of networkAttachedVolumes, default true +// IsNetworkAttachedVolumes returns the value of networkAttachedVolumes, default false func (s DeploymentSpec) IsNetworkAttachedVolumes() bool { - return util.BoolOrDefault(s.NetworkAttachedVolumes, true) + return util.BoolOrDefault(s.NetworkAttachedVolumes, false) } // GetListenAddr returns "[::]" or "0.0.0.0" depending on IsDisableIPv6 diff --git a/pkg/apis/deployment/v2alpha1/deployment_spec.go b/pkg/apis/deployment/v2alpha1/deployment_spec.go index 53a7aa0ad..7aad780e6 100644 --- a/pkg/apis/deployment/v2alpha1/deployment_spec.go +++ b/pkg/apis/deployment/v2alpha1/deployment_spec.go @@ -251,9 +251,9 @@ func (s DeploymentSpec) IsDisableIPv6() bool { return util.BoolOrDefault(s.DisableIPv6) } -// IsNetworkAttachedVolumes returns the value of networkAttachedVolumes, default true +// IsNetworkAttachedVolumes returns the value of networkAttachedVolumes, default false func (s DeploymentSpec) IsNetworkAttachedVolumes() bool { - return util.BoolOrDefault(s.NetworkAttachedVolumes, true) + return util.BoolOrDefault(s.NetworkAttachedVolumes, false) } // GetListenAddr returns "[::]" or "0.0.0.0" depending on IsDisableIPv6