Skip to content

Commit

Permalink
Issue argoproj#1308 - argo diff --local fails if live object does not…
Browse files Browse the repository at this point in the history
… exist (argoproj#1309)
  • Loading branch information
alexmt authored Mar 21, 2019
1 parent d60fb2b commit ec7cbf8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cmd/argocd/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -687,9 +687,18 @@ func NewApplicationDiffCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
err := json.Unmarshal([]byte(res.LiveState), &live)
errors.CheckError(err)

key := kube.GetResourceKey(live)
var key kube.ResourceKey
if live != nil {
key = kube.GetResourceKey(live)
} else {
var target = &unstructured.Unstructured{}
err = json.Unmarshal([]byte(res.TargetState), &target)
errors.CheckError(err)
key = kube.GetResourceKey(target)
}

if local, ok := localObjs[key]; ok || live != nil {
if local != nil && !kube.IsCRD(live) {
if local != nil && !kube.IsCRD(local) {
err = kube.SetAppInstanceLabel(local, argoSettings.AppLabelKey, appName)
errors.CheckError(err)
}
Expand Down

0 comments on commit ec7cbf8

Please sign in to comment.