Skip to content

Instantly share code, notes, and snippets.

@stevehenderson
Created March 18, 2022 14:37
Show Gist options
  • Save stevehenderson/5cee6be4aec81db130c718bf0c3c74aa to your computer and use it in GitHub Desktop.
Save stevehenderson/5cee6be4aec81db130c718bf0c3c74aa to your computer and use it in GitHub Desktop.
Get K8s StatefulSet
import (
appsv1 "k8s.io/api/apps/v1"
)
// StatefulSetGetAll returns all STS for the managed cluster
func (mgr *manager) StatefulSetGetAll() *appsv1.StatefulSetList {
stslister, err := mgr.k8sclient.AppsV1().StatefulSets("").List(context.TODO(), metav1.ListOptions{})
if err != nil {
fmt.Println("error getting StatefulSetGetAll: ", err)
}
return stslister
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment