mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 12:18:16 +00:00 
			
		
		
		
	Require match condition version only if matchConditions are specified
This commit is contained in:
		@@ -512,7 +512,9 @@ func ValidateWebhookConfiguration(fldPath *field.Path, c *api.WebhookConfigurati
 | 
			
		||||
 | 
			
		||||
	switch c.MatchConditionSubjectAccessReviewVersion {
 | 
			
		||||
	case "":
 | 
			
		||||
		allErrs = append(allErrs, field.Required(fldPath.Child("matchConditionSubjectAccessReviewVersion"), ""))
 | 
			
		||||
		if len(c.MatchConditions) > 0 {
 | 
			
		||||
			allErrs = append(allErrs, field.Required(fldPath.Child("matchConditionSubjectAccessReviewVersion"), "required if match conditions are specified"))
 | 
			
		||||
		}
 | 
			
		||||
	case "v1":
 | 
			
		||||
		_ = &v1.SubjectAccessReview{}
 | 
			
		||||
	default:
 | 
			
		||||
 
 | 
			
		||||
@@ -1438,6 +1438,7 @@ func TestValidateAuthorizationConfiguration(t *testing.T) {
 | 
			
		||||
							ConnectionInfo: api.WebhookConnectionInfo{
 | 
			
		||||
								Type: "InClusterConfig",
 | 
			
		||||
							},
 | 
			
		||||
							MatchConditions: []api.WebhookMatchCondition{{Expression: "true"}},
 | 
			
		||||
						},
 | 
			
		||||
					},
 | 
			
		||||
				},
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user