fix: applications api

Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
hongming
2019-04-24 14:30:34 +08:00
committed by zryfish
parent 5babbe8b53
commit da0ca36d1a
2 changed files with 13 additions and 3 deletions

View File

@@ -63,6 +63,7 @@ func ApplicationHandler(req *restful.Request, resp *restful.Response) {
func NamespacedApplicationHandler(req *restful.Request, resp *restful.Response) {
limit, offset := params.ParsePaging(req.QueryParameter(params.PagingParam))
namespaceName := req.PathParameter("namespace")
clusterId := req.QueryParameter("cluster_id")
conditions, err := params.ParseConditions(req.QueryParameter(params.ConditionsParam))
if err != nil {
if err != nil {
@@ -70,6 +71,15 @@ func NamespacedApplicationHandler(req *restful.Request, resp *restful.Response)
return
}
}
if len(clusterId) > 0 {
app, err := applications.GetApp(clusterId)
if err != nil {
resp.WriteHeaderAndEntity(http.StatusInternalServerError, errors.Wrap(err))
return
}
resp.WriteEntity(app)
return
}
namespace, err := resources.GetResource("", resources.Namespaces, namespaceName)

View File

@@ -643,10 +643,10 @@ func CreateClusterRoleBinding(username string, clusterRoleName string) error {
glog.Errorln("create cluster role binding", err)
return err
}
if err := kubeconfig.CreateKubeConfig(username); err != nil {
glog.Errorln("create user kubeconfig failed", username, err)
}
if clusterRoleName == constants.ClusterAdmin {
if err := kubeconfig.CreateKubeConfig(username); err != nil {
glog.Errorln("create user kubeconfig failed", username, err)
}
if err := kubectl.CreateKubectlDeploy(username); err != nil {
glog.Errorln("create user terminal pod failed", username, err)
}