1
0
mirror of https://github.com/coreos/ignition.git synced 2026-02-06 09:47:17 +01:00
Commit Graph

419 Commits

Author SHA1 Message Date
Steven Presti
7a03aaec18 Add oem to accepted url schemes
Flatcar docs talk about `oem` url add it so ignition-validate
does not fail.

see: https://github.com/coreos/butane/issues/634
2025-11-07 09:56:16 -05:00
Jeremi Piotrowski
a976abc09b internal: Upgrade to aws-sdk-go-v2
Update the code from aws-sdk-go to aws-sdk-go-v2, aws-sdk-go is out-of-support
since July 2025. I've tried to preserve the existing behavior as best I could:
- if we're running on EC2 we use ec2rolecreds first, with a fallback to anonymous
  credentials
- use anonymous credentials when outside EC2
- use IMDS for region hints

One subtle change appears to be that the S3 code does not tolerate leading
slashes in key names any more, so we need to strip it out explicitly.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2025-09-03 13:34:33 +02:00
yasminvalim
de452c404c fix: Handle unchecked error returns across the codebase and other linter issues
The linter found staticcheck and errorcheck issues.  Deferred statements now  use join  to combine any new error with an existing one, preventing error information from being lost. Other minor error checks, like for printing text  and flushing data have also been addressed.
2025-07-28 19:12:25 -03:00
Steven Presti
59e1d90655 docs/*: update mode description for affected versions 2025-05-05 13:21:34 -04:00
Steven Presti
2203687ef7 config/*: extend special bit validation logic to 3.4.0 and 3.5.0
Extend the warning to trigger on 3.4.0 and 3.5.0 when special
file mode bits are set.
2025-05-05 13:21:22 -04:00
Steven Presti
7c1f02528b config/*: move masking of special mode bits to < 3.6.0
Since a bug preventing special mode bits from being applied properly
has been fixed. Move masking of the bits for configs that are in use
which have special mode bits do not suddenly function different.
2025-05-05 13:20:15 -04:00
Madhu Pillai
c6c52924cf *: update to v3_6_experimental spec 2024-10-14 15:33:52 +02:00
Timothée Ravier
87e2d0c588 config/v3_6_experimental: adapt for new experimental spec 2024-10-14 15:33:52 +02:00
Timothée Ravier
68efbc15e6 config: copy v3_5 to v3_6_experimental 2024-10-14 15:33:52 +02:00
Timothée Ravier
3b0b89b9a7 config/v3_5: stabilize 2024-10-14 15:33:52 +02:00
Timothée Ravier
e98dd189d7 config: rename v3_5_experimental to v3_5 2024-10-14 15:33:52 +02:00
Madhu Pillai
d11012bd5f config/doc/ignition.yaml: correction in description
Docs rephrase in luks.cex.enabled description.
https://github.com/coreos/butane/pull/536#discussion_r1678449662
2024-09-16 16:35:52 +02:00
Madhu Pillai
d078c9fe79 Support LUKS encryption using IBM CEX secure keys on s390x
Extend the `luks` schema to support a new `cex` key. When enabled, the
volume key of the LUKS device uses a secure key generated using a CEX
card. The keyfile to unlock the volume is not considered confidential.

Closes: #1693

Co-authored-by: Jonathan Lebon <jonathan@jlebon.com>
2024-05-13 12:25:21 -04:00
Benjamin Gilbert
20b0584141 config/doc: drop "unless" keyword from YAML
Callers can use the ignore callback instead.
2023-05-09 15:18:56 -04:00
Benjamin Gilbert
8d17538b0d config/doc: add callback argument to select paths to ignore
Allow the Generate() caller to specify a callback that receives a slice
of path components and returns true if the subtree should be ignored.

This is an API change but not a breaking one, since config/doc hasn't
shipped in a release.
2023-05-09 15:18:56 -04:00
Benjamin Gilbert
f7f0a4ea7f config/doc: track the current node path during doc generation
Needed by next commit.
2023-05-09 15:18:56 -04:00
Benjamin Gilbert
1b8824dc08 config/doc: move constant generator arguments to a struct
Refactor to avoid repeatedly passing constant arguments to each recursive
invocation.
2023-05-09 15:18:56 -04:00
Benjamin Gilbert
f885d416d3 config/doc: move tang section to a separate component
as a convenience for Butane's boot_device docs.
2023-04-20 15:23:26 -04:00
Benjamin Gilbert
73944c8814 config/doc: allow fields to be required if constraints are met
Most fields are either required or not, but Butane has a case where a
field is required only on some specs.  Add "required-if" attribute to
allow expressing this.
2023-04-20 15:23:26 -04:00
Benjamin Gilbert
735db4ebc2 config/doc: allow skipping a field if constraints are met
Add an "unless" attribute that skips emitting the field if any
constraints are met.  This allows Butane specs to filter out unwanted
Ignition fields.
2023-04-20 15:23:26 -04:00
Benjamin Gilbert
5ae2b18342 config/doc: support matching any of several variant/version pairs
Convert the transform min/max version into a list of constraints, where
each constraint has a variant and possibly a min/max version.  The
variant for the Ignition spec version is "ignition", but callers can
supply a map of arbitrary variant/version pairs.  If any constraints
exist, one of them must match a variant/version in the map.

Provide version substitutions %<variant>_version% for every variant.
2023-04-20 15:23:25 -04:00
Benjamin Gilbert
fcf0d200ad config/doc: use semver.Version structs, not pointers to them
semver.NewVersion() returns a pointer, which helps distinguish between
a nil return (with error) and a real struct.  Once we have the pointer,
though, dereference it rather than continuing to pass it around.
2023-04-20 15:20:51 -04:00
Benjamin Gilbert
911a5be3ef config/doc: support map types as struct fields
The Butane openshift spec uses this for Kubernetes labels.
2023-04-17 16:49:02 -04:00
Benjamin Gilbert
186557201e config/doc: allow a child component to insert fields into the parent
Butane needs this to allow base specs to add sugar fields to Ignition
structs.

The "after" field specifies the existing field that should precede the
new one, or "^" to add the new field at the beginning of the struct, or
"$" to add it at the end.
2023-04-17 16:49:02 -04:00
Benjamin Gilbert
ac8addcff2 config/doc: add Components.Merge() API function
Butane needs a way to merge two Components objects together, with child
fields overriding the parent.  Implement this here to keep the API
together.  The merge happens component-by-component, without merging
components together into a unified tree.
2023-04-17 16:49:02 -04:00
Benjamin Gilbert
7120808cdb config/doc: read YAML field tags too
Butane config structs use YAML field tags, so also check those for field
names.
2023-04-17 16:49:02 -04:00
Benjamin Gilbert
8426600042 config/doc: expose parsed Components in external API
Allow the caller to retrieve parsed Components and generate the output doc
by calling .Generate() on it.  This will allow Butane to perform
additional processing on the docs tree.

As a convenience to Butane, also export the Components parsing code.
2023-04-17 16:49:02 -04:00
Benjamin Gilbert
c8aee2881c config/doc: make some methods private
When the package was internal, they were public to signal that they were
meant to be used outside their source file, though still within the same
package.  Now that the package has to care about an external stable API,
make the methods private.
2023-04-17 16:49:02 -04:00
Benjamin Gilbert
e3e16662ba internal/doc/generate: move to config/doc
We need to export it so Butane can use it.
2023-04-17 16:49:02 -04:00
Benjamin Gilbert
0e2b63c9d5 *: update to v3_5_experimental spec 2023-02-20 03:09:50 -05:00
Benjamin Gilbert
7cff68f8b3 config/v3_5_experimental: adapt for new experimental spec 2023-02-20 03:09:50 -05:00
Benjamin Gilbert
5974c0147a config: copy v3_4 to v3_5_experimental
Pure `cp -r config/v3_4 config/v3_5_experimental`.
2023-02-20 03:09:50 -05:00
Benjamin Gilbert
7641e873e4 config/v3_4: stabilize 2023-02-20 03:09:50 -05:00
Benjamin Gilbert
86d17f15b6 config: rename v3_4_experimental to v3_4
Pure `git mv config/v3_4_experimental config/v3_4`.
2023-02-19 00:29:42 -05:00
Steven Presti
b772e19557 config/v3_4_exp: add Tang offline provisioning support
Expand schema for 3_4_exp with an advertisement field to allow for
Ignition to support Tang offline provisioning by passing the supplied
advertisement field during first boot's device bind. Fixes #1474
2023-02-18 13:07:09 -05:00
Benjamin Gilbert
47d34fd048 Support persisting arbitrary LUKS open options during luksOpen
There are other options that can be stored in the LUKS header with
--persistent, including notably --perf-no_read_workqueue and
--perf-no_write_workqueue, which can improve performance.  We usually
provide options arrays to support advanced features, so add one here.

Since this is an escape hatch feature, we don't try to implement full
option matching in the volume reuse semantics; we just update any reused
volume to use the currently specified open options.
2023-02-03 13:40:49 -05:00
Benjamin Gilbert
e782590b59 Add schema field to enable discard on LUKS devices
Discard improves performance and longevity on SSDs and space utilization
on thinly-provisioned SAN devices, but also leaks information.  It's an
open-time option, not a create-time one, so it can't be enabled via the
options field.  Add a spec field to enable it.

For https://github.com/coreos/fedora-coreos-tracker/issues/1392.
2023-02-03 13:40:49 -05:00
Michael Armijo
2f63faa15b config/types/config: prevent files/links/dirs from conflicting with systemd units and dropins 2022-11-08 08:58:02 -05:00
Steven Presti
b099378b7b storage.go: refactor validate()
Separate validate() into more granular subfunctions which describe the unit
of work they are performing to improve readability and testability.
2022-10-25 15:59:40 -04:00
Steven Presti
a8d088f39e storage.go: add filesystems validation warnings
Fixes #1397, a common configuration error is to create a filesystem over
a whole-disk device rather than a partition. Add a warning for a
filesystem device matching the disk device.

Additionally, another configuration error was identified for a way to
recreate the filesystem on every provision, while the configuration to
do so is valid, it might be done unitionally. Add a warning when
wipeTable is true but wipeFilesystem is false.
2022-10-25 15:59:19 -04:00
Benjamin Gilbert
6f00407849 config/*: warn if user/group specified for hard link
We don't try to apply a user/group to a hard link, since it would affect
the target instead.
2022-08-10 12:24:28 -04:00
Benjamin Gilbert
11ebd3759e Fix comment formatting for gofmt 1.19 2022-08-09 17:54:58 -04:00
Sohan Kunkerkar
38be4f1e18 config/*: add systemd install section warning for Instantiable units
This allows to parse all units at once and helps to identify
instantiable units which don't have the install section.

Fixes https://github.com/coreos/ignition/issues/1344
2022-05-31 08:39:12 -04:00
Sohan Kunkerkar
942e8180be config/*: reuse validation logic for the unit's content
Also, changed the name of the function to reflect the actual
behavior.
2022-05-27 01:31:49 -04:00
Benjamin Gilbert
bd6aa78020 Merge pull request #1264 from lyft/aws-s3-access-points
internal/resource: support S3 access point URLs
2022-04-28 05:32:44 -04:00
Sohan Kunkerkar
3cd0933fd6 Merge pull request #1325 from sohankunkerkar/file-perm
Allow Ignition to preserve special file mode bits for specs >= 3.4.0
2022-04-10 15:34:18 -04:00
Sohan Kunkerkar
b208aca11d config/*: add validation logic regarding permission bits for specs < 3.4.0
This adds logic to throw a warning if the special file mode bits are set
in an Ignition config with the spec version < 3.4.0
2022-04-10 14:34:57 -04:00
Sohan Kunkerkar
12d42c296c config/*: mask out special mode bits for specs < 3.4.0
We've decided to support the special mode bits for specs >= 3.4.0,
so if the user provides special mode bits in their Ignition config
with the version < 3.4.0, then we need to mask those details out
while copying the file/dir mode during translation.
2022-04-10 14:34:57 -04:00
Zeleena Kearney
4daa32d59b internal/resource: support S3 access point URLs
Support S3 access point URLs in ARN format as a source.
This allows valid, opaque S3 URLs such as
`s3:arn:aws:s3:us-west-2:123456789012:accesspoint/test/object`
Being able to use this format will allow S3 URLs on different
partitions and lays the foundation to potentially support
multi-region access points in the future.

Fixes https://github.com/coreos/ignition/issues/1091
Signed-off-by: Zeleena Kearney <zeleenak@lyft.com>
2022-04-08 16:50:18 -07:00
Micah Abbott
37ecf0b20c config: update headers_test to stop using strings.Title()
`strings.Title()` is deprecated in go 1.18, so change the affected
tests to use different constants
2022-03-21 13:17:51 -04:00