Skip to content

Commit 2bf09fe

Browse files
Update private-link CLI for latest protocol health-status protos (#811)
* Update private-link CLI for latest protocol health status protos * remove aws
1 parent cf644a5 commit 2bf09fe

File tree

4 files changed

+30
-18
lines changed

4 files changed

+30
-18
lines changed

cmd/lk/agent_private_link.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ var privateLinkCommands = &cli.Command{
1919
Name: "create",
2020
Usage: "Create a private link",
2121
Description: "Creates a private link to a customer endpoint.\n\n" +
22-
"Currently expects an AWS VPC Endpoint Service Name for --endpoint.\n" +
23-
"Example: com.amazonaws.vpce.us-east-1.vpce-svc-123123a1c43abc123",
22+
"Supports Azure Private Link Service aliases for --endpoint.\n" +
23+
"Azure example: my-pls.12345678-abcd-1234-abcd-1234567890ab.eastus.azure.privatelinkservice",
2424
Before: createAgentClient,
2525
Action: createPrivateLink,
2626
Flags: []cli.Flag{
@@ -105,15 +105,19 @@ func buildPrivateLinkListRows(links []*lkproto.PrivateLink, healthByID map[strin
105105

106106
status := lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_UNKNOWN.String()
107107
updatedAt := "-"
108+
reason := "-"
108109

109110
if err, ok := healthErrByID[link.PrivateLinkId]; ok && err != nil {
110111
status = "ERROR"
111-
updatedAt = err.Error()
112+
reason = err.Error()
112113
} else if health, ok := healthByID[link.PrivateLinkId]; ok && health != nil {
113114
status = health.Status.String()
114115
if health.UpdatedAt != nil {
115116
updatedAt = health.UpdatedAt.AsTime().UTC().Format("2006-01-02T15:04:05Z07:00")
116117
}
118+
if health.Reason != "" {
119+
reason = health.Reason
120+
}
117121
}
118122
dns := link.Endpoint
119123
if dns == "" {
@@ -128,6 +132,7 @@ func buildPrivateLinkListRows(links []*lkproto.PrivateLink, healthByID map[strin
128132
dns,
129133
status,
130134
updatedAt,
135+
reason,
131136
})
132137
}
133138
return rows
@@ -218,7 +223,7 @@ func listPrivateLinks(ctx context.Context, cmd *cli.Command) error {
218223
}
219224

220225
rows := buildPrivateLinkListRows(resp.Items, healthByID, healthErrByID)
221-
table := util.CreateTable().Headers("ID", "Name", "Region", "Port", "DNS", "Health", "Updated At").Rows(rows...)
226+
table := util.CreateTable().Headers("ID", "Name", "Region", "Port", "DNS", "Health", "Updated At", "Reason").Rows(rows...)
222227
fmt.Println(table)
223228
return nil
224229
}
@@ -259,9 +264,13 @@ func getPrivateLinkHealthStatus(ctx context.Context, cmd *cli.Command) error {
259264
if resp.Value.UpdatedAt != nil {
260265
updatedAt = resp.Value.UpdatedAt.AsTime().UTC().Format("2006-01-02T15:04:05Z07:00")
261266
}
267+
reason := "-"
268+
if resp.Value.Reason != "" {
269+
reason = resp.Value.Reason
270+
}
262271
table := util.CreateTable().
263-
Headers("ID", "Health", "Updated At").
264-
Row(privateLinkID, resp.Value.Status.String(), updatedAt)
272+
Headers("ID", "Health", "Updated At", "Reason").
273+
Row(privateLinkID, resp.Value.Status.String(), updatedAt, reason)
265274
fmt.Println(table)
266275
return nil
267276
}

cmd/lk/agent_private_link_test.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func TestBuildPrivateLinkListRows_OnePrivateLink(t *testing.T) {
7474
now := time.Now().UTC()
7575
healthByID := map[string]*lkproto.PrivateLinkStatus{
7676
"pl-1": {
77-
Status: lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_AVAILABLE,
77+
Status: lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_HEALTHY,
7878
UpdatedAt: timestamppb.New(now),
7979
},
8080
}
@@ -86,7 +86,8 @@ func TestBuildPrivateLinkListRows_OnePrivateLink(t *testing.T) {
8686
assert.Equal(t, "us-east-1", rows[0][2])
8787
assert.Equal(t, "6379", rows[0][3])
8888
assert.Equal(t, "orders-db-p123.link", rows[0][4])
89-
assert.Equal(t, lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_AVAILABLE.String(), rows[0][5])
89+
assert.Equal(t, lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_HEALTHY.String(), rows[0][5])
90+
assert.Equal(t, "-", rows[0][7])
9091
}
9192

9293
func TestBuildPrivateLinkListRows_TwoPrivateLinksDifferentRegions(t *testing.T) {
@@ -109,10 +110,10 @@ func TestBuildPrivateLinkListRows_TwoPrivateLinksDifferentRegions(t *testing.T)
109110

110111
healthByID := map[string]*lkproto.PrivateLinkStatus{
111112
"pl-1": {
112-
Status: lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_AVAILABLE,
113+
Status: lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_HEALTHY,
113114
},
114115
"pl-2": {
115-
Status: lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_AVAILABLE,
116+
Status: lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_HEALTHY,
116117
},
117118
}
118119

@@ -123,6 +124,8 @@ func TestBuildPrivateLinkListRows_TwoPrivateLinksDifferentRegions(t *testing.T)
123124
assert.Equal(t, "eu-west-1", rows[1][2])
124125
assert.Equal(t, "orders-db-p123.link", rows[0][4])
125126
assert.Equal(t, "cache-p123.link", rows[1][4])
126-
assert.Equal(t, lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_AVAILABLE.String(), rows[0][5])
127-
assert.Equal(t, lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_AVAILABLE.String(), rows[1][5])
127+
assert.Equal(t, lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_HEALTHY.String(), rows[0][5])
128+
assert.Equal(t, lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_HEALTHY.String(), rows[1][5])
129+
assert.Equal(t, "-", rows[0][7])
130+
assert.Equal(t, "-", rows[1][7])
128131
}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/go-logr/logr v1.4.3
1313
github.com/go-task/task/v3 v3.44.1
1414
github.com/joho/godotenv v1.5.1
15-
github.com/livekit/protocol v1.45.2-0.20260325065350-7558ba4c26d3
15+
github.com/livekit/protocol v1.45.2-0.20260403195737-756a0a7cb7b9
1616
github.com/livekit/server-sdk-go/v2 v2.16.1
1717
github.com/mattn/go-isatty v0.0.20
1818
github.com/moby/patternmatcher v0.6.0
@@ -90,7 +90,7 @@ require (
9090
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
9191
github.com/go-git/go-billy/v5 v5.6.2 // indirect
9292
github.com/go-git/go-git/v5 v5.16.2 // indirect
93-
github.com/go-jose/go-jose/v3 v3.0.4 // indirect
93+
github.com/go-jose/go-jose/v3 v3.0.5 // indirect
9494
github.com/go-logr/stdr v1.2.2 // indirect
9595
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
9696
github.com/go-task/template v0.2.0 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMj
194194
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
195195
github.com/go-git/go-git/v5 v5.16.2 h1:fT6ZIOjE5iEnkzKyxTHK1W4HGAsPhqEqiSAssSO77hM=
196196
github.com/go-git/go-git/v5 v5.16.2/go.mod h1:4Ge4alE/5gPs30F2H1esi2gPd69R0C39lolkucHBOp8=
197-
github.com/go-jose/go-jose/v3 v3.0.4 h1:Wp5HA7bLQcKnf6YYao/4kpRpVMp/yf6+pJKV8WFSaNY=
198-
github.com/go-jose/go-jose/v3 v3.0.4/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
197+
github.com/go-jose/go-jose/v3 v3.0.5 h1:BLLJWbC4nMZOfuPVxoZIxeYsn6Nl2r1fITaJ78UQlVQ=
198+
github.com/go-jose/go-jose/v3 v3.0.5/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
199199
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
200200
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
201201
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
@@ -273,8 +273,8 @@ github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731 h1:9x+U2HGLrSw5AT
273273
github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ=
274274
github.com/livekit/mediatransportutil v0.0.0-20260309115634-0e2e24b36ee8 h1:coWig9fKxdb/nwOaIoGUUAogso12GblAJh/9SA9hcxk=
275275
github.com/livekit/mediatransportutil v0.0.0-20260309115634-0e2e24b36ee8/go.mod h1:RCd46PT+6sEztld6XpkCrG1xskb0u3SqxIjy4G897Ss=
276-
github.com/livekit/protocol v1.45.2-0.20260325065350-7558ba4c26d3 h1:wmg/PTPHbIXpKoQvoLcqdJS0K8KpKGf34Xe+YPOPTm8=
277-
github.com/livekit/protocol v1.45.2-0.20260325065350-7558ba4c26d3/go.mod h1:63AUi0vQak6Y6gPqSBHLc+ExYTUwEqF/m4b2IRW1iO0=
276+
github.com/livekit/protocol v1.45.2-0.20260403195737-756a0a7cb7b9 h1:dAOkOEzuSbsc0hb/m1z/2MfDo+OJA6hMqqjF8ehCD6I=
277+
github.com/livekit/protocol v1.45.2-0.20260403195737-756a0a7cb7b9/go.mod h1:e6QdWDkfot+M2nRh0eitJUS0ZLuwvKCsfiz2pWWSG3s=
278278
github.com/livekit/psrpc v0.7.1 h1:ms37az0QTD3UXIWuUC5D/SkmKOlRMVRsI261eBWu/Vw=
279279
github.com/livekit/psrpc v0.7.1/go.mod h1:bZ4iHFQptTkbPnB0LasvRNu/OBYXEu1NA6O5BMFo9kk=
280280
github.com/livekit/server-sdk-go/v2 v2.16.1 h1:ZkIA9OdVvQ6Up1uW/RtQ0YJUgYMJ6+ywOmDg0jX7bTg=

0 commit comments

Comments
 (0)