Skip to content

Commit

Permalink
update kube events
Browse files Browse the repository at this point in the history
  • Loading branch information
niqdev committed Oct 23, 2023
1 parent 01597be commit 9a45659
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 0 additions & 4 deletions pkg/box/kubernetes/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ func newPodLogsExitKubeConsoleEvent() *kubeBoxEvent {
return &kubeBoxEvent{kind: event.LoaderUpdate, value: "killing"}
}

func newPodLogsErrorKubeEvent(namespace string, name string, err error) *kubeBoxEvent {
return &kubeBoxEvent{kind: event.LogError, value: fmt.Sprintf("pod logs error: namespace=%s name=%s error=%v", namespace, name, err)}
}

func newPodPortForwardIgnoreKubeEvent(namespace string, name string) *kubeBoxEvent {
return &kubeBoxEvent{kind: event.LogWarning, value: fmt.Sprintf("pod port-forward ignored: namespace=%s name=%s", namespace, name)}
}
Expand Down
9 changes: 4 additions & 5 deletions pkg/box/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ func (box *KubeBoxClient) execBox(template *boxModel.BoxV1, info *boxModel.BoxIn
return box.logsBox(template, info, streamOpts, deleteOnExit)
}

if deleteOnExit {
defer box.deleteBox(info.Name)
}

// exec
opts := &kubernetes.PodExecOpts{
Namespace: box.clientOpts.Namespace,
Expand All @@ -229,11 +233,6 @@ func (box *KubeBoxClient) execBox(template *boxModel.BoxV1, info *boxModel.BoxIn
box.eventBus.Publish(newPodExecKubeLoaderEvent())
},
}

if deleteOnExit {
defer box.deleteBox(info.Name)
}

box.eventBus.Publish(newPodExecKubeEvent(template.Name, box.clientOpts.Namespace, info.Id, template.Shell))
return box.client.PodExecShell(opts)
}
Expand Down

0 comments on commit 9a45659

Please sign in to comment.