Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kargs handling regressions? #2430

Open
miabbott opened this issue Sep 14, 2021 · 2 comments
Open

kargs handling regressions? #2430

miabbott opened this issue Sep 14, 2021 · 2 comments

Comments

@miabbott
Copy link
Member

Using quay.io/coreos-assembler/coreos-assembler:latest (maps to commit 350c1d9), when I do coreos-assembler run --kargs foo=bar --kargs bar=foo, only the last karg is being appended to the kernel cmdline.

$ coreos-assembler run --kargs foo=bar --kargs bar=foo
COREOS_ASSEMBLER_CONTAINER_RUNTIME_ARGS=--name cosa-again
BASH_FUNC_coreos-assembler%%=() {  env | grep --color=auto COREOS_ASSEMBLER;
 chrt --idle 0 podman run --rm -ti --security-opt label=disable --privileged --uidmap=1000:0:1 --uidmap=0:1:1000 --uidmap 1001:1001:64536 -v ${PWD}:/srv/ --device /dev/kvm --device /dev/fuse --tmpfs /tmp -v /var/tmp:/var/tmp --name coreos-assembler ${COREOS_ASSEMBLER_CONFIG_GIT:+-v $COREOS_ASSEMBLER_CONFIG_GIT:/srv/;
+ chrt --idle 0 podman run --rm -ti --security-opt label=disable --privileged --uidmap=1000:0:1 --uidmap=0:1:1000 --uidmap 1001:1001:64536 -v /var/home/miabbott/openshift-os:/srv/ --device /dev/kvm --device /dev/fuse --tmpfs /tmp -v /var/tmp:/var/tmp --name coreos-assembler --name cosa-again quay.io/coreos-assemblero
[EVENT | QEMU guest is ready for SSH] [ [0;32m  OK   [0m] Started Network Manager Script Dispatcher Service.

Red Hat Enterprise Linux CoreOS 49.84.202109102026-0
  Part of OpenShift 4.9, RHCOS is a Kubernetes native operating system
  managed by the Machine Config Operator (`clusteroperator/machine-config`).

WARNING: Direct SSH access to machines is not recommended; instead,
make configuration changes via `machineconfig` objects:
  https://docs.openshift.com/container-platform/4.9/architecture/architecture-rhcos.html

---
Last login: Tue Sep 14 14:34:40 2021
[core@cosa-devsh ~]$ cat /proc/cmdline | more
BOOT_IMAGE=(hd0,gpt3)/ostree/rhcos-e0dce123559987d6a71c679e6357caebe104c0ed2778092a601fdf6c79f4dc0c/vmlinuz-4.18.0-305.17.1.el8_4.x86_64 random.trust_cpu=on console=tty0 console=ttyS0,115200n8 ignition.platform.id=qemu ignition.firstboot ostree=/ostree/boot.1/rhcos/e0dce123559987d6a71c679e6357caebe104c0ed2778092a601f
df6c79f4dc0c/0 bar=foo

Additionally, trying to combine multiple kargs into a single string causes cosa to choke:

$ coreos-assembler run --kargs "foo=bar bar=foo"
COREOS_ASSEMBLER_CONTAINER_RUNTIME_ARGS=--name cosa-again
BASH_FUNC_coreos-assembler%%=() {  env | grep --color=auto COREOS_ASSEMBLER;
 chrt --idle 0 podman run --rm -ti --security-opt label=disable --privileged --uidmap=1000:0:1 --uidmap=0:1:1000 --uidmap 1001:1001:64536 -v ${PWD}:/srv/ --device /dev/kvm --device /dev/fuse --tmpfs /tmp -v /var/tmp:/var/tmp --name coreos-assembler ${COREOS_ASSEMBLER_CONFIG_GIT:+-v $COREOS_ASSEMBLER_CONFIG_GIT:/srv/src/config/:ro} ${COREOS_ASSEMBLER_GIT:+-v $COREOS_ASSEMBLER_GIT/src/:/usr/lib/coreos-assembler/:ro} ${COREOS_ASSEMBLER_CONTAINER_RUNTIME_ARGS} ${COREOS_ASSEMBLER_CONTAINER:-quay.io/coreos-assembler/coreos-assembler:latest} $@;
+ chrt --idle 0 podman run --rm -ti --security-opt label=disable --privileged --uidmap=1000:0:1 --uidmap=0:1:1000 --uidmap 1001:1001:64536 -v /var/home/miabbott/openshift-os:/srv/ --device /dev/kvm --device /dev/fuse --tmpfs /tmp -v /var/tmp:/var/tmp --name coreos-assembler --name cosa-again quay.io/coreos-assembler/coreos-assembler:latest run --kargs foo=bar bar=foo
Error: Unhandled non-option argument passed for qemu: bar=foo
2021-09-14T14:35:39Z cli: Unhandled non-option argument passed for qemu: bar=foo
+ rc=1
+ set +x

These look like regressions based on the idea of the implementation here:

#1263 (comment)

...and the actual implementation in #1265

@miabbott
Copy link
Member Author

@mike-nguyen points out that multiple kargs can be passed as a string if you are already in the coreos-assembler shell

$ coreos-assembler shell
COREOS_ASSEMBLER_CONTAINER_RUNTIME_ARGS=--name cosa-again
BASH_FUNC_coreos-assembler%%=() {  env | grep --color=auto COREOS_ASSEMBLER;
 chrt --idle 0 podman run --rm -ti --security-opt label=disable --privileged --uidmap=1000:0:1 --uidmap=0:1:1000 --uidmap 1001:1001:64536 -v ${PWD}:/srv/ --device /dev/kvm --device /dev/fuse --tmpfs /tmp -v /var/tmp:/var/tmp --name coreos-assembler ${COREOS_ASSEMBLER_CONFIG_GIT:+-v $COREOS_ASSEMBLER_CONFIG_GIT:/srv/src/config/:ro} ${COREOS_ASSEMBLER_GIT:+-v $COREOS_ASSEMBLER_GIT/src/:/usr/lib/coreos-assembler/:ro} ${COREOS_ASSEMBLER_CONTAINER_RUNTIME_ARGS} ${COREOS_ASSEMBLER_CONTAINER:-quay.io/coreos-assembler/coreos-assembler:latest} $@;
+ chrt --idle 0 podman run --rm -ti --security-opt label=disable --privileged --uidmap=1000:0:1 --uidmap=0:1:1000 --uidmap 1001:1001:64536 -v /var/home/miabbott/openshift-os:/srv/ --device /dev/kvm --device /dev/fuse --tmpfs /tmp -v /var/tmp:/var/tmp --name coreos-assembler --name cosa-again quay.io/coreos-assembler/coreos-assembler:latest shell
[coreos-assembler]$ coreos-assembler run --kargs "foo=bar bar=foo"
[EVENT | QEMU guest is ready for SSH] [ [0;32m  OK   [0m] Started Generate SSH keys snippet f…via console-login-helper-messages.
Red Hat Enterprise Linux CoreOS 49.84.202109102026-0
  Part of OpenShift 4.9, RHCOS is a Kubernetes native operating system
  managed by the Machine Config Operator (`clusteroperator/machine-config`).

WARNING: Direct SSH access to machines is not recommended; instead,
make configuration changes via `machineconfig` objects:
  https://docs.openshift.com/container-platform/4.9/architecture/architecture-rhcos.html

---
[core@cosa-devsh ~]$ cat /proc/cmdline | more
BOOT_IMAGE=(hd0,gpt3)/ostree/rhcos-e0dce123559987d6a71c679e6357caebe104c0ed2778092a601fdf6c79f4dc0c/vmlinuz-4.18.0-305.17.1.el8_4.x86_64 random.trust_cpu=on console=tty0 console=ttyS0,115200n8 ignition.platform.id=qemu ignition.firstboot ostree=/ostree/boot.1/rhcos/e0dce123559987d6a71c679e6357caebe104c0ed2778092a601f
df6c79f4dc0c/0 foo=bar bar=foo
[core@cosa-devsh ~]$ 

However, multiple uses of --karg don't appear to be honored

$ coreos-assembler shell
COREOS_ASSEMBLER_CONTAINER_RUNTIME_ARGS=--name cosa-again
BASH_FUNC_coreos-assembler%%=() {  env | grep --color=auto COREOS_ASSEMBLER;
 chrt --idle 0 podman run --rm -ti --security-opt label=disable --privileged --uidmap=1000:0:1 --uidmap=0:1:1000 --uidmap 1001:1001:64536 -v ${PWD}:/srv/ --device /dev/kvm --device /dev/fuse --tmpfs /tmp -v /var/tmp:/var/tmp --name coreos-assembler ${COREOS_ASSEMBLER_CONFIG_GIT:+-v $COREOS_ASSEMBLER_CONFIG_GIT:/srv/src/config/:ro} ${COREOS_ASSEMBLER_GIT:+-v $COREOS_ASSEMBLER_GIT/src/:/usr/lib/coreos-assembler/:ro} ${COREOS_ASSEMBLER_CONTAINER_RUNTIME_ARGS} ${COREOS_ASSEMBLER_CONTAINER:-quay.io/coreos-assembler/coreos-assembler:latest} $@;
+ chrt --idle 0 podman run --rm -ti --security-opt label=disable --privileged --uidmap=1000:0:1 --uidmap=0:1:1000 --uidmap 1001:1001:64536 -v /var/home/miabbott/openshift-os:/srv/ --device /dev/kvm --device /dev/fuse --tmpfs /tmp -v /var/tmp:/var/tmp --name coreos-assembler --name cosa-again quay.io/coreos-assembler/coreos-assembler:latest shell
[coreos-assembler]$ coreos-assembler run --kargs foo=bar --kargs bar=foo
[EVENT | QEMU guest is ready for SSH] [ [0;32m  OK   [0m] Started Generate SSH keys snippet f…via console-login-helper-messages.
Red Hat Enterprise Linux CoreOS 49.84.202109102026-0
  Part of OpenShift 4.9, RHCOS is a Kubernetes native operating system
  managed by the Machine Config Operator (`clusteroperator/machine-config`).

WARNING: Direct SSH access to machines is not recommended; instead,
make configuration changes via `machineconfig` objects:
  https://docs.openshift.com/container-platform/4.9/architecture/architecture-rhcos.html

---
[core@cosa-devsh ~]$ cat /proc/cmdline 
BOOT_IMAGE=(hd0,gpt3)/ostree/rhcos-e0dce123559987d6a71c679e6357caebe104c0ed2778092a601fdf6c79f4dc0c/vmlinuz-4.18.0-305.17.1.el8_4.x86_64 random.trust_cpu=on console=tty0 console=ttyS0,115200n8 ignition.platform.id=qemu ignition.firstboot ostree=/ostree/boot.1/rhcos/e0dce123559987d6a71c679e6357caebe104c0ed2778092a601fdf6c79f4dc0c/0 bar=foo
[core@cosa-devsh ~]$ 

jlebon added a commit to jlebon/coreos-assembler that referenced this issue Sep 14, 2021
Seems like a natural thing to do, so let's support it.

See: coreos#2430
@jlebon
Copy link
Member

jlebon commented Sep 14, 2021

What does which cosa say? From the output above, it looks like you lost the quotes around "$@" in the alias definition, so it's splitting on the space within the quoted --kargs arg.

For the multiple --kargs part, I opened #2431.

cgwalters pushed a commit that referenced this issue Sep 14, 2021
Seems like a natural thing to do, so let's support it.

See: #2430
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants