Skip to content

Commit

Permalink
optimize cluster operation and some other fixes (#66)
Browse files Browse the repository at this point in the history
optimize cluster operation and some other fixes
  • Loading branch information
chris-sun-star authored Sep 19, 2023
1 parent 3d378ec commit 91a1fa8
Show file tree
Hide file tree
Showing 45 changed files with 3,631 additions and 239 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ FROM golang:1.20.4 as builder

ARG GOPROXY
ARG GOSUMDB
ARG RACE

WORKDIR /workspace
# copy everything
COPY . .
RUN GO11MODULE=ON CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o manager cmd/main.go
RUN GO11MODULE=ON CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build ${RACE} -o manager cmd/main.go

# start build docker image
FROM openanolis/anolisos:8.4-x86_64
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ endif
GOPROXY=$(shell go env GOPROXY)
GOPROXY ?= https://goproxy.io,direct
GOSUMDB ?= sum.golang.org
RACE ?= ''

# Setting SHELL to bash allows bash commands to be executed by recipes.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
Expand Down Expand Up @@ -62,7 +63,7 @@ vet: ## Run go vet against code.

.PHONY: test
test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -v ./... -coverprofile cover.out
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -timeout 60m -v ./... -coverprofile cover.out

##@ Build

Expand All @@ -79,11 +80,11 @@ run: manifests generate fmt vet ## Run a controller from your host.
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
.PHONY: docker-build
docker-build: ## Build docker image with the manager.
sudo docker build -t ${IMG} --build-arg GOPROXY=${GOPROXY} --build-arg GOSUMDB=${GOSUMDB} .
sudo docker build -t ${IMG} --build-arg GOPROXY=${GOPROXY} --build-arg GOSUMDB=${GOSUMDB} --build-arg RACE=${RACE} .

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
docker push ${IMG}
sudo docker push ${IMG}

# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
Expand Down Expand Up @@ -186,4 +187,4 @@ $(ENVTEST): $(LOCALBIN)
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest

.PHONY: tools
tools: $(YQ) $(SEMVER)
tools: $(YQ) $(SEMVER)
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ kind: Kustomization
images:
- name: controller
newName: oceanbasedev/ob-operator
newTag: 2.0.3-alpha.101
newTag: 2.0.0
4 changes: 2 additions & 2 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ spec:
# More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
resources:
limits:
cpu: 500m
memory: 128Mi
cpu: 1
memory: 1Gi
requests:
cpu: 10m
memory: 64Mi
Expand Down
26 changes: 26 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,32 @@ rules:
- get
- patch
- update
- apiGroups:
- ""
resources:
- services
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- services/finalizers
verbs:
- update
- apiGroups:
- ""
resources:
- services/status
verbs:
- get
- patch
- update
- apiGroups:
- batch
resources:
Expand Down
Loading

0 comments on commit 91a1fa8

Please sign in to comment.