File tree 2 files changed +23
-1
lines changed
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ module github.com/datainfrahq/operator-runtime
3
3
go 1.19
4
4
5
5
require (
6
+ github.com/go-logr/logr v1.2.3
6
7
k8s.io/api v0.26.1
7
8
k8s.io/apimachinery v0.26.2
8
9
k8s.io/client-go v0.26.1
@@ -13,7 +14,6 @@ require (
13
14
github.com/davecgh/go-spew v1.1.1 // indirect
14
15
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
15
16
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
16
- github.com/go-logr/logr v1.2.3 // indirect
17
17
github.com/go-openapi/jsonpointer v0.19.5 // indirect
18
18
github.com/go-openapi/jsonreference v0.20.0 // indirect
19
19
github.com/go-openapi/swag v0.19.14 // indirect
Original file line number Diff line number Diff line change @@ -4,10 +4,17 @@ import (
4
4
"crypto/sha1"
5
5
"encoding/base64"
6
6
"encoding/json"
7
+ "os"
8
+ "time"
7
9
10
+ "github.com/go-logr/logr"
8
11
"sigs.k8s.io/controller-runtime/pkg/client"
9
12
)
10
13
14
+ const (
15
+ ReconcileWait string = "RECONCILE_WAIT"
16
+ )
17
+
11
18
type ConfigMapHash struct {
12
19
Object client.Object
13
20
}
@@ -69,3 +76,18 @@ func unique[T comparable](s []T) []T {
69
76
}
70
77
return result
71
78
}
79
+
80
+ func LookupReconcileTime (log logr.Logger ) time.Duration {
81
+ val , exists := os .LookupEnv (ReconcileWait )
82
+ if ! exists {
83
+ return time .Second * 10
84
+ } else {
85
+ v , err := time .ParseDuration (val )
86
+ if err != nil {
87
+ log .Error (err , err .Error ())
88
+ // Exit Program if not valid
89
+ os .Exit (1 )
90
+ }
91
+ return v
92
+ }
93
+ }
You can’t perform that action at this time.
0 commit comments