mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 12:18:16 +00:00 
			
		
		
		
	Fix node namespace.
This commit is contained in:
		@@ -546,6 +546,9 @@ func ValidateBoundPod(pod *api.BoundPod) (errors []error) {
 | 
				
			|||||||
// ValidateMinion tests if required fields in the minion are set.
 | 
					// ValidateMinion tests if required fields in the minion are set.
 | 
				
			||||||
func ValidateMinion(minion *api.Minion) errs.ValidationErrorList {
 | 
					func ValidateMinion(minion *api.Minion) errs.ValidationErrorList {
 | 
				
			||||||
	allErrs := errs.ValidationErrorList{}
 | 
						allErrs := errs.ValidationErrorList{}
 | 
				
			||||||
 | 
						if len(minion.Namespace) != 0 {
 | 
				
			||||||
 | 
							allErrs = append(allErrs, errs.NewFieldInvalid("namespace", minion.Namespace))
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if len(minion.Name) == 0 {
 | 
						if len(minion.Name) == 0 {
 | 
				
			||||||
		allErrs = append(allErrs, errs.NewFieldRequired("name", minion.Name))
 | 
							allErrs = append(allErrs, errs.NewFieldRequired("name", minion.Name))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -159,8 +159,10 @@ func ResourceFromFile(filename string, typer runtime.ObjectTyper, mapper meta.RE
 | 
				
			|||||||
// prevents a user from unintentionally updating the wrong namespace.
 | 
					// prevents a user from unintentionally updating the wrong namespace.
 | 
				
			||||||
func CompareNamespaceFromFile(cmd *cobra.Command, namespace string) error {
 | 
					func CompareNamespaceFromFile(cmd *cobra.Command, namespace string) error {
 | 
				
			||||||
	defaultNamespace := getKubeNamespace(cmd)
 | 
						defaultNamespace := getKubeNamespace(cmd)
 | 
				
			||||||
 | 
						if len(namespace) > 0 {
 | 
				
			||||||
		if defaultNamespace != namespace {
 | 
							if defaultNamespace != namespace {
 | 
				
			||||||
			return fmt.Errorf("the namespace from the provided file %q does not match the namespace %q. You must pass '--namespace=%s' to perform this operation.", namespace, defaultNamespace, namespace)
 | 
								return fmt.Errorf("the namespace from the provided file %q does not match the namespace %q. You must pass '--namespace=%s' to perform this operation.", namespace, defaultNamespace, namespace)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -59,10 +59,6 @@ func (rs *REST) Create(ctx api.Context, obj runtime.Object) (<-chan apiserver.RE
 | 
				
			|||||||
	api.FillObjectMetaSystemFields(ctx, &minion.ObjectMeta)
 | 
						api.FillObjectMetaSystemFields(ctx, &minion.ObjectMeta)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return apiserver.MakeAsync(func() (runtime.Object, error) {
 | 
						return apiserver.MakeAsync(func() (runtime.Object, error) {
 | 
				
			||||||
		// TODO: Need to fill in any server-set fields (uid, timestamp, etc) before
 | 
					 | 
				
			||||||
		// returning minion. Can't do it properly at the moment because the registry
 | 
					 | 
				
			||||||
		// healthchecking, which might cause it to not return the minion at all. Fix
 | 
					 | 
				
			||||||
		// this after we move the healthchecking out of the minion registry.
 | 
					 | 
				
			||||||
		err := rs.registry.CreateMinion(ctx, minion)
 | 
							err := rs.registry.CreateMinion(ctx, minion)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user