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

Add Custom Resource for mirror target #2023

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
ab7502b
add mirror definition and update proto dependencies
hlts2 Feb 9, 2023
563180d
Add mirror gateway component (#1949)
hlts2 Apr 25, 2023
19b5c14
add discovery logic for other mirror target
hlts2 May 8, 2023
e73c235
add k8s template file
hlts2 May 8, 2023
14024ce
add crd for mirror target resource
hlts2 May 8, 2023
73527fe
add new values for mirror discovery logic
hlts2 May 8, 2023
75de59b
style: Format code with gofumpt and prettier
deepsource-autofix[bot] May 8, 2023
eab4970
fix schema register error and fix manifest to multi vald cluster
hlts2 May 8, 2023
d66adc8
style: Format code with gofumpt and prettier
deepsource-autofix[bot] May 8, 2023
34bc1a3
bugfix: adapt the service account and add early return
hlts2 May 8, 2023
487be4a
bugfix: usage of errors join
hlts2 May 8, 2023
24a3590
bugfix: type conversion bug
hlts2 May 8, 2023
6395fd2
fix metadata hash logic and add mirror group function
hlts2 May 10, 2023
db53d52
add status handling for network connection
hlts2 May 10, 2023
2480104
refactoring
hlts2 May 10, 2023
f1732ea
bugfix: status update handling
hlts2 May 10, 2023
85ac306
bugfix: update status using status writer
hlts2 May 10, 2023
670d9f2
add status timestamp
hlts2 May 11, 2023
86f44f2
fix yaml field format
hlts2 May 11, 2023
537c41e
improve status changes handling
hlts2 May 11, 2023
eef2149
reduced number of status updates
hlts2 May 11, 2023
2f901ea
added status check handling before changing status
hlts2 May 11, 2023
6ac161a
update vald mirror target definition and add new cluster role
hlts2 May 15, 2023
87d24ab
style: Format code with gofumpt and prettier
deepsource-autofix[bot] May 15, 2023
c514a3e
deploy multiple vald clusters and mirror target resource to connect w…
hlts2 May 15, 2023
db65d11
fix e2d test to mirror-gateway and crd view field
hlts2 May 15, 2023
d5e6942
define mirror app name
hlts2 May 15, 2023
6132cb1
deleted unused code
hlts2 May 15, 2023
3a6563b
fix golangci warning
hlts2 May 16, 2023
eafad78
crd generate command for mirror target using mirror-target-values
hlts2 May 17, 2023
3343b21
add string field validation
hlts2 May 18, 2023
0b77e8a
fix build error
hlts2 May 18, 2023
54763a6
add configuration comment
hlts2 May 24, 2023
2bd7f7a
style: Format code with gofumpt and prettier
deepsource-autofix[bot] May 24, 2023
6c4c925
add image tag for debug
hlts2 May 24, 2023
6152196
fix rebase error
hlts2 May 24, 2023
ce70d30
fix wait timeout option
hlts2 May 24, 2023
a1fe643
add new option to set mirror address
hlts2 May 31, 2023
11087eb
add new comment
hlts2 Jun 1, 2023
0e73deb
bugfix for ingress configuration
hlts2 Jun 1, 2023
3ace294
not create lb ingress when mirror is enabled
hlts2 Jun 2, 2023
a634586
not create filter ingress when mirror is enabled
hlts2 Jun 2, 2023
644d4a1
add error handling for unimplemented codes error
hlts2 Jun 6, 2023
e0ae960
bugfix register addr process
hlts2 Jun 6, 2023
87159d2
fix build error
hlts2 Jun 16, 2023
47d0689
Revert "update docker file for build error"
hlts2 Jun 19, 2023
3012861
add new package for docker build error
hlts2 Jun 19, 2023
7cc8a1b
Add mirror gateway example (#2082)
hlts2 Jun 21, 2023
348041f
add mirror target metrics
hlts2 Jun 21, 2023
a0185ec
fix example ngt dimension
hlts2 Jun 27, 2023
82c0181
make proto/all & make format
hlts2 Jul 3, 2023
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ E2E_UPSERT_COUNT ?= 10
E2E_REMOVE_COUNT ?= 3
E2E_WAIT_FOR_CREATE_INDEX_DURATION ?= 8m
E2E_TARGET_NAME ?= vald-lb-gateway
E2E_TARGET_POD_NAME ?= $(eval E2E_TARGET_POD_NAME := $(shell kubectl get pods --selector=app=$(E2E_TARGET_NAME) | tail -1 | cut -f1 -d " "))$(E2E_TARGET_POD_NAME)
E2E_TARGET_POD_NAME ?= $(eval E2E_TARGET_POD_NAME := $(shell kubectl get pods --selector=app=$(E2E_TARGET_NAME) -n $(E2E_TARGET_NAMESPACE) | tail -1 | cut -f1 -d " "))$(E2E_TARGET_POD_NAME)
E2E_TARGET_NAMESPACE ?= default
E2E_TARGET_PORT ?= 8081
E2E_PORTFORWARD_ENABLED ?= true
Expand Down
11 changes: 11 additions & 0 deletions Makefile.d/helm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,14 @@ helm/schema/crd/vald-helm-operator: \
charts/vald-helm-operator/values.yaml > $(TEMP_DIR)/valdhelmoperatorrelease-spec.yaml
$(BINDIR)/yq eval-all 'select(fileIndex==0).spec.versions[0].schema.openAPIV3Schema.properties.spec = select(fileIndex==1).spec | select(fileIndex==0)' \
$(TEMP_DIR)/valdhelmoperatorrelease.yaml $(TEMP_DIR)/valdhelmoperatorrelease-spec.yaml > charts/vald-helm-operator/crds/valdhelmoperatorrelease.yaml

.PHONY: helm/schema/crd/vald/mirror-target
## generate OpenAPI v3 schema for ValdMirrorTarget
helm/schema/crd/vald/mirror-target: \
yq/install
mv charts/vald/crds/valdmirrortarget.yaml $(TEMP_DIR)/valdmirrortarget.yaml
GOPRIVATE=$(GOPRIVATE) \
go run -mod=readonly hack/helm/schema/crd/main.go \
charts/vald/schemas/mirror-target-values.yaml > $(TEMP_DIR)/valdmirrortarget-spec.yaml
$(BINDIR)/yq eval-all 'select(fileIndex==0).spec.versions[0].schema.openAPIV3Schema.properties.spec = select(fileIndex==1).spec | select(fileIndex==0)' \
$(TEMP_DIR)/valdmirrortarget.yaml $(TEMP_DIR)/valdmirrortarget-spec.yaml > charts/vald/crds/valdmirrortarget.yaml
6 changes: 6 additions & 0 deletions Makefile.d/k8s.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
MIRROR01_NAMESPACE = vald-01
MIRROR02_NAMESPACE = vald-02
MIRROR03_NAMESPACE = vald-03
MIRROR_APP_NAME = vald-mirror-gateway

.PHONY: k8s/manifest/clean
## clean k8s manifests
Expand Down Expand Up @@ -123,6 +124,11 @@ k8s/multi/vald/deploy:
-f ./charts/vald/values/multi-vald/dev-vald-with-mirror.yaml \
-f ./charts/vald/values/multi-vald/dev-vald-03.yaml \
-n $(MIRROR03_NAMESPACE)
kubectl wait --for=condition=ready pod -l app=$(MIRROR_APP_NAME) --timeout=120s -n $(MIRROR01_NAMESPACE)
kubectl wait --for=condition=ready pod -l app=$(MIRROR_APP_NAME) --timeout=120s -n $(MIRROR02_NAMESPACE)
kubectl wait --for=condition=ready pod -l app=$(MIRROR_APP_NAME) --timeout=120s -n $(MIRROR03_NAMESPACE)
kubectl apply -f ./charts/vald/values/multi-vald/mirror-target.yaml \
-n $(MIRROR03_NAMESPACE)

.PHONY: k8s/multi/vald/delete
## delete multiple vald sample clusters to k8s
Expand Down
58 changes: 29 additions & 29 deletions apis/docs/v1/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@
- [Object](#vald-v1-Object)
- [apis/proto/v1/vald/remove.proto](#apis_proto_v1_vald_remove-proto)
- [Remove](#vald-v1-Remove)
- [apis/proto/v1/vald/search.proto](#apis_proto_v1_vald_search-proto)
- [Search](#vald-v1-Search)
- [apis/proto/v1/vald/update.proto](#apis_proto_v1_vald_update-proto)
- [Update](#vald-v1-Update)
- [apis/proto/v1/vald/upsert.proto](#apis_proto_v1_vald_upsert-proto)
- [Upsert](#vald-v1-Upsert)
- [apis/proto/v1/vald/search.proto](#apis_proto_v1_vald_search-proto)
- [Search](#vald-v1-Search)
- [apis/proto/v1/mirror/mirror.proto](#apis_proto_v1_mirror_mirror-proto)
- [Mirror](#mirror-v1-Mirror)
- [Scalar Value Types](#scalar-value-types)
Expand Down Expand Up @@ -1043,6 +1043,33 @@ Remove service provides ways to remove indexed vectors.
| StreamRemove | [.payload.v1.Remove.Request](#payload-v1-Remove-Request) stream | [.payload.v1.Object.StreamLocation](#payload-v1-Object-StreamLocation) stream | A method to remove multiple indexed vectors by bidirectional streaming. |
| MultiRemove | [.payload.v1.Remove.MultiRequest](#payload-v1-Remove-MultiRequest) | [.payload.v1.Object.Locations](#payload-v1-Object-Locations) | A method to remove multiple indexed vectors in a single request. |

<a name="apis_proto_v1_vald_search-proto"></a>

<p align="right"><a href="#top">Top</a></p>

## apis/proto/v1/vald/search.proto

<a name="vald-v1-Search"></a>

### Search

Search service provides ways to search indexed vectors.

| Method Name | Request Type | Response Type | Description |
| ---------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| Search | [.payload.v1.Search.Request](#payload-v1-Search-Request) | [.payload.v1.Search.Response](#payload-v1-Search-Response) | A method to search indexed vectors by a raw vector. |
| SearchByID | [.payload.v1.Search.IDRequest](#payload-v1-Search-IDRequest) | [.payload.v1.Search.Response](#payload-v1-Search-Response) | A method to search indexed vectors by ID. |
| StreamSearch | [.payload.v1.Search.Request](#payload-v1-Search-Request) stream | [.payload.v1.Search.StreamResponse](#payload-v1-Search-StreamResponse) stream | A method to search indexed vectors by multiple vectors. |
| StreamSearchByID | [.payload.v1.Search.IDRequest](#payload-v1-Search-IDRequest) stream | [.payload.v1.Search.StreamResponse](#payload-v1-Search-StreamResponse) stream | A method to search indexed vectors by multiple IDs. |
| MultiSearch | [.payload.v1.Search.MultiRequest](#payload-v1-Search-MultiRequest) | [.payload.v1.Search.Responses](#payload-v1-Search-Responses) | A method to search indexed vectors by multiple vectors in a single request. |
| MultiSearchByID | [.payload.v1.Search.MultiIDRequest](#payload-v1-Search-MultiIDRequest) | [.payload.v1.Search.Responses](#payload-v1-Search-Responses) | A method to search indexed vectors by multiple IDs in a single request. |
| LinearSearch | [.payload.v1.Search.Request](#payload-v1-Search-Request) | [.payload.v1.Search.Response](#payload-v1-Search-Response) | A method to linear search indexed vectors by a raw vector. |
| LinearSearchByID | [.payload.v1.Search.IDRequest](#payload-v1-Search-IDRequest) | [.payload.v1.Search.Response](#payload-v1-Search-Response) | A method to linear search indexed vectors by ID. |
| StreamLinearSearch | [.payload.v1.Search.Request](#payload-v1-Search-Request) stream | [.payload.v1.Search.StreamResponse](#payload-v1-Search-StreamResponse) stream | A method to linear search indexed vectors by multiple vectors. |
| StreamLinearSearchByID | [.payload.v1.Search.IDRequest](#payload-v1-Search-IDRequest) stream | [.payload.v1.Search.StreamResponse](#payload-v1-Search-StreamResponse) stream | A method to linear search indexed vectors by multiple IDs. |
| MultiLinearSearch | [.payload.v1.Search.MultiRequest](#payload-v1-Search-MultiRequest) | [.payload.v1.Search.Responses](#payload-v1-Search-Responses) | A method to linear search indexed vectors by multiple vectors in a single request. |
| MultiLinearSearchByID | [.payload.v1.Search.MultiIDRequest](#payload-v1-Search-MultiIDRequest) | [.payload.v1.Search.Responses](#payload-v1-Search-Responses) | A method to linear search indexed vectors by multiple IDs in a single request. |

<a name="apis_proto_v1_vald_update-proto"></a>

<p align="right"><a href="#top">Top</a></p>
Expand Down Expand Up @@ -1079,33 +1106,6 @@ Upsert service provides ways to insert/update vectors.
| StreamUpsert | [.payload.v1.Upsert.Request](#payload-v1-Upsert-Request) stream | [.payload.v1.Object.StreamLocation](#payload-v1-Object-StreamLocation) stream | A method to insert/update multiple vectors by bidirectional streaming. |
| MultiUpsert | [.payload.v1.Upsert.MultiRequest](#payload-v1-Upsert-MultiRequest) | [.payload.v1.Object.Locations](#payload-v1-Object-Locations) | A method to insert/update multiple vectors in a single request. |

<a name="apis_proto_v1_vald_search-proto"></a>

<p align="right"><a href="#top">Top</a></p>

## apis/proto/v1/vald/search.proto

<a name="vald-v1-Search"></a>

### Search

Search service provides ways to search indexed vectors.

| Method Name | Request Type | Response Type | Description |
| ---------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| Search | [.payload.v1.Search.Request](#payload-v1-Search-Request) | [.payload.v1.Search.Response](#payload-v1-Search-Response) | A method to search indexed vectors by a raw vector. |
| SearchByID | [.payload.v1.Search.IDRequest](#payload-v1-Search-IDRequest) | [.payload.v1.Search.Response](#payload-v1-Search-Response) | A method to search indexed vectors by ID. |
| StreamSearch | [.payload.v1.Search.Request](#payload-v1-Search-Request) stream | [.payload.v1.Search.StreamResponse](#payload-v1-Search-StreamResponse) stream | A method to search indexed vectors by multiple vectors. |
| StreamSearchByID | [.payload.v1.Search.IDRequest](#payload-v1-Search-IDRequest) stream | [.payload.v1.Search.StreamResponse](#payload-v1-Search-StreamResponse) stream | A method to search indexed vectors by multiple IDs. |
| MultiSearch | [.payload.v1.Search.MultiRequest](#payload-v1-Search-MultiRequest) | [.payload.v1.Search.Responses](#payload-v1-Search-Responses) | A method to search indexed vectors by multiple vectors in a single request. |
| MultiSearchByID | [.payload.v1.Search.MultiIDRequest](#payload-v1-Search-MultiIDRequest) | [.payload.v1.Search.Responses](#payload-v1-Search-Responses) | A method to search indexed vectors by multiple IDs in a single request. |
| LinearSearch | [.payload.v1.Search.Request](#payload-v1-Search-Request) | [.payload.v1.Search.Response](#payload-v1-Search-Response) | A method to linear search indexed vectors by a raw vector. |
| LinearSearchByID | [.payload.v1.Search.IDRequest](#payload-v1-Search-IDRequest) | [.payload.v1.Search.Response](#payload-v1-Search-Response) | A method to linear search indexed vectors by ID. |
| StreamLinearSearch | [.payload.v1.Search.Request](#payload-v1-Search-Request) stream | [.payload.v1.Search.StreamResponse](#payload-v1-Search-StreamResponse) stream | A method to linear search indexed vectors by multiple vectors. |
| StreamLinearSearchByID | [.payload.v1.Search.IDRequest](#payload-v1-Search-IDRequest) stream | [.payload.v1.Search.StreamResponse](#payload-v1-Search-StreamResponse) stream | A method to linear search indexed vectors by multiple IDs. |
| MultiLinearSearch | [.payload.v1.Search.MultiRequest](#payload-v1-Search-MultiRequest) | [.payload.v1.Search.Responses](#payload-v1-Search-Responses) | A method to linear search indexed vectors by multiple vectors in a single request. |
| MultiLinearSearchByID | [.payload.v1.Search.MultiIDRequest](#payload-v1-Search-MultiIDRequest) | [.payload.v1.Search.Responses](#payload-v1-Search-Responses) | A method to linear search indexed vectors by multiple IDs in a single request. |

<a name="apis_proto_v1_mirror_mirror-proto"></a>

<p align="right"><a href="#top">Top</a></p>
Expand Down
12 changes: 5 additions & 7 deletions apis/proto/v1/mirror/mirror.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,24 @@ import "github.com/googleapis/googleapis/google/api/annotations.proto";

option go_package = "github.com/vdaas/vald/apis/grpc/v1/mirror";
option java_multiple_files = true;
option java_package = "org.vdaas.vald.api.v1.mirror";
option java_outer_classname = "ValdMirror";

option java_package = "org.vdaas.vald.api.v1.mirror";

// Represent the mirror service.
service Mirror {

// Register is the RPC to register other mirror servers.
rpc Register(payload.v1.Mirror.Targets) returns (payload.v1.Mirror.Targets) {
option (google.api.http) = {
post : "/mirror/register"
body : "*"
post: "/mirror/register"
body: "*"
};
}

// Advertise is the RPC to advertise other mirror servers.
rpc Advertise(payload.v1.Mirror.Targets) returns (payload.v1.Mirror.Targets) {
option (google.api.http) = {
post : "/mirror/advertise"
body : "*"
post: "/mirror/advertise"
body: "*"
};
}
}
1 change: 0 additions & 1 deletion apis/proto/v1/payload/payload.proto
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,6 @@ message Info {

// Mirror related messages.
message Mirror {

// Represent server information.
message Target {
// The target hostname.
Expand Down
101 changes: 101 additions & 0 deletions charts/vald/crds/valdmirrortarget.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#
# Copyright (C) 2019-2023 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.
#
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: valdmirrortargets.vald.vdaas.org
spec:
group: vald.vdaas.org
names:
kind: ValdMirrorTarget
shortNames:
- vmt
- vmts
listKind: ValdMirrorTargetList
plural: valdmirrortargets
singular: valdmirrortarget
scope: Namespaced
versions:
- name: v1
served: true
storage: true
subresources:
status: {}
additionalPrinterColumns:
- name: Host
type: string
jsonPath: .spec.target.host
priority: 1
- name: Port
type: integer
jsonPath: .spec.target.port
priority: 1
- name: Status
type: string
jsonPath: .status.phase
- name: "Last Transition Time"
type: string
jsonPath: .status.lastTransitionTime
- name: Age
type: date
jsonPath: .metadata.creationTimestamp
schema:
openAPIV3Schema:
description: ValdMirrorTarget is the Schema for the valdmirrortargets API
type: object
properties:
apiVersion:
description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources"
type: string
kind:
description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"
type: string
metadata:
type: object
status:
description: ValdMirrorTargetStatus defines the observed state of ValdMirrorTarget
type: object
default: {}
properties:
phase:
type: string
enum:
- Pending
- Connected
- Disconnected
- Unknown
default: Pending
lastTransitionTime:
type: string
spec:
type: object
properties:
colocation:
type: string
minLength: 1
target:
type: object
properties:
host:
type: string
minLength: 1
port:
type: integer
maximum: 65535
minimum: 0
required:
- host
- port
25 changes: 25 additions & 0 deletions charts/vald/schemas/mirror-target-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# Copyright (C) 2019-2023 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.
#
colocation: dc1
# @schema {"name": "target", "type": "object", "required": ["host", "port"]}
# target -- Mirror target information
target:
# @schema {"name": "target.host", "type": "string", "minLength": 1}
# host -- Mirror target host name
host: "vald-mirror-gateway.vald.svc.cluster.local"
# @schema {"name": "target.port", "type": "integer", "minimum": 0, "maximum": 65535}
# target.port -- Mirror target port
port: 8081
3 changes: 2 additions & 1 deletion charts/vald/templates/gateway/filter/ing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
# limitations under the License.
#
{{- $gateway := .Values.gateway.filter -}}
{{- if and $gateway.enabled $gateway.ingress.enabled }}
{{- $mgateway := .Values.gateway.mirror -}}
{{- if and $gateway.enabled $gateway.ingress.enabled (not $mgateway.enabled) }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
Expand Down
3 changes: 2 additions & 1 deletion charts/vald/templates/gateway/lb/ing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
# limitations under the License.
#
{{- $gateway := .Values.gateway.lb -}}
{{- if and $gateway.enabled $gateway.ingress.enabled }}
{{- $mgateway := .Values.gateway.mirror -}}
{{- if and $gateway.enabled $gateway.ingress.enabled (not $mgateway.enabled) }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
Expand Down
Loading
Loading