Documentation
¶
Index ¶
- Constants
- Variables
- func AddNameserver(nameserver string) error
- func Append(base string, inc string) string
- func CleanRsaKeys()
- func Contains(obj interface{}, target interface{}) bool
- func CreateDirIfNotExist(dir string)
- func DropHosts()
- func DumpHosts(hostsMap map[string]string)
- func ExtractNetMaskFromCidr(cidr string) string
- func FindBrokenPort(exposePorts string) string
- func FixFileOwner(path string)
- func GetDaemonRunning(componentName string) int
- func GetJvmrcFilePath(jvmrcDir string) string
- func GetLocalDomains() string
- func GetLocalUserName() string
- func GetOutboundIP() (address string)
- func GetRandomSSHPort() int
- func GetTimestamp() string
- func IsCmd() bool
- func IsLinux() bool
- func IsPidFileExist() bool
- func IsProcessExist(pid int) bool
- func IsWindows() bool
- func KubeConfig() string
- func PrivateKeyPath(component, identifier string) string
- func RandomString(n int) string
- func RestoreConfig() error
- func SetupConfigMapHeartBeat(ctx context.Context, client coreV1.ConfigMapInterface, name string)
- func SetupPodHeartBeat(ctx context.Context, client coreV1.PodInterface, name string)
- func SetupPortForwardHeartBeat(port int)
- func SetupServiceHeartBeat(ctx context.Context, client coreV1.ServiceInterface, name string)
- func String2Map(str string) map[string]string
- func WaitPortBeReady(waitTime, port int) bool
- func WritePidFile(componentName string) error
- func WritePrivateKey(privateKeyPath string, data []byte) error
- type SSHCredential
- type SSHGenerator
Constants ¶
const ResourceHeartBeatIntervalMinus = 5
Variables ¶
var KtHome = fmt.Sprintf("%s/.ktctl", UserHome)
var UserHome = os.Getenv("HOME")
Functions ¶
func AddNameserver ¶ added in v0.1.2
func Contains ¶ added in v0.1.0
func Contains(obj interface{}, target interface{}) bool
Contains check whether obj exist in target, the type of target can be array, slice or map
func ExtractNetMaskFromCidr ¶ added in v0.1.0
ExtractNetMaskFromCidr extract net mask length (e.g. 16) from cidr (e.g. 1.2.3.4/16)
func FindBrokenPort ¶ added in v0.2.2
FindBrokenPort Check if all ports has process listening to Return empty string if all ports are listened, otherwise return the first broken port
func FixFileOwner ¶ added in v0.1.1
func FixFileOwner(path string)
FixFileOwner set owner to original user when run with sudo
func GetDaemonRunning ¶ added in v0.1.0
GetDaemonRunning fetch daemon pid if exist
func GetJvmrcFilePath ¶ added in v0.1.0
GetJvmrcFilePath get jvmrc file from jvmrc dir
func GetLocalDomains ¶ added in v0.1.2
func GetLocalDomains() string
func GetLocalUserName ¶ added in v0.2.0
func GetLocalUserName() string
GetLocalUserName get current username
func GetOutboundIP ¶
func GetOutboundIP() (address string)
GetOutboundIP Get preferred outbound ip of this machine
func IsPidFileExist ¶ added in v0.1.0
func IsPidFileExist() bool
IsPidFileExist check pid file is exist or not
func IsProcessExist ¶ added in v0.1.0
IsProcessExist check whether specified process still running
func PrivateKeyPath ¶ added in v0.0.12
PrivateKeyPath ...
func RestoreConfig ¶ added in v0.1.2
func RestoreConfig() error
RestoreConfig remove the nameserver which is added by ktctl.
func SetupConfigMapHeartBeat ¶ added in v0.1.2
func SetupConfigMapHeartBeat(ctx context.Context, client coreV1.ConfigMapInterface, name string)
SetupConfigMapHeartBeat setup heartbeat watcher for config map
func SetupPodHeartBeat ¶ added in v0.2.0
func SetupPodHeartBeat(ctx context.Context, client coreV1.PodInterface, name string)
SetupPodHeartBeat setup heartbeat watcher for deployment
func SetupPortForwardHeartBeat ¶ added in v0.1.2
func SetupPortForwardHeartBeat(port int)
SetupPortForwardHeartBeat setup heartbeat watcher for port forward
func SetupServiceHeartBeat ¶ added in v0.1.2
func SetupServiceHeartBeat(ctx context.Context, client coreV1.ServiceInterface, name string)
SetupServiceHeartBeat setup heartbeat watcher for service
func String2Map ¶ added in v0.0.12
String2Map Convert parameter string to real map "k1=v1,k2=v2" -> {"k1":"v1","k2","v2"}
func WaitPortBeReady ¶ added in v0.1.1
WaitPortBeReady return true when port is ready It waits at most waitTime seconds, then return false.
func WritePidFile ¶ added in v0.0.12
WritePidFile write pid to file
func WritePrivateKey ¶ added in v0.1.0
WritePrivateKey write ssh private key to privateKeyPath
Types ¶
type SSHCredential ¶ added in v0.1.0
SSHCredential ssh info
func NewDefaultSSHCredential ¶ added in v0.1.0
func NewDefaultSSHCredential() *SSHCredential
NewDefaultSSHCredential ...
type SSHGenerator ¶ added in v0.1.0
SSHGenerator ssh key pair generator
func Generate ¶ added in v0.1.0
func Generate(privateKeyPath string) (*SSHGenerator, error)
Generate generate SSHGenerator
func NewSSHGenerator ¶ added in v0.1.0
func NewSSHGenerator(privateKey string, publicKey string, privateKeyPath string) *SSHGenerator
NewSSHGenerator create ssh generator