Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MGMT-2977 Cluster specific minimal iso #932

Merged

Conversation

carbonin
Copy link
Member

@carbonin carbonin commented Jan 14, 2021

This PR allows a user to select a "minimal" iso for discovery which does not contain a rootfs. This reduces the iso size to 93M from 876M. This is required for users where the virtual media interface is significantly slower than the booted machine's network.

See coreos/fedora-coreos-tracker#661 for a larger discussion

This PR customizes the "template" minimal iso which was created in #911 by downloading the template iso, unpacking it locally, adding the ignition, and recreating the iso. A user specifies they want the minimal iso using the new API parameter (image_type) when requesting an image be generated. Installation then proceeds as it would otherwise.

Requires #930 and #931 MERGED

TODO: add tests Done, thanks @danielerez

cc @danielerez

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. api-review Categorizes an issue or PR as actively needing an API review. labels Jan 14, 2021
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 14, 2021
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 18, 2021
@carbonin carbonin changed the title [WIP] Cluster specific minimal iso [WIP] MGMT-2977 Cluster specific minimal iso Jan 18, 2021
@danielerez danielerez force-pushed the cluster_specific_minimal_iso branch 2 times, most recently from 5e209c2 to f306878 Compare January 20, 2021 10:41
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 20, 2021
@carbonin carbonin changed the title [WIP] MGMT-2977 Cluster specific minimal iso MGMT-2977 Cluster specific minimal iso Jan 20, 2021
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 20, 2021
@danielerez
Copy link
Contributor

@avishayt Can you please take a look?

Comment on lines +2925 to +2929
type: string
description: Type of image that should be generated.
$ref: '#/definitions/image_type'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's legal to have a string with a ref?

Copy link
Contributor

@danielerez danielerez Jan 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems it behaves as expected, works with 'host-stage' at least :)

assisted-service/swagger.yaml

Lines 3792 to 3794 in f557006

current_stage:
type: string
$ref: '#/definitions/host-stage'

Copy link
Contributor

@avishayt avishayt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, just one small comment

}
if err := gzipWriter.Close(); err != nil {
err = errors.Wrapf(err, "Failed to gzip ignition config")
imageBytes, err := isoeditor.IgnitionImageArchive(ignitionConfig)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
imageBytes, err := isoeditor.IgnitionImageArchive(ignitionConfig)
ignitionBytes, err := isoeditor.IgnitionImageArchive(ignitionConfig)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, done

carbonin and others added 8 commits January 24, 2021 10:32
This adds a type enum to both the cluster image info and the
image creation parameters
This will make it easier to share between the existing logic
which creates the archive then uploads it to s3 and the new logic
which will write the archive to the fs before bundling it into the
minimal iso directly
This allows us to create the entire iso locally and skip the process
of uploading the ignition to S3
This will be a good place to add "ratelimiting" for concurrent iso
editing if that's something we need.

Additionally it makes things easier to test by giving us somewhere
to inject mock objects at the inventory API level.

Authored-by: Nick Carboni <ncarboni@redhat.com>
Extracted generate cluster minimal ISO logic to 'generateClusterMinimalISO'
function in order to avoid a cyclomatic complexity error.
@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 24, 2021
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: avishayt, carbonin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

12 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 24, 2021
@danielerez
Copy link
Contributor

/retest

@danielerez
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 25, 2021
@openshift-merge-robot openshift-merge-robot merged commit 5514de2 into openshift:master Jan 25, 2021
@carbonin carbonin deleted the cluster_specific_minimal_iso branch January 25, 2021 15:01
osherdp pushed a commit to osherdp/assisted-service that referenced this pull request Jan 16, 2022
* MGMT-297 Add discovery image type

This adds a type enum to both the cluster image info and the
image creation parameters

* MGMT-2977 Move tempfile handling into create()

* MGMT-2977 Move logic for creating ignition archive to isoeditor

This will make it easier to share between the existing logic
which creates the archive then uploads it to s3 and the new logic
which will write the archive to the fs before bundling it into the
minimal iso directly

* MGMT-2977 Add the full ignition to the iso before re-creating it

This allows us to create the entire iso locally and skip the process
of uploading the ignition to S3

* MGMT-2977 Create a cluster-specific minimal iso when requested

* MGMT-2977 Create a factory interface for isoeditor

This will be a good place to add "ratelimiting" for concurrent iso
editing if that's something we need.

Additionally it makes things easier to test by giving us somewhere
to inject mock objects at the inventory API level.

Authored-by: Nick Carboni <ncarboni@redhat.com>

* MGMT-2977 extract generate cluster minimal iso logic

Extracted generate cluster minimal ISO logic to 'generateClusterMinimalISO'
function in order to avoid a cyclomatic complexity error.

* MGMT-2977 negative unit-tests for generate minimal iso

* MGMT-2977 unit-test for regenerating iso template

Added "Regenerates the iso for a new type" unit-test.

* MGMT-2977 added minimal-iso ImageType to subsystem tests

Co-authored-by: Daniel Erez <derez@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review Categorizes an issue or PR as actively needing an API review. approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants