-
Notifications
You must be signed in to change notification settings - Fork 28
Issue#138 add probes and resource limits #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
AkarshES
merged 9 commits into
oracle:main
from
amaanx86:138-add-probes-and-resource-limits
Mar 31, 2026
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f23fb83
Fix #138: Add readiness probe to OCI Native Ingress Controller
amaanx86 c97ce17
Fix #138: Add liveness probe to OCI Native Ingress Controller
amaanx86 a8d2fe7
Fix #138: Document health probes configuration in values.yaml
amaanx86 eb76d65
Fix #138: Update health probes to use HTTP endpoints on metrics server
amaanx86 d963ee6
Fix #138: Mark informer caches as synced for health checks
amaanx86 614f777
Fix #138: Add health check endpoints and controller readiness tracking
amaanx86 0373bae
Fix #138: Add health checker implementation for readiness and livenes…
amaanx86 a777eb2
Fix #138: Update probe comments in values.yaml
amaanx86 11faf4a
Fix #138: Move health probe comments to metrics section
amaanx86 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,85 @@ | ||
| /* | ||
| * | ||
| * * OCI Native Ingress Controller | ||
| * * | ||
| * * Copyright (c) 2023 Oracle America, Inc. and its affiliates. | ||
| * * Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ | ||
| * | ||
| */ | ||
|
|
||
| package server | ||
|
|
||
| import ( | ||
| "encoding/json" | ||
| "net/http" | ||
| "sync" | ||
| "sync/atomic" | ||
| ) | ||
|
|
||
| type HealthChecker struct { | ||
| mu sync.RWMutex | ||
| cachesSynced atomic.Bool | ||
| controllersReady atomic.Bool | ||
| } | ||
|
|
||
| type HealthStatus struct { | ||
| Status string `json:"status"` | ||
| CachesSynced bool `json:"cachesSynced"` | ||
| ControllersReady bool `json:"controllersReady"` | ||
| } | ||
|
|
||
| var globalHealthChecker *HealthChecker | ||
|
|
||
| func NewHealthChecker() *HealthChecker { | ||
| return &HealthChecker{ | ||
| cachesSynced: atomic.Bool{}, | ||
| controllersReady: atomic.Bool{}, | ||
| } | ||
| } | ||
|
|
||
| func GetHealthChecker() *HealthChecker { | ||
| if globalHealthChecker == nil { | ||
| globalHealthChecker = NewHealthChecker() | ||
| } | ||
| return globalHealthChecker | ||
| } | ||
|
|
||
| func (hc *HealthChecker) SetCachesSynced(synced bool) { | ||
| hc.cachesSynced.Store(synced) | ||
| } | ||
|
|
||
| func (hc *HealthChecker) SetControllersReady(ready bool) { | ||
| hc.controllersReady.Store(ready) | ||
| } | ||
|
|
||
| // Readiness check - pod should receive traffic | ||
| func (hc *HealthChecker) HandleReadiness(w http.ResponseWriter, r *http.Request) { | ||
| status := HealthStatus{ | ||
| Status: "unhealthy", | ||
| CachesSynced: hc.cachesSynced.Load(), | ||
| ControllersReady: hc.controllersReady.Load(), | ||
| } | ||
|
|
||
| if status.CachesSynced && status.ControllersReady { | ||
| status.Status = "healthy" | ||
| w.WriteHeader(http.StatusOK) | ||
| } else { | ||
| w.WriteHeader(http.StatusServiceUnavailable) | ||
| } | ||
|
|
||
| w.Header().Set("Content-Type", "application/json") | ||
| json.NewEncoder(w).Encode(status) | ||
| } | ||
|
|
||
| // Liveness check - pod should be restarted if unhealthy | ||
| func (hc *HealthChecker) HandleLiveness(w http.ResponseWriter, r *http.Request) { | ||
| status := HealthStatus{ | ||
| Status: "alive", | ||
| CachesSynced: hc.cachesSynced.Load(), | ||
| ControllersReady: hc.controllersReady.Load(), | ||
| } | ||
|
|
||
| w.WriteHeader(http.StatusOK) | ||
| w.Header().Set("Content-Type", "application/json") | ||
| json.NewEncoder(w).Encode(status) | ||
| } |
This file contains hidden or 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
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.
The comment is misplaced on webhook Port.
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.
i have moved it to metrics server @nirpai
requesting approval on PR @nirpai @AkarshES