This repository has been archived by the owner on Oct 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 255
Liveness probe #309
Merged
Merged
Liveness probe #309
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
067d3ca
Health and readiness probe implementation.
kkmsft b7a7745
Add health and readiness probe to NMI
kkmsft 63f7638
Add health and readiness probe to MIC
kkmsft 68e11d5
Add health and readiness probe parameters to deployment
kkmsft 46ecdf6
Fix logging to reflect the action
kkmsft 4c0c7ec
Increase the first time check interval and return active/not active v…
kkmsft 2875d15
Run the nmi iptables rules instantly thus avoiding waiting for the tick
kkmsft e13d665
Add end to end test
kkmsft 02206ca
Fix the backward compatible test to use old deploy files and other fixes
kkmsft 2acac42
Fix the printing of index
kkmsft 3d0888d
Remove readiness probe and respond with state in /healthz content
kkmsft c18ae4a
Fix tests to check only healthz
kkmsft 5675020
Adress review comments
kkmsft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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,45 @@ | ||
package probes | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/golang/glog" | ||
) | ||
|
||
// InitHealthProbe - sets up a health probe which responds with success (200 - OK) once its initialized. | ||
// The contents of the healthz endpoint will be the string "Active" if the condition is satisfied. | ||
// The condition is set to true when the sync cycle has become active in case of MIC and the iptables | ||
// rules set in case of NMI. | ||
func InitHealthProbe(condition *bool) { | ||
http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) { | ||
w.WriteHeader(200) | ||
if *condition { | ||
w.Write([]byte("Active")) | ||
} else { | ||
w.Write([]byte("Not Active")) | ||
} | ||
}) | ||
} | ||
|
||
func startAsync(port string) { | ||
err := http.ListenAndServe(":"+port, nil) | ||
if err != nil { | ||
glog.Fatalf("Http listen and serve error: %+v", err) | ||
} else { | ||
glog.V(1).Infof("Http listen and serve started !") | ||
} | ||
} | ||
|
||
//Start - Starts the required http server to start the probe to respond. | ||
func Start(port string) { | ||
go startAsync(port) | ||
} | ||
|
||
// InitAndStart - Initialize the default probes and starts the http listening port. | ||
func InitAndStart(port string, condition *bool) { | ||
InitHealthProbe(condition) | ||
glog.V(1).Infof("Initialized health probe") | ||
// start the probe. | ||
Start(port) | ||
glog.Infof("Initialized and started health probe") | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than having 2 different deployment files, we should just template the single file to include new specs/ignore based on a boolean flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds good. Will take it up in a future PR.