Skip to content
Permalink
Browse files

added deployment.yaml files for deployment of the appication

  • Loading branch information...
Elliot Kim Elliot Kim
Elliot Kim authored and Elliot Kim committed Nov 14, 2018
1 parent 21d20b8 commit 5f3f0776a56383637884595be2cd2c11f23df05d
Showing with 249 additions and 13 deletions.
  1. +0 −2 .vscode/settings.json
  2. +17 −0 Dockerfile
  3. +19 −0 dist/index.html
  4. +156 −0 dist/main.js
  5. +13 −0 loadbalancer.yaml
  6. +7 −1 package.json
  7. +19 −0 spekt8-deployment.yaml
  8. +7 −10 src/client/supplement/fetch.js
  9. +11 −0 src/server/server.js

This file was deleted.

@@ -0,0 +1,17 @@
# version 8 of node
FROM node:8

# create a directory for client
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

# install app dependencies
COPY package*.json ./
RUN npm install

# bundle app source
COPY . .

# bind to port 8080
EXPOSE 3000
CMD ["npm", "run", "server"]
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta
name="viewport"
content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no"
/>
<meta http-equiv="X-UA-Compatible" content="ie=edge">

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<title></title>
</head>
<body>
<div id="index"></div>
<script type="text/javascript" src="main.js"></script></body>
</html>

Large diffs are not rendered by default.

@@ -0,0 +1,13 @@
kind: Service
apiVersion: v1
metadata:
name: loadbalancer-service
spec:
ports:
- port: 8765
targetPort: 9376
selector:
app: loadbalancer
type: LoadBalancer


@@ -6,7 +6,12 @@
"scripts": {
"start": "webpack-dev-server --mode development --open",
"build": "webpack --mode production",
"server": "nodemon src/server/server.js"
"server": "node src/server/server.js"
},
"proxy": {
"/api": {
"target": "http://localhost:3000"
}
},
"author": "",
"license": "ISC",
@@ -19,6 +24,7 @@
"express": "^4.16.4",
"file-loader": "^2.0.0",
"font-awesome-sass-loader": "^2.0.1",
"path": "^0.12.7",
"react": "^16.6.0",
"react-dom": "^16.6.0",
"react-github-corner": "^2.3.0",
@@ -0,0 +1,19 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: spekt8
spec:
selector:
matchLabels:
component: spekt8
replicas: 1
template:
metadata:
labels:
component: spekt8
spec:
containers:
- name: spekt8
image: elliotxkim/spekt8
ports:
- containerPort: 3000
@@ -1,20 +1,20 @@

export default (nodes, edges, graph, that) => {
// this fetch receives the pod list
fetch('http://localhost:3000')
fetch('http://localhost:3000/api/pod')
.then((podData) => {
// console.log(data);
return podData.json();
})
.then((podObject) => {
// this fetch receives the service list
fetch('http://localhost:3000/service')
fetch('http://localhost:3000/api/service')
.then((serviceData) => {
return serviceData.json();
})
.then((serviceObject) => {
console.log('serviceobject',serviceObject);
fetch('http://localhost:3000/ingress')
fetch('http://localhost:3000/api/ingress')
.then((ingressData) => {
return ingressData.json();
})
@@ -24,15 +24,12 @@ export default (nodes, edges, graph, that) => {
const newGraph = Object.assign({}, graph);
newGraph.nodes = nodes.slice();
newGraph.edges = edges.slice();

// place service list and pod list into separate variables
const serviceArray = [];
const podArray = [];
const ingressArray = [];
const masterNode = [];

const newMasterObject = {};
newMasterObject.id = 200;


// this loop cycles through the service list and assigns them to their own boxes
// console.log('serviceobject',serviceObject);
@@ -57,7 +54,7 @@ export default (nodes, edges, graph, that) => {
console.log('podObject',podObject);
for (let i = 0; i < podObject.items.length; i+=1) {
const newPodObject = {};
newPodObject.id = i + 10;
newPodObject.id = i + 1000;
newPodObject.kind = "Pod";
newPodObject.label = 'Pods'; // pod display title
// pending versus running pods
@@ -86,7 +83,7 @@ export default (nodes, edges, graph, that) => {
// this loops through the ingress object and saves to another array
for (let i = 0; i < ingressObject.items.length; i+=1) {
const newIngressObject = {};
newIngressObject.id = i + 100;
newIngressObject.id = i + 2000;
newIngressObject.kind = "Ingress";
newIngressObject.label = "Ingress";
newIngressObject.timeStamp = ingressObject.items[i].metadata.creationTimestamp; // ingress timestamp
@@ -9,6 +9,8 @@ kc.loadFromDefault();
const k8sApi = kc.makeApiClient(k8s.Core_v1Api);
const k8sApi2 = kc.makeApiClient(k8s.Extensions_v1beta1Api);

const path = require('path');

// use statements
app.use(bodyParser.json());

@@ -19,6 +21,15 @@ app.use(function(req, res, next) {
});

app.get('/', (req, res) => {
console.log('serving index.html from ', __dirname)
res.sendFile(path.join(__dirname, '../../dist/index.html'));
});

app.get('/main.js', (req, res) => {
res.sendFile(path.join(__dirname, '../../dist/main.js'));
});

app.get('/pod', (req, res) => {
k8sApi.listNamespacedPod('default')
.then((re) => {
// console.log(re.body);

0 comments on commit 5f3f077

Please sign in to comment.
You can’t perform that action at this time.