-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check CloudAgent reachability in caph liveness probe (#266)
* Init commit: Check cloudagent reachability in liveness probe * Take the liveness probe values are arguments to the binary and default those values * Changes post merge conflict * Remove exponential backoff, liveness probe parameters should be good enough * Revert image change * Remove unused parameters --------- Co-authored-by: Pavan Neerudu <[email protected]>
- Loading branch information
1 parent
b97f32c
commit 5024947
Showing
2 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package network | ||
|
||
import ( | ||
"fmt" | ||
"net" | ||
"net/http" | ||
"time" | ||
|
||
"sigs.k8s.io/controller-runtime/pkg/healthz" | ||
) | ||
|
||
func EndpointChecker(targetIPAddress string) healthz.Checker { | ||
return func(req *http.Request) error { | ||
dialTimeout := 1 * time.Second | ||
|
||
_, err := net.DialTimeout("tcp", targetIPAddress, dialTimeout) | ||
if err != nil { | ||
return fmt.Errorf("failed to dial: %v", err) | ||
} | ||
|
||
return nil | ||
} | ||
} |