forked from rancher/rancher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
59 lines (53 loc) · 2.52 KB
/
types.go
File metadata and controls
59 lines (53 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package plan
// Plan represents the basic unit of work performed by the system-agent.
type Plan struct {
Files []File `json:"files,omitempty"`
OneTimeInstructions []OneTimeInstruction `json:"instructions,omitempty"`
Probes map[string]Probe `json:"probes,omitempty"`
PeriodicInstructions []PeriodicInstruction `json:"periodicInstructions,omitempty"`
}
// File represents a file to be written on the node by the system-agent.
// Path is the absolute path on the node (e.g. /etc/kubernetes/ssl/ca.pem).
// Content is base64-encoded. If Directory is true, a directory is created, not a file.
type File struct {
Content string `json:"content,omitempty"`
Directory bool `json:"directory,omitempty"`
UID int `json:"uid,omitempty"`
GID int `json:"gid,omitempty"`
Path string `json:"path,omitempty"`
Permissions string `json:"permissions,omitempty"` // internally, the string will be converted to a uint32 to satisfy os.FileMode
Action string `json:"action,omitempty"`
}
// CommonInstruction holds fields shared by all instruction types.
type CommonInstruction struct {
Name string `json:"name,omitempty"`
Image string `json:"image,omitempty"`
Env []string `json:"env,omitempty"`
Args []string `json:"args,omitempty"`
Command string `json:"command,omitempty"`
}
// OneTimeInstruction is an instruction that is executed exactly once.
type OneTimeInstruction struct {
CommonInstruction
SaveOutput bool `json:"saveOutput,omitempty"`
}
// PeriodicInstruction is an instruction that is executed on a recurring schedule.
type PeriodicInstruction struct {
CommonInstruction
PeriodSeconds int `json:"periodSeconds,omitempty"` // default 600, i.e. 10 minutes
SaveStderrOutput bool `json:"saveStderrOutput,omitempty"`
}
// PeriodicInstructionOutput holds the result of a periodic instruction execution.
// The Stdout and Stderr fields are gzip+base64 encoded byte slices.
type PeriodicInstructionOutput struct {
Name string `json:"name"`
Stdout []byte `json:"stdout"`
Stderr []byte `json:"stderr"`
ExitCode int `json:"exitCode"`
// LastSuccessfulRunTime is a time.UnixDate formatted string of the last successful run.
LastSuccessfulRunTime string `json:"lastSuccessfulRunTime"`
// Failures is the number of consecutive times this instruction has failed.
Failures int `json:"failures"`
// LastFailedRunTime is a time.UnixDate formatted string of when the instruction started failing.
LastFailedRunTime string `json:"lastFailedRunTime"`
}