-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: Implement delete expired index job * fix: Replace agent Remove RPC to Vald Remove RPC * fix: service name * fix: typo * fix: log method * fix: variable name * fix: use internal package * fix: Change struct field name Co-authored-by: s-shiraki <s.shiraki.business@gmail.com>
- Loading branch information
Showing
23 changed files
with
1,757 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# | ||
# 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/actions/gen/main.go | ||
|
||
name: 'Build docker image: index-deletion' | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- release/v*.* | ||
- '!release/v*.*.*' | ||
tags: | ||
- '*.*.*' | ||
- v*.*.* | ||
- '*.*.*-*' | ||
- v*.*.*-* | ||
pull_request: | ||
paths: | ||
- hack/docker/gen/main.go | ||
- dockers/index/job/deletion/Dockerfile | ||
- hack/actions/gen/main.go | ||
- .github/workflows/dockers-index-deletion-image.yaml | ||
- .github/actions/docker-build/action.yaml | ||
- .github/workflows/_docker-image.yaml | ||
- cmd/index/job/deletion/** | ||
- pkg/index/job/deletion/** | ||
- apis/grpc/** | ||
- apis/proto/** | ||
- go.mod | ||
- go.sum | ||
- versions/GO_VERSION | ||
- internal/** | ||
- '!internal/**/*_test.go' | ||
- '!internal/**/*_mock.go' | ||
- '!internal/db/**' | ||
- '!internal/k8s/**' | ||
- Makefile | ||
- Makefile.d/** | ||
pull_request_target: | ||
paths: | ||
- hack/docker/gen/main.go | ||
- dockers/index/job/deletion/Dockerfile | ||
- hack/actions/gen/main.go | ||
- .github/workflows/dockers-index-deletion-image.yaml | ||
- .github/actions/docker-build/action.yaml | ||
- .github/workflows/_docker-image.yaml | ||
- cmd/index/job/deletion/** | ||
- pkg/index/job/deletion/** | ||
- apis/grpc/** | ||
- apis/proto/** | ||
- go.mod | ||
- go.sum | ||
- versions/GO_VERSION | ||
- internal/** | ||
- '!internal/**/*_test.go' | ||
- '!internal/**/*_mock.go' | ||
- '!internal/db/**' | ||
- '!internal/k8s/**' | ||
- Makefile | ||
- Makefile.d/** | ||
jobs: | ||
build: | ||
uses: ./.github/workflows/_docker-image.yaml | ||
with: | ||
target: index-deletion | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# | ||
# 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/actions/gen/main.go | ||
|
||
name: "Build docker image: index-deletion" | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- release/v*.* | ||
- "!release/v*.*.*" | ||
tags: | ||
- "*.*.*" | ||
- v*.*.* | ||
- "*.*.*-*" | ||
- v*.*.*-* | ||
pull_request: | ||
paths: | ||
- hack/docker/gen/main.go | ||
- dockers/index/job/deletion/Dockerfile | ||
- hack/actions/gen/main.go | ||
- .github/workflows/dockers-index-deletion-image.yaml | ||
- .github/actions/docker-build/action.yaml | ||
- .github/workflows/_docker-image.yaml | ||
- cmd/index/job/deletion/** | ||
- pkg/index/job/deletion/** | ||
- apis/grpc/** | ||
- apis/proto/** | ||
- go.mod | ||
- go.sum | ||
- versions/GO_VERSION | ||
- internal/** | ||
- "!internal/**/*_test.go" | ||
- "!internal/**/*_mock.go" | ||
- "!internal/db/**" | ||
- "!internal/k8s/**" | ||
- Makefile | ||
- Makefile.d/** | ||
pull_request_target: | ||
paths: | ||
- hack/docker/gen/main.go | ||
- dockers/index/job/deletion/Dockerfile | ||
- hack/actions/gen/main.go | ||
- .github/workflows/dockers-index-deletion-image.yaml | ||
- .github/actions/docker-build/action.yaml | ||
- .github/workflows/_docker-image.yaml | ||
- cmd/index/job/deletion/** | ||
- pkg/index/job/deletion/** | ||
- apis/grpc/** | ||
- apis/proto/** | ||
- go.mod | ||
- go.sum | ||
- versions/GO_VERSION | ||
- internal/** | ||
- "!internal/**/*_test.go" | ||
- "!internal/**/*_mock.go" | ||
- "!internal/db/**" | ||
- "!internal/k8s/**" | ||
- Makefile | ||
- Makefile.d/** | ||
jobs: | ||
build: | ||
uses: ./.github/workflows/_docker-image.yaml | ||
with: | ||
target: index-deletion | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
|
||
"github.com/vdaas/vald/internal/errors" | ||
"github.com/vdaas/vald/internal/info" | ||
"github.com/vdaas/vald/internal/log" | ||
"github.com/vdaas/vald/internal/runner" | ||
"github.com/vdaas/vald/internal/safety" | ||
"github.com/vdaas/vald/pkg/index/job/deletion/config" | ||
"github.com/vdaas/vald/pkg/index/job/deletion/usecase" | ||
) | ||
|
||
const ( | ||
maxVersion = "v0.0.10" | ||
minVersion = "v0.0.0" | ||
name = "index deletion job" | ||
) | ||
|
||
func main() { | ||
if err := safety.RecoverFunc(func() error { | ||
return runner.Do( | ||
context.Background(), | ||
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 | ||
} | ||
} |
Oops, something went wrong.