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

feat: Implement index exporter #2746

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
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
247 changes: 247 additions & 0 deletions .github/workflows/dockers-index-exportation-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
#
# Copyright (C) 2019-2024 vdaas.org vald team <vald@vdaas.org>
#
# 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.
#

# DO_NOT_EDIT this workflow file is generated by https://github.com/vdaas/vald/blob/main/hack/docker/gen/main.go


name: 'Build docker image: index-exportation'
on:
push:
branches:
- main
- release/v*.*
- '!release/v*.*.*'
tags:
- '*.*.*'
- '*.*.*-*'
- v*.*.*
- v*.*.*-*
pull_request:
paths:
- '!**/*_mock.go'
- '!**/*_test.go'
- .github/actions/docker-build/action.yaml
- .github/workflows/_docker-image.yaml
- .github/workflows/dockers-index-exportation-image.yaml
- Makefile
- Makefile.d/**
- apis/grpc/v1/payload/*.go
- apis/grpc/v1/rpc/errdetails/*.go
- apis/grpc/v1/vald/*.go
- apis/proto/**
- cmd/index/job/exportation/*.go
- dockers/index/job/exportation/Dockerfile
- go.mod
- go.sum
- hack/docker/gen/main.go
- internal/backoff/*.go
- internal/cache/*.go
- internal/cache/cacher/*.go
- internal/cache/gache/*.go
- internal/circuitbreaker/*.go
- internal/client/v1/client/vald/*.go
- internal/config/*.go
- internal/conv/*.go
- internal/db/kvs/pogreb/*.go
- internal/db/kvs/redis/*.go
- internal/db/nosql/cassandra/*.go
- internal/db/rdb/mysql/*.go
- internal/db/rdb/mysql/dbr/*.go
- internal/encoding/json/*.go
- internal/errors/*.go
- internal/file/*.go
- internal/info/*.go
- internal/io/*.go
- internal/k8s/*.go
- internal/log/*.go
- internal/log/format/*.go
- internal/log/glg/*.go
- internal/log/level/*.go
- internal/log/logger/*.go
- internal/log/nop/*.go
- internal/log/retry/*.go
- internal/log/zap/*.go
- internal/net/*.go
- internal/net/control/*.go
- internal/net/grpc/*.go
- internal/net/grpc/admin/*.go
- internal/net/grpc/codes/*.go
- internal/net/grpc/credentials/*.go
- internal/net/grpc/errdetails/*.go
- internal/net/grpc/health/*.go
- internal/net/grpc/interceptor/client/metric/*.go
- internal/net/grpc/interceptor/client/trace/*.go
- internal/net/grpc/interceptor/server/logging/*.go
- internal/net/grpc/interceptor/server/metric/*.go
- internal/net/grpc/interceptor/server/recover/*.go
- internal/net/grpc/interceptor/server/trace/*.go
- internal/net/grpc/keepalive/*.go
- internal/net/grpc/logger/*.go
- internal/net/grpc/pool/*.go
- internal/net/grpc/proto/*.go
- internal/net/grpc/reflection/*.go
- internal/net/grpc/status/*.go
- internal/net/grpc/types/*.go
- internal/net/http/dump/*.go
- internal/net/http/json/*.go
- internal/net/http/metrics/*.go
- internal/net/http/middleware/*.go
- internal/net/http/rest/*.go
- internal/net/http/routing/*.go
- internal/net/quic/*.go
- internal/observability/*.go
- internal/observability/attribute/*.go
- internal/observability/exporter/*.go
- internal/observability/exporter/otlp/*.go
- internal/observability/metrics/*.go
- internal/observability/metrics/grpc/*.go
- internal/observability/metrics/mem/*.go
- internal/observability/metrics/runtime/cgo/*.go
- internal/observability/metrics/runtime/goroutine/*.go
- internal/observability/metrics/version/*.go
- internal/observability/trace/*.go
- internal/os/*.go
- internal/params/*.go
- internal/rand/*.go
- internal/runner/*.go
- internal/safety/*.go
- internal/servers/*.go
- internal/servers/server/*.go
- internal/servers/starter/*.go
- internal/strings/*.go
- internal/sync/*.go
- internal/sync/errgroup/*.go
- internal/sync/semaphore/*.go
- internal/sync/singleflight/*.go
- internal/timeutil/*.go
- internal/timeutil/location/*.go
- internal/tls/*.go
- internal/version/*.go
- pkg/index/job/exportation/config/*.go
- pkg/index/job/exportation/service/*.go
- pkg/index/job/exportation/usecase/*.go
- versions/GO_VERSION
pull_request_target:
paths:
- '!**/*_mock.go'
- '!**/*_test.go'
- .github/actions/docker-build/action.yaml
- .github/workflows/_docker-image.yaml
- .github/workflows/dockers-index-exportation-image.yaml
- Makefile
- Makefile.d/**
- apis/grpc/v1/payload/*.go
- apis/grpc/v1/rpc/errdetails/*.go
- apis/grpc/v1/vald/*.go
- apis/proto/**
- cmd/index/job/exportation/*.go
- dockers/index/job/exportation/Dockerfile
- go.mod
- go.sum
- hack/docker/gen/main.go
- internal/backoff/*.go
- internal/cache/*.go
- internal/cache/cacher/*.go
- internal/cache/gache/*.go
- internal/circuitbreaker/*.go
- internal/client/v1/client/vald/*.go
- internal/config/*.go
- internal/conv/*.go
- internal/db/kvs/pogreb/*.go
- internal/db/kvs/redis/*.go
- internal/db/nosql/cassandra/*.go
- internal/db/rdb/mysql/*.go
- internal/db/rdb/mysql/dbr/*.go
- internal/encoding/json/*.go
- internal/errors/*.go
- internal/file/*.go
- internal/info/*.go
- internal/io/*.go
- internal/k8s/*.go
- internal/log/*.go
- internal/log/format/*.go
- internal/log/glg/*.go
- internal/log/level/*.go
- internal/log/logger/*.go
- internal/log/nop/*.go
- internal/log/retry/*.go
- internal/log/zap/*.go
- internal/net/*.go
- internal/net/control/*.go
- internal/net/grpc/*.go
- internal/net/grpc/admin/*.go
- internal/net/grpc/codes/*.go
- internal/net/grpc/credentials/*.go
- internal/net/grpc/errdetails/*.go
- internal/net/grpc/health/*.go
- internal/net/grpc/interceptor/client/metric/*.go
- internal/net/grpc/interceptor/client/trace/*.go
- internal/net/grpc/interceptor/server/logging/*.go
- internal/net/grpc/interceptor/server/metric/*.go
- internal/net/grpc/interceptor/server/recover/*.go
- internal/net/grpc/interceptor/server/trace/*.go
- internal/net/grpc/keepalive/*.go
- internal/net/grpc/logger/*.go
- internal/net/grpc/pool/*.go
- internal/net/grpc/proto/*.go
- internal/net/grpc/reflection/*.go
- internal/net/grpc/status/*.go
- internal/net/grpc/types/*.go
- internal/net/http/dump/*.go
- internal/net/http/json/*.go
- internal/net/http/metrics/*.go
- internal/net/http/middleware/*.go
- internal/net/http/rest/*.go
- internal/net/http/routing/*.go
- internal/net/quic/*.go
- internal/observability/*.go
- internal/observability/attribute/*.go
- internal/observability/exporter/*.go
- internal/observability/exporter/otlp/*.go
- internal/observability/metrics/*.go
- internal/observability/metrics/grpc/*.go
- internal/observability/metrics/mem/*.go
- internal/observability/metrics/runtime/cgo/*.go
- internal/observability/metrics/runtime/goroutine/*.go
- internal/observability/metrics/version/*.go
- internal/observability/trace/*.go
- internal/os/*.go
- internal/params/*.go
- internal/rand/*.go
- internal/runner/*.go
- internal/safety/*.go
- internal/servers/*.go
- internal/servers/server/*.go
- internal/servers/starter/*.go
- internal/strings/*.go
- internal/sync/*.go
- internal/sync/errgroup/*.go
- internal/sync/semaphore/*.go
- internal/sync/singleflight/*.go
- internal/timeutil/*.go
- internal/timeutil/location/*.go
- internal/tls/*.go
- internal/version/*.go
- pkg/index/job/exportation/config/*.go
- pkg/index/job/exportation/service/*.go
- pkg/index/job/exportation/usecase/*.go
- versions/GO_VERSION
jobs:
build:
uses: ./.github/workflows/_docker-image.yaml
with:
target: index-exportation
secrets: inherit
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ HELM_OPERATOR_IMAGE = $(NAME)-helm-operator
INDEX_CORRECTION_IMAGE = $(NAME)-index-correction
INDEX_CREATION_IMAGE = $(NAME)-index-creation
INDEX_DELETION_IMAGE = $(NAME)-index-deletion
INDEX_EXPORTATION_IMAGE = $(NAME)-index-exportation
INDEX_OPERATOR_IMAGE = $(NAME)-index-operator
INDEX_SAVE_IMAGE = $(NAME)-index-save
LB_GATEWAY_IMAGE = $(NAME)-lb-gateway
Expand Down
10 changes: 10 additions & 0 deletions Makefile.d/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ binary/build: \
cmd/index/job/correction/index-correction \
cmd/index/job/creation/index-creation \
cmd/index/job/deletion/index-deletion \
cmd/index/job/exportation/index-exportation \
cmd/index/job/readreplica/rotate/readreplica-rotate \
cmd/index/job/save/index-save \
cmd/index/operator/index-operator \
Expand Down Expand Up @@ -85,6 +86,10 @@ cmd/index/job/deletion/index-deletion:
$(eval CGO_ENABLED = 0)
$(call go-build,index/job/deletion,,-static,,,$@)

cmd/index/job/exportation/index-exportation:
$(eval CGO_ENABLED = 0)
$(call go-build,index/job/exportation,,-static,,,$@)

cmd/index/job/save/index-save:
$(eval CGO_ENABLED = 0)
$(call go-build,index/job/save,,-static,,,$@)
Expand Down Expand Up @@ -134,6 +139,7 @@ binary/build/zip: \
artifacts/vald-index-correction-$(GOOS)-$(GOARCH).zip \
artifacts/vald-index-creation-$(GOOS)-$(GOARCH).zip \
artifacts/vald-index-deletion-$(GOOS)-$(GOARCH).zip \
artifacts/vald-index-exportation-$(GOOS)-$(GOARCH).zip \
artifacts/vald-index-operator-$(GOOS)-$(GOARCH).zip \
artifacts/vald-index-save-$(GOOS)-$(GOARCH).zip \
artifacts/vald-lb-gateway-$(GOOS)-$(GOARCH).zip \
Expand Down Expand Up @@ -197,6 +203,10 @@ artifacts/vald-index-deletion-$(GOOS)-$(GOARCH).zip: cmd/index/job/deletion/inde
$(call mkdir, $(dir $@))
zip --junk-paths $@ $<

artifacts/vald-index-exportation-$(GOOS)-$(GOARCH).zip: cmd/index/job/exportation/index-exportation
$(call mkdir, $(dir $@))
zip --junk-paths $@ $<

artifacts/vald-index-save-$(GOOS)-$(GOARCH).zip: cmd/index/job/save/index-save
$(call mkdir, $(dir $@))
zip --junk-paths $@ $<
Expand Down
13 changes: 13 additions & 0 deletions Makefile.d/docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ docker/build: \
docker/build/index-correction \
docker/build/index-creation \
docker/build/index-deletion \
docker/build/index-exportation \
docker/build/index-operator \
docker/build/index-save \
docker/build/loadtest \
Expand Down Expand Up @@ -65,6 +66,7 @@ docker/xpanes/build:
docker/build/index-correction \
docker/build/index-creation \
docker/build/index-deletion \
docker/build/index-exportation \
docker/build/index-operator \
docker/build/index-save \
docker/build/loadtest \
Expand Down Expand Up @@ -354,6 +356,17 @@ docker/build/index-deletion:
IMAGE=$(INDEX_DELETION_IMAGE) \
docker/build/image

.PHONY: docker/name/index-exportation
docker/name/index-exportation:
@echo "$(ORG)/$(INDEX_EXPORTATION_IMAGE)"

.PHONY: docker/build/index-exportation
## build index-exportation image
docker/build/index-exportation:
@make DOCKERFILE="$(ROOTDIR)/dockers/index/job/exportation/Dockerfile" \
IMAGE=$(INDEX_EXPORTATION_IMAGE) \
docker/build/image

.PHONY: docker/name/index-operator
docker/name/index-operator:
@echo "$(ORG)/$(INDEX_OPERATOR_IMAGE)"
Expand Down
59 changes: 59 additions & 0 deletions cmd/index/job/exportation/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright (C) 2019-2024 vdaas.org vald team <vald@vdaas.org>
//
// 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.
package main

import (
"context"
"log"

"github.com/vdaas/vald/internal/errors"
"github.com/vdaas/vald/internal/info"
"github.com/vdaas/vald/internal/runner"
"github.com/vdaas/vald/internal/safety"
"github.com/vdaas/vald/pkg/index/job/exportation/config"
"github.com/vdaas/vald/pkg/index/job/exportation/usecase"
)

const (
maxVersion = "v0.0.10"
minVersion = "v0.0.0"
name = "index exportation job"
)

func main() {
if err := safety.RecoverFunc(func() error {
return runner.Do(
context.Background(),
highpon marked this conversation as resolved.
Show resolved Hide resolved
runner.WithName(name),
runner.WithVersion(info.Version, maxVersion, minVersion),
runner.WithConfigLoader(func(path string) (any, *config.GlobalConfig, error) {
cfg, err := config.NewConfig(path)
if err != nil {
return nil, nil, errors.Wrap(err, "failed to load "+name+"'s configuration")
}
return cfg, &cfg.GlobalConfig, nil
}),
runner.WithDaemonInitializer(func(cfg any) (runner.Runner, error) {
c, ok := cfg.(*config.Data)
if !ok {
return nil, errors.ErrInvalidConfig
}
return usecase.New(c)
}),
)
})(); err != nil {
log.Fatal(err, info.Get())
return
}
}
Loading
Loading