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/08 11:30:57 UTC

[GitHub] [incubator-yunikorn-k8shim] pbacsko opened a new pull request #308: [YUNIKORN-871] Admission controller should only validate yunikorn con…

pbacsko opened a new pull request #308:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/308


   …figmap changes
   
   ### What is this PR for?
   The admission controller logs configmap validation messages to the console, even if it's not yunikorn related.
   We should suppress these messages.
   
   ### What type of PR is it?
   * [x] - Bug Fix
   * [ ] - Improvement
   * [ ] - Feature
   * [ ] - Documentation
   * [ ] - Hot Fix
   * [ ] - Refactoring
   
   ### Todos
   * [ ] - Task
   
   ### What is the Jira issue?
   https://issues.apache.org/jira/browse/YUNIKORN-871
   
   ### How should this be tested?
   Create a configmap with a name other than "yunikorn-configs". It should not appear in the admission controller logs.
   
   ### 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] kingamarton commented on a change in pull request #308: [YUNIKORN-871] Admission controller should only validate yunikorn con…

Posted by GitBox <gi...@apache.org>.
kingamarton commented on a change in pull request #308:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/308#discussion_r725020767



##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -229,38 +234,47 @@ func (c *admissionController) validateConf(ar *v1beta1.AdmissionReview) *v1beta1
 				},
 			}
 		}
+
+		if skipped {
+			return &v1beta1.AdmissionResponse{
+				Allowed: true,
+				Result: &metav1.Status{
+					Message: skippedByController,
+				},
+			}
+		}
 	}
 
 	return &v1beta1.AdmissionResponse{
 		Allowed: true,
 	}
 }
 
-func (c *admissionController) validateConfigMap(cm *v1.ConfigMap) error {
+func (c *admissionController) validateConfigMap(cm *v1.ConfigMap) (error, bool) {

Review comment:
       Instead of adding additional complexity to the code by introduving a second return value, I think we should simplify the check: for example if the input is not a configmap and not our config, return nil (as it was initially).
   This would require a small change in validateConf() function to return nil instead of a valid AdmissionResponse. 
   This would require some manual testing, to make sure that the nil return value is not causing any issues




-- 
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] pbacsko commented on a change in pull request #308: [YUNIKORN-871] Admission controller should only validate yunikorn con…

Posted by GitBox <gi...@apache.org>.
pbacsko commented on a change in pull request #308:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/308#discussion_r725108811



##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -229,38 +234,47 @@ func (c *admissionController) validateConf(ar *v1beta1.AdmissionReview) *v1beta1
 				},
 			}
 		}
+
+		if skipped {
+			return &v1beta1.AdmissionResponse{
+				Allowed: true,
+				Result: &metav1.Status{
+					Message: skippedByController,
+				},
+			}
+		}
 	}
 
 	return &v1beta1.AdmissionResponse{
 		Allowed: true,
 	}
 }
 
-func (c *admissionController) validateConfigMap(cm *v1.ConfigMap) error {
+func (c *admissionController) validateConfigMap(cm *v1.ConfigMap) (error, bool) {

Review comment:
       This can work, however, if we follow your suggestion, we can't print anything in `serve()`, because we don't know why we have allowed:true. It's either because the configmap is not ours, or because its ours and the contents are OK. 




-- 
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] kingamarton commented on a change in pull request #308: [YUNIKORN-871] Admission controller should only validate yunikorn con…

Posted by GitBox <gi...@apache.org>.
kingamarton commented on a change in pull request #308:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/308#discussion_r725021725



##########
File path: pkg/plugin/admissioncontrollers/webhook/admission_controller.go
##########
@@ -229,38 +234,47 @@ func (c *admissionController) validateConf(ar *v1beta1.AdmissionReview) *v1beta1
 				},
 			}
 		}
+
+		if skipped {
+			return &v1beta1.AdmissionResponse{
+				Allowed: true,
+				Result: &metav1.Status{
+					Message: skippedByController,
+				},
+			}
+		}
 	}
 
 	return &v1beta1.AdmissionResponse{
 		Allowed: true,
 	}
 }
 
-func (c *admissionController) validateConfigMap(cm *v1.ConfigMap) error {
+func (c *admissionController) validateConfigMap(cm *v1.ConfigMap) (error, bool) {

Review comment:
       Or what is even better than a nil, an empty response with just the proper message set




-- 
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] pbacsko commented on pull request #308: [YUNIKORN-871] Admission controller should only validate yunikorn con…

Posted by GitBox <gi...@apache.org>.
pbacsko commented on pull request #308:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/308#issuecomment-939875976


   > This looks much better and simpler. I have one small ask: now that you removed the admission review response log message, we don't have any information in the logs related the validity of the configmap. Please add a small log message for the case when the configmap is the YK configmap. You can add it in `validateConfigMap` function
   
   As we discussed on Slack, all errors are logged. If there's no message, it means that the validation is passed.


-- 
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 #308: [YUNIKORN-871] Admission controller should only validate yunikorn con…

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on pull request #308:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/308#issuecomment-938753218


   # [Codecov](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/308?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 [#308](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/308?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6043049) 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 `3.44%`.
   > The diff coverage is `76.94%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/308/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/308?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     #308      +/-   ##
   ==========================================
   + Coverage   59.75%   63.19%   +3.44%     
   ==========================================
     Files          35       37       +2     
     Lines        3133     3486     +353     
   ==========================================
   + Hits         1872     2203     +331     
   - Misses       1180     1194      +14     
   - Partials       81       89       +8     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/308?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/308/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/308/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/308/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/308/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/308/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/controller/application/app\_controller.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/308/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-cGtnL2NvbnRyb2xsZXIvYXBwbGljYXRpb24vYXBwX2NvbnRyb2xsZXIuZ28=) | `71.05% <ø> (-0.26%)` | :arrow_down: |
   | [...missioncontrollers/webhook/admission\_controller.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/308/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) | `33.74% <0.00%> (+1.00%)` | :arrow_up: |
   | [pkg/shim/main.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/308/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% <ø> (ø)` | |
   | [pkg/shim/scheduler.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/308/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/common/events/recorder.go](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/308/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 [29 more](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/308/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/308?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/308?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 [6902ea8...6043049](https://codecov.io/gh/apache/incubator-yunikorn-k8shim/pull/308?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] kingamarton merged pull request #308: [YUNIKORN-871] Admission controller should only validate yunikorn con…

Posted by GitBox <gi...@apache.org>.
kingamarton merged pull request #308:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/308


   


-- 
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