const path = require('path'); const os = require('os'); module.exports = { tags: async (tln) => [], dotenvs: async (tln) => [], env: async (tln, env) => { env.KUBECTL_HOME = env.TLN_COMPONENT_HOME; env.PATH = [env.TLN_COMPONENT_HOME, env.PATH].join(path.delimiter); }, options: async (tln, args) => [], inherits: async (tln) => [], depends: async (tln) => [], steps: async (tln) => [ { id: 'version', builder: async (tln, script) => { const id = script.env.TLN_COMPONENT_ID; const home = script.env.TLN_COMPONENT_HOME; const {name, version} = tln.unpackId(id); if (version) { script.set([` echo [kubectl] && kubectl version `]); } }}, { id: 'install', filter: '', builder: async (tln, script) => { const id = script.env.TLN_COMPONENT_ID; const home = script.env.TLN_COMPONENT_HOME; const {name, version} = tln.unpackId(id); // // 'arm', 'arm64', 'ia32', 'loong64', 'mips', 'mipsel', 'ppc64', 'riscv64', 's390x', 'x64' const arch = os.arch() === 'x64' ? 'amd64' : os.arch(); // if (version && tln.canInstallComponent(tln, id, home)) { script.set(tln.getDownloadScript(tln, { linux: { name: `kubectl`, opts: null, url: `https://dl.k8s.io/release/v${version}/bin/linux/${arch}/kubectl`, cmd: 'chmod +x ./kubectl', keep: true }, darwin: { name: `kubectl`, opts: null, url: `https://dl.k8s.io/release/v${version}/bin/darwin/${arch}/kubectl`, cmd: 'chmod +x ./kubectl', keep: true }, win32: { name: `kubectl.exe`, opts: null, url: `https://dl.k8s.io/release/v${version}/bin/windows/${arch}/kubectl.exe`, cmd: null, keep: true } })); } } } ], components: async (tln) => require('./../components.js').map(v => { return { id: `kubectl-${v.id}` } }) }