# kubectl create namespace edit-test # kubectl create service clusterip svc1 --tcp 80 --namespace=edit-test --save-config # kubectl edit service svc1 --namespace=edit-test --save-config=true --output-patch=true description: edit with flag --output-patch=true should output the patch mode: edit args: - service - svc1 saveConfig: "true" outputPatch: "true" namespace: edit-test expectedStdout: - 'Patch: {"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"v1\",\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"creationTimestamp\":\"2017-02-27T19:40:53Z\",\"labels\":{\"app\":\"svc1\",\"new-label\":\"new-value\"},\"name\":\"svc1\",\"namespace\":\"edit-test\",\"resourceVersion\":\"670\",\"selfLink\":\"/api/v1/namespaces/edit-test/services/svc1\",\"uid\":\"a6c11186-fd24-11e6-b53c-480fcf4a5275\"},\"spec\":{\"clusterIP\":\"10.0.0.204\",\"ports\":[{\"name\":\"80\",\"port\":80,\"protocol\":\"TCP\",\"targetPort\":80}],\"selector\":{\"app\":\"svc1\"},\"sessionAffinity\":\"None\",\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"},"labels":{"new-label":"new-value"}}}' - service/svc1 edited expectedExitCode: 0 steps: - type: request expectedMethod: GET expectedPath: /api/v1/namespaces/edit-test/services/svc1 expectedInput: 0.request resultingStatusCode: 200 resultingOutput: 0.response - type: edit expectedInput: 1.original resultingOutput: 1.edited - type: request expectedMethod: PATCH expectedPath: /api/v1/namespaces/edit-test/services/svc1 expectedContentType: application/strategic-merge-patch+json expectedInput: 2.request resultingStatusCode: 200 resultingOutput: 2.response