mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: size restricted tmpfs /tmp and read-only / support (#1012)
* fn: size restricted tmpfs /tmp and read-only / support *) read-only Root Fs Support *) removed CPUShares from docker API. This was unused. *) docker.Prepare() refactoring *) added docker.configureTmpFs() for size limited tmpfs on /tmp *) tmpfs size support in routes and resource tracker *) fix fn-test-utils to handle sparse files better in create file * test typo fix
This commit is contained in:
@@ -108,6 +108,9 @@ type Call struct {
|
||||
// Hot function idle timeout in seconds before termination.
|
||||
IdleTimeout int32 `json:"idle_timeout,omitempty" db:"-"`
|
||||
|
||||
// Tmpfs size in megabytes.
|
||||
TmpFsSize uint32 `json:"tmpfs_size,omitempty" db:"-"`
|
||||
|
||||
// Memory is the amount of RAM this call is allocated.
|
||||
Memory uint64 `json:"memory,omitempty" db:"-"`
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ type Route struct {
|
||||
Format string `json:"format" db:"format"`
|
||||
Timeout int32 `json:"timeout" db:"timeout"`
|
||||
IdleTimeout int32 `json:"idle_timeout" db:"idle_timeout"`
|
||||
TmpFsSize uint32 `json:"tmpfs_size" db:"tmpfs_size"`
|
||||
Config Config `json:"config,omitempty" db:"config"`
|
||||
Annotations Annotations `json:"annotations,omitempty" db:"annotations"`
|
||||
CreatedAt strfmt.DateTime `json:"created_at,omitempty" db:"created_at"`
|
||||
@@ -174,6 +175,7 @@ func (r1 *Route) Equals(r2 *Route) bool {
|
||||
eq = eq && r1.Format == r2.Format
|
||||
eq = eq && r1.Timeout == r2.Timeout
|
||||
eq = eq && r1.IdleTimeout == r2.IdleTimeout
|
||||
eq = eq && r1.TmpFsSize == r2.TmpFsSize
|
||||
eq = eq && r1.Config.Equals(r2.Config)
|
||||
eq = eq && r1.Annotations.Equals(r2.Annotations)
|
||||
// NOTE: datastore tests are not very fun to write with timestamp checks,
|
||||
@@ -207,6 +209,9 @@ func (r *Route) Update(patch *Route) {
|
||||
if patch.IdleTimeout != 0 {
|
||||
r.IdleTimeout = patch.IdleTimeout
|
||||
}
|
||||
if patch.TmpFsSize != 0 {
|
||||
r.TmpFsSize = patch.TmpFsSize
|
||||
}
|
||||
if patch.Format != "" {
|
||||
r.Format = patch.Format
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ func TestRouteSimple(t *testing.T) {
|
||||
Format: "http",
|
||||
Timeout: 10,
|
||||
IdleTimeout: 10,
|
||||
TmpFsSize: 10,
|
||||
}
|
||||
|
||||
err := route1.Validate()
|
||||
|
||||
Reference in New Issue
Block a user