Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for NamespaceFrom (0.18 sec)

  1. staging/src/k8s.io/apiserver/pkg/endpoints/request/context_test.go

    func TestNamespaceContext(t *testing.T) {
    	ctx := NewDefaultContext()
    	result, ok := NamespaceFrom(ctx)
    	if !ok {
    		t.Fatalf("Error getting namespace")
    	}
    	if metav1.NamespaceDefault != result {
    		t.Fatalf("Expected: %s, Actual: %s", metav1.NamespaceDefault, result)
    	}
    
    	ctx = NewContext()
    	_, ok = NamespaceFrom(ctx)
    	if ok {
    		t.Fatalf("Should not be ok because there is no namespace on the context")
    	}
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Jul 26 17:14:05 UTC 2022
    - 2.7K bytes
    - Viewed (0)
  2. pkg/registry/rbac/rolebinding/policybased/storage.go

    	// Get the namespace from the context (populated from the URL).
    	// The namespace in the object can be empty until StandardStorage.Create()->BeforeCreate() populates it from the context.
    	namespace, ok := genericapirequest.NamespaceFrom(ctx)
    	if !ok {
    		return nil, errors.NewBadRequest("namespace is required")
    	}
    
    	roleBinding := obj.(*rbac.RoleBinding)
    	if rbacregistry.BindingAuthorized(ctx, roleBinding.RoleRef, namespace, s.authorizer) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Nov 18 10:11:16 UTC 2022
    - 5.5K bytes
    - Viewed (0)
  3. pkg/registry/registrytest/service.go

    	r.Err = err
    }
    
    func (r *ServiceRegistry) ListServices(ctx context.Context, options *metainternalversion.ListOptions) (*api.ServiceList, error) {
    	r.mu.Lock()
    	defer r.mu.Unlock()
    
    	ns, _ := genericapirequest.NamespaceFrom(ctx)
    
    	// Copy metadata from internal list into result
    	res := new(api.ServiceList)
    	res.TypeMeta = r.List.TypeMeta
    	res.ListMeta = r.List.ListMeta
    
    	if ns != metav1.NamespaceAll {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Jan 16 13:43:36 UTC 2023
    - 2.9K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apiserver/pkg/registry/rest/create.go

    	}
    
    	// ensure namespace on the object is correct, or error if a conflicting namespace was set in the object
    	requestNamespace, ok := genericapirequest.NamespaceFrom(ctx)
    	if !ok {
    		return errors.NewInternalError(fmt.Errorf("no namespace information found in request context"))
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Sep 27 11:48:28 UTC 2022
    - 9.1K bytes
    - Viewed (0)
  5. pkg/registry/core/serviceaccount/storage/token.go

    	req := obj.(*authenticationapi.TokenRequest)
    
    	// Get the namespace from the context (populated from the URL).
    	namespace, ok := genericapirequest.NamespaceFrom(ctx)
    	if !ok {
    		return nil, errors.NewBadRequest("namespace is required")
    	}
    
    	// require name/namespace in the body to match URL if specified
    	if len(req.Name) > 0 && req.Name != name {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Feb 05 10:24:31 UTC 2024
    - 10K bytes
    - Viewed (0)
  6. staging/src/k8s.io/apiserver/pkg/registry/rest/update.go

    	if kerr != nil {
    		return kerr
    	}
    
    	// ensure namespace on the object is correct, or error if a conflicting namespace was set in the object
    	requestNamespace, ok := genericapirequest.NamespaceFrom(ctx)
    	if !ok {
    		return errors.NewInternalError(fmt.Errorf("no namespace information found in request context"))
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Sep 27 11:48:28 UTC 2022
    - 11.8K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apiserver/pkg/registry/generic/registry/store.go

    // to resource directories enforcing namespace rules.
    func NamespaceKeyRootFunc(ctx context.Context, prefix string) string {
    	key := prefix
    	ns, ok := genericapirequest.NamespaceFrom(ctx)
    	if ok && len(ns) > 0 {
    		key = key + "/" + ns
    	}
    	return key
    }
    
    // NamespaceKeyFunc is the default function for constructing storage paths to
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Jan 19 23:22:44 UTC 2024
    - 60.8K bytes
    - Viewed (0)
  8. staging/src/k8s.io/apiserver/pkg/endpoints/metrics/metrics.go

    //
    // see: https://github.com/kubernetes/kubernetes/pull/120520
    func determineRequestNamespaceAndName(ctx context.Context, opts *metainternalversion.ListOptions) (namespace, name string) {
    	if requestNamespace, ok := request.NamespaceFrom(ctx); ok && len(requestNamespace) > 0 {
    		namespace = requestNamespace
    	} else if opts != nil && opts.FieldSelector != nil {
    		if selectorNamespace, ok := opts.FieldSelector.RequiresExactMatch("metadata.namespace"); ok {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Sep 27 07:29:19 UTC 2023
    - 35K bytes
    - Viewed (0)
  9. staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go

    		}
    	}
    
    	// determine the namespace and name scope of the watch, first from the request, secondarily from the field selector
    	scope := namespacedName{}
    	if requestNamespace, ok := request.NamespaceFrom(ctx); ok && len(requestNamespace) > 0 {
    		scope.namespace = requestNamespace
    	} else if selectorNamespace, ok := pred.Field.RequiresExactMatch("metadata.namespace"); ok {
    		scope.namespace = selectorNamespace
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jun 12 10:12:02 UTC 2024
    - 51.8K bytes
    - Viewed (0)
  10. staging/src/k8s.io/apiserver/pkg/endpoints/apiserver_test.go

    	}
    	return storage.item.DeepCopy(), storage.errors["get"]
    }
    
    func (storage *SimpleRESTStorage) checkContext(ctx context.Context) {
    	storage.actualNamespace, storage.namespacePresent = request.NamespaceFrom(ctx)
    }
    
    func (storage *SimpleRESTStorage) Delete(ctx context.Context, id string, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions) (runtime.Object, bool, error) {
    	storage.checkContext(ctx)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon May 01 20:15:22 UTC 2023
    - 158.7K bytes
    - Viewed (0)
Back to top