Skip to content

Template constraint for workspace scheduling #1433

Closed

Description

@ammario

Related #813

In v1, we have customers that wanted to shut down all workspaces in an organization on a period while simultaneously giving their developers control to suit their working patterns and time zone.

The problem with developer controlled auto stop is they're not the ones incentivized to reduce costs.

Solution

The cleanest solution I could think of is we allow the ability to set an auto-start at the template level in addition to the workspace level. That auto-stop can be overridden by the workspace, but only by schedules that have the same interval or less. For example, if a daily auto-stop is set in the template, a daily one must be set by the user.

Auto start policy is flipped, the template interval serves as the floor instead of the ceiling.

A caveat with this approach is UX complexity.

For example, if I set a template cron auto start of 9am CST Mon to Fri, and then a user configures 9AM GMT Tues to Sun (one extra day), we need a really clear error, because it's an easy mistake to make.

Org-level auto-start

We don't implement this. For one, it's added complexity. For two, the templates describe the resource costs, they should also describe the cost management. This is consistent with my proposed quota system.


cc @johnstcn

Acceptance Criteria

  • [/] Template: set max_ttl and min_autostart_duration
  • [/] Workspace: ttl and autostart_schedule constrained by template
  • [/] Template: update max_ttl and min_autostart_duration

Activity

  1. greyscaled commented on May 14, 2022

    @greyscaled
    Contributor

    I love the approach described here. Add just talked to @johnstcn about using the template-level for permissions on Friday. We should have a breakout to discuss technical impact so that we can slot this.

  2. changed the title [-]Add hierarchical workspace scheduling[/-] [+]Add Template constraint on workspace scheduling[/+] on May 17, 2022
  3. changed the title [-]Add Template constraint on workspace scheduling[/-] [+]Template constraint for workspace scheduling[/+] on May 17, 2022
  4. greyscaled commented on May 17, 2022

    @greyscaled
    Contributor

    Breakout details between @johnstcn and @vapurrmaid

    We're thinking about adding a max_uptime time.Duration field on a template -- this would be some duration after which ephemeral workspace resources built from the aforementioned template would be eligible for automatic shutdown.

    Spec:

    • max_uptime on template
    • validation on setting autostart and autostop that ensures they are within this interval.
  5. added this to the Community MVP milestone on May 17, 2022
  6. 16 remaining items

  7. reopened this on Jun 7, 2022
  8. ammario commented on Jun 7, 2022

    @ammario
    MemberAuthor

    @johnstcn why can't constraints be updated after the template is first created?

  9. johnstcn commented on Jun 8, 2022

    @johnstcn
    Member

    @johnstcn why can't constraints be updated after the template is first created?

    #2159

  10. ketang commented on Jun 8, 2022

    @ketang
    Contributor

    Nit: could it be confusing to use the edit command to change metadata rather than the core scripts?

    Can these be edited non-interactively via command line arguments?

  11. johnstcn commented on Jun 8, 2022

    @johnstcn
    Member

    Nit: could it be confusing to use the edit command to change metadata rather than the core scripts?

    What do you suggest as an alternative name? Would editmeta or metadata sound better?

    Can these be edited non-interactively via command line arguments?

    Currently, only non-interactive editing is supported.

  12. ketang commented on Jun 8, 2022

    @ketang
    Contributor

    Perhaps coder template schedule?

    Non interactive only is fine.

  13. johnstcn commented on Jun 8, 2022

    @johnstcn
    Member

    Perhaps coder template schedule?

    There's other template-specific metadata such as description that doesn't relate specifically to the template schedule; do you want to break this out into separate template subcommands?

  14. ketang commented on Jun 8, 2022

    @ketang
    Contributor

    Maybe not. Given that this is non-interactive, then it isn't the issue I assumed because users aren't prompted for a bunch of stuff they don't want to change. They opt in via the arguments they pass. edit is good, carry on, carry on.

  15. johnstcn commented on Jun 8, 2022

    @johnstcn
    Member

    @ammario Can this issue be closed?

  16. deleted a comment from greyscaled on Jun 14, 2022
  17. ammario commented on Oct 11, 2022

    @ammario
    MemberAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apiArea: HTTP APIcliArea: CLIsiteArea: frontend dashboard

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions