Skip to content

Commit d5432fa

Browse files
committed
11
1 parent 0b77878 commit d5432fa

4 files changed

Lines changed: 12 additions & 10 deletions

File tree

OpenFlow/src/Config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ export class Config {
3838
public static aes_secret: string = Config.getEnv("aes_secret", "");
3939
public static skip_history_collections: string = Config.getEnv("skip_history_collections", "");
4040

41-
public static kubeconfig: string = Config.getEnv("kubeconfig", "");
42-
4341
public static baseurl(): string {
4442
var result: string = "";
4543
if (Config.tls_crt != '' && Config.tls_key != '') {

OpenFlow/src/KubeUtil.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ export class KubeUtil {
1515
return this._instance;
1616
}
1717
constructor() {
18-
var config = Config.kubeconfig;
1918
const kc = new k8s.KubeConfig();
20-
kc.loadFromString(config);
19+
kc.loadFromCluster();
2120
this.CoreV1Api = kc.makeApiClient(k8s.CoreV1Api);
2221
this.AppsV1Api = kc.makeApiClient(k8s.AppsV1Api);
2322
this.ExtensionsV1beta1Api = kc.makeApiClient(k8s.ExtensionsV1beta1Api);

OpenFlow/src/index.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { TokenUser } from "./TokenUser";
1717
import { Auth } from "./Auth";
1818
import { Role } from "./Role";
1919
import { Config } from "./Config";
20+
import { KubeUtil } from "./KubeUtil";
2021

2122
const logger: winston.Logger = Logger.configure();
2223
Config.db = new DatabaseConnection(logger, Config.mongodb_url, Config.mongodb_db);
@@ -125,14 +126,18 @@ process.on('unhandledRejection', up => {
125126
WebSocketServer.configure(logger, server);
126127
logger.info("listening on " + Config.baseurl());
127128
logger.info("namespace: " + Config.namespace);
128-
var fs = require('fs');
129-
var contents = fs.readFileSync('/kubeconfig/kube.yaml', 'utf8');
130-
var json = JSON.stringify(contents, null, 3);
131-
console.log(json);
132-
logger.info("kubeconfig: " + Config.kubeconfig);
133129
if (!await initDatabase()) {
134130
process.exit(404);
135131
}
132+
133+
134+
var res = await KubeUtil.instance().GetDeployment("demo3", "api");
135+
if (res != null) {
136+
var json = JSON.stringify(res, null, 3);
137+
console.log(json);
138+
} else {
139+
console.log("demo3/api not found!");
140+
}
136141
} catch (error) {
137142
logger.error(error.message);
138143
}

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.177
1+
0.0.178

0 commit comments

Comments
 (0)