lib/tools/k8sutil.js
function K8sutil() {
    // this.getNamespace();
    podName = os.hostname();
    podGenerateName = podName.substr(0, podName.lastIndexOf('-'));
    logger.debug('k8sutil', 'K8sutil()', 'The pod name: ', podName);
    fetchContainerID();
    try {
        // var kubeconfig = Api.config.fromKubeconfig();
        var kubeconfig = Api.config.getInCluster();
        kubeconfig.promises = true;
        // kubeconfig.namespace = 'default';
        logger.debug('k8sutil', 'K8sutil()', 'Kubeconfig', kubeconfig);
        core = new Api.Core(kubeconfig);
        ext = new Api.Extensions(kubeconfig);
        namespace = core.namespaces.namespace;
        logger.info('k8sutil', 'K8sutil()', 'Current namespace', namespace);
        if (!podJson) {
            core.ns(namespace).pods(this.getPodName()).get().then(parsePodInfo).catch(
                function(err) {
                    logger.error('k8sutil', 'K8sutil()', err.message);
                }
            );
        }

    } catch (e) {
        logger.debug('k8sutil', 'K8sutil()',
            'Failed to load K8S configuration, is not a ICp environment.');
    }
    findIngressSvc();
    setNodeIPs();
}
function K8sutil() {
    // this.getNamespace();
    podName = os.hostname();
    podGenerateName = podName.substr(0, podName.lastIndexOf('-'));
    logger.debug('k8sutil', 'K8sutil()', 'The pod name: ', podName);
    fetchContainerID();
    try {
        // var kubeconfig = Api.config.fromKubeconfig();
        var kubeconfig = Api.config.getInCluster();
        kubeconfig.promises = true;
        // kubeconfig.namespace = 'default';
        logger.debug('k8sutil', 'K8sutil()', 'Kubeconfig', kubeconfig);
        core = new Api.Core(kubeconfig);
        ext = new Api.Extensions(kubeconfig);
        namespace = core.namespaces.namespace;
        logger.info('k8sutil', 'K8sutil()', 'Current namespace', namespace);
        if (!podJson) {
            core.ns(namespace).pods(this.getPodName()).get().then(parsePodInfo).catch(
                function(err) {
                    logger.error('k8sutil', 'K8sutil()', err.message);
                }
            );
        }

    } catch (e) {
        logger.debug('k8sutil', 'K8sutil()',
            'Failed to load K8S configuration, is not a ICp environment.');
    }
    findIngressSvc();
    setNodeIPs();
}
function K8sutil ( ) { // this.getNamespace(); podName = os . hostname ( ) ; podGenerateName = podName . substr ( 0 , podName . lastIndexOf ( '-' ) ) ; logger . debug ( 'k8sutil' , 'K8sutil()' , 'The pod name: ' , podName ) ; fetchContainerID ( ) ; try { // var kubeconfig = Api.config.fromKubeconfig(); var kubeconfig = Api . config . getInCluster ( ) ; kubeconfig . promises = true ; // kubeconfig.namespace = 'default'; logger . debug ( 'k8sutil' , 'K8sutil()' , 'Kubeconfig' , kubeconfig ) ; core = new Api . Core ( kubeconfig ) ; ext = new Api . Extensions ( kubeconfig ) ; namespace = core . namespaces . namespace ; logger . info ( 'k8sutil' , 'K8sutil()' , 'Current namespace' , namespace ) ; if ( ! podJson ) { core . ns ( namespace ) . pods ( this . getPodName ( ) ) . get ( ) . then ( parsePodInfo ) . catch ( function ( err ) { logger . error ( 'k8sutil' , 'K8sutil()' , err . message ) ; } ) ; } } catch ( e ) { logger . debug ( 'k8sutil' , 'K8sutil()' , 'Failed to load K8S configuration, is not a ICp environment.' ) ; } findIngressSvc ( ) ; setNodeIPs ( ) ; }
var NAMESPACE_DEFAULT = 'default';
var NAMESPACE_DEFAULT = default ;