Change:
kubectl create, delete, etc. can already take a List object. kubectl apply can take the list object when it does creation, but it gives an (ugly) error when it's configuring the objects. Then... expected: Actual:
what's you ?
0-alpha.5
Sounds like a bug. Are you interested in taking a look
sure I will take a look during this weekend.
I think the root cause is , the actually is , in the origin , is not , but after the , this object is nil. Would you like to double check this?
I'll take a look.
if you have make sure about this, please let me know. Thanks :)
Is there any ways we could get this into 1.2? It's actually making our config generation quite painful to have to make a separate file for every object. It looks like got pretty far? would you like to make a PR that we can review?
I don't see how. It could have made 1.2 if a PR had been sent within a few days of the issue being filed.
I unassigned all issues assigned to you. Please only assign issues that are actively being worked on, so that others can know which issues are available to be picked up.
My apologies. If I'm not mistaken, this issue was filed after the code freeze for 1.2. I didn't realize that it was time critical or that it could make the release at that time. However, I should have asked. Sorry for the inconvenience. Thank you. I still plan to address those issues for the next release, as discussed, but will assign each one to myself as I work on it.
I created which fixes this. I'm really hoping we can get this into 1.2 since it's a pretty small, isolated fix but a pretty big bug that is complicating our config generation system. Let me know what else I can do to help.
Thanks for the PR. We're short on reviewer bandwidth at the moment. I assigned it to Clayton for review or delegation.

Discussion:
} encoder := f.JSONEncoder() <ins> decoder := f.Decoder(false) </ins> count := 0 err = r.Visit(func(info *resource.Info, err error) error {

return cmdutil.AddSourceToErr(fmt.Sprintf("retrieving original configuration from:n%vnfor:", info), info.Source, err) } <ins> // Create the versioned struct from the original from the server for // strategic patch. // TODO: Move all structs in apply to use raw data. Can be done once // builder has a RawResult method which delivers raw data instead of // internal objects. versionedObject, _, err := decoder.Decode(current, nil, nil) if err != nil { return cmdutil.AddSourceToErr(fmt.Sprintf("converting encoded server-side object back to versioned struct:n%vnfor:", info), info.Source, err) } </ins> // Compute a three way strategic merge patch to send to server. <del> patch, err := strategicpatch.CreateThreeWayMergePatch(original, modified, current, info.VersionedObject, true) </del> <ins> patch, err := strategicpatch.CreateThreeWayMergePatch(original, modified, current, versionedObject, true) </ins> if err != nil { format := "creating patch with:noriginal:n%snmodified:n%sncurrent:n%snfrom:n%vnfor:" return cmdutil.AddSourceToErr(fmt.Sprintf(format, original, modified, current, info), info.Source, err)

} const ( <del> filenameRC  = "../../../examples/guestbook/redis-master-controller.yaml" filenameSVC = "../../../examples/guestbook/frontend-service.yaml" </del> <ins> filenameRC    = "../../../test/fixtures/pkg/kubectl/cmd/apply/rc.yaml" filenameSVC   = "../../../test/fixtures/pkg/kubectl/cmd/apply/service.yaml" filenameRCSVC = "../../../test/fixtures/pkg/kubectl/cmd/apply/rc-service.yaml" </ins> ) func readBytesFromFile(t *testing.T, filename string) []byte {

} } <del> func TestApplyMultipleObject(t *testing.T) { </del> <ins> func TestApplyMultipleObjectsAsList(t *testing.T) { testApplyMultipleObjects(t, true) } func TestApplyMultipleObjectsAsFiles(t *testing.T) { testApplyMultipleObjects(t, false) } func testApplyMultipleObjects(t *testing.T, asList bool) { </ins> nameRC, currentRC := readAndAnnotateReplicationController(t, filenameRC) pathRC := "/namespaces/test/replicationcontrollers/" + nameRC

buf := bytes.NewBuffer([]byte{}) cmd := NewCmdApply(f, buf) <del> cmd.Flags().Set("filename", filenameRC) cmd.Flags().Set("filename", filenameSVC) </del> <ins> if asList { cmd.Flags().Set("filename", filenameRCSVC) } else { cmd.Flags().Set("filename", filenameRC) cmd.Flags().Set("filename", filenameSVC) } </ins> cmd.Flags().Set("output", "name") cmd.Run(cmd, []string{})

// Names should come from the REST response, NOT the files expectRC := "replicationcontroller/" + nameRC + "n" expectSVC := "service/" + nameSVC + "n" <del> expect := expectRC + expectSVC if buf.String() != expect { t.Fatalf("unexpected output: %snexpected: %s", buf.String(), expect) </del> <ins> // Test both possible orders since output is non-deterministic. expectOne := expectRC + expectSVC expectTwo := expectSVC + expectRC if buf.String() != expectOne && buf.String() != expectTwo { t.Fatalf("unexpected output: %snexpected: %s OR %s", buf.String(), expectOne, expectTwo) </ins> } }

<ins> apiVersion: v1 kind: List items: - apiVersion: v1 kind: Service metadata: name: test-service labels: name: test-service spec: ports: - port: 80 selector: name: test-rc - apiVersion: v1 kind: ReplicationController metadata: name: test-rc labels: name: test-rc spec: replicas: 1 template: metadata: labels: name: test-rc spec: containers: - name: test-rc image: nginx ports: - containerPort: 80 </ins>

<ins> apiVersion: v1 kind: ReplicationController metadata: name: test-rc labels: name: test-rc spec: replicas: 1 template: metadata: labels: name: test-rc spec: containers: - name: test-rc image: nginx ports: - containerPort: 80 </ins>

<ins> apiVersion: v1 kind: Service metadata: name: test-service labels: name: test-service spec: ports: - port: 80 selector: name: test-rc </ins>