Skip to content

Plugable secrets backend - #366

Merged
thaJeztah merged 1 commit into
docker:masterfrom
twistlock:plugable_secrets_backend
Sep 18, 2017
Merged

Plugable secrets backend#366
thaJeztah merged 1 commit into
docker:masterfrom
twistlock:plugable_secrets_backend

Conversation

@liron-l

@liron-lliron-l commented Jul 20, 2017

Copy link
Copy Markdown
Contributor

This commit extends SwarmKit secret management with pluggable secret
backends support.
Following previous commits:

  1. moby/swarmkit@eebac27
  2. moby/moby@08f7cf0

Added driver parameter to docker secret command.
Specifically:

  1. docker secret create [secret_name] --driver [driver_name]
  2. Displaying the driver in
 $ docker secret ls
$ docker secret inspect [secret_name]
$ docker secret inspect [secret_name] -pretty

Signed-off-by: Liron Levin liron@twistlock.com

@codecov-io

codecov-io commented Jul 20, 2017

Copy link
Copy Markdown

Codecov Report

Merging #366 into master will increase coverage by 0.04%.
The diff coverage is 72.09%.

@@ Coverage Diff @@## master #366 +/- ##
==========================================
+ Coverage 49.01% 49.06% +0.04% 
==========================================
Files 199 199 Lines 16392 16422 +30 ==========================================
+ Hits 8035 8057 +22 - Misses 7939 7946 +7 - Partials 418 419 +1

@liron-l

Copy link
Copy Markdown
ContributorAuthor

@dnephin@thaJeztah I closed and re-opend #348 since the tests did not get triggered on push.
I hope it's OK if we continue the discussion here.

@dnephindnephin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@liron-l
liron-lforce-pushed the plugable_secrets_backend branch from 343de92 to 64bfcb7CompareJuly 20, 2017 18:41
@liron-l

liron-l commented Jul 20, 2017

Copy link
Copy Markdown
ContributorAuthor

@dnephin thanks! I think that the commit approval is what's causing the builds to stop.

@dnephin

dnephin commented Jul 20, 2017

Copy link
Copy Markdown
Contributor

Hmm, I don't know about that. We approve plenty of PRs that are still able to build afterward.

I think it's something about the files/changes. On my PR which had this issue (#107) I also retried recreating it, and after the first build it also stopped building again, and the new PR doesn't have any approvals.

@liron-l

Copy link
Copy Markdown
ContributorAuthor

Makes sense @dnephin. Let me know what further steps are required to complete this PR.

@dnephin

Copy link
Copy Markdown
Contributor

Once someone else gives their approval we can run the tests manually and merge. Let's not worry about the github bug for now

@liron-l

Copy link
Copy Markdown
ContributorAuthor

Great @dnephin thanks!

@liron-l

Copy link
Copy Markdown
ContributorAuthor

@thaJeztah PTAL, I separated vendor.conf bump to another commit.
Let me know if I need to bump additional packages. Thanks!

@liron-l
liron-lforce-pushed the plugable_secrets_backend branch 2 times, most recently from 8c158ce to 4064118CompareJuly 30, 2017 11:33
@liron-l

Copy link
Copy Markdown
ContributorAuthor

@thaJeztah@cpuguy83 please take a look, I've updated the docker vendor dependencies again. Thanks!

@cpuguy83cpuguy83 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@vdemeestervdemeester left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM 🐸
/cc @thaJeztah needs some docs update ? 👼

@liron-l

Copy link
Copy Markdown
ContributorAuthor

@thaJeztah PTAL

@liron-l

Copy link
Copy Markdown
ContributorAuthor

@vdemeester, @cpuguy83, @diogomonica, @thaJeztah, should I add additional changes to this commit?

Comment threadcli/command/secret/create.go Outdated
}
flags := cmd.Flags()
flags.VarP(&options.labels, "label", "l", "Secret labels")
flags.StringVar(&options.driver, "driver", "", "Secret driver")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This flag needs to have a version annotation, so that it is hidden / produces an error on older API versions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, to be consistent with docker network create, docker volume create, in this case I would be +1 to add a -d shorthand as well

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Thanks @thaJeztah I set the version annotation to 1.31, hope this makes sense.

in = file
defer file.Close()
if options.driver != "" && options.file != "" {
return errors.Errorf("When using secret driver secret data must be empty")

@thaJeztahthaJeztahAug 14, 2017

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could this be handled by the (external) driver? IIUC, with this change the secret's value is taken from the external store, so

$ docker secret create --driver external mysecret

Doesn't really "create" a secret, but "associates" the external secret with a secret in Docker.

Do we need to keep the option open to have external secret stores create new secrets from the Docker CLI? i.e.

$ echo"new secret"| docker secret create --driver external mysecret -

If so, this validation should be done by the driver (just like currently checking for empty values is done in the backend)

$ docker secret create foo
Error response from daemon: rpc error: code = InvalidArgument desc = secret data must be larger than 0 and less than 512000 bytes

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@thaJeztah according to the secrets plugin subsystem design, the secrets plugin will be readonly (that is, swarm will not populate the secret values).
I think it might be better to prevent incorrect usage as soon as possible (since file is a cli only option).

@liron-l
liron-lforce-pushed the plugable_secrets_backend branch from 4064118 to 66ac875CompareAugust 14, 2017 10:00
@liron-l

Copy link
Copy Markdown
ContributorAuthor

Thanks @thaJeztah, I've updated the review according to your comments.

  1. Set minimum version for --secret parameter (1.31)
  2. Kept the CLI validation, according to the secret plugin design, we will never populate the secrets from the cli. In the context of plugins, the creation means that we create a real secret in swarmkit (secret name and metadata) and only the value is fetched from the plugin.

@liron-l
liron-lforce-pushed the plugable_secrets_backend branch from 66ac875 to 7133af1CompareAugust 14, 2017 10:07
@liron-l
liron-lforce-pushed the plugable_secrets_backend branch 4 times, most recently from 3bf9d64 to 74c55deCompareAugust 18, 2017 19:23
@liron-l

Copy link
Copy Markdown
ContributorAuthor

@thaJeztah@diogomonica I've updated the code, please take a look if the new secrets driver API makes sense.

@liron-l

Copy link
Copy Markdown
ContributorAuthor

@diogomonica@thaJeztah PTAL.

@liron-l
liron-lforce-pushed the plugable_secrets_backend branch 3 times, most recently from 1920e7e to 93292ffCompareAugust 27, 2017 20:05
@liron-l

Copy link
Copy Markdown
ContributorAuthor

@thaJeztah PTAL, let me know if additional changes are required.

@liron-l
liron-lforce-pushed the plugable_secrets_backend branch 2 times, most recently from bc8f58d to 736f0a4CompareSeptember 3, 2017 20:32
@liron-l

Copy link
Copy Markdown
ContributorAuthor

@diogomonica@thaJeztah PTAL, all other dependencies related to this feature are completed. Thanks.

@liron-l
liron-lforce-pushed the plugable_secrets_backend branch from 736f0a4 to ef47835CompareSeptember 7, 2017 08:05
This commit extends SwarmKit secret management with pluggable secret
backends support.
Following previous commits:
1. moby/swarmkit@eebac27
2. moby/moby@08f7cf0
Added driver parameter to `docker secret` command.
Specifically:
1. `docker secret create [secret_name] --driver [driver_name]`
2. Displaying the driver in
```
$ docker secret ls
$ docker secret inspect [secret_name]
$ docker secret inspect [secret_name] -pretty
```
Signed-off-by: Liron Levin <liron@twistlock.com>
@liron-l
liron-lforce-pushed the plugable_secrets_backend branch from ef47835 to 0ee9e05CompareSeptember 7, 2017 08:10
@diogomonica

Copy link
Copy Markdown
Contributor

This LGTM, but I don't have merging rights.

@liron-l

Copy link
Copy Markdown
ContributorAuthor

@vdemeester@dnephin@thaJeztah can somebody please merge?

@thaJeztahthaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

alright let's get this merged

LGTM 👍

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@liron-l@codecov-io@dnephin@diogomonica@vdemeester@cpuguy83@thaJeztah@GordonTheTurtle