@@ -29,7 +29,7 @@ const clusterHealthzUrl = `${conf.backend.apiServerHost}/healthz`;
29
29
/**
30
30
* The validate URL of the heapster to check that it is running.
31
31
*/
32
- const heapsterValidateUrl = `${ conf . backend . heapsterServerHost } /api/v1/model/stats/ ` ;
32
+ const heapsterValidateUrl = `${ conf . backend . heapsterServerHost } /api/v1/model/metrics/uptime ` ;
33
33
34
34
/**
35
35
* A Number, representing the ID value of the timer that is set for function which periodically
@@ -70,11 +70,12 @@ function heapsterHealthCheck(doneFn) {
70
70
if ( err ) {
71
71
return doneFn ( new Error ( err ) ) ;
72
72
}
73
- let statistics = JSON . parse ( stdout . trim ( ) ) ;
74
- let uptime = statistics . uptime ;
75
- if ( ! isNaN ( uptime ) ) {
76
- return doneFn ( ) ;
73
+ try {
74
+ JSON . parse ( stdout . trim ( ) ) ;
75
+ } catch ( err ) {
76
+ return doneFn ( err ) ;
77
77
}
78
+ return doneFn ( 'ok' ) ;
78
79
} ) ;
79
80
}
80
81
@@ -121,11 +122,13 @@ gulp.task('wait-for-heapster', function(doneFn) {
121
122
counter += 1 ;
122
123
123
124
// constantly query the heapster until it is properly running
124
- heapsterHealthCheck ( function ( ) {
125
- gulpUtil . log ( gulpUtil . colors . magenta ( 'Heapster is up and running.' ) ) ;
126
- clearTimeout ( isHeapsterRunningSetIntervalHandler ) ;
127
- isHeapsterRunningSetIntervalHandler = null ;
128
- doneFn ( ) ;
125
+ heapsterHealthCheck ( function ( result ) {
126
+ if ( result === 'ok' && isHeapsterRunningSetIntervalHandler !== null ) {
127
+ gulpUtil . log ( gulpUtil . colors . magenta ( 'Heapster is up and running.' ) ) ;
128
+ clearTimeout ( isHeapsterRunningSetIntervalHandler ) ;
129
+ isHeapsterRunningSetIntervalHandler = null ;
130
+ doneFn ( ) ;
131
+ }
129
132
} ) ;
130
133
}
131
134
} ) ;
0 commit comments