revert base folder structure to src/*

This commit is contained in:
Roman committed 2020-06-10 11:25:17 +03:00
1 parent afa8864452
commit 81c2a75d73
750 files changed
+44 -43

No files matched your search

@@ -0,0 +1,46 @@
import * as k8s from "@kubernetes/client-node"
import { splitConfig, dumpConfigYaml } from "../../../../main/k8s"
const state = {
availableKubeContexts: []
}
const actions = {
reloadAvailableKubeContexts: ({commit}) => {
let kc = new k8s.KubeConfig();
try {
kc.loadFromDefault();
} catch (error) {
console.error("Failed to read default kubeconfig: " + error.message);
}
// Remove the default setup the client makes if it does not find anything in the default config
// See: https://github.com/kubernetes-client/javascript/blob/2fc8fbc956ca89bf425ca3ea045d46ee7b75296b/src/config.ts#L253
// It defaults to loadFromClusterAndUser() when no config file can be found
if(kc.currentContext === "loaded-context") {
kc = new k8s.KubeConfig();
}
commit("saveAvailableKubeContexts", splitConfig(kc))
}
}
const getters = {
availableKubeContexts: function(state){
return state.availableKubeContexts
}
}
const mutations = {
saveAvailableKubeContexts(state, contexts) {
state.availableKubeContexts = contexts
}
}
export default {
namespaced: false,
state,
getters,
mutations,
actions
}