Exemple #1
0
    def update_deployment(self,
                          request,
                          project_id,
                          cluster_id,
                          ns,
                          data,
                          kind=2,
                          category=None,
                          app_name=None):
        """滚动升级
        """
        if kind == 2:
            client = MesosClient(request.user.token.access_token, project_id,
                                 cluster_id, None)
            resp = client.update_deployment(ns, data)
        else:
            client = K8SClient(request.user.token.access_token, project_id,
                               cluster_id, None)
            curr_func = getattr(client, FUNC_MAP[category] % "update")
            resp = curr_func(ns, app_name, data)

        if resp.get("code") != ErrorCode.NoError:
            return APIResponse({
                "code": resp.get("code", DEFAULT_ERROR_CODE),
                "message": resp.get("message", _("请求出现异常!"))
            })
        return APIResponse({"message": _("更新成功!")})
Exemple #2
0
 def update_mesos_instance(self, access_token: str, project_id: str,
                           cluster_id: str, ns: str, data: Dict,
                           kind: str) -> Dict:
     """更新 mesos 应用"""
     client = MesosClient(access_token, project_id, cluster_id, None)
     if kind == MesosResourceName.deployment.value:
         return client.update_deployment(ns, data)
     return client.update_application(ns, data)
 def update_deployment(self, client: MesosClient,
                       params: Union[Dict]) -> Dict:
     return client.update_deployment(self.instance_data.namespace,
                                     self.instance_data.manifest,
                                     params=params)