From 8a185b2ad54434f86fd8204bf24723bd533181d6 Mon Sep 17 00:00:00 2001 From: wilhelmguo Date: Mon, 11 Mar 2019 16:11:42 +0800 Subject: [PATCH 1/2] frontend:fix endpoints update error --- .../kubernetes-namespaced-resource.ts | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/frontend/src/app/shared/base/kubernetes-namespaced/kubernetes-namespaced-resource.ts b/src/frontend/src/app/shared/base/kubernetes-namespaced/kubernetes-namespaced-resource.ts index ba60f3c9d..f455091ea 100644 --- a/src/frontend/src/app/shared/base/kubernetes-namespaced/kubernetes-namespaced-resource.ts +++ b/src/frontend/src/app/shared/base/kubernetes-namespaced/kubernetes-namespaced-resource.ts @@ -136,27 +136,18 @@ export class KubernetesNamespacedResource implements OnInit, OnDestroy { } onSaveResourceEvent(obj: any) { - this.kubernetesClient.get(this.cluster, this.kubeResource, obj.metadata.name, obj.metadata.namespace).subscribe( - resp => { - const respObj = resp.data; - respObj.spec = obj.spec; - respObj.metadata.labels = obj.metadata.labels; - respObj.metadata.annotations = obj.metadata.annotations; - this.kubernetesClient.update(respObj, this.cluster, this.kubeResource, obj.metadata.name, obj.metadata.namespace).subscribe( - resp2 => { - this.messageHandlerService.showSuccess('ADMIN.KUBERNETES.MESSAGE.UPDATE'); - this.retrieveResource(); - }, - error => { - this.messageHandlerService.handleError(error); - } - ); + // set resourceVersion to undefined prevent updates from failing + obj.metadata.resourceVersion = undefined; + obj.metadata.creationTimestamp = undefined; + this.kubernetesClient.update(obj, this.cluster, this.kubeResource, obj.metadata.name, obj.metadata.namespace).subscribe( + () => { + this.messageHandlerService.showSuccess('ADMIN.KUBERNETES.MESSAGE.UPDATE'); + this.retrieveResource(); }, error => { this.messageHandlerService.handleError(error); } ); - } initShow() { From f759e68906c3e3499f4d871b895702c30ec3c96d Mon Sep 17 00:00:00 2001 From: wilhelmguo Date: Mon, 11 Mar 2019 17:05:47 +0800 Subject: [PATCH 2/2] backend: fix deployment deploy error --- src/backend/resources/deployment/deployment.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/resources/deployment/deployment.go b/src/backend/resources/deployment/deployment.go index 1a0b5a145..61f25eca5 100644 --- a/src/backend/resources/deployment/deployment.go +++ b/src/backend/resources/deployment/deployment.go @@ -40,7 +40,7 @@ func GetDeploymentList(indexer *client.CacheFactory, namespace string) ([]*v1bet // GetDeploymentResource get deployment resource statistics func GetDeploymentResource(cli client.ResourceHandler, deployment *v1beta1.Deployment) (*common.ResourceList, error) { - obj, err := cli.Get(api.ResourceNameStatefulSet, deployment.Namespace, deployment.Name) + obj, err := cli.Get(api.ResourceNameDeployment, deployment.Namespace, deployment.Name) old := obj.(*v1beta1.Deployment) if err != nil { if errors.IsNotFound(err) {