mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Restart deployment (#1175)
Signed-off-by: Pavel Ashevskii <pashevskii@mirantis.com>
This commit is contained in:
1 parent
f9578ba407
commit
d074e0499f
6 files changed
+79
-7
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import moment from "moment";
|
||||
|
||||
import { IAffinity, WorkloadKubeObject } from "../workload-kube-object";
|
||||
import { autobind } from "../../utils";
|
||||
import { KubeApi } from "../kube-api";
|
||||
@@ -23,6 +25,25 @@ export class DeploymentApi extends KubeApi<Deployment> {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
restart(params: { namespace: string; name: string }) {
|
||||
return this.request.patch(this.getUrl(params), {
|
||||
data: {
|
||||
spec: {
|
||||
template: {
|
||||
metadata: {
|
||||
annotations: {"kubectl.kubernetes.io/restartedAt" : moment.utc().format()}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
'content-type': 'application/strategic-merge-patch+json'
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@autobind()
|
||||
@@ -38,6 +59,7 @@ export class Deployment extends WorkloadKubeObject {
|
||||
metadata: {
|
||||
creationTimestamp?: string;
|
||||
labels: { [app: string]: string };
|
||||
annotations?: { [app: string]: string };
|
||||
};
|
||||
spec: {
|
||||
containers: {
|
||||
|
||||
@@ -64,7 +64,7 @@ export class JsonApi<D = JsonApiData, P extends JsonApiParams = JsonApiParams> {
|
||||
}
|
||||
|
||||
patch<T = D>(path: string, params?: P, reqInit: RequestInit = {}) {
|
||||
return this.request<T>(path, params, { ...reqInit, method: "patch" });
|
||||
return this.request<T>(path, params, { ...reqInit, method: "PATCH" });
|
||||
}
|
||||
|
||||
del<T = D>(path: string, params?: P, reqInit: RequestInit = {}) {
|
||||
|
||||
Reference in new issue
Block a user