rc/file-system

Definition · Catalog README · Source

Use this extension when your workload needs a folder from the file system to be there when it starts, for example a folder for its data, a folder for temporary files, or a folder of configuration files.

In a Condition, you say where the folder must be, and if the workload only reads it or also writes to it. For a folder that the workload writes to, you also say if the files must still be there after the workload restarts. You can also say if all copies of the workload must see the same files, and how much space the folder needs.

The Condition does not say what kind of storage to use. A network file system, a cloud file service or a local disk can all give the same folder. The platform chooses.

Documentation

This experimental extension describes a file system path that a workload expects to be mounted, such as a data directory, a scratch directory or a directory of configuration files. A Condition states what the workload expects at the path. It does not name the storage technology behind it; NFS, a cloud file service or a local disk can all fulfill the same Condition.

The first immutable candidate release is 0.1.0. The newest is 0.2.0, with the same rules and descriptions and examples for every part.

Example Condition:

- name: library-data
  kind: rc.file_system
  interface:
    type: mount
    path: /var/lib/media-library
    access: read_write
    persistence: persistent
    minimumSize: 10Gi

A workload that reads the mount path from an environment variable declares the variable instead of, or in addition to, a literal path:

- name: credentials
  kind: rc.file_system
  interface:
    type: mount
    access: read_only
  env:
    - property: path
      name: CREDENTIALS_DIR

A complete Profile with a data directory, a read-only configuration mount and an environment-supplied path is in examples/data-and-config-mounts-profile.yaml.

Vocabulary

Field Values Adapter decision it enables
interface.path Absolute path Where to mount. Required unless env supplies the path.
interface.access read_only, read_write Whether the mount must be writable. Required.
interface.persistence persistent, ephemeral Whether written data must survive a restart or replacement of the workload instance (persistent) or may be discarded with it (ephemeral). Required when access is read_write.
interface.sharing shared, exclusive Whether every instance of the workload must see the same contents (shared) or each must have its own (exclusive). Optional; omitted means no requirement.
interface.minimumSize Whole number with Mi, Gi or Ti, such as 10Gi The least capacity to provide. Optional.
env[].property path Which environment variable must hold the mount path, so the adapter can choose where to mount and tell the workload.

A Condition gives the path as interface.path, through env, or both. With both, the literal is the workload's default and the variable overrides it.

persistence, sharing and minimumSize describe data the workload writes. Omit them on a read-only mount, whose contents the target environment supplies.

The contents of a read-only mount, file ownership and permissions, performance and encryption are intentionally not part of this release.

Packages

Install the package for your language to declare this extension's Conditions from your code.

Go

Package
runtimeconditions.io/x/rc/filesystem
Version
0.2.0 Not published yet

This package version is generated but not published to its registry yet.

go get runtimeconditions.io/x/rc/filesystem@v0.2.0

Conditions

Every Condition part this package defines, with the fields you can set. Select a line to open it.

rc.file_system · mount: A folder that the platform mounts into your workload at a path.

filesystem.Mount is the interface of a rc.file_system Condition.

Field Type Required Description
Access Access yes Whether your workload only reads the folder, or also writes to it. read_only or read_write.
Values:
read_only: The workload only reads the folder. The platform puts the files there.
read_write: The workload also writes to the folder.
MinimumSize *string no The least space that the folder must have, such as 10Gi. Use a whole number with Mi, Gi or Ti. A whole number followed by Mi, Gi or Ti, such as 512Mi or 10Gi.
Path *string no The full path where the folder must be, such as /var/lib/app. You need it unless env gives the path. The full path of the folder. It must start with / and cannot be only /.
Persistence *Persistence no Whether the files that your workload writes must still be there after it restarts or is replaced. You need it when access is read_write. persistent or ephemeral.
Values:
ephemeral: The files can be lost when the workload restarts or is replaced.
persistent: The files must still be there after the workload restarts or is replaced.
Sharing *Sharing no Whether every copy of your workload must see the same files, or each copy must have its own. Leave it out if either works. shared or exclusive.
Values:
exclusive: Each copy of the workload has its own files.
shared: Every copy of the workload sees the same files.
env on rc.file_system · mount: The environment variable that tells your workload where the folder is.

filesystem.Env sets the env field of a rc.file_system Condition.

It has no fields to set.

RcFileSystem

filesystem.RcFileSystem declares a rc.file_system Condition.

Example: a workload that keeps its media library in /var/lib/media-library. It writes there, the files must still be there after a restart, and the folder needs at least 10 GiB of space.

filesystem.RcFileSystem(
	filesystem.Mount{
		Access:      filesystem.AccessReadWrite,
		MinimumSize: &[]string{"10Gi"}[0],
		Path:        &[]string{"/var/lib/media-library"}[0],
		Persistence: &[]filesystem.Persistence{filesystem.PersistencePersistent}[0],
	},
)

Env

filesystem.Env sets the env field of rc.file_system Conditions with interface type mount.

The environment variable that tells your workload where the folder is. Use it when your workload reads the path from a variable, so the platform can choose where to mount the folder. If you also give interface.path, that path is the default and the variable can change it.

Example: a workload that reads its credential files from the folder named in CREDENTIALS_DIR.

filesystem.RcFileSystem(
	filesystem.Mount{
		Access: filesystem.AccessReadOnly,
	},
	filesystem.Env{
		filesystem.EnvItem{
			Name:     "CREDENTIALS_DIR",
			Property: filesystem.PropertyPath,
		},
	},
)

The full API, with every type, field and constant documented, is in the Go package documentation.

Python

Package
runtimeconditions-file-system
Version
0.2.0 Not published yet

This package version is generated but not published to its registry yet.

pip install runtimeconditions-file-system

Conditions

Every Condition part this package defines, with the fields you can set. Select a line to open it.

rc.file_system · mount: A folder that the platform mounts into your workload at a path.

Mount is the interface of a rc.file_system Condition.

Field Type Required Description
access Access yes Whether your workload only reads the folder, or also writes to it. read_only or read_write.
Values:
read_only: The workload only reads the folder. The platform puts the files there.
read_write: The workload also writes to the folder.
minimum_size str | None no The least space that the folder must have, such as 10Gi. Use a whole number with Mi, Gi or Ti. A whole number followed by Mi, Gi or Ti, such as 512Mi or 10Gi.
path str | None no The full path where the folder must be, such as /var/lib/app. You need it unless env gives the path. The full path of the folder. It must start with / and cannot be only /.
persistence Persistence | None no Whether the files that your workload writes must still be there after it restarts or is replaced. You need it when access is read_write. persistent or ephemeral.
Values:
ephemeral: The files can be lost when the workload restarts or is replaced.
persistent: The files must still be there after the workload restarts or is replaced.
sharing Sharing | None no Whether every copy of your workload must see the same files, or each copy must have its own. Leave it out if either works. shared or exclusive.
Values:
exclusive: Each copy of the workload has its own files.
shared: Every copy of the workload sees the same files.
env on rc.file_system · mount: The environment variable that tells your workload where the folder is.

Env sets the env field of a rc.file_system Condition.

Field Type Required Description
value EnvValue yes The environment variable that tells your workload where the folder is. Use it when your workload reads the path from a variable, so the platform can choose where to mount the folder. If you also give interface.path, that path is the default and the variable can change it. Example: a workload that reads its credential files from the folder named in CREDENTIALS_DIR. The environment variables that tell your workload where the folder is. List at least one, each one once.
value[].name str yes The name of the variable, such as DATA_DIR. It uses letters, digits and underscores, and cannot start with a digit.
value[].property Property yes What the variable holds. Only path is allowed.
Values:
path: The variable holds the path of the folder.
value[].required bool | None no True when the workload cannot start without this variable.
value[].sensitive bool | None no True when the value is a secret, so the platform can store and pass it securely.

rc_file_system

rc_file_system declares a rc.file_system Condition.

Example: a workload that keeps its media library in /var/lib/media-library. It writes there, the files must still be there after a restart, and the folder needs at least 10 GiB of space.

from runtimeconditions_file_system import Access, Mount, Persistence, rc_file_system

rc_file_system(
    Mount(
        access=Access.READ_WRITE,
        minimum_size="10Gi",
        path="/var/lib/media-library",
        persistence=Persistence.PERSISTENT,
    ),
)

Env

Env sets the env field of rc.file_system Conditions with interface type mount.

The environment variable that tells your workload where the folder is. Use it when your workload reads the path from a variable, so the platform can choose where to mount the folder. If you also give interface.path, that path is the default and the variable can change it.

Example: a workload that reads its credential files from the folder named in CREDENTIALS_DIR.

from runtimeconditions_file_system import (
    Access,
    Env,
    EnvItem,
    Mount,
    Property,
    rc_file_system,
)

rc_file_system(
    Mount(access=Access.READ_ONLY),
    Env(value=[EnvItem(name="CREDENTIALS_DIR", property=Property.PATH)]),
)

Every class, field and enum member is documented in the package's docstrings.

TypeScript

Package
@runtimeconditions/file-system
Version
0.2.0 Not published yet

This package version is generated but not published to its registry yet.

npm install @runtimeconditions/file-system

Conditions

Every Condition part this package defines, with the fields you can set. Select a line to open it.

rc.file_system · mount: A folder that the platform mounts into your workload at a path.

Mount is the interface of a rc.file_system Condition.

Field Type Required Description
access Access yes Whether your workload only reads the folder, or also writes to it. read_only or read_write.
Values:
read_only: The workload only reads the folder. The platform puts the files there.
read_write: The workload also writes to the folder.
minimumSize string no The least space that the folder must have, such as 10Gi. Use a whole number with Mi, Gi or Ti. A whole number followed by Mi, Gi or Ti, such as 512Mi or 10Gi.
path string no The full path where the folder must be, such as /var/lib/app. You need it unless env gives the path. The full path of the folder. It must start with / and cannot be only /.
persistence Persistence no Whether the files that your workload writes must still be there after it restarts or is replaced. You need it when access is read_write. persistent or ephemeral.
Values:
ephemeral: The files can be lost when the workload restarts or is replaced.
persistent: The files must still be there after the workload restarts or is replaced.
sharing Sharing no Whether every copy of your workload must see the same files, or each copy must have its own. Leave it out if either works. shared or exclusive.
Values:
exclusive: Each copy of the workload has its own files.
shared: Every copy of the workload sees the same files.
env on rc.file_system · mount: The environment variable that tells your workload where the folder is.

Env sets the env field of a rc.file_system Condition.

Field Type Required Description
value EnvValue yes The environment variable that tells your workload where the folder is. Use it when your workload reads the path from a variable, so the platform can choose where to mount the folder. If you also give interface.path, that path is the default and the variable can change it. Example: a workload that reads its credential files from the folder named in CREDENTIALS_DIR. The environment variables that tell your workload where the folder is. List at least one, each one once.
value[].name string yes The name of the variable, such as DATA_DIR. It uses letters, digits and underscores, and cannot start with a digit.
value[].property Property yes What the variable holds. Only path is allowed.
Values:
path: The variable holds the path of the folder.
value[].required boolean no True when the workload cannot start without this variable.
value[].sensitive boolean no True when the value is a secret, so the platform can store and pass it securely.

rcFileSystem

rcFileSystem declares a rc.file_system Condition.

Example: a workload that keeps its media library in /var/lib/media-library. It writes there, the files must still be there after a restart, and the folder needs at least 10 GiB of space.

import { Access, Mount, Persistence, rcFileSystem } from "@runtimeconditions/file-system";

rcFileSystem(
  new Mount({
    access: Access.ReadWrite,
    minimumSize: "10Gi",
    path: "/var/lib/media-library",
    persistence: Persistence.Persistent,
  }),
);

Env

Env sets the env field of rc.file_system Conditions with interface type mount.

The environment variable that tells your workload where the folder is. Use it when your workload reads the path from a variable, so the platform can choose where to mount the folder. If you also give interface.path, that path is the default and the variable can change it.

Example: a workload that reads its credential files from the folder named in CREDENTIALS_DIR.

kind: rc.file_system
interface:
  type: mount
  access: read_only
env:
  - property: path
    name: CREDENTIALS_DIR

Every class, field and enum member is documented in the package's type declarations.

Java

Package
io.runtimeconditions.bindings:runtimeconditions-file-system
Version
0.2.0 Not published yet

This package version is generated but not published to its registry yet.

<dependency>
  <groupId>io.runtimeconditions.bindings</groupId>
  <artifactId>runtimeconditions-file-system</artifactId>
  <version>0.2.0</version>
</dependency>

Conditions

Every Condition part this package defines, with the fields you can set. Select a line to open it.

rc.file_system · mount: A folder that the platform mounts into your workload at a path.

Mount is the interface of a rc.file_system Condition.

Field Type Required Description
access Access yes Whether your workload only reads the folder, or also writes to it. read_only or read_write.
Values:
read_only: The workload only reads the folder. The platform puts the files there.
read_write: The workload also writes to the folder.
minimumSize String no The least space that the folder must have, such as 10Gi. Use a whole number with Mi, Gi or Ti. A whole number followed by Mi, Gi or Ti, such as 512Mi or 10Gi.
path String no The full path where the folder must be, such as /var/lib/app. You need it unless env gives the path. The full path of the folder. It must start with / and cannot be only /.
persistence Persistence no Whether the files that your workload writes must still be there after it restarts or is replaced. You need it when access is read_write. persistent or ephemeral.
Values:
ephemeral: The files can be lost when the workload restarts or is replaced.
persistent: The files must still be there after the workload restarts or is replaced.
sharing Sharing no Whether every copy of your workload must see the same files, or each copy must have its own. Leave it out if either works. shared or exclusive.
Values:
exclusive: Each copy of the workload has its own files.
shared: Every copy of the workload sees the same files.
env on rc.file_system · mount: The environment variable that tells your workload where the folder is.

Env sets the env field of a rc.file_system Condition.

Field Type Required Description
value EnvValue yes The environment variable that tells your workload where the folder is. Use it when your workload reads the path from a variable, so the platform can choose where to mount the folder. If you also give interface.path, that path is the default and the variable can change it. Example: a workload that reads its credential files from the folder named in CREDENTIALS_DIR. The environment variables that tell your workload where the folder is. List at least one, each one once.
value[].name String yes The name of the variable, such as DATA_DIR. It uses letters, digits and underscores, and cannot start with a digit.
value[].property Property yes What the variable holds. Only path is allowed.
Values:
path: The variable holds the path of the folder.
value[].required Boolean no True when the workload cannot start without this variable.
value[].sensitive Boolean no True when the value is a secret, so the platform can store and pass it securely.

Bindings.rcFileSystem

Bindings.rcFileSystem declares a rc.file_system Condition.

Example: a workload that keeps its media library in /var/lib/media-library. It writes there, the files must still be there after a restart, and the folder needs at least 10 GiB of space.

import io.runtimeconditions.bindings.filesystem.Access;
import io.runtimeconditions.bindings.filesystem.Bindings;
import io.runtimeconditions.bindings.filesystem.Mount;
import io.runtimeconditions.bindings.filesystem.Persistence;

Bindings.rcFileSystem(
    new Mount(Access.READ_WRITE, "10Gi", "/var/lib/media-library", Persistence.PERSISTENT, null));

Env

Env sets the env field of rc.file_system Conditions with interface type mount.

The environment variable that tells your workload where the folder is. Use it when your workload reads the path from a variable, so the platform can choose where to mount the folder. If you also give interface.path, that path is the default and the variable can change it.

Example: a workload that reads its credential files from the folder named in CREDENTIALS_DIR.

import io.runtimeconditions.bindings.filesystem.Access;
import io.runtimeconditions.bindings.filesystem.Bindings;
import io.runtimeconditions.bindings.filesystem.Env;
import io.runtimeconditions.bindings.filesystem.EnvItem;
import io.runtimeconditions.bindings.filesystem.EnvValue;
import io.runtimeconditions.bindings.filesystem.Mount;
import io.runtimeconditions.bindings.filesystem.Property;
import java.util.List;

Bindings.rcFileSystem(
    new Mount(Access.READ_ONLY, null, null, null, null),
    new Env(new EnvValue(List.of(new EnvItem("CREDENTIALS_DIR", Property.PATH, null, null)))));

Every record, component and enum constant is documented in the Javadoc.

Kinds

rc.file_system

Your workload needs a folder from the file system.

Example: a workload that keeps its media library in /var/lib/media-library. It writes there, the files must still be there after a restart, and the folder needs at least 10 GiB of space.

kind: rc.file_system
interface:
  type: mount
  path: /var/lib/media-library
  access: read_write
  persistence: persistent
  minimumSize: 10Gi

Interface types

Interface types

mount rc.file_system

A folder that the platform mounts into your workload at a path.

Example: a workload that reads its settings from files in /etc/media-library. It never writes there.

kind: rc.file_system
interface:
  type: mount
  path: /etc/media-library
  access: read_only

Fields

interface.path

The full path where the folder must be, such as /var/lib/app. You need it unless env gives the path.

interface.access

Whether your workload only reads the folder, or also writes to it.

interface.persistence

Whether the files that your workload writes must still be there after it restarts or is replaced. You need it when access is read_write.

interface.sharing

Whether every copy of your workload must see the same files, or each copy must have its own. Leave it out if either works.

interface.minimumSize

The least space that the folder must have, such as 10Gi. Use a whole number with Mi, Gi or Ti.

Allowed values for interface.access
ValueDescription
read_onlyThe workload only reads the folder. The platform puts the files there.
read_writeThe workload also writes to the folder.
Allowed values for interface.persistence
ValueDescription
persistentThe files must still be there after the workload restarts or is replaced.
ephemeralThe files can be lost when the workload restarts or is replaced.
Allowed values for interface.sharing
ValueDescription
sharedEvery copy of the workload sees the same files.
exclusiveEach copy of the workload has its own files.

Condition fields

envApplies to rc.file_system, mount

The environment variable that tells your workload where the folder is. Use it when your workload reads the path from a variable, so the platform can choose where to mount the folder. If you also give interface.path, that path is the default and the variable can change it.

Example: a workload that reads its credential files from the folder named in CREDENTIALS_DIR.

kind: rc.file_system
interface:
  type: mount
  access: read_only
env:
  - property: path
    name: CREDENTIALS_DIR
Allowed values for env[].property
ValueDescription
pathThe variable holds the path of the folder.