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

apiserver, apiclient: revise closing frame construction #1948

Merged
merged 2 commits into from
Feb 16, 2022

Conversation

etungsten
Copy link
Contributor

Issue number:
Resolves #1947

Description of changes:

Author: Erikson Tung <etung@amazon.com>
Date:   Tue Feb 8 13:33:53 2022 -0800

    apiserver, apiclient: revise closing frame construction
    
    apiserver now sends closing code "Normal" when the apiclient-exec'd
    process finishes regardless of its exit code.
    The process's exit code is now stored in the closing frame's reason
    message which then gets extracted out in apiclient to determine the
    proper exit status.


Author: Erikson Tung <etung@amazon.com>
Date:   Tue Feb 8 13:32:55 2022 -0800

    apiclient: update tokio-tungstenite to v0.16+

Testing done:
Built aws-k8s-1.21 x86_64 image and created AMI out of it
Launched instance, boots fine, both host containers come up fine.
Got into the control container via SSM start-session and tried the following:

[ssm-user@ip-192-168-7-35 /]$ apiclient -u /os
{"arch":"x86_64","build_id":"efda1795","pretty_name":"Bottlerocket OS 1.6.0 (aws-k8s-1.21)","variant_id":"aws-k8s-1.21","version_id":"1.6.0"}

[ssm-user@ip-192-168-7-35 /]$ apiclient exec admin cat /etc/motd
Welcome to Bottlerocket's admin container!

This container provides access to the Bottlerocket host filesystems (see
/.bottlerocket/rootfs) and contains common tools for inspection and
troubleshooting.  It is based on Amazon Linux 2, and most things are in the
same places you would find them on an AL2 host.

To permit more intrusive troubleshooting, including actions that mutate the
running state of the Bottlerocket host, we provide a tool called "sheltie"
(`sudo sheltie`).  When run, this tool drops you into a root shell in the
Bottlerocket host's root filesystem.
[ssm-user@ip-192-168-7-35 /]$ echo $?
0

[ssm-user@ip-192-168-7-35 /]$ apiclient exec admin cat /path/to/nowhere
cat: /path/to/nowhere: No such file or directory
[ssm-user@ip-192-168-7-35 /]$ echo $?
1

[ssm-user@ip-192-168-7-35 /]$ enter-admin-container
Confirming admin container is enabled...
Waiting for admin container to start...
Entering admin container
bash-4.2# exit                                                                                                                    
exit
[ssm-user@ip-192-168-7-35 /]$ echo $?
0
[ssm-user@ip-192-168-7-35 /]$ 

apiclient exec behaves as expected, the exit status reflects the exec'd process's exit status.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

@etungsten etungsten requested review from cbgbt and zmrow February 8, 2022 22:46
apiserver now sends closing code "Normal" when the apiclient-exec'd
process finishes regardless of its exit code.
The process's exit code is now stored in the closing frame's reason
message which then gets extracted out in apiclient to determine the
proper exit status.
@etungsten etungsten merged commit 3bca249 into bottlerocket-os:develop Feb 16, 2022
@etungsten etungsten deleted the webby-socks branch February 16, 2022 18:00
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

Successfully merging this pull request may close these issues.

apiclient: update tokio-tungstenite to v0.16.1+
4 participants