@@ -25,6 +25,7 @@ package v1alpha
2525import (
2626 "time"
2727
28+ "k8s.io/api/core/v1"
2829 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2930)
3031
@@ -33,8 +34,10 @@ type MemberStatus struct {
3334 // ID holds the unique ID of the member.
3435 // This id is also used within the ArangoDB cluster to identify this server.
3536 ID string `json:"id"`
36- // State holds the current state of this member
37- State MemberState `json:"state"`
37+ // Phase holds the current lifetime phase of this member
38+ Phase MemberPhase `json:"phase"`
39+ // CreatedAt holds the creation timestamp of this member.
40+ CreatedAt metav1.Time `json:"created-at"`
3841 // PersistentVolumeClaimName holds the name of the persistent volume claim used for this member (if any).
3942 PersistentVolumeClaimName string `json:"persistentVolumeClaimName,omitempty"`
4043 // PodName holds the name of the Pod that currently runs this member
@@ -44,6 +47,9 @@ type MemberStatus struct {
4447 // RecentTerminatons holds the times when this member was recently terminated.
4548 // First entry is the oldest. (do not add omitempty, since we want to be able to switch from a list to an empty list)
4649 RecentTerminations []metav1.Time `json:"recent-terminations"`
50+ // IsInitialized is set after the very first time a pod was created for this member.
51+ // After that, DBServers must have a UUID field or fail.
52+ IsInitialized bool `json:"initialized"`
4753}
4854
4955// RemoveTerminationsBefore removes all recent terminations before the given timestamp.
@@ -78,3 +84,17 @@ func (s MemberStatus) RecentTerminationsSince(timestamp time.Time) int {
7884 }
7985 return count
8086}
87+
88+ // IsNotReadySince returns true when the given member has not been ready since the given timestamp.
89+ // That means it:
90+ // - A) Was created before timestamp and never reached a ready state or
91+ // - B) The Ready condition is set to false, and last transision is before timestamp
92+ func (s MemberStatus ) IsNotReadySince (timestamp time.Time ) bool {
93+ cond , found := s .Conditions .Get (ConditionTypeReady )
94+ if found {
95+ // B
96+ return cond .Status != v1 .ConditionTrue && cond .LastTransitionTime .Time .Before (timestamp )
97+ }
98+ // A
99+ return s .CreatedAt .Time .Before (timestamp )
100+ }
0 commit comments