-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add namespaces support for REST #668
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,9 +13,22 @@ import ( | |
glog "k8s.io/klog" | ||
) | ||
|
||
func makeDeleteHandler(namespace string, client clientset.Interface) http.HandlerFunc { | ||
func makeDeleteHandler(defaultNamespace string, client clientset.Interface) http.HandlerFunc { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am going to make a rather big suggestion that will require another refactor. I think we should have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From my understanding on the proposal, you mean using only one |
||
return func(w http.ResponseWriter, r *http.Request) { | ||
|
||
q := r.URL.Query() | ||
namespace := q.Get("namespace") | ||
|
||
lookupNamespace := defaultNamespace | ||
if len(namespace) > 0 { | ||
lookupNamespace = namespace | ||
} | ||
|
||
if namespace == "kube-system" { | ||
http.Error(w, "unable to list within the kube-system namespace", http.StatusUnauthorized) | ||
return | ||
} | ||
|
||
if r.Body != nil { | ||
defer r.Body.Close() | ||
} | ||
|
@@ -35,7 +48,7 @@ func makeDeleteHandler(namespace string, client clientset.Interface) http.Handle | |
return | ||
} | ||
|
||
err = client.OpenfaasV1().Functions(namespace). | ||
err = client.OpenfaasV1().Functions(lookupNamespace). | ||
Delete(context.TODO(), request.FunctionName, metav1.DeleteOptions{}) | ||
if err != nil { | ||
w.WriteHeader(http.StatusInternalServerError) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will revert, generally the change is in this image