Documentation
¶
Index ¶
- Variables
- func Environment(items []string, namespace string, missing func(error) error) (env []string, secrets map[string]bool, err error)
- func EnvironmentDatastores(items []string, namespace string) (naming.Paths, error)
- func EnvironmentHasLocalSource(s string) bool
- func EnvironmentKeySources(value []string, namespace string) ([]keywords.KeySource, error)
- func InstallKeySources(value []string, namespace string) ([]keywords.KeySource, error)
- func InstalledDir(p naming.Path) string
- func IsLocalSource(s string) bool
- func Keywords(prefix string) []*keywords.Keyword
- func ModeHasSpecialBits(s string) bool
- func Pop(words []string) (string, []string)
- func SectionDatastores(get func(option string) []string, namespace string) []string
- func Split(text []string) [][]string
- func TextHasLocalSource(s string) bool
- func TextHasSpecialMode(s string) bool
- func ValidateInstall(value string) error
- type DataRecv
- func (t *DataRecv) DatastoreList(_ context.Context) naming.Paths
- func (t *DataRecv) Do(ctx context.Context) error
- func (t *DataRecv) HasMetadata(path naming.Path, k string) bool
- func (t *DataRecv) InstallDataByKind(kind naming.Kind) (bool, error)
- func (t *DataRecv) InstallFromDatastore(ctx context.Context, from object.DataStore) (bool, error)
- func (t *DataRecv) OldSendSignals(ctx context.Context) error
- func (t *DataRecv) RootDirPerm() *os.FileMode
- func (t *DataRecv) RunInstall(ctx context.Context) error
- func (t *DataRecv) SendSignals(ctx context.Context, signals *volsignal.T) error
- func (t *DataRecv) SetReceiver(to receiver)
- func (t *DataRecv) Status()
- type EnvItem
- type ErrEnvSourceMissing
- type Installed
- type KeyMeta
- type SigRoute
Constants ¶
This section is empty.
Variables ¶
var ( // GroupPermissions holds the owner and the permissions of the files // and directories installed, and of the root of the head. GroupPermissions = keywords.Group{ ID: "permissions", Name: "Owner and permissions", Text: keywords.NewText(fs, "text/group/permissions"), Order: 44, } // GroupInstall holds the files and directories installed in the head, // and the signals sent when they change. It has the id, name and order // of the install group of the tasks. GroupInstall = keywords.Group{ ID: "install", Name: "Install", Text: keywords.NewText(fs, "text/group/install"), Order: 46, } // Groups are the groups the keywords Keywords returns name. Groups = []keywords.Group{ GroupPermissions, GroupInstall, } )
The groups of the keywords Keywords returns, declared once here and added by each driver installing files in its head, the filesystems and the volumes.
The install lines and the configs, secrets and directories keywords they replace are no strategies: an install installs all of them, in order.
Functions ¶
func Environment ¶
func Environment(items []string, namespace string, missing func(error) error) (env []string, secrets map[string]bool, err error)
Environment returns the variables of the items of an environment keyword, NAME=value, in the order they are written, so the last of a name wins, and the names of the ones read from a sec, whose values are secret. A datastore or a key not existing is passed to missing, which says whether it is an error, nil going on without it. A key generated, "source random", not existing is an error: the provision of the object generates it on its leader node, and a variable going without it, or a password made here, would differ from what the other nodes and the data hold.
func EnvironmentDatastores ¶
EnvironmentDatastores returns the datastores the items of an environment keyword read, each once.
func EnvironmentHasLocalSource ¶
EnvironmentHasLocalSource reports whether an environment value names a source the server reads locally, as opposed to one it fetches over http or generates, as IsLocalSource tells.
A value the grammar refuses seeds nothing, as the resource refuses it at its action, but is judged all the same, every word following "source" taken for a source: what it means is not for the policy to guess.
func EnvironmentKeySources ¶
EnvironmentKeySources returns the keys the references of an environment value seed from a source, the value evaluated, its relative datastore paths being of the namespace given.
func InstallKeySources ¶
InstallKeySources returns the keys the lines of an install value seed from a source, the value evaluated, its relative datastore paths being of the namespace given. A line installing from the datastores of a pattern seeds the key of each one matching, as its install does.
func InstalledDir ¶
InstalledDir returns the directory holding the install records of the resources of the instance of p, a file named after each resource.
func IsLocalSource ¶
IsLocalSource reports whether a source is read from the node: any source but "random", which is generated, and an http or https url, fetched.
It is the test the seeding runs to choose between a generation, a fetch and a local read, so a source it reads locally, as "http:///etc/x" with no host, is never taken for a fetch here, and /dev/urandom is a path.
func ModeHasSpecialBits ¶
ModeHasSpecialBits reports whether a perm or dirperm value asks for the setuid or the setgid bit.
A file installed in a volume with one of them, owned by an account of the node, runs as that account for whoever executes it: on the node, where the volume is mounted, or in a container mounting the volume.
func Pop ¶
Pop returns "a", "b c d" from "a b c d". This function is used in a loop to iterate all words of a line until Pop returns "", "".
func SectionDatastores ¶
SectionDatastores returns the datastores a resource section reads keys of, each once, by the values of its keywords get returns, as evaluated for a node: the install lines installing from one, the references of the environment keywords, and the deprecated configs, secrets and environment keywords reading a datastore. Their relative paths are of the namespace given.
A line naming its datastores by a pattern of their name, as "./sec/haproxy-*", is returned as that pattern: it reads the datastores matching it when it runs, a datastore made later as well.
The values are read from the configuration alone, whatever the state of the resource: what an object uses is what its configuration names, which a stopped instance starts with again.
func TextHasLocalSource ¶
TextHasLocalSource reports whether an install text names a source the server reads locally, as opposed to one it fetches over http or generates.
It lives here, next to the grammar it parses, so the rbac policy that refuses a local source to a user holding no root grant does not have to reimplement that grammar and drift from it.
func TextHasSpecialMode ¶
TextHasSpecialMode reports whether an install text asks for the setuid or the setgid bit on one of the files or directories it installs.
Such a mode is not applied today: the mode word is read as permission bits alone. It is refused anyway, so a mode that would be applied once the grammar honours the bits is not one a user holding no root grant has already written.
func ValidateInstall ¶
ValidateInstall says whether the install lines of value are ones the install takes, as far as the lines naming datastores by a pattern go: their pattern, and the * of their destination, the files of the datastores having to be told apart. A line fetching its file from a url is held to fetchLineErr: an https url, a file, and no key nor template.
Types ¶
type DataRecv ¶
type DataRecv struct {
// Install is the list of files or directories to install in the data receiver.
Install []string `json:"install"`
// User is the default owner user of the installed items.
User string `json:"user"`
// Group is the default owner group of the installed items.
Group string `json:"group"`
// Perm is the default permission of the installed files.
Perm *os.FileMode `json:"perm"`
// DirPerm is the default permission of the installed directories.
// If not set, DirPerm defaults to Perm with execution bit over read bits (e.g. 0640 => 0750).
DirPerm *os.FileMode `json:"dirperm"`
// Deprecated by Install
Configs []string `json:"configs"`
Secrets []string `json:"secrets"`
Directories []string `json:"directories"`
Signal string `json:"signal"`
// contains filtered or unexported fields
}
func (*DataRecv) DatastoreList ¶
DatastoreList returns the datastores the resource installs from, each once, in the order the install lines and references name them first: several lines installing from the same datastore name it once.
func (*DataRecv) HasMetadata ¶
HasMetadata returns true if the volume has a configs or secrets reference to <namespace>/<kind>/<name>[/<key>]
func (*DataRecv) InstallDataByKind ¶
func (*DataRecv) InstallFromDatastore ¶
InstallFromDatastore installs the keys of the datastore from, the refresh a write of it runs.
func (*DataRecv) RootDirPerm ¶
func (*DataRecv) RunInstall ¶
RunInstall installs what the data receiver declares, as a start does, and logs what it leaves as it is too, and why: a directory in place, a file up to date, a key the store does not hold, a store that does not exist.
func (*DataRecv) SendSignals ¶
func (*DataRecv) SetReceiver ¶
func (t *DataRecv) SetReceiver(to receiver)
type EnvItem ¶
EnvItem is an item of an environment keyword: a variable with its value, NAME=value, or a variable read from the key of a datastore, NAME from <path> key <key> [source <uri>]. A * in the name of a reference stands for the key: with a key pattern, it names a variable per key matching. The source seeds the key the datastore does not hold.
func ParseEnvironment ¶
ParseEnvironment parses the items of an environment keyword, as the shell lexer splits it, the relative paths of its references in the namespace.
A word followed by "from" starts a reference, which no literal does: a literal holds an "=", or is a bare name a container engine reads from its own environment.
A reference ends after its key, or after "source <uri>": so a bare name "source" right after a reference, followed by another item, is read as the source of the reference. It is written "source=" or moved before the reference to be a variable. A "source" followed by "from" is the name of the next reference, and one ending the list a bare name.
type ErrEnvSourceMissing ¶
ErrEnvSourceMissing is a datastore or a key an environment item reads not existing, which a resource may run without.
func (ErrEnvSourceMissing) Error ¶
func (t ErrEnvSourceMissing) Error() string
type Installed ¶
Installed is the record of the last install of a resource that wrote files: the daemon watching it tells the tasks reading them.
func ReadInstalled ¶
ReadInstalled returns the install record of the file filename.
type KeyMeta ¶
func ParseKeyMetaRel ¶
func ParseKeyMetaRelSelf ¶
ParseKeyMetaRelSelf is ParseKeyMetaRel for a reference in the configuration of self: "from ." names self, and a relative path is of the namespace of self.
func ParseKeyMetaRelWithFallback ¶
ParseKeyMetaRelWithFallback parses a key reference in the format "from <path> key <key>" and falls back to the legacy format "<path>" with a default key name for backward compatibility.
func (*KeyMeta) RootDecode ¶
func (*KeyMeta) SourceIsRandom ¶
SourceIsRandom says the key is generated, "source random", rather than read from a source.