Skip to content

Commit

Permalink
[targets] Rename targets.endpoints to targets.endpoint (#646)
Browse files Browse the repository at this point in the history
  • Loading branch information
manugarg committed Dec 15, 2023
1 parent 186e432 commit 4b53de0
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 57 deletions.
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

0 comments on commit 4b53de0

Please sign in to comment.