Skip to content

Commit

Permalink
Merge pull request kubernetes#715 from mm4tt/ss_runtime
Browse files Browse the repository at this point in the history
Support StatefulSets in runtimeobjects.go
  • Loading branch information
k8s-ci-robot authored Jul 31, 2019
2 parents 1dc0a1f + dd8f171 commit f2b8e3d
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ func ListRuntimeObjectsForKind(c clientset.Interface, kind, namespace, labelSele
}
return nil
}
case "StatefulSet":
listFunc = func() error {
list, err := c.AppsV1().StatefulSets(namespace).List(listOpts)
if err != nil {
return err
}
runtimeObjectsList = make([]runtime.Object, len(list.Items))
for i := range list.Items {
runtimeObjectsList[i] = &list.Items[i]
}
return nil
}
case "DaemonSet":
listFunc = func() error {
list, err := c.AppsV1().DaemonSets(namespace).List(listOpts)
Expand Down Expand Up @@ -165,6 +177,8 @@ func GetSelectorFromRuntimeObject(obj runtime.Object) (labels.Selector, error) {
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
case *appsv1.Deployment:
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
case *appsv1.StatefulSet:
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
case *appsv1.DaemonSet:
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
case *batch.Job:
Expand Down Expand Up @@ -222,6 +236,8 @@ func GetSpecFromRuntimeObject(obj runtime.Object) (interface{}, error) {
return typed.Spec, nil
case *appsv1.Deployment:
return typed.Spec, nil
case *appsv1.StatefulSet:
return typed.Spec, nil
case *appsv1.DaemonSet:
return typed.Spec, nil
case *batch.Job:
Expand Down Expand Up @@ -266,6 +282,11 @@ func GetReplicasFromRuntimeObject(obj runtime.Object) (int32, error) {
return *typed.Spec.Replicas, nil
}
return 0, nil
case *appsv1.StatefulSet:
if typed.Spec.Replicas != nil {
return *typed.Spec.Replicas, nil
}
return 0, nil
case *appsv1.DaemonSet:
return 0, nil
case *batch.Job:
Expand Down

0 comments on commit f2b8e3d

Please sign in to comment.