Files
nomad/client/config/users.go
Seth Hoenig 286dce7a2a exec2: add a client.users configuration block (#20093)
* exec: add a client.users configuration block

For now just add min/max dynamic user values; soon we can also absorb
the "user.denylist" and "user.checked_drivers" options from the
deprecated client.options map.

* give the no-op pool implementation a better name

* use explicit error types to make referencing them cleaner in tests

* use import alias to not shadow package name
2024-03-08 16:02:32 -06:00

33 lines
785 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package config
import sconfig "github.com/hashicorp/nomad/nomad/structs/config"
// UsersConfig configures things related to operating system users.
type UsersConfig struct {
// MinDynamicUser is the lowest uid/gid for use in the dynamic users pool.
MinDynamicUser int
// MaxDynamicUser is the highest uid/gid for use in the dynamic users pool.
MaxDynamicUser int
}
func UsersConfigFromAgent(c *sconfig.UsersConfig) *UsersConfig {
return &UsersConfig{
MinDynamicUser: *c.MinDynamicUser,
MaxDynamicUser: *c.MaxDynamicUser,
}
}
func (u *UsersConfig) Copy() *UsersConfig {
if u == nil {
return nil
}
return &UsersConfig{
MinDynamicUser: u.MinDynamicUser,
MaxDynamicUser: u.MaxDynamicUser,
}
}