Skip to content

Commit

Permalink
[web] update user participants for k8s non-interactive in recorded se…
Browse files Browse the repository at this point in the history
…ssions (#49345)
  • Loading branch information
stevenGravy authored Nov 22, 2024
1 parent 353dda0 commit 3f2231e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function makeDesktopRecording({

function makeSshOrKubeRecording({
participants,
user,
time,
session_start,
session_stop,
Expand All @@ -80,9 +81,13 @@ function makeSshOrKubeRecording({
);

let hostname = server_hostname || 'N/A';
// SSH interactive/non-interactive and k8s interactive sessions user participants are in the participants field.
let userParticipants = participants;
// For Kubernetes sessions, put the full pod name as 'hostname'.
if (proto === 'kube') {
hostname = `${kubernetes_cluster}/${kubernetes_pod_namespace}/${kubernetes_pod_name}`;
// For non-interactive k8s sessions the participant is the Teleport user running the command
if (!interactive) userParticipants = [user];
}

// Description set to play for interactive so users can search by "play".
Expand All @@ -97,7 +102,7 @@ function makeSshOrKubeRecording({
durationText,
sid,
createdDate: time,
users: participants ? participants.join(', ') : [],
users: userParticipants ? userParticipants.join(', ') : [],
hostname,
description,
recordingType: kubernetes_cluster ? 'k8s' : 'ssh',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ test('fetch session recordings, response formatting', async () => {
playable: false,
recordingType: 'k8s',
sid: '456b933c-4ec4-59f1-862c-90ca9f7648b1',
users: [],
users: '[email protected]',
},
],
startKey: '',
Expand Down

0 comments on commit 3f2231e

Please sign in to comment.