Skip to content

Commit d2a425f

Browse files
Merge pull request #31 from segmentio/yolken-ignore-diff-warnings
Strip out kubectl warnings
2 parents 3415e54 + 9869a9a commit d2a425f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pkg/cluster/kube_client.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cluster
22

33
import (
4+
"bytes"
45
"context"
56
"encoding/json"
67
"fmt"
@@ -238,6 +239,13 @@ func (cc *KubeClusterClient) DiffStructured(
238239
)
239240
}
240241

242+
// Strip everything before the initial "{"; kubectl can insert arbitrary warnings, etc.
243+
// that can cause the result to not be valid JSON.
244+
jsonStart := bytes.Index(rawResults, []byte("{"))
245+
if jsonStart > 0 {
246+
rawResults = rawResults[jsonStart:]
247+
}
248+
241249
results := diff.Results{}
242250
if err := json.Unmarshal(rawResults, &results); err != nil {
243251
return nil, err

pkg/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
package version
22

33
// Version stores the current kubeapply version.
4-
const Version = "0.0.26"
4+
const Version = "0.0.27"

0 commit comments

Comments
 (0)