Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

stage1 handling and configuration #1977

Closed
wants to merge 16 commits into from

Conversation

krnowak
Copy link
Collaborator

@krnowak krnowak commented Jan 14, 2016

  • rewrite stage1hash.go
    • replace --stage1-image flag with --stage1-{url,path,name,hash,from-dir}
  • add stage1 configuration
    • defines name, version and location of a stage1 image
      • name and version are used to search for the image in the image store
      • location is used for fetching the image if it is not in the store
  • extend paths configuration
    • add stage1 images directory path
      • used together with the --stage1-from-dir flag
  • add the stage1 loading test
    • it tests all the --stage1-* flags
    • it tests the configuration
  • add some features to the test aci server, required by the stage1 loading test
    • add caching (etag handling)
    • add http connections
  • add the stub stage1 image fot the stage1 loading test
    • it does almost nothing
    • might be useful in other tests that check something between running rkt and actual execution of the coreos.com/rkt/stage1/run entrypoint.
  • add some per-image flags for specifying the type of the image reference
    • likely to be dropped, be a part of a different PR
    • wrote it long time ago (when refactoring image handling)
    • forgot to test it

Fixes #1425, #1600, #471.

@krnowak
Copy link
Collaborator Author

krnowak commented Jan 18, 2016

Ready for review - semaphore has passed (https://semaphoreci.com/coreos/rkt/branches/pull-request-1977/builds/4). It is running again, because I just pushed the commit with CHANGELOG.md updates.

@krnowak
Copy link
Collaborator Author

krnowak commented Jan 18, 2016

About milestones - this PR is set to 1.0, the issues it fixes are set to 0.16.0. Something has to be moved (likely the issues).

In general, you will be best off by specifying an absolute path to the image file.
This parameter is currently very shabby and will be reworked in the near future.
For the flavor setup, the default value is also empty, which tells rkt to look for the image in the directory the rkt binary is located, unless it is overridden at runtime.
Normally, this parameter should be some URL, with a scheme or an absolute path.
Copy link
Member

Choose a reason for hiding this comment

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

Can you give an example of typical usage?

For example, Fedora (rkt.spec) uses --with-stage1-default-location=%{_libexecdir}/%{name}/stage1-host.aci.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added the line:
The path is usually something like /usr/libexec/rkt/stage1-images or /usr/lib/rkt/stage1-images.

@krnowak
Copy link
Collaborator Author

krnowak commented Jan 19, 2016

ping @robszumski for the flags change. I replaced --stage1-image with a set of flags: --stage1-url, --stage1-path, --stage1-name, --stage1-hash and --stage1-from-dir. Commit message here explains what these flags do - kinvolk@c170745

@krnowak krnowak mentioned this pull request Jan 19, 2016
5 tasks
@robszumski
Copy link
Contributor

@krnowak SGTM

This extends the "override semantics" section. Also, it rewords or
fixes other parts of the documentation.
Some of the configured values can be overridden with command line
flags, so it would be nice to mention which ones for each kind.
build: Use a better wording in configure.ac (conflicting -> mutually
exclusive), reformat ldflags for clarity in rkt.mk

config: Document some public structs, remove a useless call to
os.TempDir(), make sure that data directory is an absolute path, fix a
bug in toArray

functional tests: Minor code shuffling and renaming in test aci
server.

image: print a message when using stage1 image from a hash
This setting will be later used by --stage1-from-dir flag.
It replaces the --stage1-image flag with five mutually-exclusive
flags: --stage1-url, --stage1-path, --stage1-name, --stage1-hash and
--stage1-from-dir. The flags tell rkt to use stage1 image,
respectively, from a URL, from a path, in the store under the name, in
the store with the hash, from a file in the default stage1 images
directory.

In case none of the above flags were provided, rkt takes stage1 and
paths configuration and build-time defaults to decide for which name
and version of the stage1 image it should search for in the image
store and, if that fails, from which location it should fetch the
image.

This introduces a new configure flag for defining the path to the
default stage1 images directory.
…nder http

This will be used in the stage1 loading test to test stage1 loading
either from a configuration with an http location defined or from the
--stage1-url flag with an http url.
This will be used in the stage1 loading test to make sure that rkt
reuses a stage1 image from the store instead of fetching it from the
remote location again.
…truct

The list of options will grow, which will make the NewServer function
even more awkward (with 5 parameters or so). So this commit puts all
the configuration into the ServerSetup struct and provides a function
for getting a default setup, which can be modified before passing it
to NewServer function.
…ndom one

Choosing a fixed port will make the server to listen on port 80 or
443, depending on whether it uses http or https protocol.

This also replaces a hack for running a discovery server with a proper
solution, which is replacing a default listener with our own.
This implementation is actually so minimal, that it does not even
bother with running stage2.

We can use it regardless of how the project was configured. This
stage1 image could also be used in other tests that do not involve
checking things happening inside stage1 or stage2.

This will be used in stage1 loading test.
The stage1 loading test will use stub stage1 image for its checks. One
of them is testing whether rkt falls back to fetching stage1 image
from the same directory the rkt binary is in. To do this, we need to
put the stub stage1 image in the same directory as rkt. To avoid a
confusion from packagers and users, we do it backwards - we put a
symlink to the rkt binary in the directory where stub stage1 image is.

In the same directory we also put symlinks to all the flavors of the
stage1 image, so the tests should work as they did so far.
It tests loading stage1 from the configuration and from the
flags. Docker cases are not tested at all - we need a docker test
server first.
@krnowak
Copy link
Collaborator Author

krnowak commented Jan 26, 2016

Closing to get the semaphore testing for the new PR.

@krnowak krnowak closed this Jan 26, 2016
@krnowak
Copy link
Collaborator Author

krnowak commented Jan 26, 2016

Followup - #2035

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants