mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #129434 from xigang/crd_handler
refactor: simplify boolean expressions in CRD handler
This commit is contained in:
		@@ -660,13 +660,13 @@ func (r *crdHandler) getOrCreateServingInfoFor(uid types.UID, name string) (*crd
 | 
				
			|||||||
			return nil, fmt.Errorf("failed converting CRD validation to internal version: %v", err)
 | 
								return nil, fmt.Errorf("failed converting CRD validation to internal version: %v", err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		s, err := structuralschema.NewStructural(internalValidation.OpenAPIV3Schema)
 | 
							s, err := structuralschema.NewStructural(internalValidation.OpenAPIV3Schema)
 | 
				
			||||||
		if crd.Spec.PreserveUnknownFields == false && err != nil {
 | 
							if !crd.Spec.PreserveUnknownFields && err != nil {
 | 
				
			||||||
			// This should never happen. If it does, it is a programming error.
 | 
								// This should never happen. If it does, it is a programming error.
 | 
				
			||||||
			utilruntime.HandleError(fmt.Errorf("failed to convert schema to structural: %v", err))
 | 
								utilruntime.HandleError(fmt.Errorf("failed to convert schema to structural: %v", err))
 | 
				
			||||||
			return nil, fmt.Errorf("the server could not properly serve the CR schema") // validation should avoid this
 | 
								return nil, fmt.Errorf("the server could not properly serve the CR schema") // validation should avoid this
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if crd.Spec.PreserveUnknownFields == false {
 | 
							if !crd.Spec.PreserveUnknownFields {
 | 
				
			||||||
			// we don't own s completely, e.g. defaults are not deep-copied. So better make a copy here.
 | 
								// we don't own s completely, e.g. defaults are not deep-copied. So better make a copy here.
 | 
				
			||||||
			s = s.DeepCopy()
 | 
								s = s.DeepCopy()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user