You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@yunikorn.apache.org by GitBox <gi...@apache.org> on 2021/10/27 14:52:57 UTC
[GitHub] [incubator-yunikorn-k8shim] pbacsko opened a new pull request #324: [YUNIKORN-927] Improve logging in the yunikorn admission controller
pbacsko opened a new pull request #324:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/324
### What is this PR for?
Improve logging for the admission controller for debuggability.
### What type of PR is it?
* [ ] - Bug Fix
* [x] - Improvement
* [ ] - Feature
* [ ] - Documentation
* [ ] - Hot Fix
* [ ] - Refactoring
### What is the Jira issue?
https://issues.apache.org/jira/browse/YUNIKORN-927
### How should this be tested?
### Screenshots (if appropriate)
### Questions:
* [ ] - The licenses files need update.
* [ ] - There is breaking changes for older versions.
* [ ] - It needs documentation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@yunikorn.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-yunikorn-k8shim] yangwwei commented on a change in pull request #324: [YUNIKORN-927] Improve logging in the yunikorn admission controller
Posted by GitBox <gi...@apache.org>.
yangwwei commented on a change in pull request #324:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/324#discussion_r737696783
##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -311,10 +328,14 @@ func (c *admissionController) serve(w http.ResponseWriter, r *http.Request) {
resp, err := json.Marshal(admissionReview)
if err != nil {
- http.Error(w, fmt.Sprintf("could not encode response: %v", err), http.StatusInternalServerError)
+ errMessage := fmt.Sprintf("could not encode response: %v", err)
+ log.Logger().Error(errMessage)
Review comment:
you can pass the err object to log.Logger().Error directly, that will print the stacktrace as well.
##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -311,10 +328,14 @@ func (c *admissionController) serve(w http.ResponseWriter, r *http.Request) {
resp, err := json.Marshal(admissionReview)
if err != nil {
- http.Error(w, fmt.Sprintf("could not encode response: %v", err), http.StatusInternalServerError)
+ errMessage := fmt.Sprintf("could not encode response: %v", err)
+ log.Logger().Error(errMessage)
+ http.Error(w, errMessage, http.StatusInternalServerError)
}
if _, err = w.Write(resp); err != nil {
- http.Error(w, fmt.Sprintf("could not write response: %v", err), http.StatusInternalServerError)
+ errMessage := fmt.Sprintf("could not write response: %v", err)
+ log.Logger().Error(errMessage)
Review comment:
same as above
##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -101,10 +107,16 @@ func (c *admissionController) mutate(ar *v1beta1.AdmissionReview) *v1beta1.Admis
patch = updateSchedulerName(patch)
patch = updateLabels(namespace, &pod, patch)
+ log.Logger().Info(fmt.Sprintf("generated patch for pod %s\n", pod.Name),
+ zap.Any("patch", patch))
+ } else {
+ log.Logger().Info(fmt.Sprintf("request kind (%s) is not pod, but %s. Ignored.\n",
+ uid, requestKind))
Review comment:
better format needed
##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -295,10 +309,13 @@ func (c *admissionController) serve(w http.ResponseWriter, r *http.Request) {
Message: err.Error(),
},
}
- } else if r.URL.Path == mutateURL {
+ } else if urlPath == mutateURL {
admissionResponse = c.mutate(&ar)
- } else if r.URL.Path == validateConfURL {
+ } else if urlPath == validateConfURL {
admissionResponse = c.validateConf(&ar)
+ } else {
+ log.Logger().Warn(fmt.Sprintf("Request is neither mutation nor validation: %s\n",
+ urlPath))
Review comment:
format the log
##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -229,6 +239,8 @@ func (c *admissionController) validateConf(ar *v1beta1.AdmissionReview) *v1beta1
},
}
}
+ } else {
+ log.Logger().Warn(fmt.Sprintf("request kind is not configmap, but %s. Ignored.\n", requestKind))
Review comment:
format the log
##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -101,10 +107,16 @@ func (c *admissionController) mutate(ar *v1beta1.AdmissionReview) *v1beta1.Admis
patch = updateSchedulerName(patch)
patch = updateLabels(namespace, &pod, patch)
+ log.Logger().Info(fmt.Sprintf("generated patch for pod %s\n", pod.Name),
+ zap.Any("patch", patch))
Review comment:
our logging package provides a easier way of logging, fmt package is not needed here, see an example:
```
log.Logger().Info("AdmissionReview",
zap.Any("Kind", req.Kind),
zap.String("Namespace", namespace),
zap.String("UID", string(req.UID)),
zap.String("Operation", string(req.Operation)),
zap.Any("UserInfo", req.UserInfo))
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@yunikorn.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-yunikorn-k8shim] wilfred-s closed pull request #324: [YUNIKORN-927] Improve logging in the yunikorn admission controller
Posted by GitBox <gi...@apache.org>.
wilfred-s closed pull request #324:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/324
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@yunikorn.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-yunikorn-k8shim] wilfred-s commented on a change in pull request #324: [YUNIKORN-927] Improve logging in the yunikorn admission controller
Posted by GitBox <gi...@apache.org>.
wilfred-s commented on a change in pull request #324:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/324#discussion_r737904996
##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -311,10 +328,14 @@ func (c *admissionController) serve(w http.ResponseWriter, r *http.Request) {
resp, err := json.Marshal(admissionReview)
if err != nil {
- http.Error(w, fmt.Sprintf("could not encode response: %v", err), http.StatusInternalServerError)
+ errMessage := fmt.Sprintf("could not encode response: %v", err)
+ log.Logger().Error(errMessage)
+ http.Error(w, errMessage, http.StatusInternalServerError)
}
if _, err = w.Write(resp); err != nil {
- http.Error(w, fmt.Sprintf("could not write response: %v", err), http.StatusInternalServerError)
+ errMessage := fmt.Sprintf("could not write response: %v", err)
+ log.Logger().Error(errMessage)
Review comment:
see above we need the sting in the http call
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@yunikorn.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-yunikorn-k8shim] codecov[bot] edited a comment on pull request #324: [YUNIKORN-927] Improve logging in the yunikorn admission controller
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #324:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/324#issuecomment-953017187
# [Codecov](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#324](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (abca608) into [master](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/commit/c47ed51f075c5af5910f71da40e7e68699a9abae?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c47ed51) will **increase** coverage by `1.91%`.
> The diff coverage is `66.12%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/graphs/tree.svg?width=650&height=150&src=pr&token=LZImIuvleR&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #324 +/- ##
==========================================
+ Coverage 59.75% 61.66% +1.91%
==========================================
Files 35 39 +4
Lines 3133 3626 +493
==========================================
+ Hits 1872 2236 +364
- Misses 1180 1288 +108
- Partials 81 102 +21
```
| [Impacted Files](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [pkg/appmgmt/appmgmt\_recovery.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwcG1nbXQvYXBwbWdtdF9yZWNvdmVyeS5nbw==) | `67.50% <0.00%> (-8.18%)` | :arrow_down: |
| [pkg/cache/amprotocol\_mock.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NhY2hlL2FtcHJvdG9jb2xfbW9jay5nbw==) | `0.00% <0.00%> (ø)` | |
| [pkg/cache/context\_recovery.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NhY2hlL2NvbnRleHRfcmVjb3ZlcnkuZ28=) | `45.23% <0.00%> (-1.11%)` | :arrow_down: |
| [pkg/common/events/recorder\_mock.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbW1vbi9ldmVudHMvcmVjb3JkZXJfbW9jay5nbw==) | `0.00% <0.00%> (ø)` | |
| [pkg/common/events/states.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbW1vbi9ldmVudHMvc3RhdGVzLmdv) | `0.00% <0.00%> (ø)` | |
| [pkg/shim/main.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3NoaW0vbWFpbi5nbw==) | `0.00% <0.00%> (ø)` | |
| [...missioncontrollers/webhook/admission\_controller.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3BsdWdpbi9hZG1pc3Npb25jb250cm9sbGVycy93ZWJob29rL2FkbWlzc2lvbl9jb250cm9sbGVyLmdv) | `29.12% <2.00%> (-3.62%)` | :arrow_down: |
| [pkg/shim/scheduler.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3NoaW0vc2NoZWR1bGVyLmdv) | `78.41% <20.00%> (-1.15%)` | :arrow_down: |
| [pkg/cache/context.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NhY2hlL2NvbnRleHQuZ28=) | `37.36% <20.45%> (-3.72%)` | :arrow_down: |
| [pkg/common/events/recorder.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbW1vbi9ldmVudHMvcmVjb3JkZXIuZ28=) | `33.33% <33.33%> (+3.33%)` | :arrow_up: |
| ... and [33 more](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [a8b472f...abca608](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@yunikorn.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-yunikorn-k8shim] codecov[bot] edited a comment on pull request #324: [YUNIKORN-927] Improve logging in the yunikorn admission controller
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #324:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/324#issuecomment-953017187
# [Codecov](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#324](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (db099b4) into [master](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/commit/c47ed51f075c5af5910f71da40e7e68699a9abae?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c47ed51) will **increase** coverage by `1.91%`.
> The diff coverage is `67.70%`.
> :exclamation: Current head db099b4 differs from pull request most recent head abca608. Consider uploading reports for the commit abca608 to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/graphs/tree.svg?width=650&height=150&src=pr&token=LZImIuvleR&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #324 +/- ##
==========================================
+ Coverage 59.75% 61.66% +1.91%
==========================================
Files 35 39 +4
Lines 3133 3626 +493
==========================================
+ Hits 1872 2236 +364
- Misses 1180 1288 +108
- Partials 81 102 +21
```
| [Impacted Files](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [pkg/appmgmt/appmgmt\_recovery.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwcG1nbXQvYXBwbWdtdF9yZWNvdmVyeS5nbw==) | `67.50% <0.00%> (-8.18%)` | :arrow_down: |
| [pkg/cache/amprotocol\_mock.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NhY2hlL2FtcHJvdG9jb2xfbW9jay5nbw==) | `0.00% <0.00%> (ø)` | |
| [pkg/cache/context\_recovery.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NhY2hlL2NvbnRleHRfcmVjb3ZlcnkuZ28=) | `45.23% <0.00%> (-1.11%)` | :arrow_down: |
| [pkg/common/events/recorder\_mock.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbW1vbi9ldmVudHMvcmVjb3JkZXJfbW9jay5nbw==) | `0.00% <0.00%> (ø)` | |
| [pkg/common/events/states.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbW1vbi9ldmVudHMvc3RhdGVzLmdv) | `0.00% <0.00%> (ø)` | |
| [pkg/shim/main.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3NoaW0vbWFpbi5nbw==) | `0.00% <0.00%> (ø)` | |
| [...missioncontrollers/webhook/admission\_controller.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3BsdWdpbi9hZG1pc3Npb25jb250cm9sbGVycy93ZWJob29rL2FkbWlzc2lvbl9jb250cm9sbGVyLmdv) | `29.12% <3.33%> (-3.62%)` | :arrow_down: |
| [pkg/shim/scheduler.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3NoaW0vc2NoZWR1bGVyLmdv) | `78.41% <20.00%> (-1.15%)` | :arrow_down: |
| [pkg/cache/context.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NhY2hlL2NvbnRleHQuZ28=) | `37.36% <20.45%> (-3.72%)` | :arrow_down: |
| [pkg/common/events/recorder.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbW1vbi9ldmVudHMvcmVjb3JkZXIuZ28=) | `33.33% <33.33%> (+3.33%)` | :arrow_up: |
| ... and [33 more](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [a8b472f...abca608](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@yunikorn.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-yunikorn-k8shim] codecov[bot] commented on pull request #324: [YUNIKORN-927] Improve logging in the yunikorn admission controller
Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on pull request #324:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/324#issuecomment-953017187
# [Codecov](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#324](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (db099b4) into [master](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/commit/c47ed51f075c5af5910f71da40e7e68699a9abae?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c47ed51) will **increase** coverage by `1.91%`.
> The diff coverage is `67.70%`.
> :exclamation: Current head db099b4 differs from pull request most recent head 55e9da8. Consider uploading reports for the commit 55e9da8 to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/graphs/tree.svg?width=650&height=150&src=pr&token=LZImIuvleR&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #324 +/- ##
==========================================
+ Coverage 59.75% 61.66% +1.91%
==========================================
Files 35 39 +4
Lines 3133 3626 +493
==========================================
+ Hits 1872 2236 +364
- Misses 1180 1288 +108
- Partials 81 102 +21
```
| [Impacted Files](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [pkg/appmgmt/appmgmt\_recovery.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2FwcG1nbXQvYXBwbWdtdF9yZWNvdmVyeS5nbw==) | `67.50% <0.00%> (-8.18%)` | :arrow_down: |
| [pkg/cache/amprotocol\_mock.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NhY2hlL2FtcHJvdG9jb2xfbW9jay5nbw==) | `0.00% <0.00%> (ø)` | |
| [pkg/cache/context\_recovery.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NhY2hlL2NvbnRleHRfcmVjb3ZlcnkuZ28=) | `45.23% <0.00%> (-1.11%)` | :arrow_down: |
| [pkg/common/events/recorder\_mock.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbW1vbi9ldmVudHMvcmVjb3JkZXJfbW9jay5nbw==) | `0.00% <0.00%> (ø)` | |
| [pkg/common/events/states.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbW1vbi9ldmVudHMvc3RhdGVzLmdv) | `0.00% <0.00%> (ø)` | |
| [pkg/shim/main.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3NoaW0vbWFpbi5nbw==) | `0.00% <0.00%> (ø)` | |
| [...missioncontrollers/webhook/admission\_controller.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3BsdWdpbi9hZG1pc3Npb25jb250cm9sbGVycy93ZWJob29rL2FkbWlzc2lvbl9jb250cm9sbGVyLmdv) | `29.12% <3.33%> (-3.62%)` | :arrow_down: |
| [pkg/shim/scheduler.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL3NoaW0vc2NoZWR1bGVyLmdv) | `78.41% <20.00%> (-1.15%)` | :arrow_down: |
| [pkg/cache/context.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NhY2hlL2NvbnRleHQuZ28=) | `37.36% <20.45%> (-3.72%)` | :arrow_down: |
| [pkg/common/events/recorder.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGtnL2NvbW1vbi9ldmVudHMvcmVjb3JkZXIuZ28=) | `33.33% <33.33%> (+3.33%)` | :arrow_up: |
| ... and [33 more](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [a8b472f...55e9da8](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/324?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@yunikorn.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-yunikorn-k8shim] wilfred-s commented on a change in pull request #324: [YUNIKORN-927] Improve logging in the yunikorn admission controller
Posted by GitBox <gi...@apache.org>.
wilfred-s commented on a change in pull request #324:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/324#discussion_r737904843
##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -311,10 +328,14 @@ func (c *admissionController) serve(w http.ResponseWriter, r *http.Request) {
resp, err := json.Marshal(admissionReview)
if err != nil {
- http.Error(w, fmt.Sprintf("could not encode response: %v", err), http.StatusInternalServerError)
+ errMessage := fmt.Sprintf("could not encode response: %v", err)
+ log.Logger().Error(errMessage)
Review comment:
We need to build the errMessage anyway for the return in the `http.Error` call so we have it might as well log it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@yunikorn.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-yunikorn-k8shim] wilfred-s commented on a change in pull request #324: [YUNIKORN-927] Improve logging in the yunikorn admission controller
Posted by GitBox <gi...@apache.org>.
wilfred-s commented on a change in pull request #324:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/324#discussion_r737921596
##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -229,6 +239,8 @@ func (c *admissionController) validateConf(ar *v1beta1.AdmissionReview) *v1beta1
},
}
}
+ } else {
Review comment:
can we turn this around:
```
if requestKind != "ConfigMap" {
log <not a configmap>
return <allowed response>
}
<check config map>
```
##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -72,16 +74,20 @@ func (c *admissionController) mutate(ar *v1beta1.AdmissionReview) *v1beta1.Admis
namespace := ar.Request.Namespace
var patch []patchOperation
- if req.Kind.Kind == "Pod" {
+ var requestKind = req.Kind.Kind
+ var uid = string(req.UID)
+
+ if requestKind == "Pod" {
log.Logger().Info("AdmissionReview",
zap.Any("Kind", req.Kind),
Review comment:
This value is always "AdmissionReview" see https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#request details, lets remove this as we already have it
##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -101,10 +107,16 @@ func (c *admissionController) mutate(ar *v1beta1.AdmissionReview) *v1beta1.Admis
patch = updateSchedulerName(patch)
patch = updateLabels(namespace, &pod, patch)
+ log.Logger().Info(fmt.Sprintf("generated patch for pod %s\n", pod.Name),
+ zap.Any("patch", patch))
+ } else {
Review comment:
can we turn this around:
```
if requestKind != "Pod" {
log <not a pod>
return <allowed response>
}
<mutate pod>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@yunikorn.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-yunikorn-k8shim] wilfred-s commented on a change in pull request #324: [YUNIKORN-927] Improve logging in the yunikorn admission controller
Posted by GitBox <gi...@apache.org>.
wilfred-s commented on a change in pull request #324:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/324#discussion_r737910785
##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -72,16 +74,20 @@ func (c *admissionController) mutate(ar *v1beta1.AdmissionReview) *v1beta1.Admis
namespace := ar.Request.Namespace
var patch []patchOperation
- if req.Kind.Kind == "Pod" {
+ var requestKind = req.Kind.Kind
+ var uid = string(req.UID)
+
+ if requestKind == "Pod" {
log.Logger().Info("AdmissionReview",
zap.Any("Kind", req.Kind),
Review comment:
This value of `kind` is always "AdmissionReview" see https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#request details, lets remove this as we already have it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@yunikorn.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-yunikorn-k8shim] wilfred-s closed pull request #324: [YUNIKORN-927] Improve logging in the yunikorn admission controller
Posted by GitBox <gi...@apache.org>.
wilfred-s closed pull request #324:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/324
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@yunikorn.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org