1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-04-09 10:42:22 +00:00

added function for get cache

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
This commit is contained in:
NoSkillGirl 2021-06-16 06:54:34 +05:30
parent e677e91679
commit d6920e1acf
2 changed files with 13 additions and 0 deletions

View file

@ -78,6 +78,12 @@ var (
//VerifyMutatingWebhookServicePath is the path for verify webhook(used to veryfing if admission control is enabled and active)
VerifyMutatingWebhookServicePath = "/verifymutate"
// GetCachePath is the path for getting latest cache
GetCachePath = "/cache"
// CacheSyncPath is the path for syncing the cache
CacheSyncPath = "/cache/sync"
// LivenessServicePath is the path for check liveness health
LivenessServicePath = "/health/liveness"

View file

@ -215,6 +215,13 @@ func NewWebhookServer(
mux.HandlerFunc("POST", config.PolicyValidatingWebhookServicePath, ws.handlerFunc(ws.policyValidation, true))
mux.HandlerFunc("POST", config.VerifyMutatingWebhookServicePath, ws.handlerFunc(ws.verifyHandler, false))
mux.HandlerFunc("GET", config.GetCachePath, func(w http.ResponseWriter, r *http.Request) {
defer r.Body.Close()
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
json.NewEncoder(w).Encode(pCache)
})
// Handle Liveness responds to a Kubernetes Liveness probe
// Fail this request if Kubernetes should restart this instance
mux.HandlerFunc("GET", config.LivenessServicePath, func(w http.ResponseWriter, r *http.Request) {