We have the following code, which throws error after Kubernetes upgrade:
module.exports.getReplicationControllers = async function getReplicationControllers(namespace) { const kubeConfig = (await getNamespacesByCluster()).get(namespace); if (!kubeConfig) throw new Error(`No clusters contain the namespace ${namespace}`) const kubeConfigEscaped = shellEscape([kubeConfig]); const namespaceEscaped = shellEscape([namespace]); const result = await cpp(`kubectl --kubeconfig ${kubeConfigEscaped} get replicationcontrollers -o json -n ${namespaceEscaped}`); console.error(result.stderr); /** @type */ const resultParsed = JSON.parse(result.stdout); const serviceNames = resultParsed.items.map((item) => item.metadata.name); return serviceNames; } ChildProcessError: stdout maxBuffer length exceeded kubectl --kubeconfig /kubeconfig-staging get replicationcontrollers -o json -n momentum-uat (exited with error code ERR_CHILD_PROCESS_STDIO_MAXBUFFER)
What I've tried so far is:
const result = await cpp(`kubectl --kubeconfig ${kubeConfigEscaped} get replicationcontrollers -o=jsonpath='{.items[*].metadata.name}' -n ${namespaceEscaped}`); console.error(result.stderr); const serviceNames = result.split(' '); return serviceNames; Which returns
TypeError: result.split is not a function
I am not super versed with JavaScript, any help appreciated.
https://stackoverflow.com/questions/66717341/childprocesserror-stdout-maxbuffer-length-exceeded March 20, 2021 at 09:04AM
没有评论:
发表评论