8000 config: add config subcommand by s-urbaniak · Pull Request #2405 · rkt/rkt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

config: add config subcommand #2405

Merged
merged 1 commit into from
Apr 14, 2016
Merged

config: add config subcommand #2405

merged 1 commit into from
Apr 14, 2016

Conversation

s-urbaniak
Copy link
Contributor

This command adds the config subcommand.

TODOs:

  • add paths entries (removed)
  • add stage0 auth entries
  • add stage0 paths entries
  • add stage1 entries (currently only one)
  • add unit tests

Fixes #2368

@s-urbaniak s-urbaniak force-pushed the config branch 5 times, most recently from 8e5e987 to b9c93ed Compare April 11, 2016 10:27
@s-urbaniak
Copy link
Contributor Author

@jonboulle @alban @krnowak PTAL; stage1 is not ready yet, learning that part right now.

@s-urbaniak s-urbaniak changed the title WIP config: add config subcommand config: add config subcommand Apr 11, 2016
@s-urbaniak
< 8000 /path> Copy link
Contributor Author

I suggest implementing stage1 in a different PR in case this is lgtm.

```
$ rkt config
{
"stage0": [
Copy link
Contributor

Choose a reason for hiding this comment

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

OOB notes:

  • define top-level struct, as this is new
  • explain why we are printing each entry separately (even if the input config was deduplicated)
  • explain oauth/basic mutual incompatibility and override semantics

Copy link
Contributor

Choose a reason for hiding this comment

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

also, please capture everything from the design doc in here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed OOB notes. I could not reproduce the oauth/basic mutual incompatibility, I mixed up the already documented override semantics of system/user directories.

@jonboulle
Copy link
Contributor

/cc @josephschorr

}
```

And the follwong user configuration:
Copy link
Member

Choose a reason for hiding this comment

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

s/follwong/following

@s-urbaniak
8000 Copy link
Contributor Author

@alban @krnowak @jonboulle PTAL


The entries "stage0" and "stage1" refer to stage-specific configuration. The generated output are valid configuration entries as specified in the configuration documentation.

The "stage0" entry contains entries of rktKind "auth", "dockerAuth", and "paths". Note that the `config` subcommand will output separate entries per "auth" domain and separate entries per "dockerAuth" registry. While it is possible to specify an array of strings in the input configuration rkt internally merges configuration state from different directories potentially creating multiple entries.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'll make my plans about configuration clear here.

stage0 configuration is the configuration read by the rkt binary. So, rkt needs to know the credentials for fetching images (auth and dockerAuth kinds), needs to know where to store the fetched images (paths kind) and needs to know which stage1 image should be used by default and where to look for it (stage1 kind).

stage1 configuration will keep the configuration read by the binaries inside stage1 image (in our case init, enter and so on). So in this entry, we would put networking configuration and other stage1 specific settings.

So, in the current PR, stage1 entry should be empty.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, about the multiple auth entries - that's an implementation detail. We may change the code later to be smarter and merge the blocks with the same credentials. So I would keep quiet about it to avoid giving an impression that "domains" key is always a table with only one element.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm .. not sure about this, @jonboulle suggested to be transparent about it but you have a point, it's an implementation detail.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's partly an implementation detail, but it's also unintuitive why there's an asymmetry if I feed in a config with multiple entries and get back multiple stanzas with single entries. I think we can strike a balance explaining that they are semantically identical.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The asymmetry is only because of the implementation. Anyway, this can stay for now, but I'd like to have a warning or something that one should not assume that it will stay like that (means - one entry for each domain). "domains" key is an array for a reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I addressed this by adding a statement that the current merged/non-merged output behavior is subject to change.

@s-urbaniak s-urbaniak force-pushed the config branch 2 times, most recently from e699eeb to 76d4023 Compare April 12, 2016 10:57
@s-urbaniak
Copy link
Contributor Author

@alban @krnowak @jonboulle PTAL; if looks good, I'll squash being ready for the release.

@@ -0,0 +1,125 @@
# rkt config
Copy link
Contributor

Choose a reason for hiding this comment

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

Paging @joshix for doc review.

@jonboulle
Copy link
Contributor

@jonboulle
Copy link
Contributor

Since this becomes API, I'd like to see a test that this outputs what we expect (and is consumable again, if that's what we're promising), rather than just a successful marshalling. In the interests of getting this in 1.4.0 I'm okay with that being a follow-up, but we need some guarantees to avoid future breakage.

@s-urbaniak
Copy link
Contributor Author

@jonboulle issue already created, xref'ing here: #2410

@josephschorr
Copy link

Looks good from a usage perspective; excited to add support.

@@ -0,0 +1,125 @@
# rkt config

This command prints the rkt configuration per stage in JSON format.
Copy link
Contributor

Choose a reason for hiding this comment

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

The config subcommand prints the configuration of each rkt stage in JSON on the standard output.

(have to break reviewing this until later today)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed, thanks @joshix!

@s-urbaniak s-urbaniak force-pushed the config branch 3 times, most recently from a55d1f5 to 3fab112 Compare April 13, 2016 18:41
cmdRkt.AddCommand(cmdConfig)
}

func runConfig(cmd *cobra.Command, args []string) (exit int) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess that (exit int) is a copy-pasta from other commands, you don't use it here, so just simplify it to int.

A3E2 Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@krnowak
Copy link
Collaborator
krnowak commented Apr 14, 2016

Two final nits, otherwise LFAD.

This adds the config subcommand. Currently only stage0 configuration is
supported.

Fixes rkt#2368
@iaguis iaguis merged commit ed0d6dc into rkt:master Apr 14, 2016
@alban alban mentioned this pull request Apr 15, 2016
@s-urbaniak s-urbaniak deleted the config branch April 20, 2016 06:59
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.

7 participants
0