Skip to content

Commit a9a03b4

Browse files
authored
Merge pull request #732 from rawmind0/clustersync
Updated WaitForClusterState function to check for condition last update before return error
2 parents d5c38e9 + 9d510a8 commit a9a03b4

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
## 1.17.2 (August 25, 2021)
2+
3+
FEATURES:
4+
5+
6+
7+
ENHANCEMENTS:
8+
9+
* Added verb `own` to policy rule
10+
* Updated `WaitForClusterState` function to check for condition last update before return error
11+
12+
BUG FIXES:
13+
14+
15+
116
## 1.17.1 (August 18, 2021)
217

318
FEATURES:

rancher2/config.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const (
2727
rancher2ManagementV2TypePrefix = "management.cattle.io"
2828
rancher2ReadyAnswer = "pong"
2929
rancher2RetriesWait = 5
30+
rancher2WaitFalseCond = 120
3031
rancher2RKEK8sSystemImageVersion = "2.3.0"
3132
rancher2NodeTemplateChangeVersion = "2.3.3" // Change node template id format
3233
rancher2TokeTTLMinutesVersion = "2.4.6" // ttl token is readed in minutes
@@ -735,8 +736,9 @@ func (c *Config) WaitForClusterState(clusterID, state string, interval time.Dura
735736
if obj.Conditions[i].Status == "True" {
736737
return obj, nil
737738
}
738-
// When condition is false, checking if the cluster is transitioning to still wait for condition
739-
if obj.Transitioning == "yes" {
739+
// When cluster condition is false, retrying if it has been updated for last rancher2WaitFalseCond seconds
740+
lastUpdate, err := time.Parse(time.RFC3339, obj.Conditions[i].LastUpdateTime)
741+
if err == nil && time.Since(lastUpdate) < rancher2WaitFalseCond*time.Second {
740742
break
741743
}
742744
return nil, fmt.Errorf("Cluster ID %s: %s", clusterID, obj.Conditions[i].Message)

0 commit comments

Comments
 (0)