| 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 serverscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/pkg/server`/ |
| 18 | |
| 19 | // ReadinessManager supports checking if the proxy server is ready. |
| 20 | type ReadinessManagerscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/pkg/server`/ReadinessManager# interface { |
| 21 | // Ready returns if the proxy server is ready. If not, also return an |
| 22 | // error message. |
| 23 | Readyscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/pkg/server`/ReadinessManager#Ready.() (bool, string) |
| 24 | } |
| 25 | |
| 26 | var _ ReadinessManagerscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/pkg/server`/ReadinessManager# = &DefaultBackendStoragescip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/pkg/server`/DefaultBackendStorage#{} |
| 27 | |
| 28 | func (s *DefaultBackendStoragescip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/pkg/server`/DefaultBackendStorage#) Readyscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/pkg/server`/DefaultBackendStorage#Ready().() (bool, string) { |
| 29 | if s.NumBackendsscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/pkg/server`/DefaultBackendStorage#NumBackends().() == 0 { |
| 30 | return false, "no connection to any proxy agent" |
| 31 | } |
| 32 | return true, "" |
| 33 | } |