Skip to content

Commit

Permalink
Refactor/merge dashboard to master (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfooI authored Feb 27, 2024
1 parent cffd203 commit 42a7c9b
Show file tree
Hide file tree
Showing 161 changed files with 2,459 additions and 1,330 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/addlicense.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
- name: addlicense-check
run: |
go install github.com/google/addlicense@latest
find . -type f -name "*.go" -not -path "./distribution/*" | xargs addlicense -check
find . -type f -name "*.go" -not -path "./distribution/*" -not -path "**/generated/*" | xargs addlicense -check
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build ob-operator
name: build images

on:
pull_request:
Expand Down Expand Up @@ -28,4 +28,7 @@ jobs:
run: go mod vendor

- name: go build ob-operator
run: go build -o bin/manager cmd/main.go
run: go build -o bin/manager cmd/operator/main.go

- name: go build oceanbase-dashboard
run: go build -o bin/oceanbase-dashboard cmd/dashboard/main.go
1 change: 1 addition & 0 deletions .github/workflows/release-charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- '2.[0-9]+.[0-9]+'
- 'chart-2.[0-9]+.[0-9]+'
- 'oceanbase-[0-9]+.[0-9]+.[0-9]+.[0-9]+'
- "dashboard-[0-9]+.[0-9]+.[0-9]+"

jobs:
release-chart:
Expand Down
27 changes: 2 additions & 25 deletions .github/workflows/release-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,6 @@ env:
tagName: ${{ github.ref_name }}

jobs:
release-dashboard-chart:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
mark_as_latest: false
skip_existing: true
charts_dir: ./distribution/dashboard/manifests

release-oceanbase-dashboard:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -62,9 +39,9 @@ jobs:
- name: Build and push oceanbase-dashboard w/o cache
uses: docker/build-push-action@v2
with:
context: ./distribution/dashboard
context: .
platforms: linux/amd64,linux/arm64
file: ./distribution/dashboard/Dockerfile
file: ./build/Dockerfile.dashboard
push: true
tags: ${{ vars.DOCKER_PUSH_BASE }}/oceanbase-dashboard:${{ steps.set_version_vars.outputs.version }}
build-args: |
Expand Down
15 changes: 1 addition & 14 deletions .github/workflows/release-operator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,11 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Create and push manifests w/ cache
uses: docker/build-push-action@v2
if: ${{ vars.ENABLE_DOCKER_CACHE }}
with:
context: .
platforms: linux/amd64,linux/arm64
file: Dockerfile
push: true
tags: ${{ vars.DOCKER_PUSH_BASE }}/ob-operator:${{ github.ref_name }}
cache-from: type=registry,ref=${{ vars.DOCKER_PUSH_BASE }}/ob-operator:buildcache
cache-to: type=registry,ref=${{ vars.DOCKER_PUSH_BASE }}/ob-operator:buildcache,mode=max

- name: Create and push manifests w/o cache
uses: docker/build-push-action@v2
if: ${{ !vars.ENABLE_DOCKER_CACHE }}
with:
context: .
platforms: linux/amd64,linux/arm64
file: Dockerfile
file: build/Dockerfile.operator
push: true
tags: ${{ vars.DOCKER_PUSH_BASE }}/ob-operator:${{ github.ref_name }}
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ deploy/*secret*
# !vendor/**/zz_generated.*

.vscode
testreports
testreports

log/*
./nohup.out
node_modules/
ui/dist/
2 changes: 1 addition & 1 deletion api/v1alpha1/obcluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ func (r *OBCluster) validateStorageClassAllowExpansion(storageClassName string)
return err
}
if sc.AllowVolumeExpansion == nil || !*sc.AllowVolumeExpansion {
return errors.New(fmt.Sprintf("storage class %s does not allow volume expansion", storageClassName))
return fmt.Errorf("storage class %s does not allow volume expansion", storageClassName)
}
return nil
}
24 changes: 24 additions & 0 deletions build/Dockerfile.dashboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM node:16-alpine as builder-fe
WORKDIR /workspace
COPY ./ui .
ENV NODE_OPTIONS=--max_old_space_size=5120
RUN yarn
RUN yarn build

FROM golang:1.20.4 as builder-be
ARG GOPROXY=https://goproxy.io,direct
ARG GOSUMDB=sum.golang.org
ARG COMMIT_HASH=unknown
WORKDIR /workspace
COPY . .
RUN make dep-install build

# start build docker image
FROM openanolis/anolisos:8.4-x86_64
WORKDIR /root
COPY --from=builder-be /workspace/bin/oceanbase-dashboard .
COPY --from=builder-fe /workspace/dist ./ui/dist
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
USER root

ENTRYPOINT ["/root/oceanbase-dashboard"]
2 changes: 1 addition & 1 deletion Dockerfile → build/Dockerfile.operator
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG RACE
WORKDIR /workspace
# copy everything
COPY . .
RUN GO11MODULE=ON CGO_ENABLED=1 GOOS=linux go build ${RACE} -o manager cmd/main.go
RUN GO11MODULE=ON CGO_ENABLED=1 GOOS=linux go build ${RACE} -o manager cmd/operator/main.go

# start build docker image
FROM openanolis/anolisos:8.8
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 18 additions & 5 deletions distribution/dashboard/main.go → cmd/dashboard/main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
/*
Copyright (c) 2023 OceanBase
ob-operator is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/

package main

import (
"os"

"github.com/oceanbase/oceanbase-dashboard/internal/server"
"github.com/oceanbase/oceanbase-dashboard/pkg/log"
logger "github.com/sirupsen/logrus"

"github.com/oceanbase/ob-operator/internal/dashboard/server"
"github.com/oceanbase/ob-operator/pkg/log"
)

func init() {
Expand Down Expand Up @@ -34,14 +47,14 @@ func init() {
// @in header
// @name Cookie
func main() {
HTTPServer := server.NewHTTPServer()
err := HTTPServer.RegisterRouter()
httpServer := server.NewHTTPServer()
err := httpServer.RegisterRouter()
if err != nil {
logger.WithError(err).Errorln("Register router failed")
os.Exit(1)
}
logger.Info("Successfully registered router")
err = HTTPServer.Run()
err = httpServer.Run()
if err != nil {
logger.WithError(err).Errorln("Start server failed")
os.Exit(1)
Expand Down
File renamed without changes.
50 changes: 0 additions & 50 deletions distribution/dashboard/Makefile

This file was deleted.

294 changes: 0 additions & 294 deletions distribution/dashboard/bindata/bindata.go

This file was deleted.

11 changes: 0 additions & 11 deletions distribution/dashboard/config/config.go

This file was deleted.

24 changes: 0 additions & 24 deletions distribution/dashboard/internal/business/common/converter.go

This file was deleted.

10 changes: 0 additions & 10 deletions distribution/dashboard/internal/business/constant/constant.go

This file was deleted.

15 changes: 0 additions & 15 deletions distribution/dashboard/internal/business/enums/obcluster/status.go

This file was deleted.

36 changes: 0 additions & 36 deletions distribution/dashboard/internal/business/k8s/k8s_test.go

This file was deleted.

This file was deleted.

Loading

0 comments on commit 42a7c9b

Please sign in to comment.