本文整理汇总了Golang中k8s/io/kubernetes/pkg/client/clientset_generated/internalclientset.Clientset.Apps方法的典型用法代码示例。如果您正苦于以下问题:Golang Clientset.Apps方法的具体用法?Golang Clientset.Apps怎么用?Golang Clientset.Apps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类k8s/io/kubernetes/pkg/client/clientset_generated/internalclientset.Clientset
的用法示例。
在下文中一共展示了Clientset.Apps方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetStatefulSetDetail
// GetStatefulSetDetail gets pet set details.
func GetStatefulSetDetail(client *k8sClient.Clientset, heapsterClient client.HeapsterClient,
namespace, name string) (*StatefulSetDetail, error) {
log.Printf("Getting details of %s service in %s namespace", name, namespace)
// TODO(floreks): Use channels.
statefulSetData, err := client.Apps().StatefulSets(namespace).Get(name)
if err != nil {
return nil, err
}
podList, err := GetStatefulSetPods(client, heapsterClient, dataselect.DefaultDataSelectWithMetrics, name, namespace)
if err != nil {
return nil, err
}
podInfo, err := getStatefulSetPodInfo(client, statefulSetData)
if err != nil {
return nil, err
}
events, err := GetStatefulSetEvents(client, dataselect.DefaultDataSelect, statefulSetData.Namespace, statefulSetData.Name)
if err != nil {
return nil, err
}
statefulSet := getStatefulSetDetail(statefulSetData, heapsterClient, *events, *podList, *podInfo)
return &statefulSet, nil
}
示例2: GetStatefulSetPodsEvents
// GetStatefulSetPodsEvents gets events associated to pods in pet set.
func GetStatefulSetPodsEvents(client *client.Clientset, namespace, statefulSetName string) (
[]api.Event, error) {
statefulSet, err := client.Apps().StatefulSets(namespace).Get(statefulSetName)
if err != nil {
return nil, err
}
podEvents, err := event.GetPodsEvents(client, namespace, statefulSet.Spec.Selector.MatchLabels)
if err != nil {
return nil, err
}
return podEvents, nil
}
示例3: getRawStatefulSetPods
// Returns array of api pods targeting pet set with given name.
func getRawStatefulSetPods(client *k8sClient.Clientset, statefulSetName, namespace string) (
[]api.Pod, error) {
statefulSet, err := client.Apps().StatefulSets(namespace).Get(statefulSetName)
if err != nil {
return nil, err
}
channels := &common.ResourceChannels{
PodList: common.GetPodListChannel(client, common.NewSameNamespaceQuery(namespace), 1),
}
podList := <-channels.PodList.List
if err := <-channels.PodList.Error; err != nil {
return nil, err
}
matchingPods := common.FilterNamespacedPodsByLabelSelector(podList.Items,
statefulSet.ObjectMeta.Namespace, statefulSet.Spec.Selector)
return matchingPods, nil
}