File tree Expand file tree Collapse file tree 5 files changed +45
-0
lines changed Expand file tree Collapse file tree 5 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import (
23
23
"fmt"
24
24
_ "net/http/pprof"
25
25
"os"
26
+ goruntime "runtime"
26
27
"time"
27
28
28
29
// +kubebuilder:scaffold:imports
81
82
watchFilterValue string
82
83
watchNamespace string
83
84
profilerAddress string
85
+ enableContentionProfiling bool
84
86
clusterConcurrency int
85
87
kubeadmConfigConcurrency int
86
88
syncPeriod time.Duration
@@ -119,6 +121,9 @@ func InitFlags(fs *pflag.FlagSet) {
119
121
fs .StringVar (& profilerAddress , "profiler-address" , "" ,
120
122
"Bind address to expose the pprof profiler (e.g. localhost:6060)" )
121
123
124
+ fs .BoolVar (& enableContentionProfiling , "contention-profiling" , false ,
125
+ "Enable block profiling, if profiler-address is set." )
126
+
122
127
fs .IntVar (& clusterConcurrency , "cluster-concurrency" , 10 ,
123
128
"Number of clusters to process simultaneously" )
124
129
@@ -184,6 +189,10 @@ func main() {
184
189
watchNamespaces = []string {watchNamespace }
185
190
}
186
191
192
+ if profilerAddress != "" && enableContentionProfiling {
193
+ goruntime .SetBlockProfileRate (1 )
194
+ }
195
+
187
196
ctrlOptions := ctrl.Options {
188
197
Scheme : scheme ,
189
198
MetricsBindAddress : metricsBindAddr ,
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import (
23
23
"fmt"
24
24
_ "net/http/pprof"
25
25
"os"
26
+ goruntime "runtime"
26
27
"time"
27
28
28
29
// +kubebuilder:scaffold:imports
86
87
watchFilterValue string
87
88
watchNamespace string
88
89
profilerAddress string
90
+ enableContentionProfiling bool
89
91
kubeadmControlPlaneConcurrency int
90
92
syncPeriod time.Duration
91
93
restConfigQPS float32
@@ -124,6 +126,9 @@ func InitFlags(fs *pflag.FlagSet) {
124
126
fs .StringVar (& profilerAddress , "profiler-address" , "" ,
125
127
"Bind address to expose the pprof profiler (e.g. localhost:6060)" )
126
128
129
+ fs .BoolVar (& enableContentionProfiling , "contention-profiling" , false ,
130
+ "Enable block profiling, if profiler-address is set." )
131
+
127
132
fs .IntVar (& kubeadmControlPlaneConcurrency , "kubeadmcontrolplane-concurrency" , 10 ,
128
133
"Number of kubeadm control planes to process simultaneously" )
129
134
@@ -188,6 +193,10 @@ func main() {
188
193
watchNamespaces = []string {watchNamespace }
189
194
}
190
195
196
+ if profilerAddress != "" && enableContentionProfiling {
197
+ goruntime .SetBlockProfileRate (1 )
198
+ }
199
+
191
200
ctrlOptions := ctrl.Options {
192
201
Scheme : scheme ,
193
202
MetricsBindAddress : metricsBindAddr ,
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import (
22
22
"flag"
23
23
"fmt"
24
24
"os"
25
+ goruntime "runtime"
25
26
"time"
26
27
27
28
// +kubebuilder:scaffold:imports
86
87
watchNamespace string
87
88
watchFilterValue string
88
89
profilerAddress string
90
+ enableContentionProfiling bool
89
91
clusterTopologyConcurrency int
90
92
clusterClassConcurrency int
91
93
clusterConcurrency int
@@ -159,6 +161,9 @@ func InitFlags(fs *pflag.FlagSet) {
159
161
fs .StringVar (& profilerAddress , "profiler-address" , "" ,
160
162
"Bind address to expose the pprof profiler (e.g. localhost:6060)" )
161
163
164
+ fs .BoolVar (& enableContentionProfiling , "contention-profiling" , false ,
165
+ "Enable block profiling, if profiler-address is set." )
166
+
162
167
fs .IntVar (& clusterTopologyConcurrency , "clustertopology-concurrency" , 10 ,
163
168
"Number of clusters to process simultaneously" )
164
169
@@ -252,6 +257,10 @@ func main() {
252
257
watchNamespaces = []string {watchNamespace }
253
258
}
254
259
260
+ if profilerAddress != "" && enableContentionProfiling {
261
+ goruntime .SetBlockProfileRate (1 )
262
+ }
263
+
255
264
ctrlOptions := ctrl.Options {
256
265
Scheme : scheme ,
257
266
MetricsBindAddress : metricsBindAddr ,
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import (
22
22
"flag"
23
23
"fmt"
24
24
"os"
25
+ goruntime "runtime"
25
26
"time"
26
27
27
28
// +kubebuilder:scaffold:imports
73
74
watchNamespace string
74
75
watchFilterValue string
75
76
profilerAddress string
77
+ enableContentionProfiling bool
76
78
concurrency int
77
79
syncPeriod time.Duration
78
80
restConfigQPS float32
@@ -125,6 +127,9 @@ func initFlags(fs *pflag.FlagSet) {
125
127
fs .StringVar (& profilerAddress , "profiler-address" , "" ,
126
128
"Bind address to expose the pprof profiler (e.g. localhost:6060)" )
127
129
130
+ fs .BoolVar (& enableContentionProfiling , "contention-profiling" , false ,
131
+ "Enable block profiling, if profiler-address is set." )
132
+
128
133
fs .IntVar (& concurrency , "concurrency" , 10 ,
129
134
"The number of docker machines to process simultaneously" )
130
135
@@ -186,6 +191,10 @@ func main() {
186
191
watchNamespaces = []string {watchNamespace }
187
192
}
188
193
194
+ if profilerAddress != "" && enableContentionProfiling {
195
+ goruntime .SetBlockProfileRate (1 )
196
+ }
197
+
189
198
ctrlOptions := ctrl.Options {
190
199
Scheme : scheme ,
191
200
MetricsBindAddress : metricsBindAddr ,
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import (
22
22
"flag"
23
23
"fmt"
24
24
"os"
25
+ goruntime "runtime"
25
26
"time"
26
27
27
28
"github.com/spf13/pflag"
68
69
watchNamespace string
69
70
watchFilterValue string
70
71
profilerAddress string
72
+ enableContentionProfiling bool
71
73
clusterConcurrency int
72
74
machineConcurrency int
73
75
syncPeriod time.Duration
@@ -121,6 +123,9 @@ func InitFlags(fs *pflag.FlagSet) {
121
123
fs .StringVar (& profilerAddress , "profiler-address" , "" ,
122
124
"Bind address to expose the pprof profiler (e.g. localhost:6060)" )
123
125
126
+ fs .BoolVar (& enableContentionProfiling , "contention-profiling" , false ,
127
+ "Enable block profiling, if profiler-address is set." )
128
+
124
129
fs .IntVar (& clusterConcurrency , "cluster-concurrency" , 10 ,
125
130
"Number of clusters to process simultaneously" )
126
131
@@ -180,6 +185,10 @@ func main() {
180
185
watchNamespaces = []string {watchNamespace }
181
186
}
182
187
188
+ if profilerAddress != "" && enableContentionProfiling {
189
+ goruntime .SetBlockProfileRate (1 )
190
+ }
191
+
183
192
ctrlOptions := ctrl.Options {
184
193
Scheme : scheme ,
185
194
MetricsBindAddress : metricsBindAddr ,
You can’t perform that action at this time.
0 commit comments