Skip to content

Commit

Permalink
Merge branch 'main' into ignition-25-92
Browse files Browse the repository at this point in the history
  • Loading branch information
yasminvalim committed Apr 23, 2024
2 parents 6bb638f + 5c7c765 commit ac5237b
Show file tree
Hide file tree
Showing 369 changed files with 45,335 additions and 20,091 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/release-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ Fedora packaging:
- [ ] Run `kinit your_fas_account@FEDORAPROJECT.ORG`
- [ ] Run `fedpkg new-sources $(spectool -S ignition.spec | sed 's:.*/::')`
- [ ] PR the changes in [Fedora](https://src.fedoraproject.org/rpms/ignition)
- [ ] Once the PR merges to rawhide, merge rawhide into the other relevant branches (e.g. f38) then push those, for example:
- [ ] Once the PR merges to rawhide, merge rawhide into the other relevant branches (e.g. f39) then push those, for example:
```bash
git checkout rawhide
git pull --ff-only
git checkout f38
git checkout f39
git merge --ff-only rawhide
git push origin f38
git push origin f39
```
- [ ] On each of those branches run `fedpkg build` including rawhide.
- [ ] Once the builds have finished, submit them to [bodhi](https://bodhi.fedoraproject.org/updates/new), filling in:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.validate
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.fedoraproject.org/fedora:38 AS builder
FROM registry.fedoraproject.org/fedora:39 AS builder
RUN dnf install -y golang git-core
RUN mkdir /ignition-validate
COPY . /ignition-validate
Expand Down
3 changes: 2 additions & 1 deletion config/shared/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ var (
ErrInvalidProxy = errors.New("proxies must be http(s)")
ErrInsecureProxy = errors.New("insecure plaintext HTTP proxy specified for HTTPS resources")
ErrPathConflictsSystemd = errors.New("path conflicts with systemd unit or dropin")
ErrPathConflictsParentDir = errors.New("path conflicts with parent directory of another file, link, or directory")
ErrPathAlreadyExists = errors.New("path already exists")
ErrMissLabeledDir = errors.New("parent directory path matches configured file, check path, and ensure parent directory is configured")

// Systemd section errors
ErrInvalidSystemdExt = errors.New("invalid systemd unit extension")
Expand Down
67 changes: 34 additions & 33 deletions config/v3_5_experimental/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ var (
}
)

var paths = map[string]struct{}{}

func (cfg Config) Validate(c path.ContextPath) (r report.Report) {
systemdPath := "/etc/systemd/system/"
unitPaths := map[string]struct{}{}
Expand Down Expand Up @@ -76,43 +78,21 @@ func (cfg Config) validateParents(c path.ContextPath) report.Report {
Path string
Field string
}
paths := map[string]struct{}{}
r := report.Report{}

for i, f := range cfg.Storage.Files {
if _, exists := paths[f.Path]; exists {
r.AddOnError(c.Append("storage", "files", i, "path"), errors.ErrPathConflictsParentDir) //TODO: should add different error?
return r
}
paths[f.Path] = struct{}{}
entries = append(entries, struct {
Path string
Field string
}{Path: f.Path, Field: "files"})
r = handlePathConflict(f.Path, "files", i, c, r, errors.ErrPathAlreadyExists)
addPathAndEntry(f.Path, "files", &entries)
}

for i, d := range cfg.Storage.Directories {
if _, exists := paths[d.Path]; exists {
r.AddOnError(c.Append("storage", "directories", i, "path"), errors.ErrPathConflictsParentDir) //TODO: should add different error?
return r
}
paths[d.Path] = struct{}{}
entries = append(entries, struct {
Path string
Field string
}{Path: d.Path, Field: "directories"})
r = handlePathConflict(d.Path, "directories", i, c, r, errors.ErrPathAlreadyExists)
addPathAndEntry(d.Path, "directories", &entries)
}

for i, l := range cfg.Storage.Links {
if _, exists := paths[l.Path]; exists {
r.AddOnError(c.Append("storage", "links", i, "path"), errors.ErrPathConflictsParentDir) //TODO: error to already exist path
return r
}
paths[l.Path] = struct{}{}
entries = append(entries, struct {
Path string
Field string
}{Path: l.Path, Field: "links"})
r = handlePathConflict(l.Path, "links", i, c, r, errors.ErrPathAlreadyExists)
addPathAndEntry(l.Path, "links", &entries)
}

sort.Slice(entries, func(i, j int) bool {
Expand All @@ -122,7 +102,7 @@ func (cfg Config) validateParents(c path.ContextPath) report.Report {
for i, entry := range entries {
if i > 0 && isWithin(entry.Path, entries[i-1].Path) {
if entries[i-1].Field != "directories" {
r.AddOnError(c.Append("storage", entry.Field, i, "path"), errors.ErrPathConflictsParentDir) //TODO: conflict parent directories error
r.AddOnError(c.Append("storage", entry.Field, i, "path"), errors.ErrMissLabeledDir)
return r
}
}
Expand All @@ -131,16 +111,37 @@ func (cfg Config) validateParents(c path.ContextPath) report.Report {
return r
}

// check the depth
func handlePathConflict(path, fieldName string, index int, c path.ContextPath, r report.Report, err error) report.Report {
if _, exists := paths[path]; exists {
r.AddOnError(c.Append("storage", fieldName, index, "path"), err)
}
return r
}

func addPathAndEntry(path, fieldName string, entries *[]struct{ Path, Field string }) {
*entries = append(*entries, struct {
Path string
Field string
}{Path: path, Field: fieldName})
}

func depth(path string) uint {
var count uint
for p := filepath.Clean(path); p != "/" && p != "."; count++ {
p = filepath.Dir(p)
cleanedPath := filepath.FromSlash(filepath.Clean(path))
sep := string(filepath.Separator)

volume := filepath.VolumeName(cleanedPath)
if volume != "" {
cleanedPath = cleanedPath[len(volume):]
}

for cleanedPath != sep && cleanedPath != "." {
cleanedPath = filepath.Dir(cleanedPath)
count++
}
return count
}

// isWithin checks if newPath is within prevPath.
func isWithin(newPath, prevPath string) bool {
return strings.HasPrefix(newPath, prevPath) && newPath != prevPath
}
22 changes: 18 additions & 4 deletions config/v3_5_experimental/types/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (

"github.com/coreos/ignition/v2/config/shared/errors"
"github.com/coreos/ignition/v2/config/util"

"github.com/coreos/vcontext/path"
"github.com/coreos/vcontext/report"
)
Expand Down Expand Up @@ -194,7 +193,7 @@ func TestConfigValidation(t *testing.T) {
},
},
},
out: errors.ErrPathConflictsParentDir,
out: errors.ErrMissLabeledDir,
at: path.New("json", "storage", "files", 1, "path"),
},

Expand All @@ -210,7 +209,7 @@ func TestConfigValidation(t *testing.T) {
},
},
},
out: errors.ErrPathConflictsParentDir,
out: errors.ErrMissLabeledDir,
at: path.New("json", "storage", "links", 1, "path"),
},

Expand All @@ -226,7 +225,7 @@ func TestConfigValidation(t *testing.T) {
},
},
},
out: errors.ErrPathConflictsParentDir,
out: errors.ErrMissLabeledDir,
at: path.New("json", "storage", "directories", 1, "path"),
},

Expand Down Expand Up @@ -333,3 +332,18 @@ func TestConfigValidation(t *testing.T) {
}
}
}

func BenchmarkValidateParents(b *testing.B) {
cfg := Config{
Storage: Storage{
Files: []File{
{Node: Node{Path: "/foo/bar"}},
{Node: Node{Path: "/foo/bar/baz"}},
},
},
}

for i := 0; i < b.N; i++ {
_ = cfg.validateParents(path.New("json"))
}
}
16 changes: 15 additions & 1 deletion docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@ nav_order: 9

# Release Notes

## Upcoming Ignition 2.18.0 (unreleased)
## Upcoming Ignition 2.19.0 (unreleased)

### Breaking changes

### Features

- Support Akamai Connected Cloud (Linode)

### Changes

### Bug fixes

## Ignition 2.18.0 (2024-03-01)

### Breaking changes

Expand All @@ -13,6 +25,7 @@ nav_order: 9

### Features

- Support Scaleway


### Changes
Expand All @@ -23,6 +36,7 @@ nav_order: 9

- Fix failure when config only disables units already disabled
- Fix validation to catch conflicts with the parent directory of another file, link or directories
- Retry HTTP requests on Azure on status codes 404, 410, and 429


## Ignition 2.17.0 (2023-11-20)
Expand Down
4 changes: 4 additions & 0 deletions docs/supported-platforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ nav_order: 8

Ignition is currently only supported for the following platforms:

* [Akamai Connected Cloud] (`akamai`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys and network configuration are handled separately.
* [Alibaba Cloud] (`aliyun`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
* [Apple Hypervisor] (`applehv`) - Ignition will read its configuration using an HTTP GET over a vsock connection with its host on port 1024.
* [Amazon Web Services] (`aws`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
Expand All @@ -26,6 +27,7 @@ Ignition is currently only supported for the following platforms:
* [Equinix Metal] (`packet`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
* [IBM Power Systems Virtual Server] (`powervs`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
* [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).
* [Scaleway] (`scaleway`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
* [VirtualBox] (`virtualbox`) - Use the VirtualBox guest property `/Ignition/Config` to provide the config to the virtual machine.
* [VMware] (`vmware`) - Use the VMware Guestinfo variables `ignition.config.data` and `ignition.config.data.encoding` to provide the config and its encoding to the virtual machine. Valid encodings are "", "base64", and "gzip+base64". Guestinfo variables can be provided directly or via an OVF environment, with priority given to variables specified directly.
* [Vultr] (`vultr`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
Expand All @@ -35,6 +37,7 @@ Ignition is under active development, so this list may grow over time.

For most cloud providers, cloud SSH keys and custom network configuration are handled by [Afterburn].

[Akamai Connected Cloud]: https://www.linode.com
[Alibaba Cloud]: https://www.alibabacloud.com/product/ecs
[Apple Hypervisor]: https://developer.apple.com/documentation/hypervisor
[Amazon Web Services]: https://aws.amazon.com/ec2/
Expand All @@ -54,6 +57,7 @@ For most cloud providers, cloud SSH keys and custom network configuration are ha
[Equinix Metal]: https://metal.equinix.com/product/
[IBM Power Systems Virtual Server]: https://www.ibm.com/products/power-virtual-server
[QEMU]: https://www.qemu.org/
[Scaleway]: https://www.scaleway.com
[VirtualBox]: https://www.virtualbox.org/
[VMware]: https://www.vmware.com/
[Vultr]: https://www.vultr.com/products/cloud-compute/
Expand Down
56 changes: 27 additions & 29 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,63 +4,61 @@ go 1.20

require (
cloud.google.com/go/compute/metadata v0.2.3
cloud.google.com/go/storage v1.36.0
github.com/aws/aws-sdk-go v1.49.16
cloud.google.com/go/storage v1.40.0
github.com/aws/aws-sdk-go v1.51.16
github.com/beevik/etree v1.3.0
github.com/containers/libhvee v0.6.0
github.com/containers/libhvee v0.7.1
github.com/coreos/go-semver v0.3.1
github.com/coreos/go-systemd/v22 v22.5.0
github.com/coreos/vcontext v0.0.0-20230201181013-d72178a18687
github.com/google/renameio/v2 v2.0.0
github.com/google/uuid v1.5.0
github.com/google/uuid v1.6.0
github.com/mdlayher/vsock v1.2.1
github.com/mitchellh/copystructure v1.2.0
github.com/pin/tftp v2.1.0+incompatible
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
github.com/vincent-petithory/dataurl v1.0.0
github.com/vmware/vmw-guestinfo v0.0.0-20220317130741-510905f0efa3
golang.org/x/net v0.19.0
golang.org/x/oauth2 v0.15.0
golang.org/x/sys v0.16.0
google.golang.org/api v0.155.0
golang.org/x/net v0.24.0
golang.org/x/oauth2 v0.19.0
golang.org/x/sys v0.19.0
google.golang.org/api v0.172.0
gopkg.in/yaml.v3 v3.0.1
)

require (
cloud.google.com/go v0.110.10 // indirect
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/iam v1.1.5 // indirect
cloud.google.com/go v0.112.1 // indirect
cloud.google.com/go/compute v1.24.0 // indirect
cloud.google.com/go/iam v1.1.7 // indirect
github.com/coreos/go-json v0.0.0-20230131223807-18775e0fb4fb // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/godbus/dbus/v5 v5.0.4 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/googleapis/gax-go/v2 v2.12.3 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/mdlayher/socket v0.4.1 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/sync v0.5.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231211222908-989df2bf70f3 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/protobuf v1.31.0 // indirect
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240314234333-6e1732d8331c // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
)
Loading

0 comments on commit ac5237b

Please sign in to comment.