Kubeadm: refactor all calls to os.Exit() / CheckErr()

Created on 22 Aug 2019  路  8Comments  路  Source: kubernetes/kubeadm

in a number of places kubeadm calls:
https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/util/error.go#L54

if err is non-nil the function causes an abrupt os.Exit(..).

we need to refactor all calls to this function and any stray calls to os.Exit().

mini-guide:

if err := someOperation(); err != nil {
   return err
}

for more detail see the comments in this PR;
https://github.com/kubernetes/kubernetes/pull/80937#discussion_r312964179
https://github.com/kubernetes/kubernetes/pull/80937

cc @rosti for extra comments if needed.

help wanted kincleanup prioritbacklog

Most helpful comment

/assign

All 8 comments

/assign

Thanks for taking on this @michaelclopez ! Ping me for a review when ready.

In addition to CheckErr calls, we need to make sure, that we don't have any os.Exit() and klog.Fatal* calls.

  • os.Exit calls should return an appropriate error.
  • klog.Fatal* is basically klog.Error* and os.Exit(1). Any such calls should be replaced by klog.Error* and error return and propagation.

No problem @rosti. Should I ping you with questions in case I need clarification on something?

@michaelclopez , feel free to ping me for any kind of questions, that you might have.

we are in code freeze. punting to 1.17.

No problem @rosti. Should I ping you with questions in case I need clarification on something?

@michaelclopez Hi, sorry for bugging you, I'm going to do this task if you have no enough time. :)

cc: @neolit123 @rosti

Yes, sorry about the delay. Got pulled in a few directions here. Please take this if you can get it out sooner.

Yes, sorry about the delay. Got pulled in a few directions here. Please take this if you can get it out sooner.

@michaelclopez Thanks a lot. :)

Was this page helpful?
0 / 5 - 0 ratings