Skip to content

Commit cc056f8

Browse files
committed
feat: add public plan library for system-agent
Signed-off-by: Carlos Salas <carlos.salas@suse.com>
1 parent 4d8e0e6 commit cc056f8

2 files changed

Lines changed: 66 additions & 0 deletions

File tree

pkg/plan/go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/rancher/rancher/pkg/plan
2+
3+
go 1.25.0
4+
5+
toolchain go1.25.8

pkg/plan/types.go

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package plan
2+
3+
// Plan represents the basic unit of work performed by the system-agent
4+
type Plan struct {
5+
Files []File `json:"files,omitempty"`
6+
OneTimeInstructions []OneTimeInstruction `json:"instructions,omitempty"`
7+
Probes map[string]Probe `json:"probes,omitempty"`
8+
PeriodicInstructions []PeriodicInstruction `json:"periodicInstructions,omitempty"`
9+
}
10+
11+
type File struct {
12+
Content string `json:"content,omitempty"`
13+
Directory bool `json:"directory,omitempty"`
14+
UID int `json:"uid,omitempty"`
15+
GID int `json:"gid,omitempty"`
16+
Path string `json:"path,omitempty"`
17+
Permissions string `json:"permissions,omitempty"` // internally, the string will be converted to a uint32 to satisfy os.FileMode
18+
Action string `json:"action,omitempty"`
19+
}
20+
21+
type Probe struct {
22+
Name string `json:"name,omitempty"`
23+
InitialDelaySeconds int `json:"initialDelaySeconds,omitempty"` // default 0
24+
TimeoutSeconds int `json:"timeoutSeconds,omitempty"` // default 1
25+
SuccessThreshold int `json:"successThreshold,omitempty"` // default 1
26+
FailureThreshold int `json:"failureThreshold,omitempty"` // default 3
27+
HTTPGetAction HTTPGetAction `json:"httpGet,omitempty"`
28+
}
29+
30+
type OneTimeInstruction struct {
31+
CommonInstruction
32+
SaveOutput bool `json:"saveOutput,omitempty"`
33+
}
34+
35+
type CommonInstruction struct {
36+
Name string `json:"name,omitempty"`
37+
Image string `json:"image,omitempty"`
38+
Env []string `json:"env,omitempty"`
39+
Args []string `json:"args,omitempty"`
40+
Command string `json:"command,omitempty"`
41+
}
42+
43+
type PeriodicInstruction struct {
44+
CommonInstruction
45+
PeriodSeconds int `json:"periodSeconds,omitempty"` // default 600, i.e. 10 minutes
46+
SaveStderrOutput bool `json:"saveStderrOutput,omitempty"`
47+
}
48+
49+
type ProbeStatus struct {
50+
Healthy bool `json:"healthy,omitempty"`
51+
SuccessCount int `json:"successCount,omitempty"`
52+
FailureCount int `json:"failureCount,omitempty"`
53+
}
54+
55+
type HTTPGetAction struct {
56+
URL string `json:"url,omitempty"`
57+
Insecure bool `json:"insecure,omitempty"`
58+
ClientCert string `json:"clientCert,omitempty"`
59+
ClientKey string `json:"clientKey,omitempty"`
60+
CACert string `json:"caCert,omitempty"`
61+
}

0 commit comments

Comments
 (0)