Skip to content

Commit 73ba30e

Browse files
committed
rename extra => additional
Signed-off-by: Justin Alvarez <[email protected]>
1 parent d78bd2b commit 73ba30e

File tree

6 files changed

+49
-48
lines changed

6 files changed

+49
-48
lines changed

cmd/limactl/hostagent.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func newHostagentCommand() *cobra.Command {
2828
hostagentCommand.Flags().StringP("pidfile", "p", "", "write pid to file")
2929
hostagentCommand.Flags().String("socket", "", "hostagent socket")
3030
hostagentCommand.Flags().String("nerdctl-archive", "", "local file path (not URL) of nerdctl-full-VERSION-linux-GOARCH.tar.gz")
31-
hostagentCommand.Flags().String("extra-archive", "", "local file path (not URL) of an arbitrary archive")
31+
hostagentCommand.Flags().String("additional-archive", "", "local file path (not URL) of an arbitrary archive to add to CIDATA")
3232
return hostagentCommand
3333
}
3434

@@ -71,12 +71,12 @@ func hostagentAction(cmd *cobra.Command, args []string) error {
7171
if nerdctlArchive != "" {
7272
opts = append(opts, hostagent.WithNerdctlArchive(nerdctlArchive))
7373
}
74-
extraArchive, err := cmd.Flags().GetString("extra-archive")
74+
additionalArchive, err := cmd.Flags().GetString("additional-archive")
7575
if err != nil {
7676
return err
7777
}
78-
if extraArchive != "" {
79-
opts = append(opts, hostagent.WithExtraArchive(extraArchive))
78+
if additionalArchive != "" {
79+
opts = append(opts, hostagent.WithAdditionalArchive(additionalArchive))
8080
}
8181
ha, err := hostagent.New(instName, stdout, sigintCh, opts...)
8282
if err != nil {

examples/default.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,15 @@ containerd:
197197
# Also see "/var/log/cloud-init-output.log" in the guest.
198198

199199
# Adds an additional archive which matches the system architecture to the CIDATA image which is mounted on boot.
200+
# The additional archive will be available on the CIDATA disk at /additional.tgz.
200201
# Useful for provisioning scripts that run before mounts (like `mode: dependency`) in case they need any file resources.
201202
# See pkg/cidata/cidata.TEMPLATE.d/boot/40-install-containerd.sh for an example of how to use an archive
202203
# from a provisioning script.
203-
# extraArchives:
204-
# - location: "~/extra.amd64.tar.gz"
204+
# additionalArchives:
205+
# - location: "~/additional.amd64.tar.gz"
205206
# arch: "x86_64"
206207
# digest: "sha256:..."
207-
# - location: "~/extra.aarch64.tar.gz"
208+
# - location: "~/additional.aarch64.tar.gz"
208209
# arch: "aarch64"
209210
# digest: "sha256:..."
210211

pkg/cidata/cidata.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func setupEnv(y *limayaml.LimaYAML) (map[string]string, error) {
104104
return env, nil
105105
}
106106

107-
func GenerateISO9660(instDir, name string, y *limayaml.LimaYAML, udpDNSLocalPort, tcpDNSLocalPort int, nerdctlArchive, extraArchive string) error {
107+
func GenerateISO9660(instDir, name string, y *limayaml.LimaYAML, udpDNSLocalPort, tcpDNSLocalPort int, nerdctlArchive, additionalArchive string) error {
108108
if err := limayaml.Validate(*y, false); err != nil {
109109
return err
110110
}
@@ -287,16 +287,16 @@ func GenerateISO9660(instDir, name string, y *limayaml.LimaYAML, udpDNSLocalPort
287287
})
288288
}
289289

290-
if extraArchive != "" {
291-
extratgzR, err := os.Open(extraArchive)
290+
if additionalArchive != "" {
291+
additionaltgzR, err := os.Open(additionalArchive)
292292
if err != nil {
293293
return err
294294
}
295-
defer extratgzR.Close()
295+
defer additionaltgzR.Close()
296296
layout = append(layout, iso9660util.Entry{
297297
// ISO9660 requires len(Path) <= 30
298-
Path: "extra.tgz",
299-
Reader: extratgzR,
298+
Path: "additional.tgz",
299+
Reader: additionaltgzR,
300300
})
301301
}
302302

pkg/hostagent/hostagent.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ type HostAgent struct {
5757
}
5858

5959
type options struct {
60-
nerdctlArchive string // local path, not URL
61-
extraArchive string // local path, not URL
60+
nerdctlArchive string // local path, not URL
61+
additionalArchive string // local path, not URL
6262
}
6363

6464
type Opt func(*options) error
@@ -70,9 +70,9 @@ func WithNerdctlArchive(s string) Opt {
7070
}
7171
}
7272

73-
func WithExtraArchive(s string) Opt {
73+
func WithAdditionalArchive(s string) Opt {
7474
return func(o *options) error {
75-
o.extraArchive = s
75+
o.additionalArchive = s
7676
return nil
7777
}
7878
}
@@ -115,7 +115,7 @@ func New(instName string, stdout io.Writer, sigintCh chan os.Signal, opts ...Opt
115115
}
116116
}
117117

118-
if err := cidata.GenerateISO9660(inst.Dir, instName, y, udpDNSLocalPort, tcpDNSLocalPort, o.nerdctlArchive, o.extraArchive); err != nil {
118+
if err := cidata.GenerateISO9660(inst.Dir, instName, y, udpDNSLocalPort, tcpDNSLocalPort, o.nerdctlArchive, o.additionalArchive); err != nil {
119119
return nil, err
120120
}
121121

pkg/limayaml/limayaml.go

+25-25
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,31 @@ import (
77
)
88

99
type LimaYAML struct {
10-
Arch *Arch `yaml:"arch,omitempty" json:"arch,omitempty"`
11-
Images []Image `yaml:"images" json:"images"` // REQUIRED
12-
CPUType map[Arch]string `yaml:"cpuType,omitempty" json:"cpuType,omitempty"`
13-
CPUs *int `yaml:"cpus,omitempty" json:"cpus,omitempty"`
14-
Memory *string `yaml:"memory,omitempty" json:"memory,omitempty"` // go-units.RAMInBytes
15-
Disk *string `yaml:"disk,omitempty" json:"disk,omitempty"` // go-units.RAMInBytes
16-
Mounts []Mount `yaml:"mounts,omitempty" json:"mounts,omitempty"`
17-
MountType *MountType `yaml:"mountType,omitempty" json:"mountType,omitempty"`
18-
SSH SSH `yaml:"ssh,omitempty" json:"ssh,omitempty"` // REQUIRED (FIXME)
19-
Firmware Firmware `yaml:"firmware,omitempty" json:"firmware,omitempty"`
20-
Video Video `yaml:"video,omitempty" json:"video,omitempty"`
21-
Provision []Provision `yaml:"provision,omitempty" json:"provision,omitempty"`
22-
Containerd Containerd `yaml:"containerd,omitempty" json:"containerd,omitempty"`
23-
Probes []Probe `yaml:"probes,omitempty" json:"probes,omitempty"`
24-
PortForwards []PortForward `yaml:"portForwards,omitempty" json:"portForwards,omitempty"`
25-
Message string `yaml:"message,omitempty" json:"message,omitempty"`
26-
Networks []Network `yaml:"networks,omitempty" json:"networks,omitempty"`
27-
Network NetworkDeprecated `yaml:"network,omitempty" json:"network,omitempty"` // DEPRECATED, use `networks` instead
28-
Env map[string]string `yaml:"env,omitempty" json:"env,omitempty"`
29-
DNS []net.IP `yaml:"dns,omitempty" json:"dns,omitempty"`
30-
HostResolver HostResolver `yaml:"hostResolver,omitempty" json:"hostResolver,omitempty"`
31-
UseHostResolver *bool `yaml:"useHostResolver,omitempty" json:"useHostResolver,omitempty"` // DEPRECATED, use `HostResolver.Enabled` instead
32-
PropagateProxyEnv *bool `yaml:"propagateProxyEnv,omitempty" json:"propagateProxyEnv,omitempty"`
33-
CACertificates CACertificates `yaml:"caCerts,omitempty" json:"caCerts,omitempty"`
34-
ExtraArchives []File `yaml:"extraArchives,omitempty" json:"extraArchives,omitempty"`
10+
Arch *Arch `yaml:"arch,omitempty" json:"arch,omitempty"`
11+
Images []Image `yaml:"images" json:"images"` // REQUIRED
12+
CPUType map[Arch]string `yaml:"cpuType,omitempty" json:"cpuType,omitempty"`
13+
CPUs *int `yaml:"cpus,omitempty" json:"cpus,omitempty"`
14+
Memory *string `yaml:"memory,omitempty" json:"memory,omitempty"` // go-units.RAMInBytes
15+
Disk *string `yaml:"disk,omitempty" json:"disk,omitempty"` // go-units.RAMInBytes
16+
Mounts []Mount `yaml:"mounts,omitempty" json:"mounts,omitempty"`
17+
MountType *MountType `yaml:"mountType,omitempty" json:"mountType,omitempty"`
18+
SSH SSH `yaml:"ssh,omitempty" json:"ssh,omitempty"` // REQUIRED (FIXME)
19+
Firmware Firmware `yaml:"firmware,omitempty" json:"firmware,omitempty"`
20+
Video Video `yaml:"video,omitempty" json:"video,omitempty"`
21+
Provision []Provision `yaml:"provision,omitempty" json:"provision,omitempty"`
22+
Containerd Containerd `yaml:"containerd,omitempty" json:"containerd,omitempty"`
23+
Probes []Probe `yaml:"probes,omitempty" json:"probes,omitempty"`
24+
PortForwards []PortForward `yaml:"portForwards,omitempty" json:"portForwards,omitempty"`
25+
Message string `yaml:"message,omitempty" json:"message,omitempty"`
26+
Networks []Network `yaml:"networks,omitempty" json:"networks,omitempty"`
27+
Network NetworkDeprecated `yaml:"network,omitempty" json:"network,omitempty"` // DEPRECATED, use `networks` instead
28+
Env map[string]string `yaml:"env,omitempty" json:"env,omitempty"`
29+
DNS []net.IP `yaml:"dns,omitempty" json:"dns,omitempty"`
30+
HostResolver HostResolver `yaml:"hostResolver,omitempty" json:"hostResolver,omitempty"`
31+
UseHostResolver *bool `yaml:"useHostResolver,omitempty" json:"useHostResolver,omitempty"` // DEPRECATED, use `HostResolver.Enabled` instead
32+
PropagateProxyEnv *bool `yaml:"propagateProxyEnv,omitempty" json:"propagateProxyEnv,omitempty"`
33+
CACertificates CACertificates `yaml:"caCerts,omitempty" json:"caCerts,omitempty"`
34+
AdditionalArchives []File `yaml:"additionalArchives,omitempty" json:"additionalArchives,omitempty"`
3535
}
3636

3737
type Arch = string

pkg/start/start.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ func Start(ctx context.Context, inst *store.Instance) error {
143143
if nerdctlArchiveCache != "" {
144144
args = append(args, "--nerdctl-archive", nerdctlArchiveCache)
145145
}
146-
if len(y.ExtraArchives) > 0 {
147-
location, errs := downloadAndCacheArchiveForArch(y.ExtraArchives, *y.Arch, "extrArchive")
146+
if len(y.AdditionalArchives) > 0 {
147+
location, errs := downloadAndCacheArchiveForArch(y.AdditionalArchives, *y.Arch, "additionalArchive")
148148
if location == "" {
149-
return fmt.Errorf("failed to download the extraArchive archive, attempted %d candidates, errors=%v",
150-
len(y.ExtraArchives), errs)
149+
return fmt.Errorf("failed to download the additionalArchive archive, attempted %d candidates, errors=%v",
150+
len(y.AdditionalArchives), errs)
151151
}
152-
args = append(args, "--extra-archive", location)
152+
args = append(args, "--additional-archive", location)
153153
}
154154

155155
args = append(args, inst.Name)

0 commit comments

Comments
 (0)