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

[targets] Rename targets.endpoints to targets.endpoint #646

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/content/docs/how-to/targets/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ probe {
type: HTTP
...
targets {
endpoints {
endpoint {
# This will probe https://web.example.com/url1, target will show up as
# "frontend_main" in metrics.
name: "frontend_main"
url: "https://web.example.com/url1"
}
endpoints {
endpoint {
# This will probe http://cms.example.com, target will show up as
# "cms.example.com" in metrics.
name: "cms.example.com"
Expand Down
2 changes: 1 addition & 1 deletion examples/include/cloudprober.d/team2.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ probe {
name: "probe_team2"
type: TCP
targets {
endpoints {
endpoint {
name: "fix1.vendor.com"
port: 4321
}
Expand Down
87 changes: 43 additions & 44 deletions targets/proto/targets.pb.go

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

6 changes: 3 additions & 3 deletions targets/proto/targets.proto
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ message TargetsDef {
// Static endpoints. These endpoints are merged with the resources returned
// by the targets type above.
// Example:
// endpoints {
// endpoint {
// name: "service-gtwy-1"
// ip: "10.1.18.121"
// port: 8080
Expand All @@ -173,11 +173,11 @@ message TargetsDef {
// value: "products-service"
// }
// }
// endpoints {
// endpoint {
// name: "frontend-url1"
// url: "https://frontend.example.com/url1"
// }
repeated Endpoint endpoints = 23;
repeated Endpoint endpoint = 23;

// Regex to apply on the targets.
optional string regex = 21;
Expand Down
6 changes: 3 additions & 3 deletions targets/proto/targets_proto_gen.cue
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ import (
// Static endpoints. These endpoints are merged with the resources returned
// by the targets type above.
// Example:
// endpoints {
// endpoint {
// name: "service-gtwy-1"
// ip: "10.1.18.121"
// port: 8080
Expand All @@ -173,11 +173,11 @@ import (
// value: "products-service"
// }
// }
// endpoints {
// endpoint {
// name: "frontend-url1"
// url: "https://frontend.example.com/url1"
// }
endpoints?: [...#Endpoint] @protobuf(23,Endpoint)
endpoint?: [...#Endpoint] @protobuf(23,Endpoint)

// Regex to apply on the targets.
regex?: string @protobuf(21,string)
Expand Down
2 changes: 1 addition & 1 deletion targets/targets.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func baseTargets(targetsDef *targetspb.TargetsDef, ldLister endpoint.Lister, l *
ldLister: ldLister,
}

eps, err := endpoint.FromProtoMessage(targetsDef.GetEndpoints())
eps, err := endpoint.FromProtoMessage(targetsDef.GetEndpoint())
if err != nil {
return nil, fmt.Errorf("targets.baseTargets(): error creating static endpoints from proto: %v", err)
}
Expand Down
6 changes: 3 additions & 3 deletions targets/targets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func TestList(t *testing.T) {
Regex: proto.String(tt.re),
}
for _, ep := range staticHosts {
targetsDef.Endpoints = append(targetsDef.Endpoints, &targetspb.Endpoint{
targetsDef.Endpoint = append(targetsDef.Endpoint, &targetspb.Endpoint{
Name: proto.String(ep),
})
}
Expand Down Expand Up @@ -302,7 +302,7 @@ func TestNew(t *testing.T) {
{
name: "static endpoints",
targetsDef: &targetspb.TargetsDef{
Endpoints: []*targetspb.Endpoint{
Endpoint: []*targetspb.Endpoint{
{
Name: proto.String("host1"),
},
Expand All @@ -316,7 +316,7 @@ func TestNew(t *testing.T) {
Type: &targetspb.TargetsDef_HostNames{
HostNames: "host2,host3",
},
Endpoints: []*targetspb.Endpoint{
Endpoint: []*targetspb.Endpoint{
{
Name: proto.String("host1"),
},
Expand Down