本文整理匯總了Golang中k8s/io/kubernetes/pkg/api.Probe.Exec方法的典型用法代碼示例。如果您正苦於以下問題:Golang Probe.Exec方法的具體用法?Golang Probe.Exec怎麽用?Golang Probe.Exec使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類k8s/io/kubernetes/pkg/api.Probe
的用法示例。
在下文中一共展示了Probe.Exec方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: writeProbe
func writeProbe(m map[string]interface{}, item *api.Probe) {
if x, ok := m["initial_delay"].(int); ok {
item.InitialDelaySeconds = x
}
if x, ok := m["timeout"].(int); ok {
item.TimeoutSeconds = x
}
if x, ok := m["period"].(int); ok {
item.PeriodSeconds = x
}
if x, ok := m["success_threshold"].(int); ok {
item.SuccessThreshold = x
}
if x, ok := m["failure_threshold"].(int); ok {
item.FailureThreshold = x
}
if n, ok := extractSingleMap(m["exec"]); ok {
item.Exec = &api.ExecAction{}
if l, ok := n["command"].([]interface{}); ok {
for _, x := range l {
item.Exec.Command = append(item.Exec.Command, x.(string))
}
}
}
if n, ok := extractSingleMap(m["http_get"]); ok {
item.HTTPGet = &api.HTTPGetAction{}
if x, ok := n["path"].(string); ok {
item.HTTPGet.Path = x
}
if x, ok := n["port"].(int); ok {
item.HTTPGet.Port = intstr.FromInt(x)
}
if x, ok := n["host"].(string); ok {
item.HTTPGet.Host = x
}
if x, ok := n["scheme"].(string); ok {
item.HTTPGet.Scheme = api.URIScheme(x)
}
if l, ok := n["http_header"].([]interface{}); ok {
for _, x := range l {
if y, ok := extractSingleMap(x); ok {
h := api.HTTPHeader{}
if x, ok := y["name"].(string); ok {
h.Name = x
}
if x, ok := y["value"].(string); ok {
h.Value = x
}
item.HTTPGet.HTTPHeaders = append(item.HTTPGet.HTTPHeaders, h)
}
}
}
}
if n, ok := extractSingleMap(m["tcp_socket"]); ok {
item.TCPSocket = &api.TCPSocketAction{}
if x, ok := n["port"].(int); ok {
item.TCPSocket.Port = intstr.FromInt(x)
}
}
}