Skip to content

Commit

Permalink
controller: Temporarily stop updating the ProbeTime for the conditions
Browse files Browse the repository at this point in the history
It caused too many conflicts for now. We will dig more later. Temporarily stop
updating the ProbeTime
  • Loading branch information
yasker committed Aug 8, 2018
1 parent a6027d9 commit 9838a5f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions controller/node_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func (nc *NodeController) syncNode(key string) (err error) {
for _, pod := range managerPods {
if pod.Spec.NodeName == node.Name {
condition := types.GetNodeConditionFromStatus(node.Status, types.NodeConditionTypeReady)
condition.LastProbeTime = util.Now()
//condition.LastProbeTime = util.Now()
switch pod.Status.Phase {
case v1.PodRunning:
if condition.Status != types.ConditionStatusTrue {
Expand Down Expand Up @@ -370,7 +370,7 @@ func (nc *NodeController) syncDiskStatus(node *longhorn.Node) error {
}

condition := types.GetDiskConditionFromStatus(diskStatus, types.DiskConditionTypeSchedulable)
condition.LastProbeTime = util.Now()
//condition.LastProbeTime = util.Now()
// check disk pressure
if diskStatus.StorageAvailable <= disk.StorageMaximum*minimalAvailablePercentage/100 {
if condition.Status != types.ConditionStatusFalse {
Expand Down Expand Up @@ -437,7 +437,7 @@ func (nc *NodeController) syncNodeStatus(pod *v1.Pod, node *longhorn.Node) error
condition.Reason = ""
condition.Message = ""
}
condition.LastProbeTime = util.Now()
//condition.LastProbeTime = util.Now()
break
}
}
Expand Down
10 changes: 6 additions & 4 deletions controller/node_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,11 @@ func (s *TestSuite) TestSyncNode(c *C) {
n, err := lhClient.LonghornV1alpha1().Nodes(TestNamespace).Get(node.Name, metav1.GetOptions{})
c.Assert(err, IsNil)
for ctype, condition := range n.Status.Conditions {
if condition.Status != types.ConditionStatusUnknown {
c.Assert(condition.LastProbeTime, Not(Equals), "")
}
/*
if condition.Status != types.ConditionStatusUnknown {
c.Assert(condition.LastProbeTime, Not(Equals), "")
}
*/
condition.LastProbeTime = ""
condition.LastTransitionTime = ""
condition.Message = ""
Expand All @@ -435,7 +437,7 @@ func (s *TestSuite) TestSyncNode(c *C) {
for fsid, diskStatus := range diskConditions {
for ctype, condition := range diskStatus.Conditions {
if condition.Status != types.ConditionStatusUnknown {
c.Assert(condition.LastProbeTime, Not(Equals), "")
//c.Assert(condition.LastProbeTime, Not(Equals), "")
c.Assert(condition.LastTransitionTime, Not(Equals), "")
}
condition.LastProbeTime = ""
Expand Down
4 changes: 2 additions & 2 deletions controller/volume_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ func (vc *VolumeController) ReconcileVolumeState(v *longhorn.Volume, e *longhorn
condition.Status = types.ConditionStatusFalse
condition.LastTransitionTime = util.Now()
}
condition.LastProbeTime = util.Now()
//condition.LastProbeTime = util.Now()
condition.Reason = types.VolumeConditionReasonReplicaSchedulingFailure
v.Status.Conditions[types.VolumeConditionTypeScheduled] = condition
allScheduled = false
Expand All @@ -563,7 +563,7 @@ func (vc *VolumeController) ReconcileVolumeState(v *longhorn.Volume, e *longhorn
condition.Message = ""
condition.LastTransitionTime = util.Now()
}
condition.LastProbeTime = util.Now()
//condition.LastProbeTime = util.Now()
v.Status.Conditions[types.VolumeConditionTypeScheduled] = condition
}

Expand Down
8 changes: 5 additions & 3 deletions controller/volume_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,11 @@ func (s *TestSuite) runTestCases(c *C, testCases map[string]*VolumeTestCase) {
c.Assert(retV.Spec, DeepEquals, tc.expectVolume.Spec)
// mask timestamps
for ctype, condition := range retV.Status.Conditions {
if ctype == types.VolumeConditionTypeScheduled {
c.Assert(condition.LastProbeTime, Not(Equals), "")
}
/*
if ctype == types.VolumeConditionTypeScheduled {
c.Assert(condition.LastProbeTime, Not(Equals), "")
}
*/
condition.LastProbeTime = ""
condition.LastTransitionTime = ""
retV.Status.Conditions[ctype] = condition
Expand Down

0 comments on commit 9838a5f

Please sign in to comment.