Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions cmd/lk/agent_private_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ var privateLinkCommands = &cli.Command{
Usage: "Manage private links for agents",
Commands: []*cli.Command{
{
Name: "create",
Usage: "Create a private link",
Name: "create",
Usage: "Create a private link",
Description: "Creates a private link to a customer endpoint.\n\n" +
"Currently expects an AWS VPC Endpoint Service Name for --endpoint.\n" +
"Example: com.amazonaws.vpce.us-east-1.vpce-svc-123123a1c43abc123",
Expand Down Expand Up @@ -104,14 +104,14 @@ func privateLinkServiceDNS(name, projectID string) string {
return fmt.Sprintf("%s-%s.plg.svc", name, projectID)
}

func buildPrivateLinkListRows(links []*lkproto.PrivateLink, healthByID map[string]*lkproto.PrivateLinkHealthStatus, healthErrByID map[string]error) [][]string {
func buildPrivateLinkListRows(links []*lkproto.PrivateLink, healthByID map[string]*lkproto.PrivateLinkStatus, healthErrByID map[string]error) [][]string {
var rows [][]string
for _, link := range links {
if link == nil {
continue
}

status := lkproto.PrivateLinkHealthStatus_PRIVATE_LINK_ATTACHMENT_HEALTH_STATUS_UNKNOWN.String()
status := lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_UNKNOWN.String()
updatedAt := "-"

if err, ok := healthErrByID[link.PrivateLinkId]; ok && err != nil {
Expand Down Expand Up @@ -173,13 +173,13 @@ func listPrivateLinks(ctx context.Context, cmd *cli.Command) error {
return formatPrivateLinkClientError("list", err)
}

healthByID := make(map[string]*lkproto.PrivateLinkHealthStatus, len(resp.Items))
healthByID := make(map[string]*lkproto.PrivateLinkStatus, len(resp.Items))
healthErrByID := make(map[string]error)
for _, link := range resp.Items {
if link == nil || link.PrivateLinkId == "" {
continue
}
health, healthErr := agentsClient.GetPrivateLinkHealthStatus(ctx, &lkproto.GetPrivateLinkHealthStatusRequest{
health, healthErr := agentsClient.GetPrivateLinkStatus(ctx, &lkproto.GetPrivateLinkStatusRequest{
PrivateLinkId: link.PrivateLinkId,
})
if healthErr != nil {
Expand All @@ -193,9 +193,9 @@ func listPrivateLinks(ctx context.Context, cmd *cli.Command) error {

if cmd.Bool("json") {
type privateLinkWithHealth struct {
PrivateLink *lkproto.PrivateLink `json:"private_link"`
Health *lkproto.PrivateLinkHealthStatus `json:"health"`
HealthError string `json:"health_error,omitempty"`
PrivateLink *lkproto.PrivateLink `json:"private_link"`
Status *lkproto.PrivateLinkStatus `json:"health"`
HealthError string `json:"health_error,omitempty"`
}
items := make([]privateLinkWithHealth, 0, len(resp.Items))
for _, link := range resp.Items {
Expand All @@ -204,7 +204,7 @@ func listPrivateLinks(ctx context.Context, cmd *cli.Command) error {
}
entry := privateLinkWithHealth{
PrivateLink: link,
Health: healthByID[link.PrivateLinkId],
Status: healthByID[link.PrivateLinkId],
}
if err := healthErrByID[link.PrivateLinkId]; err != nil {
entry.HealthError = err.Error()
Expand Down Expand Up @@ -245,7 +245,7 @@ func deletePrivateLink(ctx context.Context, cmd *cli.Command) error {

func getPrivateLinkHealthStatus(ctx context.Context, cmd *cli.Command) error {
privateLinkID := cmd.String("id")
resp, err := agentsClient.GetPrivateLinkHealthStatus(ctx, &lkproto.GetPrivateLinkHealthStatusRequest{
resp, err := agentsClient.GetPrivateLinkStatus(ctx, &lkproto.GetPrivateLinkStatusRequest{
PrivateLinkId: privateLinkID,
})
if err != nil {
Expand Down
22 changes: 10 additions & 12 deletions cmd/lk/agent_private_link_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"testing"
"time"

lkproto "github.com/livekit/protocol/livekit"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
lkproto "github.com/livekit/protocol/livekit"
"github.com/urfave/cli/v3"
"google.golang.org/protobuf/types/known/timestamppb"
)
Expand Down Expand Up @@ -62,7 +62,7 @@ func TestPrivateLinkServiceDNS(t *testing.T) {
}

func TestBuildPrivateLinkListRows_EmptyList(t *testing.T) {
rows := buildPrivateLinkListRows([]*lkproto.PrivateLink{}, map[string]*lkproto.PrivateLinkHealthStatus{}, map[string]error{})
rows := buildPrivateLinkListRows([]*lkproto.PrivateLink{}, map[string]*lkproto.PrivateLinkStatus{}, map[string]error{})
assert.Empty(t, rows)
}

Expand All @@ -77,9 +77,9 @@ func TestBuildPrivateLinkListRows_OnePrivateLink(t *testing.T) {
}

now := time.Now().UTC()
healthByID := map[string]*lkproto.PrivateLinkHealthStatus{
healthByID := map[string]*lkproto.PrivateLinkStatus{
"pl-1": {
Status: lkproto.PrivateLinkHealthStatus_PRIVATE_LINK_ATTACHMENT_HEALTH_STATUS_HEALTHY,
Status: lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_AVAILABLE,
UpdatedAt: timestamppb.New(now),
},
}
Expand All @@ -90,7 +90,7 @@ func TestBuildPrivateLinkListRows_OnePrivateLink(t *testing.T) {
assert.Equal(t, "orders-db", rows[0][1])
assert.Equal(t, "us-east-1", rows[0][2])
assert.Equal(t, "6379", rows[0][3])
assert.Equal(t, lkproto.PrivateLinkHealthStatus_PRIVATE_LINK_ATTACHMENT_HEALTH_STATUS_HEALTHY.String(), rows[0][4])
assert.Equal(t, lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_AVAILABLE.String(), rows[0][4])
}

func TestBuildPrivateLinkListRows_TwoPrivateLinksDifferentRegions(t *testing.T) {
Expand All @@ -109,12 +109,12 @@ func TestBuildPrivateLinkListRows_TwoPrivateLinksDifferentRegions(t *testing.T)
},
}

healthByID := map[string]*lkproto.PrivateLinkHealthStatus{
healthByID := map[string]*lkproto.PrivateLinkStatus{
"pl-1": {
Status: lkproto.PrivateLinkHealthStatus_PRIVATE_LINK_ATTACHMENT_HEALTH_STATUS_HEALTHY,
Status: lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_AVAILABLE,
},
"pl-2": {
Status: lkproto.PrivateLinkHealthStatus_PRIVATE_LINK_ATTACHMENT_HEALTH_STATUS_UNHEALTHY,
Status: lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_AVAILABLE,
},
}

Expand All @@ -123,8 +123,6 @@ func TestBuildPrivateLinkListRows_TwoPrivateLinksDifferentRegions(t *testing.T)

assert.Equal(t, "us-east-1", rows[0][2])
assert.Equal(t, "eu-west-1", rows[1][2])
assert.Equal(t, lkproto.PrivateLinkHealthStatus_PRIVATE_LINK_ATTACHMENT_HEALTH_STATUS_HEALTHY.String(), rows[0][4])
assert.Equal(t, lkproto.PrivateLinkHealthStatus_PRIVATE_LINK_ATTACHMENT_HEALTH_STATUS_UNHEALTHY.String(), rows[1][4])
assert.Equal(t, lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_AVAILABLE.String(), rows[0][4])
assert.Equal(t, lkproto.PrivateLinkStatus_PRIVATE_LINK_STATUS_AVAILABLE.String(), rows[1][4])
}


57 changes: 28 additions & 29 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ require (
github.com/go-logr/logr v1.4.3
github.com/go-task/task/v3 v3.44.1
github.com/joho/godotenv v1.5.1
github.com/livekit/protocol v1.44.1-0.20260212060033-b3d04db215ef
github.com/livekit/server-sdk-go/v2 v2.13.4-0.20260212013907-8b9f855080d8
github.com/livekit/protocol v1.44.1-0.20260223200831-a71190b6850a
github.com/livekit/server-sdk-go/v2 v2.13.4-0.20260223172816-77b4264bca63
github.com/moby/patternmatcher v0.6.0
github.com/pelletier/go-toml v1.9.5
github.com/pion/rtcp v1.2.16
github.com/pion/rtp v1.10.0
github.com/pion/webrtc/v4 v4.2.3
github.com/pion/rtp v1.10.1
github.com/pion/webrtc/v4 v4.2.6
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.11.1
Expand All @@ -33,8 +33,8 @@ require (
)

require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20251209175733-2a1774d88802.1 // indirect
buf.build/go/protovalidate v1.1.0 // indirect
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260209202127-80ab13bee0bf.1 // indirect
buf.build/go/protovalidate v1.1.2 // indirect
buf.build/go/protoyaml v0.6.0 // indirect
cel.dev/expr v0.25.1 // indirect
dario.cat/mergo v1.0.2 // indirect
Expand Down Expand Up @@ -84,7 +84,7 @@ require (
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/gammazero/deque v1.2.0 // indirect
github.com/gammazero/deque v1.2.1 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.6.2 // indirect
github.com/go-git/go-git/v5 v5.16.2 // indirect
Expand All @@ -96,7 +96,7 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/cel-go v0.26.1 // indirect
github.com/google/cel-go v0.27.0 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.6.0 // indirect
Expand All @@ -108,7 +108,7 @@ require (
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jxskiss/base62 v1.1.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.18.3 // indirect
github.com/klauspost/compress v1.18.4 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/lithammer/shortuuid/v4 v4.2.0 // indirect
github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731 // indirect
Expand All @@ -130,14 +130,14 @@ require (
github.com/muesli/termenv v0.16.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nats-io/nats.go v1.48.0 // indirect
github.com/nats-io/nkeys v0.4.12 // indirect
github.com/nats-io/nkeys v0.4.15 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/pion/datachannel v1.6.0 // indirect
github.com/pion/dtls/v3 v3.0.10 // indirect
github.com/pion/dtls/v3 v3.1.2 // indirect
github.com/pion/ice/v4 v4.2.0 // indirect
github.com/pion/interceptor v0.1.43 // indirect
github.com/pion/interceptor v0.1.44 // indirect
github.com/pion/logging v0.2.4 // indirect
github.com/pion/mdns/v2 v2.1.0 // indirect
github.com/pion/randutil v0.1.0 // indirect
Expand All @@ -153,7 +153,7 @@ require (
github.com/prometheus/client_golang v1.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.66.1 // indirect
github.com/prometheus/procfs v0.16.1 // indirect
github.com/prometheus/procfs v0.19.2 // indirect
github.com/puzpuzpuz/xsync/v3 v3.5.1 // indirect
github.com/redis/go-redis/v9 v9.17.2 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
Expand All @@ -163,7 +163,6 @@ require (
github.com/shibumi/go-pathspec v1.3.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/skeema/knownhosts v1.3.1 // indirect
github.com/stoewer/go-strcase v1.3.1 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/tonistiigi/fsutil v0.0.0-20250605211040-586307ad452f // indirect
github.com/tonistiigi/go-csvvalue v0.0.0-20240814133006-030d3b2625d0 // indirect
Expand All @@ -173,31 +172,31 @@ require (
github.com/x448/float16 v0.8.4 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
github.com/zeebo/xxh3 v1.1.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.61.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
go.opentelemetry.io/otel v1.39.0 // indirect
go.opentelemetry.io/otel v1.40.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0 // indirect
go.opentelemetry.io/otel/metric v1.39.0 // indirect
go.opentelemetry.io/otel/metric v1.40.0 // indirect
go.opentelemetry.io/otel/sdk v1.39.0 // indirect
go.opentelemetry.io/otel/trace v1.39.0 // indirect
go.opentelemetry.io/otel/trace v1.40.0 // indirect
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.1 // indirect
go.uber.org/zap/exp v0.3.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
golang.org/x/crypto v0.47.0 // indirect
golang.org/x/exp v0.0.0-20260112195511-716be5621a96 // indirect
golang.org/x/mod v0.32.0 // indirect
golang.org/x/net v0.49.0 // indirect
golang.org/x/sys v0.40.0 // indirect
golang.org/x/term v0.39.0 // indirect
golang.org/x/text v0.33.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260114163908-3f89685c29c3 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260114163908-3f89685c29c3 // indirect
google.golang.org/grpc v1.78.0 // indirect
golang.org/x/crypto v0.48.0 // indirect
golang.org/x/exp v0.0.0-20260212183809-81e46e3db34a // indirect
golang.org/x/mod v0.33.0 // indirect
golang.org/x/net v0.50.0 // indirect
golang.org/x/sys v0.41.0 // indirect
golang.org/x/term v0.40.0 // indirect
golang.org/x/text v0.34.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57 // indirect
google.golang.org/grpc v1.79.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
mvdan.cc/sh/v3 v3.12.0 // indirect
Expand Down
Loading