Skip to content

Commit

Permalink
Merge pull request #345 from wilhelmguo/hotfix/fix_endpoints_update_i…
Browse files Browse the repository at this point in the history
…nvalid

Fix endpoints update error
  • Loading branch information
wilhelmguo authored Mar 11, 2019
2 parents 986e035 + f759e68 commit 4b6ea6b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/backend/resources/deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 4b6ea6b

Please sign in to comment.