@@ -13,6 +13,7 @@ import (
13
13
"io"
14
14
"os"
15
15
"os/signal"
16
+ "path/filepath"
16
17
"strconv"
17
18
"sync"
18
19
)
@@ -73,6 +74,11 @@ func run(cmd *cobra.Command, args []string) error {
73
74
return err
74
75
}
75
76
77
+ nfs_data , err := cmd .Flags ().GetString ("nfs-data" )
78
+ if err != nil {
79
+ return err
80
+ }
81
+
76
82
cluster := args [0 ]
77
83
78
84
background , err := cmd .Flags ().GetBool ("background" )
@@ -160,7 +166,7 @@ func run(cmd *cobra.Command, args []string) error {
160
166
}
161
167
registryMounts = []mount.Mount {
162
168
{
163
- Type : "volume" ,
169
+ Type : mount . TypeVolume ,
164
170
Source : vol .Name ,
165
171
Target : "/var/lib/registry" ,
166
172
},
@@ -182,6 +188,41 @@ func run(cmd *cobra.Command, args []string) error {
182
188
return err
183
189
}
184
190
191
+ if nfs_data != "" {
192
+ nfs_data , err := filepath .Abs (nfs_data )
193
+ if err != nil {
194
+ return err
195
+ }
196
+ // Pull the ganesha image
197
+ reader , err = cli .ImagePull (ctx , "docker.io/janeczku/nfs-ganesha" , types.ImagePullOptions {})
198
+ if err != nil {
199
+ panic (err )
200
+ }
201
+ io .Copy (os .Stdout , reader )
202
+
203
+ // Start the ganesha image
204
+ nfsServer , err := cli .ContainerCreate (ctx , & container.Config {
205
+ Image : "janeczku/nfs-ganesha" ,
206
+ }, & container.HostConfig {
207
+ Mounts : []mount.Mount {
208
+ {
209
+ Type : mount .TypeBind ,
210
+ Source : nfs_data ,
211
+ Target : "/data/nfs" ,
212
+ },
213
+ },
214
+ Privileged : true ,
215
+ NetworkMode : container .NetworkMode ("container:" + dnsmasq .ID ),
216
+ }, nil , prefix + "-nfs-ganesha" )
217
+ if err != nil {
218
+ return err
219
+ }
220
+ createdContainers = append (createdContainers , nfsServer .ID )
221
+ if err := cli .ContainerStart (ctx , nfsServer .ID , types.ContainerStartOptions {}); err != nil {
222
+ return err
223
+ }
224
+ }
225
+
185
226
wg := sync.WaitGroup {}
186
227
wg .Add (int (nodes ))
187
228
// start one vm after each other
0 commit comments