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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
node_modules/
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM akkerman/rpi-nginx

COPY jquery*.js script.js style.css logotext.svg index.html /usr/share/nginx/html/
COPY jsplumb/* /usr/share/nginx/html/jsplumb/
COPY nginx.conf /etc/nginx/
62 changes: 62 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* Created by cquach on 11-11-15.
*/
'use strict';

module.exports = function (grunt) {
require('jit-grunt')(grunt, {
'configureProxies': 'grunt-connect-proxy'
});

var serveStatic = require('serve-static');

grunt.initConfig({
watch: {
livereload: {
options: {
livereload: true
},
files: [
'./{,*/**/}*.html',
'./{,*/**/}*.css',
'./{,*/**/}*.js'
]
}
},
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: '0.0.0.0'
},
proxies: [
{
context: '/api',
host: 'rpi-master',
port: '8080',
https: false,
changeOrigin: false,
xforward: false
}
],
livereload: {
options: {
open: false,
livereload: 35729,
middleware: function (connect) {
return [
require('grunt-connect-proxy/lib/utils').proxyRequest,
serveStatic('.')
];
}
}
}
}
});

grunt.registerTask('serve', [
'configureProxies',
'connect:livereload',
'watch'
]);
};
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,21 @@ This is a simple visualizer for use with the Kubernetes API.

### Usage:
* First install a Kubernetes or Container Engine Cluster
* ```git clone https://github.com/brendandburns/gcp-live-k8s-visualizer.git```
* ```kubecfg proxy --www=path/to/gcp-live-k8s-visualizer```
* ```git clone https://github.com/saturnism/gcp-live-k8s-visualizer.git```
* ```kubectl proxy -p 8080 -w =path/to/gcp-live-k8s-visualizer```

You can then access the visualizer via:
* `http://localhost:8080/static/`

If you need to connect to it via non-localhost IP, then you need to start the proxy differently:
* `kubectl proxy -p 8080 --accept-hosts=".*" -w =path/to/gcp-live-k8s-visualizer`

That's it. The visualizer uses labels to organize the visualization. In particular it expects that

* pods, replicationcontrollers, and services have a ```name``` label, and pods and their associated replication controller share the same ```name```, and
* the pods in your cluster will have a ```uses``` label which contains a comma separated list of services that the pod uses.
* the pods in your cluster will have a ```uses``` label which contains a underscore separated list of services that the pod uses.
* resources that you want to show in the visualizer should have ```visualize``` label set to the value ```true```

### Using Grunt
To use Grunt while developing, run `npm install` and then run `grunt serve`.
Change the `connect.proxies.host` and/or `connect.proxies.port` in the Gruntfile to reflect the hostname of the Kubernetes API
28 changes: 14 additions & 14 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@
limitations under the License.
-->
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
<head>
<script src="jquery.min.js"></script>
<script src="jquery-ui.min.js"></script>
<script src="jsplumb/jquery.jsPlumb-1.6.4.js"></script>
<link rel="stylesheet" href="jsplumb/jsplumb.css">
<link rel="stylesheet" href="jsplumb/flowchart-style.css">

<script src="script.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="main">
<div class="navbar">
<div class="navbar-logo">
<img src="logotext.svg" id="nav-logo-img" alt="logo">
</div>
</div>
<div class="demo flowchart-demo" id="sheet">
</div>
</head>
<body>
<div id="main">
<div class="navbar">
<div class="navbar-logo">
<img src="logotext.svg" id="nav-logo-img" alt="logo">
</div>
</body>
</div>
<div class="demo flowchart-demo" id="sheet">
</div>
</div>
</body>
</html>
5 changes: 5 additions & 0 deletions jquery-ui.min.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions jquery.min.js

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
worker_processes 1;

events { worker_connections 1024; }

http {
include mime.types;
index index.html index.htm index.php;
sendfile on;

gzip on;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 500;
gzip_disable "MSIE [1-6]\.";
gzip_types text/plain text/xml text/css
text/comma-separated-values
text/javascript
application/x-javascript
application/atom+xml;

# List of application servers
upstream backend {
server 192.168.10.1:8080;
}

# Configuration for the server
server {

# Running port
listen 80;

root /usr/share/nginx/html;
access_log /var/log/nginx/localhost.access.log;

# Proxying the connections connections
location /api {
proxy_pass http://backend;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;

}
}
}
29 changes: 29 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "gcp-live-k8s-visualizer",
"version": "0.1.0",
"description": "This is a simple visualizer for use with the Kubernetes API.",
"main": "index.html",
"directories": {
"example": "examples"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/saturnism/gcp-live-k8s-visualizer.git"
},
"author": "",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/saturnism/gcp-live-k8s-visualizer/issues"
},
"homepage": "https://github.com/saturnism/gcp-live-k8s-visualizer#readme",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-connect-proxy": "^0.2.0",
"grunt-contrib-connect": "^0.11.2",
"grunt-contrib-watch": "^0.6.1",
"jit-grunt": "^0.9.1"
}
}
Loading