- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 13 for NamespaceFrom (0.43 sec)
-
staging/src/k8s.io/apiserver/pkg/endpoints/request/context.go
func WithNamespace(parent context.Context, namespace string) context.Context { return WithValue(parent, namespaceKey, namespace) } // NamespaceFrom returns the value of the namespace key on the ctx func NamespaceFrom(ctx context.Context) (string, bool) { namespace, ok := ctx.Value(namespaceKey).(string) return namespace, ok }
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Thu Sep 23 14:08:44 UTC 2021 - 2.4K bytes - Viewed (0) -
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) -
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) -
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) -
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) -
pkg/registry/rbac/validation/rule.go
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Mon Nov 02 16:51:16 UTC 2020 - 11.6K bytes - Viewed (0) -
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) -
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) -
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) -
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)