Skip to content

Commit 86d9f1a

Browse files
authored
Merge pull request #2014 from jdoss/jdoss/Proxmoxve_vendor-data_support
providers: support for vendor-data in proxmoxve
2 parents 14af5fa + e6568e5 commit 86d9f1a

File tree

3 files changed

+35
-15
lines changed

3 files changed

+35
-15
lines changed

docs/release-notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Starting with this release, ignition-validate binaries are signed with the
1414
### Features
1515

1616
- Add Azure blob support for fetching ignition configs
17+
- Add a check for ignition config in vendor-data (proxmoxve)
1718

1819
### Changes
1920

docs/supported-platforms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Ignition is currently supported for the following platforms:
2424
* Bare Metal (`metal`) - Use the `ignition.config.url` kernel parameter to provide a URL to the configuration. The URL can use the `http://`, `https://`, `tftp://`, `s3://`, `arn:`, or `gs://` schemes to specify a remote config.
2525
* [Nutanix] (`nutanix`) - Ignition will read its configuration from the instance userdata via config drive. Cloud SSH keys are handled separately.
2626
* [OpenStack] (`openstack`) - Ignition will read its configuration from the instance userdata via either metadata service or config drive. Cloud SSH keys are handled separately.
27-
* [Proxmox VE] (`proxmoxve`) - Ignition will read its configuration from the instance userdata via config drive. Cloud SSH keys are handled separately.
27+
* [Proxmox VE] (`proxmoxve`) - Ignition will read its configuration from the instance userdata via config drive. If there isn't any valid Ignition configuration in userdata it will check the vendordata next. Cloud SSH keys are handled separately.
2828
* [Equinix Metal] (`packet`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
2929
* [IBM Power Systems Virtual Server] (`powervs`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
3030
* [QEMU] (`qemu`) - Ignition will read its configuration from the 'opt/com.coreos/config' key on the QEMU Firmware Configuration Device (available in QEMU 2.4.0 and higher).

internal/providers/proxmoxve/proxmoxve.go

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ import (
4040
)
4141

4242
const (
43-
cidataPath = "/user-data"
44-
deviceLabel = "cidata"
43+
ciuserdataPath = "/user-data"
44+
// See https://bugzilla.proxmox.com/show_bug.cgi?id=2429 for more details about vendordata
45+
civendordataPath = "/vendor-data"
46+
deviceLabel = "cidata"
4547
)
4648

4749
func init() {
@@ -123,20 +125,37 @@ func fetchConfigFromDevice(logger *log.Logger, ctx context.Context, path string)
123125
)
124126
}()
125127

126-
if !fileExists(filepath.Join(mnt, cidataPath)) {
127-
return nil, nil
128-
}
128+
paths := []string{ciuserdataPath, civendordataPath}
129+
header := []byte("#cloud-config\n")
129130

130-
contents, err := os.ReadFile(filepath.Join(mnt, cidataPath))
131-
if err != nil {
132-
return nil, err
133-
}
131+
for _, path := range paths {
132+
fullPath := filepath.Join(mnt, path)
133+
if !fileExists(fullPath) {
134+
continue
135+
}
134136

135-
header := []byte("#cloud-config\n")
136-
if bytes.HasPrefix(contents, header) {
137-
logger.Debug("config drive (%q) contains a cloud-config configuration, ignoring", path)
138-
return nil, nil
137+
contents, err := os.ReadFile(fullPath)
138+
if err != nil {
139+
// Log the error but continue to next file
140+
logger.Debug("failed to read %q: %v", fullPath, err)
141+
continue
142+
}
143+
144+
// Skip if it's a cloud-config file
145+
if bytes.HasPrefix(contents, header) {
146+
logger.Debug("config drive (%q) contains a cloud-config configuration, ignoring", fullPath)
147+
continue
148+
}
149+
150+
// Check if there's actual content in the file
151+
if len(contents) > 0 {
152+
logger.Debug("config drive (%q) contains data", fullPath)
153+
return contents, nil
154+
}
155+
156+
logger.Debug("config drive (%q) is empty, ignoring", fullPath)
139157
}
140158

141-
return contents, nil
159+
// No valid configuration found in any of the files
160+
return nil, nil
142161
}

0 commit comments

Comments
 (0)