Skip to content

Commit

Permalink
[admin] More runtime info: podName and nodeIp (#3197)
Browse files Browse the repository at this point in the history
* [admin] Render additional workspace properties

* [protocol] add instance.status.podName

* [protocol] Introduce instance.status.nodeIp
  • Loading branch information
geropl authored Feb 23, 2021
1 parent 9ae4251 commit 9be229e
Show file tree
Hide file tree
Showing 36 changed files with 304 additions and 189 deletions.
5 changes: 3 additions & 2 deletions components/dashboard/ee/src/admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ import { HashRouter } from "react-router-dom";
import { Link, Typography } from "@material-ui/core";
import { UserView, AdditionalUserPropertiesRenderer } from "./components/admin/user-view";
import { GitpodHostUrl } from "@gitpod/gitpod-protocol/lib/util/gitpod-host-url";
import { WorkspaceView } from "./components/admin/workspace-view";
import { WorkspaceView, AdditionalWorkspacePropertiesRenderer } from "./components/admin/workspace-view";
import { renderEntrypoint } from "../../src/entrypoint";

export interface AdminIndexProps {
renderAdditionalUserProperties?: AdditionalUserPropertiesRenderer;
renderAdditionalWorkspaceProperties?: AdditionalWorkspacePropertiesRenderer;
}

export const AdminIndex: React.SFC<AdminIndexProps | undefined> = (_props: AdminIndexProps) => {
Expand All @@ -48,7 +49,7 @@ export const AdminIndex: React.SFC<AdminIndexProps | undefined> = (_props: Admin
<Route path="/users"><UsersAdmin service={service} /></Route>
<Route path="/user/:id" render={rp => <UserView userID={rp.match.params.id} service={service} renderAdditionalUserProperties={props.renderAdditionalUserProperties}/>} />
<Route path="/workspaces"><WorkspacesAdmin service={service} /></Route>
<Route path="/workspace/:id" render={rp => <WorkspaceView workspaceID={rp.match.params.id} service={service} />} />
<Route path="/workspace/:id" render={rp => <WorkspaceView workspaceID={rp.match.params.id} service={service} renderAdditionalWorkspaceProperties={props.renderAdditionalWorkspaceProperties} />} />
<Route path="/"><UsersAdmin service={service} /></Route>
</Switch>
</HashRouter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import { ErrorCodes } from '@gitpod/gitpod-protocol/lib/messaging/error';
export interface WorkspaceViewProps {
service: GitpodService;
workspaceID: string;

renderAdditionalWorkspaceProperties?: AdditionalWorkspacePropertiesRenderer;
}
export type AdditionalWorkspacePropertiesRenderer = (service: GitpodService, workspace: WorkspaceAndInstance | undefined) => JSX.Element;

interface WorkspaceViewState {
workspace?: WorkspaceAndInstance;
Expand Down Expand Up @@ -110,6 +113,9 @@ export class WorkspaceView extends React.Component<WorkspaceViewProps, Workspace
<TableCell>{!!fields[f].render ? fields[f].render(workspace) : workspace[f]}</TableCell>
<TableCell style={{textAlign: "right"}}>{fields[f].actions && fields[f].actions(workspace)}</TableCell>
</TableRow>) }
{
this.props.renderAdditionalWorkspaceProperties && this.props.renderAdditionalWorkspaceProperties(this.props.service, workspace)
}
</Table>
}
</React.Fragment>
Expand Down
6 changes: 6 additions & 0 deletions components/gitpod-protocol/src/workspace-instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ export interface WorkspaceInstanceStatus {
// nodeName is the name of the node the instance was scheduled onto
nodeName?: string;

// podName is the name of the pod of this instance
podName?: string;

// nodeIp is the IP of the node the workspace is running on
nodeIp?: string;

// ownerToken is the token one needs to access the workspace. Its presence is checked by ws-proxy.
ownerToken?: string;
}
Expand Down
4 changes: 4 additions & 0 deletions components/ws-manager-api/core.proto
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,10 @@ message WorkspaceMetadata {
message WorkspaceRuntimeInfo {
// node_name is the name of the node the workspace runs on
string node_name = 1;
// pod_name is the name of the pod the workspace runs in
string pod_name = 2;
// node_ip is the IP of the node the workspace runs on
string node_ip = 3;
}

// WorkspaceAuthentication contains authentication information used by ws-proxy to allow/deny access to
Expand Down
283 changes: 149 additions & 134 deletions components/ws-manager-api/go/core.pb.go

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions components/ws-manager-api/go/mock/mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions components/ws-manager-api/typescript/src/core_grpc_pb.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
* Licensed under the GNU Affero General Public License (AGPL).
* See License-AGPL.txt in the project root for license information.
*/

// package: wsman
// file: core.proto

Expand Down
6 changes: 0 additions & 6 deletions components/ws-manager-api/typescript/src/core_grpc_pb.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
* Licensed under the GNU Affero General Public License (AGPL).
* See License-AGPL.txt in the project root for license information.
*/

// GENERATED CODE -- DO NOT EDIT!

'use strict';
Expand Down
14 changes: 8 additions & 6 deletions components/ws-manager-api/typescript/src/core_pb.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
* Licensed under the GNU Affero General Public License (AGPL).
* See License-AGPL.txt in the project root for license information.
*/

// package: wsman
// file: core.proto

Expand Down Expand Up @@ -735,6 +729,12 @@ export class WorkspaceRuntimeInfo extends jspb.Message {
getNodeName(): string;
setNodeName(value: string): WorkspaceRuntimeInfo;

getPodName(): string;
setPodName(value: string): WorkspaceRuntimeInfo;

getNodeIp(): string;
setNodeIp(value: string): WorkspaceRuntimeInfo;


serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): WorkspaceRuntimeInfo.AsObject;
Expand All @@ -749,6 +749,8 @@ export class WorkspaceRuntimeInfo extends jspb.Message {
export namespace WorkspaceRuntimeInfo {
export type AsObject = {
nodeName: string,
podName: string,
nodeIp: string,
}
}

Expand Down
62 changes: 55 additions & 7 deletions components/ws-manager-api/typescript/src/core_pb.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
* Licensed under the GNU Affero General Public License (AGPL).
* See License-AGPL.txt in the project root for license information.
*/

/**
* @fileoverview
* @enhanceable
Expand Down Expand Up @@ -5138,7 +5132,9 @@ proto.wsman.WorkspaceRuntimeInfo.prototype.toObject = function(opt_includeInstan
*/
proto.wsman.WorkspaceRuntimeInfo.toObject = function(includeInstance, msg) {
var f, obj = {
nodeName: jspb.Message.getFieldWithDefault(msg, 1, "")
nodeName: jspb.Message.getFieldWithDefault(msg, 1, ""),
podName: jspb.Message.getFieldWithDefault(msg, 2, ""),
nodeIp: jspb.Message.getFieldWithDefault(msg, 3, "")
};

if (includeInstance) {
Expand Down Expand Up @@ -5179,6 +5175,14 @@ proto.wsman.WorkspaceRuntimeInfo.deserializeBinaryFromReader = function(msg, rea
var value = /** @type {string} */ (reader.readString());
msg.setNodeName(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setPodName(value);
break;
case 3:
var value = /** @type {string} */ (reader.readString());
msg.setNodeIp(value);
break;
default:
reader.skipField();
break;
Expand Down Expand Up @@ -5215,6 +5219,20 @@ proto.wsman.WorkspaceRuntimeInfo.serializeBinaryToWriter = function(message, wri
f
);
}
f = message.getPodName();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
f = message.getNodeIp();
if (f.length > 0) {
writer.writeString(
3,
f
);
}
};


Expand All @@ -5233,6 +5251,36 @@ proto.wsman.WorkspaceRuntimeInfo.prototype.setNodeName = function(value) {
};


/**
* optional string pod_name = 2;
* @return {string}
*/
proto.wsman.WorkspaceRuntimeInfo.prototype.getPodName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};


/** @param {string} value */
proto.wsman.WorkspaceRuntimeInfo.prototype.setPodName = function(value) {
jspb.Message.setProto3StringField(this, 2, value);
};


/**
* optional string node_ip = 3;
* @return {string}
*/
proto.wsman.WorkspaceRuntimeInfo.prototype.getNodeIp = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};


/** @param {string} value */
proto.wsman.WorkspaceRuntimeInfo.prototype.setNodeIp = function(value) {
jspb.Message.setProto3StringField(this, 3, value);
};





Expand Down
4 changes: 3 additions & 1 deletion components/ws-manager-bridge/src/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ export class WorkspaceManagerBridge implements Disposable {
instance.status.conditions.timeout = status.conditions.timeout;
instance.status.conditions.firstUserActivity = mapFirstUserActivity(rawStatus.getConditions()!.getFirstUserActivity());
instance.status.message = status.message;
instance.status.nodeName = instance.status.nodeName || (status.runtime || {}).nodeName;
instance.status.nodeName = instance.status.nodeName || status.runtime?.nodeName;
instance.status.podName = instance.status.podName || status.runtime?.podName;
instance.status.nodeIp = instance.status.nodeIp || status.runtime?.nodeIp;
instance.status.ownerToken = status.auth!.ownerToken;

if (status.repo) {
Expand Down
4 changes: 4 additions & 0 deletions components/ws-manager/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
<<<<<<< HEAD
=======
github.com/fatih/gomodifytags v1.12.0/go.mod h1:TbUyEjH1Zo0GkJd2Q52oVYqYcJ0eGNqG8bsiOb75P9c=
>>>>>>> 546870a ([protocol] add instance.status.podName)
github.com/fatih/gomodifytags v1.13.0/go.mod h1:TbUyEjH1Zo0GkJd2Q52oVYqYcJ0eGNqG8bsiOb75P9c=
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
Expand Down
2 changes: 2 additions & 0 deletions components/ws-manager/pkg/manager/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ func (m *Manager) getWorkspaceStatus(wso workspaceObjects) (*api.WorkspaceStatus
},
Runtime: &api.WorkspaceRuntimeInfo{
NodeName: wso.Pod.Spec.NodeName,
PodName: wso.Pod.Name,
NodeIp: wso.Pod.Status.HostIP,
},
Auth: &api.WorkspaceAuthentication{
Admission: admission,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
"deployed": 1
},
"runtime": {
"node_name": "gke-staging--gitpod--workspace-pool-1-f122a8ea-bb2l"
"node_name": "gke-staging--gitpod--workspace-pool-1-f122a8ea-bb2l",
"pod_name": "ws-d6835d33-116f-4d3f-aeb6-ad628f4004b6",
"node_ip": "10.132.15.200"
},
"auth": {
"admission": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"deployed": 1
},
"runtime": {
"node_name": "gke-gitpod-dev-default-pool-b25aa276-3tl2"
"node_name": "gke-gitpod-dev-default-pool-b25aa276-3tl2",
"pod_name": "ws-fb291b69-7bbc-4865-a432-33f558f20091"
},
"auth": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"deployed": 1
},
"runtime": {
"node_name": "gke-gitpod-dev-worker-pool-2-184c607e-wl2d"
"node_name": "gke-gitpod-dev-worker-pool-2-184c607e-wl2d",
"pod_name": "ws-f9d04251-f057-4287-b7b1-956093140c5d",
"node_ip": "10.132.15.195"
},
"auth": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"deployed": 1
},
"runtime": {
"node_name": "gke-gitpod-dev-worker-pool-1-f039fa9e-2jrb"
"node_name": "gke-gitpod-dev-worker-pool-1-f039fa9e-2jrb",
"pod_name": "ws-79be1e8b-a6de-4572-8627-99ef12303a88",
"node_ip": "10.132.0.25"
},
"auth": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"deployed": 1
},
"runtime": {
"node_name": "gke-gitpod-dev-worker-pool-2-184c607e-fltt"
"node_name": "gke-gitpod-dev-worker-pool-2-184c607e-fltt",
"pod_name": "ws-4f8ea7b8-b87d-42f2-b8dd-1a32fdbdf0d4",
"node_ip": "10.132.0.42"
},
"auth": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
"deployed": 1
},
"runtime": {
"node_name": "gke-dev-workload-7fd27879-kn1v"
"node_name": "gke-dev-workload-7fd27879-kn1v",
"pod_name": "ws-f07f0f2e-08fb-433a-8282-fef07b596909",
"node_ip": "10.132.0.35"
},
"auth": {
"owner_token": "l\u003cM3U,%$Fe3/Y/515B;/*D:1HhQAaq0c"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"deployed": 1
},
"runtime": {
"node_name": "gke-production--gitp-workspace-pool-2-a3afc0b4-nmbw"
"node_name": "gke-production--gitp-workspace-pool-2-a3afc0b4-nmbw",
"pod_name": "ws-cecf2a75-7225-4056-a125-fa3144b9c012"
},
"auth": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"deployed": 1
},
"runtime": {
"node_name": "gke-production--gitp-workspace-pool-2-a3afc0b4-nmbw"
"node_name": "gke-production--gitp-workspace-pool-2-a3afc0b4-nmbw",
"pod_name": "ws-cecf2a75-7225-4056-a125-fa3144b9c012"
},
"auth": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
},
"message": "pod is pending",
"runtime": {
"node_name": "gke-gitpod-dev-worker-pool-2-184c607e-1wgf"
"node_name": "gke-gitpod-dev-worker-pool-2-184c607e-1wgf",
"pod_name": "ws-b3242d9b-6920-41b5-8e72-c3d5637ca148"
},
"auth": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
},
"message": "pod is pending",
"runtime": {
"node_name": "gke-gitpod-dev-worker-pool-2-184c607e-1wgf"
"node_name": "gke-gitpod-dev-worker-pool-2-184c607e-1wgf",
"pod_name": "ws-b3242d9b-6920-41b5-8e72-c3d5637ca148"
},
"auth": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@
}
},
"runtime": {
"node_name": "gke-staging--gitpod--workspace-pool-2-331a2b32-mgbq"
"node_name": "gke-staging--gitpod--workspace-pool-2-331a2b32-mgbq",
"pod_name": "ws-df376c57-7a0e-4233-976a-7a021e6f088c",
"node_ip": "10.132.15.227"
},
"auth": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
}
},
"runtime": {
"node_name": "gke-gitpod-dev-worker-pool-1-3df476cf-qxwr"
"node_name": "gke-gitpod-dev-worker-pool-1-3df476cf-qxwr",
"pod_name": "ws-27e46234-5004-44c1-a2e8-56d68ac3c70b",
"node_ip": "10.132.0.12"
},
"auth": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
},
"message": "container workspace was terminated unexpectedly - workspace should recover",
"runtime": {
"node_name": "gke-gitpod-staging-e-workspace-pool-2-2eb903d0-g86k"
"node_name": "gke-gitpod-staging-e-workspace-pool-2-2eb903d0-g86k",
"pod_name": "ws-283522ed-51f1-4838-951b-0f115c0a7aae",
"node_ip": "10.132.0.35"
},
"auth": {}
}
Expand Down
Loading

0 comments on commit 9be229e

Please sign in to comment.