# Info: KCL Kubeconfig task schemas for provisioning (Provisioning)
# Author: JesusPerezLorenzo 
# Release: 0.0.4
# Date: 15-12-2023

#schema Kubernetes:
#  name: str = "kubernetes"
#  version: str
#  major_version: str
#  cmd_task: "install"| "update" | "remove" = "install" 

schema K8sNodejoin:
   name: str = "k8s-nodejoin"
   cp_hostname: str
   # Task to get kubernetes config file to set KUBECONFIG or .kunbe/config
   cluster: str
   #req_sudo: bool = True
   # Path to copy file 
   target_path: str = "/tmp/k8s_join.sh"
   # source file path 
   source_path: str = "/tmp/k8s_join.sh"
   # host to admin service or where ${source_path} can be found
   admin_host?: str 
   # Cluster services admin hosts port to connect via SSH
   admin_port?: int
   # Cluster services admin user connect via SSH
   admin_user?: str
   ssh_key_path?: str
   source_cmd: str = "kubeadm token create --print-join-command > ${source_path}"
   target_cmd: str = "sudo bash ${target_path}"
   check:
      len(cluster) > 0, "Check cluster value"
      len(cp_hostname) > 0, "Check cp_hostname value"

