60 lines
1.3 KiB
V
60 lines
1.3 KiB
V
module kubernetes
|
|
|
|
import incubaid.herolib.osal.core as osal
|
|
import incubaid.herolib.ui.console
|
|
import incubaid.herolib.core.texttools
|
|
import incubaid.herolib.osal.startupmanager
|
|
|
|
fn startupcmd() ![]startupmanager.ZProcessNewArgs {
|
|
return []startupmanager.ZProcessNewArgs{}
|
|
}
|
|
|
|
fn running() !bool {
|
|
// Check if kubectl is available and can connect
|
|
job := osal.exec(cmd: 'kubectl cluster-info', raise_error: false)!
|
|
return job.exit_code == 0
|
|
}
|
|
|
|
fn start_pre() ! {
|
|
console.print_header('Pre-start checks')
|
|
if !osal.cmd_exists('kubectl') {
|
|
return error('kubectl not found in PATH')
|
|
}
|
|
}
|
|
|
|
fn start_post() ! {
|
|
console.print_header('Post-start validation')
|
|
}
|
|
|
|
fn stop_pre() ! {
|
|
}
|
|
|
|
fn stop_post() ! {
|
|
}
|
|
|
|
fn installed() !bool {
|
|
return osal.cmd_exists('kubectl')
|
|
}
|
|
|
|
fn install() ! {
|
|
console.print_header('install kubectl')
|
|
// kubectl is typically installed separately via package manager
|
|
// This can be enhanced to auto-download if needed
|
|
if !osal.cmd_exists('kubectl') {
|
|
return error('Please install kubectl: https://kubernetes.io/docs/tasks/tools/')
|
|
}
|
|
}
|
|
|
|
fn build() ! {
|
|
// Not applicable for kubectl wrapper
|
|
}
|
|
|
|
fn destroy() ! {
|
|
console.print_header('destroy kubernetes client')
|
|
// No cleanup needed for kubectl wrapper
|
|
}
|
|
|
|
// fn configure() ! {
|
|
// console.print_debug('Kubernetes client configured')
|
|
// }
|