| 1 |
/* |
| 2 |
copyright 2020 the kubernetes authors. |
| 3 |
|
| 4 |
licensed under the apache license, version 2.0 (the "license"); |
| 5 |
you may not use this file except in compliance with the license. |
| 6 |
you may obtain a copy of the license at |
| 7 |
|
| 8 |
http://www.apache.org/licenses/license-2.0 |
| 9 |
|
| 10 |
unless required by applicable law or agreed to in writing, software |
| 11 |
distributed under the license is distributed on an "as is" basis, |
| 12 |
without warranties or conditions of any kind, either express or implied. |
| 13 |
see the license for the specific language governing permissions and |
| 14 |
limitations under the license. |
| 15 |
*/ |
| 16 |
|
| 17 |
package server |
| 18 |
|
| 19 |
// ReadinessManager supports checking if the proxy server is ready. |
| 20 |
type ReadinessManager interface { |
| 21 |
// Ready returns if the proxy server is ready. If not, also return an |
| 22 |
// error message. |
| 23 |
Ready() (bool, string) |
| 24 |
} |
| 25 |
|
| 26 |
var _ ReadinessManager = &DefaultBackendStorage{} |
| 27 |
|
| 28 |
func (s *DefaultBackendStorage) Ready() (bool, string) { |
| 29 |
if s.NumBackends() == 0 { |
| 30 |
return false, "no connection to any proxy agent" |
| 31 |
} |
| 32 |
return true, "" |
| 33 |
} |