mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 12:18:16 +00:00 
			
		
		
		
	The namespace context for a get of an individual namespace is the namespace
This commit is contained in:
		@@ -292,8 +292,10 @@ func (r *APIRequestInfoResolver) GetAPIRequestInfo(req *http.Request) (APIReques
 | 
				
			|||||||
	// URL forms: /namespaces/{namespace}/{kind}/*, where parts are adjusted to be relative to kind
 | 
						// URL forms: /namespaces/{namespace}/{kind}/*, where parts are adjusted to be relative to kind
 | 
				
			||||||
	if currentParts[0] == "namespaces" {
 | 
						if currentParts[0] == "namespaces" {
 | 
				
			||||||
		if len(currentParts) < 3 {
 | 
							if len(currentParts) < 3 {
 | 
				
			||||||
			requestInfo.Namespace = ""
 | 
					 | 
				
			||||||
			requestInfo.Resource = "namespaces"
 | 
								requestInfo.Resource = "namespaces"
 | 
				
			||||||
 | 
								if len(currentParts) > 1 {
 | 
				
			||||||
 | 
									requestInfo.Namespace = currentParts[1]
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			requestInfo.Resource = currentParts[2]
 | 
								requestInfo.Resource = currentParts[2]
 | 
				
			||||||
			requestInfo.Namespace = currentParts[1]
 | 
								requestInfo.Namespace = currentParts[1]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -80,7 +80,7 @@ func TestGetAPIRequestInfo(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		// resource paths
 | 
							// resource paths
 | 
				
			||||||
		{"GET", "/namespaces", "list", "", "", "namespaces", "Namespace", "", []string{"namespaces"}},
 | 
							{"GET", "/namespaces", "list", "", "", "namespaces", "Namespace", "", []string{"namespaces"}},
 | 
				
			||||||
		{"GET", "/namespaces/other", "get", "", "", "namespaces", "Namespace", "other", []string{"namespaces", "other"}},
 | 
							{"GET", "/namespaces/other", "get", "", "other", "namespaces", "Namespace", "other", []string{"namespaces", "other"}},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		{"GET", "/namespaces/other/pods", "list", "", "other", "pods", "Pod", "", []string{"pods"}},
 | 
							{"GET", "/namespaces/other/pods", "list", "", "other", "pods", "Pod", "", []string{"pods"}},
 | 
				
			||||||
		{"GET", "/namespaces/other/pods/foo", "get", "", "other", "pods", "Pod", "foo", []string{"pods", "foo"}},
 | 
							{"GET", "/namespaces/other/pods/foo", "get", "", "other", "pods", "Pod", "foo", []string{"pods", "foo"}},
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user