Skip to content
Open
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
3 changes: 3 additions & 0 deletions constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ const (
// ComponentTBot is the "tbot" binary
ComponentTBot = "tbot"

// ComponentTerraformProvider is the Teleport Terraform provider.
ComponentTerraformProvider = "terraform-provider"
Comment on lines +247 to +248

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Tag embedded operator clients with their bot kind

When the Kubernetes operator runs, integrations/operator/main.go:75,149-186 selects KindKubernetesOperator and gives the client returned by EmbeddedBot.StartAndWaitForClient to every reconciler, but integrations/lib/embeddedtbot/bot.go:214-220 still builds that client without a component user agent and this patch defines only the Terraform component. Consequently operator-originated resource changes remain attributed to the generic gRPC client instead of the Kubernetes operator, irreversibly corrupting the client-tool usage data this change is intended to collect. Define the operator component and select the user agent from b.cfg.Kind when building embedded-bot clients.

Useful? React with 👍 / 👎.


// ComponentKubeClient is the Kubernetes client.
ComponentKubeClient = "client:kube"

Expand Down
3 changes: 3 additions & 0 deletions integrations/terraform/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/grpclog"

"github.com/gravitational/teleport"
"github.com/gravitational/teleport/api/client"
"github.com/gravitational/teleport/api/constants"
"github.com/gravitational/teleport/api/metadata"
"github.com/gravitational/teleport/api/utils/retryutils"
"github.com/gravitational/teleport/lib/utils"
logutils "github.com/gravitational/teleport/lib/utils/log"
Expand Down Expand Up @@ -391,6 +393,7 @@ func (p *Provider) Configure(ctx context.Context, req tfsdk.ConfigureProviderReq
grpc.WithDefaultCallOptions(
grpc.WaitForReady(true),
),
metadata.WithUserAgentFromTeleportComponent(teleport.ComponentTerraformProvider),
},
InsecureAddressDiscovery: insecure,
}
Expand Down
7 changes: 6 additions & 1 deletion lib/web/sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,9 @@ func (c *SessionContext) newRemoteTLSClient(ctx context.Context, cluster reverse
apiclient.LoadTLS(tlsConfig),
},
CircuitBreakerConfig: breaker.NoopBreakerConfig(),
DialOpts: []grpc.DialOption{
metadata.WithUserAgentFromTeleportComponent(teleport.ComponentWeb),
},
})
}

Expand Down Expand Up @@ -1270,7 +1273,9 @@ func (s *sessionCache) newSessionContextFromSession(ctx context.Context, session
Credentials: []apiclient.Credentials{apiclient.LoadTLS(tlsConfig)},
CircuitBreakerConfig: breaker.NoopBreakerConfig(),
PROXYHeaderGetter: client.CreatePROXYHeaderGetter(ctx, s.proxySigner),
DialOpts: s.rootClientDialOptions,
DialOpts: append([]grpc.DialOption{
metadata.WithUserAgentFromTeleportComponent(teleport.ComponentWeb),
}, s.rootClientDialOptions...),
})
if err != nil {
return nil, trace.Wrap(err)
Expand Down
Loading