Class StatefulSetUtils


  • public class StatefulSetUtils
    extends Object
    • Method Detail

      • ssSnapshot

        public static Map<String,​String> ssSnapshot​(String name)
        Returns a map of pod name to resource version for the pods currently in the given statefulset.
        Parameters:
        name - The StatefulSet name
        Returns:
        A map of pod name to resource version for pods in the given StatefulSet.
      • ssHasRolled

        public static boolean ssHasRolled​(String name,
                                          Map<String,​String> snapshot)
        Method to check that all pods for expected StatefulSet were rolled
        Parameters:
        name - StatefulSet name
        snapshot - Snapshot of pods for StatefulSet before the rolling update
        Returns:
        true when the pods for StatefulSet are recreated
      • waitTillSsHasRolled

        public static Map<String,​String> waitTillSsHasRolled​(String name,
                                                                   Map<String,​String> snapshot)
        Method to wait when StatefulSet will be recreated after rolling update
        Parameters:
        name - StatefulSet name
        snapshot - Snapshot of pods for StatefulSet before the rolling update
        Returns:
        The snapshot of the StatefulSet after rolling update with Uid for every pod
      • waitTillSsHasRolled

        public static Map<String,​String> waitTillSsHasRolled​(String name,
                                                                   int expectedPods,
                                                                   Map<String,​String> snapshot)
        Method to wait when StatefulSet will be recreated after rolling update with wait for all pods ready
        Parameters:
        name - StatefulSet name
        expectedPods - Expected number of pods
        snapshot - Snapshot of pods for StatefulSet before the rolling update
        Returns:
        The snapshot of the StatefulSet after rolling update with Uid for every pod
      • waitForAllStatefulSetPodsReady

        public static void waitForAllStatefulSetPodsReady​(String statefulSetName,
                                                          int expectPods,
                                                          long timeout)
        Wait until the STS is ready and all of its Pods are also ready with custom timeout.
        Parameters:
        statefulSetName - The name of the StatefulSet
        expectPods - The number of pods expected.
      • waitForAllStatefulSetPodsReady

        public static void waitForAllStatefulSetPodsReady​(String statefulSetName,
                                                          int expectPods)
        Wait until the STS is ready and all of its Pods are also ready with default timeout.
        Parameters:
        statefulSetName - The name of the StatefulSet
        expectPods - The number of pods expected.
      • waitForStatefulSetDeletion

        public static void waitForStatefulSetDeletion​(String name)
        Wait until the given StatefulSet has been deleted.
        Parameters:
        name - The name of the StatefulSet.
      • waitForStatefulSetRecovery

        public static void waitForStatefulSetRecovery​(String name,
                                                      String statefulSetUid)
        Wait until the given StatefulSet has been recovered.
        Parameters:
        name - The name of the StatefulSet.
      • waitForStatefulSetLabelsChange

        public static void waitForStatefulSetLabelsChange​(String statefulSetName,
                                                          Map<String,​String> labels)
      • waitForStatefulSetLabelsDeletion

        public static void waitForStatefulSetLabelsDeletion​(String statefulSetName,
                                                            String... labelKeys)
      • waitForNoRollingUpdate

        public static void waitForNoRollingUpdate​(String statefulSetName,
                                                  Map<String,​String> pods)