Skip to content

Commit

Permalink
Rename ip to host of proto payload field for mirror gateway (#2031)
Browse files Browse the repository at this point in the history
* fix field name and yaml indent

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

* make proto/add format

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>

---------

Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
  • Loading branch information
hlts2 committed Jun 27, 2023
1 parent 53782fd commit 5af54b2
Show file tree
Hide file tree
Showing 32 changed files with 191 additions and 123 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dockers-gateway-mirror-image.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2019-2022 vdaas.org vald team <vald@vdaas.org>
# 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.
Expand Down
10 changes: 5 additions & 5 deletions apis/docs/v1/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,10 @@ Mirror related messages.

Represent server information.

| Field | Type | Label | Description |
| ----- | ----------------- | ----- | ---------------- |
| ip | [string](#string) | | The target ip. |
| port | [uint32](#uint32) | | The target port. |
| Field | Type | Label | Description |
| ----- | ----------------- | ----- | -------------------- |
| host | [string](#string) | | The target hostname. |
| port | [uint32](#uint32) | | The target port. |

<a name="payload-v1-Mirror-Targets"></a>

Expand Down Expand Up @@ -1112,7 +1112,7 @@ Upsert service provides ways to insert/update vectors.

## apis/proto/v1/mirror/mirror.proto

Copyright (C) 2019-2022 vdaas.org vald team &lt;vald@vdaas.org&gt;
Copyright (C) 2019-2023 vdaas.org vald team &lt;vald@vdaas.org&gt;

Licensed under the Apache License, Version 2.0 (the &#34;License&#34;);
you may not use this file except in compliance with the License.
Expand Down
14 changes: 7 additions & 7 deletions apis/grpc/v1/mirror/mirror.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions apis/grpc/v1/payload/payload_vtproto.pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -7166,10 +7166,10 @@ func (m *Mirror_Target) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x10
}
if len(m.Ip) > 0 {
i -= len(m.Ip)
copy(dAtA[i:], m.Ip)
i = encodeVarint(dAtA, i, uint64(len(m.Ip)))
if len(m.Host) > 0 {
i -= len(m.Host)
copy(dAtA[i:], m.Host)
i = encodeVarint(dAtA, i, uint64(len(m.Host)))
i--
dAtA[i] = 0xa
}
Expand Down Expand Up @@ -8605,7 +8605,7 @@ func (m *Mirror_Target) SizeVT() (n int) {
}
var l int
_ = l
l = len(m.Ip)
l = len(m.Host)
if l > 0 {
n += 1 + l + sov(uint64(l))
}
Expand Down Expand Up @@ -16022,7 +16022,7 @@ func (m *Mirror_Target) UnmarshalVT(dAtA []byte) error {
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Ip", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field Host", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
Expand Down Expand Up @@ -16050,7 +16050,7 @@ func (m *Mirror_Target) UnmarshalVT(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Ip = string(dAtA[iNdEx:postIndex])
m.Host = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
Expand Down
4 changes: 2 additions & 2 deletions apis/proto/v1/payload/payload.proto
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,8 @@ message Mirror {

// Represent server information.
message Target {
// The target ip.
string ip = 1;
// The target hostname.
string host = 1;
// The target port.
uint32 port = 2;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"description": "Must be a valid serialized protocol buffer of the above specified type."
}
},
"description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }"
"description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }"
},
"runtimeError": {
"type": "object",
Expand All @@ -123,9 +123,9 @@
"v1MirrorTarget": {
"type": "object",
"properties": {
"ip": {
"host": {
"type": "string",
"description": "The target ip."
"description": "The target hostname."
},
"port": {
"type": "integer",
Expand Down
15 changes: 15 additions & 0 deletions charts/vald/values/multi-vald/dev-vald-01.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#
# 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.
#
discoverer:
clusterRoleBinding:
name: vald-01
Expand Down
15 changes: 15 additions & 0 deletions charts/vald/values/multi-vald/dev-vald-02.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#
# 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.
#
discoverer:
clusterRole:
enabled: false
Expand Down
15 changes: 15 additions & 0 deletions charts/vald/values/multi-vald/dev-vald-03.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#
# 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.
#
gateway:
mirror:
gateway_config:
Expand Down
15 changes: 15 additions & 0 deletions charts/vald/values/multi-vald/dev-vald-with-mirror.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#
# 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.
#
defaults:
image:
tag: pr-1949 # TODO: Delete it later.
Expand Down
8 changes: 2 additions & 6 deletions cmd/gateway/mirror/main.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
//
// Copyright (C) 2019-2022 vdaas.org vald team <vald@vdaas.org>
// 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
// 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 provides program main
package main

import (
Expand Down
4 changes: 2 additions & 2 deletions cmd/gateway/mirror/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2019-2022 vdaas.org vald team <vald@vdaas.org>
# 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.
Expand Down Expand Up @@ -143,6 +143,6 @@ gateway:
write_buffer_size: 0
tls:
enabled: false
ca: /path/to/ca
ca: /path/to/ca
cert: /path/to/cert
key: /path/to/key
3 changes: 1 addition & 2 deletions dockers/gateway/mirror/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (C) 2019-2022 vdaas.org vald team <vald@vdaas.org>
# 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.
Expand All @@ -13,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

ARG GO_VERSION=latest
ARG DISTROLESS_IMAGE=gcr.io/distroless/static
ARG DISTROLESS_IMAGE_TAG=nonroot
Expand Down
13 changes: 13 additions & 0 deletions internal/client/v1/client/mirror/mirror.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
// 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.
package mirror

import (
Expand Down
13 changes: 13 additions & 0 deletions internal/client/v1/client/mirror/option.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
// 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.
package mirror

import (
Expand Down
16 changes: 6 additions & 10 deletions internal/config/mirror.go
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
//
// Copyright (C) 2019-2022 vdaas.org vald team <vald@vdaas.org>
// 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
// 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 config providers configuration type and load configuration logic
package config

// Mirror represents the Mirror Gateway configuration.
type Mirror struct {
// Client represents the gRPC client configuration for connecting the LB Gateway.
Client *GRPCClient `json:"client" yaml:"client"`
Client *GRPCClient `json:"client" yaml:"client"`
// SelfMirrorAddr represents the address for the self Mirror Gateway.
SelfMirrorAddr string `json:"self_mirror_addr" yaml:"self_mirror_addr"`
SelfMirrorAddr string `json:"self_mirror_addr" yaml:"self_mirror_addr"`
// GatewayAddr represents the address for the Vald Gateway (e.g lb-gateway).
GatewayAddr string `json:"gateway_addr" yaml:"gateway_addr"`
GatewayAddr string `json:"gateway_addr" yaml:"gateway_addr"`
// PodName represents self Mirror Gateway Pod name.
PodName string `json:"pod_name" yaml:"pod_name"`
PodName string `json:"pod_name" yaml:"pod_name"`
// AdvertiseInterval represents interval to advertise Mirror Gateway information to other mirror gateway.
AdvertiseInterval string `json:"advertise_interval" yaml:"advertise_interval"`
}
Expand Down
8 changes: 2 additions & 6 deletions pkg/gateway/mirror/config/config.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
//
// Copyright (C) 2019-2022 vdaas.org vald team <vald@vdaas.org>
// 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
// 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 setting stores all server application settings
package config

import (
Expand Down
7 changes: 2 additions & 5 deletions pkg/gateway/mirror/handler/doc.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
//
// Copyright (C) 2019-2022 vdaas.org vald team <vald@vdaas.org>
// 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
// 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 handler
Loading

0 comments on commit 5af54b2

Please sign in to comment.