@@ -7,29 +7,29 @@ import "github.com/pkg/errors"
7
7
// DeployOptions is options for deploying
8
8
type DeployOptions struct {
9
9
ResourceOpts ResourceOptions
10
- Name string // Name of application
11
- Entrypoint * Entrypoint // entrypoint
12
- Podname string // Name of pod to deploy
13
- NodeFilter NodeFilter // filter of nodenames, using includes or not using excludes
14
- Image string // Name of image to deploy
15
- ExtraArgs string // Extra arguments to append to command
16
- Count int // How many workloads needed, e.g. 4
17
- Env []string // Env for workload
18
- DNS []string // DNS for workload
19
- ExtraHosts []string // Extra hosts for workload
20
- Networks map [string ]string // Network names and specified IPs
21
- User string // User for workload
22
- Debug bool // debug mode, use syslog as log driver
23
- OpenStdin bool // OpenStdin for workload
24
- Labels map [string ]string // Labels for workloads
25
- DeployStrategy string // Deploy strategy
26
- Data map [ string ] ReaderManager // For additional file data
27
- NodesLimit int // Limit nodes count
28
- ProcessIdent string // ProcessIdent ident this deploy
29
- IgnoreHook bool // IgnoreHook ignore hook process
30
- AfterCreate []string // AfterCreate support run cmds after create
31
- RawArgs []byte // RawArgs for raw args processing
32
- Lambda bool // indicate is lambda workload or not
10
+ Name string // Name of application
11
+ Entrypoint * Entrypoint // entrypoint
12
+ Podname string // Name of pod to deploy
13
+ NodeFilter NodeFilter // filter of nodenames, using includes or not using excludes
14
+ Image string // Name of image to deploy
15
+ ExtraArgs string // Extra arguments to append to command
16
+ Count int // How many workloads needed, e.g. 4
17
+ Env []string // Env for workload
18
+ DNS []string // DNS for workload
19
+ ExtraHosts []string // Extra hosts for workload
20
+ Networks map [string ]string // Network names and specified IPs
21
+ User string // User for workload
22
+ Debug bool // debug mode, use syslog as log driver
23
+ OpenStdin bool // OpenStdin for workload
24
+ Labels map [string ]string // Labels for workloads
25
+ DeployStrategy string // Deploy strategy
26
+ Files [] LinuxFile // For additional file data
27
+ NodesLimit int // Limit nodes count
28
+ ProcessIdent string // ProcessIdent ident this deploy
29
+ IgnoreHook bool // IgnoreHook ignore hook process
30
+ AfterCreate []string // AfterCreate support run cmds after create
31
+ RawArgs []byte // RawArgs for raw args processing
32
+ Lambda bool // indicate is lambda workload or not
33
33
}
34
34
35
35
// Processing tracks workloads count yet finished
@@ -80,18 +80,40 @@ func (o *CopyOptions) Validate() error {
80
80
return nil
81
81
}
82
82
83
+ // LinuxFile is used for copy file
84
+ type LinuxFile struct {
85
+ Content []byte
86
+ Filename string
87
+ UID int
88
+ GID int
89
+ Mode int64
90
+ }
91
+
92
+ // Clone returns a copy of content bytes
93
+ func (f LinuxFile ) Clone () LinuxFile {
94
+ c := make ([]byte , len (f .Content ))
95
+ copy (c , f .Content )
96
+ return LinuxFile {
97
+ Content : c ,
98
+ Filename : f .Filename ,
99
+ UID : f .UID ,
100
+ GID : f .GID ,
101
+ Mode : f .Mode ,
102
+ }
103
+ }
104
+
83
105
// SendOptions for send files to multiple workload
84
106
type SendOptions struct {
85
- IDs []string
86
- Data map [ string ][] byte
107
+ IDs []string
108
+ Files [] LinuxFile
87
109
}
88
110
89
111
// Validate checks options
90
112
func (o * SendOptions ) Validate () error {
91
113
if len (o .IDs ) == 0 {
92
114
return errors .WithStack (ErrNoWorkloadIDs )
93
115
}
94
- if len (o .Data ) == 0 {
116
+ if len (o .Files ) == 0 {
95
117
return errors .WithStack (ErrNoFilesToSend )
96
118
}
97
119
return nil
0 commit comments