-
Notifications
You must be signed in to change notification settings - Fork 880
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a few nits, and questions, otherwise LGTM 👍
@@ -388,17 +383,17 @@ func RmApp(cfg RmConfig) error { | |||
} | |||
} | |||
|
|||
if err := RunCrossingEntrypoint(cfg.PodPath, cfg.PodPID, cfg.AppName.String(), appRmEntrypoint, args); err != nil { | |||
if err := RunCrossingEntrypoint(cfg.PodPath, cfg.PodPID, cfg.AppName.String(), appRmEntrypoint, args, false); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are starting to accumulate more, and more parameters. How about introducing a:
type CrossingEntryPoint struct {
PodPath string
PodPID string
AppName string
RmEntrypoint string
Interactive bool
}
and have the following method:
func (cep CrossingEntryPoint) Run() error {
...
}
The caller would instantiate a struct using obvious named values, and invoke the Run()
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes a lot of sense.
flavor, _, err := stage1initcommon.GetFlavor(p) | ||
if err != nil { | ||
log.PrintE("failed to get stage1 flavor", err) | ||
os.Exit(254) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't our logger exit with 254, when using log.FatalE
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does, it looks like we can get rid of all those explicit Exit().
if err != nil { | ||
log.FatalE("error getting cgroups", err) | ||
log.PrintE(`error preparing cgroups`, err) | ||
os.Exit(254) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, log.FatalE
doesn't exit with 254 already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to double-check, as I don't exactly remember what was going on here.
if !isUnified { | ||
enabledCgroups, err := v1.GetEnabledCgroups() | ||
// when using host cgroups, make the subgroup writable by pod systemd | ||
if flavor != "kvm" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh ....
@@ -165,10 +156,39 @@ func main() { | |||
Args: args, | |||
} | |||
|
|||
if err := cmd.Run(); err != nil { | |||
log.PrintE(`error executing "systemctl daemon-reload"`, err) | |||
if out, err := cmd.CombinedOutput(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
;-)
if err := cmd.Run(); err != nil { | ||
log.PrintE(`error executing "systemctl daemon-reload"`, err) | ||
if out, err := cmd.CombinedOutput(); err != nil { | ||
log.Error(fmt.Errorf("%q failed at daemon-reload:\n%s", appName, out)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log.Errorf
?
return errwrap.Wrap(errors.New("failed to determine cgroup version"), err) | ||
} | ||
|
||
if !isUnified { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if isUnified {
return nil
}
then untab the inner block
log.PrintE(`error executing "systemctl daemon-reload"`, err) | ||
|
||
if out, err := cmd.CombinedOutput(); err != nil { | ||
log.Error(fmt.Errorf("%q failed at daemon-reload:\n%s", appName, out)) | ||
os.Exit(254) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log.FatalF
?
if err := cmd.Run(); err != nil { | ||
log.PrintE(fmt.Sprintf("error starting app %q", appName.String()), err) | ||
if out, err := cmd.CombinedOutput(); err != nil { | ||
log.Error(fmt.Errorf("%q failed:\n%s", appName, out)) | ||
os.Exit(254) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log.FatalF
?
This add `Errorf()`, `Fatalf()` and `Panicf()` as convience helpers to format and print string errors.
This fixes an incorrect behavior regarding cgroups remounting. When running inside a kvm pod app-add should not try to tweak host cgroups, as the pod already gets a dedicated and writable cgroup hierarchy inside the VM.
This commit adds a `/etc/mtab -> ../proc/self/mounts` symlink in stage1 in oder to make mount and other tools happy.
a3fd941
to
24bbe1f
Compare
Added a couple more commits to cleanup a few other bits after review comments. @s-urbaniak PTAL. |
LGTM, nice to have the 254 exits consolidated! |
This is a cumulative PR containing multiple fixes for
rkt app
that surfaced while writing tests at #3371. Tests are not yet green, but these fixes should be ready to get in.