Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] [minor] add rebalancer implementation #1772

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4f6d141
add rebalancer implementation
kpango Jul 30, 2021
0f560c4
update job configmap
kevindiu Jul 30, 2021
49fee85
Merge branch 'master' into feature/rebalancer/initial-development
kevindiu Aug 2, 2021
bb72a28
reset k8s directory
hlts2 Aug 10, 2021
4a74d93
Merge branch 'master' into feature/rebalancer/initial-development
hlts2 Aug 10, 2021
559f284
make helm/schema/crd/vald
hlts2 Aug 10, 2021
8665b4b
Merge branch 'master' into feature/rebalancer/initial-development
kevindiu Aug 16, 2021
354fc2a
regenerate rebalancer pb.go
kevindiu Aug 16, 2021
592d3f0
fix build error
kevindiu Aug 16, 2021
dab1e63
handle error from process.Signal()
kevindiu Aug 16, 2021
710a39e
[test] fix index problem
hlts2 Aug 17, 2021
ec1c293
Revert "[test] fix index problem"
hlts2 Aug 18, 2021
0eea156
[test] return location name in lb gateway
kevindiu Aug 18, 2021
3ff842c
Merge branch 'master' into feature/rebalancer/initial-development
hlts2 Aug 23, 2021
67023d4
Merge branch 'master' into feature/rebalancer/initial-development
kevindiu Aug 23, 2021
6a563d8
Merge branch 'master' into feature/rebalancer/initial-development
hlts2 Sep 6, 2021
7e9751f
make helm/schema/vald
hlts2 Sep 6, 2021
22bdb48
use other docker image to build
kevindiu Sep 8, 2021
4c03b19
Merge branch 'master' into feature/rebalancer/initial-development
kevindiu Oct 15, 2021
68fc4e0
fix build error due to new k8s interface
kevindiu Oct 15, 2021
a0b1afb
Merge branch 'master' into feature/rebalancer/initial-development
kevindiu Oct 15, 2021
b5773f9
fix build error due to new k8s interface
kevindiu Oct 15, 2021
302f273
fix charts
kevindiu Oct 15, 2021
72599bc
Merge branch 'master' into feature/rebalancer/initial-development
kevindiu Oct 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions .github/workflows/dockers-rebalancer-storage-controller-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#
# Copyright (C) 2019-2021 vdaas.org vald team <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: "Build docker image: rebalancer-storage-controller"

on:
push:
branches:
- master
tags:
- "*.*.*"
- "v*.*.*"
- "*.*.*-*"
- "v*.*.*-*"
paths:
- "go.mod"
- "go.sum"
- "internal/**"
- "!internal/**/*_test.go"
- "!internal/db/**"
- "apis/grpc/**"
- "pkg/rebalancer/storage/controller/**"
- "cmd/rebalancer/storage/controller/**"
- "versions/GO_VERSION"
pull_request:
paths:
- "go.mod"
- "go.sum"
- "internal/**"
- "!internal/**/*_test.go"
- "!internal/db/**"
- "apis/grpc/**"
- "pkg/rebalancer/storage/controller/**"
- "cmd/rebalancer/storage/controller/**"
- "versions/GO_VERSION"

jobs:
build:
strategy:
max-parallel: 4
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: "--debug"
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.PACKAGE_USER }}
password: ${{ secrets.PACKAGE_TOKEN }}
- name: Build and Publish
id: build_and_publish
uses: ./.github/actions/docker-build
with:
target: rebalancer-storage-controller
builder: ${{ steps.buildx.outputs.name }}
- name: Initialize CodeQL
if: startsWith( github.ref, 'refs/tags/')
uses: github/codeql-action/init@v1
- name: Run vulnerability scanner (table)
if: startsWith( github.ref, 'refs/tags/')
uses: aquasecurity/trivy-action@master
with:
image-ref: "${{ steps.build_and_publish.outputs.IMAGE_NAME }}:${{ steps.build_and_publish.outputs.PRIMARY_TAG }}"
format: "table"
- name: Run vulnerability scanner (sarif)
if: startsWith( github.ref, 'refs/tags/')
uses: aquasecurity/trivy-action@master
with:
image-ref: "${{ steps.build_and_publish.outputs.IMAGE_NAME }}:${{ steps.build_and_publish.outputs.PRIMARY_TAG }}"
format: "template"
template: "@/contrib/sarif.tpl"
output: "trivy-results.sarif"
- name: Upload Trivy scan results to Security tab
if: startsWith( github.ref, 'refs/tags/')
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: "trivy-results.sarif"
slack:
name: Slack notification
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || startsWith( github.ref, 'refs/tags/')
steps:
- uses: technote-space/workflow-conclusion-action@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: 8398a7/action-slack@v2
with:
author_name: rebalancer-storage-controller image build
status: ${{ env.WORKFLOW_CONCLUSION }}
only_mention_fail: channel
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFY_WEBHOOK_URL }}
177 changes: 177 additions & 0 deletions .github/workflows/dockers-rebalancer-storage-job-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
#
# Copyright (C) 2019-2021 vdaas.org vald team <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: "Build docker image: rebalancer-storage-job"

on:
push:
branches:
- master
tags:
- "*.*.*"
- "v*.*.*"
- "*.*.*-*"
- "v*.*.*-*"
paths:
- "go.mod"
- "go.sum"
- "internal/**"
- "!internal/**/*_test.go"
- "!internal/db/**"
- "!internal/k8s/**"
- "apis/grpc/**"
- "pkg/rebalancer/storage/job/**"
- "cmd/rebalancer/storage/job/**"
- "dockers/base/Dockerfile"
- "dockers/rebalancer/storage/job/Dockerfile"
- "versions/GO_VERSION"
pull_request:
paths:
- "go.mod"
- "go.sum"
- "internal/**"
- "!internal/**/*_test.go"
- "!internal/db/**"
- "!internal/k8s/**"
- "apis/grpc/**"
- "pkg/rebalancer/storage/job/**"
- "cmd/rebalancer/storage/job/**"
- "dockers/base/Dockerfile"
- "dockers/rebalancer/storage/job/Dockerfile"
- "versions/GO_VERSION"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: "--debug"
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-rebalancer-storage-job-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-rebalancer-storage-job-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.PACKAGE_USER }}
password: ${{ secrets.PACKAGE_TOKEN }}
- name: Image name
id: image_name
run: |
image_name=`make docker/name/rebalancer-storage-job`
base_platforms=`make docker/platforms`
echo "IMAGE_NAME=${image_name}" >> $GITHUB_ENV
echo "::set-output name=IMAGE_NAME::${image_name}"
echo "::set-output name=BASE_PLATFORMS::${base_platforms}"
- name: Determine tag name (master)
if: github.ref == 'refs/heads/master'
run: |
echo "PRIMARY_TAG=nightly" >> $GITHUB_ENV
echo "PLATFORMS=${PLATFORMS}" >> $GITHUB_ENV
env:
PLATFORMS: ${{ steps.image_name.outputs.BASE_PLATFORMS }}
- name: Determine tag name (pull request)
if: github.event_name == 'pull_request'
run: |
pr_num=`cat $GITHUB_EVENT_PATH | jq -r ".number"`
echo "PR-${pr_num}" > versions/VALD_VERSION
echo "PRIMARY_TAG=pr-${pr_num}" >> $GITHUB_ENV
echo "PLATFORMS=${PLATFORMS}" >> $GITHUB_ENV
env:
PLATFORMS: linux/amd64
- name: Determine tag name (tags)
if: startsWith( github.ref, 'refs/tags/')
id: determine_tag
run: |
tag_name=`echo $GITHUB_REF | sed -e 's:^refs/tags/::'`
echo "::set-output name=TAG_NAME::${tag_name}"
echo "PRIMARY_TAG=${tag_name}" >> $GITHUB_ENV
echo "PLATFORMS=${PLATFORMS}" >> $GITHUB_ENV
env:
PLATFORMS: ${{ steps.image_name.outputs.BASE_PLATFORMS }}
- name: Build and Push
run: |
make \
DOCKER="docker buildx" \
DOCKER_OPTS="--platform ${PLATFORMS} --builder ${BUILDER} ${CACHE_OPTS} ${LABEL_OPTS} --push" \
TAG="${PRIMARY_TAG}" \
docker/build/rebalancer-storage-job
make \
ORG="ghcr.io/vdaas/vald" \
DOCKER="docker buildx" \
DOCKER_OPTS="--platform ${PLATFORMS} --builder ${BUILDER} ${CACHE_OPTS} ${LABEL_OPTS} --push" \
TAG="${PRIMARY_TAG}" \
docker/build/rebalancer-storage-job
env:
DOCKER_BUILDKIT: 1
BUILDER: ${{ steps.buildx.outputs.name }}
CACHE_OPTS: "--cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,mode=max,dest=/tmp/.buildx-cache"
LABEL_OPTS: "--label org.opencontainers.image.url=${{ github.event.repository.html_url }} --label org.opencontainers.image.source=${{ github.event.repository.html_url }} --label org.opencontainers.image.revision=${{ github.sha }}"
- name: Initialize CodeQL
if: startsWith( github.ref, 'refs/tags/')
uses: github/codeql-action/init@v1
- name: Run vulnerability scanner (table)
if: startsWith( github.ref, 'refs/tags/')
uses: aquasecurity/trivy-action@master
with:
image-ref: "${{ steps.image_name.outputs.IMAGE_NAME }}:${{ steps.determine_tag.outputs.TAG_NAME }}"
format: "table"
- name: Run vulnerability scanner (sarif)
if: startsWith( github.ref, 'refs/tags/')
uses: aquasecurity/trivy-action@master
with:
image-ref: "${{ steps.image_name.outputs.IMAGE_NAME }}:${{ steps.determine_tag.outputs.TAG_NAME }}"
format: "template"
template: "@/contrib/sarif.tpl"
output: "trivy-results.sarif"
- name: Upload Trivy scan results to Security tab
if: startsWith( github.ref, 'refs/tags/')
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: "trivy-results.sarif"
slack:
name: Slack notification
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || startsWith( github.ref, 'refs/tags/')
steps:
- uses: technote-space/workflow-conclusion-action@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: 8398a7/action-slack@v2
with:
author_name: rebalancer-storage-job image build
status: ${{ env.WORKFLOW_CONCLUSION }}
only_mention_fail: channel
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFY_WEBHOOK_URL }}
42 changes: 22 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,28 @@
# limitations under the License.
#

ORG ?= vdaas
NAME = vald
GOPKG = github.com/$(ORG)/$(NAME)
GOPRIVATE = $(GOPKG),$(GOPKG)/apis
DATETIME = $(eval DATETIME := $(shell date -u +%Y/%m/%d_%H:%M:%S%z))$(DATETIME)
TAG ?= latest
CRORG ?= $(ORG)
# CRORG = ghcr.io/vdaas/vald
AGENT_IMAGE = $(NAME)-agent-ngt
AGENT_SIDECAR_IMAGE = $(NAME)-agent-sidecar
CI_CONTAINER_IMAGE = $(NAME)-ci-container
DEV_CONTAINER_IMAGE = $(NAME)-dev-container
DISCOVERER_IMAGE = $(NAME)-discoverer-k8s
FILTER_GATEWAY_IMAGE = $(NAME)-filter-gateway
FILTER_INGRESS_TF_IMAGE = $(NAME)-filter-ingress-tensorflow
HELM_OPERATOR_IMAGE = $(NAME)-helm-operator
LB_GATEWAY_IMAGE = $(NAME)-lb-gateway
LOADTEST_IMAGE = $(NAME)-loadtest
MANAGER_INDEX_IMAGE = $(NAME)-manager-index
MAINTAINER = "$(ORG).org $(NAME) team <$(NAME)@$(ORG).org>"
ORG ?= vdaas
NAME = vald
GOPKG = github.com/$(ORG)/$(NAME)
GOPRIVATE = $(GOPKG),$(GOPKG)/apis
DATETIME = $(eval DATETIME := $(shell date -u +%Y/%m/%d_%H:%M:%S%z))$(DATETIME)
TAG ?= latest
CRORG ?= $(ORG)
# CRORG = ghcr.io/vdaas/vald
AGENT_IMAGE = $(NAME)-agent-ngt
AGENT_SIDECAR_IMAGE = $(NAME)-agent-sidecar
CI_CONTAINER_IMAGE = $(NAME)-ci-container
DEV_CONTAINER_IMAGE = $(NAME)-dev-container
DISCOVERER_IMAGE = $(NAME)-discoverer-k8s
FILTER_GATEWAY_IMAGE = $(NAME)-filter-gateway
FILTER_INGRESS_TF_IMAGE = $(NAME)-filter-ingress-tensorflow
HELM_OPERATOR_IMAGE = $(NAME)-helm-operator
LB_GATEWAY_IMAGE = $(NAME)-lb-gateway
LOADTEST_IMAGE = $(NAME)-loadtest
MANAGER_INDEX_IMAGE = $(NAME)-manager-index
REBALANCER_STORAGE_CONTROLLER_IMAGE = $(NAME)-rebalancer-storage-controller
REBALANCER_STORAGE_JOB_IMAGE = $(NAME)-rebalancer-storage-job
MAINTAINER = "$(ORG).org $(NAME) team <$(NAME)@$(ORG).org>"

VERSION ?= $(eval VERSION := $(shell cat versions/VALD_VERSION))$(VERSION)

Expand Down
Loading