Skip to content

feat: Add startup_script_timeout and delay_login_until_ready #84

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

Merged

Conversation

mafredri
Copy link
Member

Type: schema.TypeString,
ForceNew: true,
Optional: true,
Description: "A script to run before the agent is stopped. The script should exit when it is done to signal that the workspace can be stopped.",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated description here, I considered commenting it out or adding (NOT YET IMPLEMENTED.), but we'll likely do this soon after we get the startup script changes in.

@@ -46,13 +46,15 @@ resource "kubernetes_pod" "dev" {

### Optional

- `allow_login_before_ready` (Boolean) Allow users to login to the workspace before the agent is ready. Note that, when enabled, the agent could still be executing the startup script and the workspace in an incomplete state when logging in.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kylecarbs does this match what you were suggesting in coder/coder#5749 (comment)?

I interpreted it as an option to allow/prevent it. Is that how you intended it? Or did you intend it to be the "default behavior for login before ready"? If it's the latter, we could rename this to be just login_before_ready instead of allow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might invert the naming scheme because, eventually we'll make this default to blocking login before ready, and ideally it'd be false by default.

Apart from that we're aligned!

Copy link
Member Author

@mafredri mafredri Jan 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going a back and forth on the naming a bit:

wait_until_ready
stop_login_before_ready
delay_login_until_ready
block_login_until_ready
prevent_login_before_ready
disallow_login_before_ready
deny_login_before_ready

I think delay_login_until_ready is most descriptive and flexible option. This would allow us to implement --skip-delay-login --confirm-i-really-want-to-log-in-to-my-partially-started-workspace flag for users trying to SSH in. 😄

Likewise if admins want to truly block the behavior (i.e. startup script must complete before you can login), we can add a second boolean to actually prevent the behavior.

Alternatively we could have something like login_before_ready: delay, login_before_ready: no_skip, login_before_ready: yes.

Edit: 163bba0

Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, although it might be valuable to RFC/describe incoming changes. It will be definitely more complex than adding a single timeout.

@mafredri
Copy link
Member Author

LGTM, although it might be valuable to RFC/describe incoming changes. It will be definitely more complex than adding a single timeout.

Re: RFC, is there any specific questions you have after reading coder/coder#5749? I felt it adequately describes what will be implemented but I'm happy to answer any questions. IMO it won't be a very complex change since it's focused towards fixing the startup_script use-case only, leaving room for extending it to support shutdown_script.

@mafredri mafredri changed the title feat: Add startup_script_timeout and allow_login_before_ready feat: Add startup_script_timeout and delay_login_until_ready Jan 19, 2023
@mtojek
Copy link
Member

mtojek commented Jan 19, 2023

Yes, I have a feeling that we're missing a short paragraph mainly describing changes: WorkspaceAgentStatus vs WorkspaceAgentState, deprecation path for these properties.

It's hard to figure out from Introduce new WorkspaceAgentStatus: starting, start_timeout, started, (stopping, stop_timeout, stopped), what's the intention and outcomes without jumping about pages. I believe that users can find answers in the comments, but a single write-up would be appreciated.

@mafredri mafredri merged commit 0385749 into main Jan 23, 2023
@mafredri mafredri deleted the mafredri/add-startup-script-timeout-and-before-ready-login branch January 23, 2023 13:23
@github-actions github-actions bot locked and limited conversation to collaborators Jan 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants