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

Documentation: add a document on storage options #632

Merged
merged 1 commit into from
Oct 26, 2016

Conversation

ericchiang
Copy link
Contributor

fyi @dghubble there's some third party resource docs here.

Copy link
Contributor

@pop pop left a comment

Choose a reason for hiding this comment

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

Overall this looks good.

I have a lot of feedback, but most of it is related to following the style guide. As far as the word choice and sentence flow goes you can take my feedback with a grain of salt.

As far as enforcing the coreos/docs style guide goes:

  • Links should follow the [link text][ref], with [ref]: url at the bottom of the file.
  • Headings ought to be in sentence heading.

I'll make a PR with a reference to the coreos docs style guide to the CONTRIBUTING.md doc ASAP.


## Caveat: Running replicated instances

Validation is still being done to ensure correctness when multiple instances of dex are using the same backing storage. While everything "should just work", edge cases require time to investigate and write tests for. This work can be followed on the issue tracker [here](https://github.com/coreos/dex/issues/600).
Copy link
Contributor

@pop pop Oct 24, 2016

Choose a reason for hiding this comment

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

  • Reference style hyperlinks ([hyperlinked text][label])

Copy link
Contributor

Choose a reason for hiding this comment

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

I would reword this to be:

Dex performs correctness validation when multiple instances use the same backing storage. This should "Just Work" but when it doesn't you should check out the [dex issue tracker][dex-issue-tracker-url] and add or comment on a relevant issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dex performs correctness validation when multiple instances use the same backing storage.

That's not the same thing. This is stating that we still need to write the tests to prove correctness and you probably shouldn't be running these kind of setups in the first place. How does this sound?

Tests still need to be written to validate that multiple instances of dex behave correctly when using the same storage.
While there aren't any technical limitations, edge cases have been observed and progress on these kind of bugs can be found on the [dex issue tracker].


Regardless of the implementation, dex saves sensitive data in its backing storage: signing keys, bcrypt'd passwords, etc. Storage breaches are serious because attacks may propagate to any application which relies on dex. Whatever storage option used, transport security and database ACLs are both musts.

## Caveat: Running replicated instances
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Sentence style headings (## Only the first character and proper nouns are capitalized)

description: "An OAuth2 client."
```

Once the `ThirdPartyResource` is created, custom resources can be created at a namespace level (though there will be a gap between the `ThirdPartyResource` being created and the API server accepting the custom resource). While most fields are user defined, the API server still respects the common `ObjectMeta` and `TypeMeta` values. For example names are still restricted to a small set of characters, and the `resourceVersion` field can be used for an [atomic compare and swap](https://github.com/kubernetes/kubernetes/blob/release-1.4/docs/devel/api-conventions.md#concurrency-control-and-consistency).
Copy link
Contributor

@pop pop Oct 24, 2016

Choose a reason for hiding this comment

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

  • Reference style hyperlinks ([hyperlinked text][label])

caFile: /etc/dex/postgres.ca
```

The SSL "mode" corresponds to the `github.com/lib/pq` package [connection options](https://godoc.org/github.com/lib/pq#hdr-Connection_String_Parameters). If unspecified, dex defaults to the strictest mode "verify-full".
Copy link
Contributor

@pop pop Oct 24, 2016

Choose a reason for hiding this comment

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

  • Reference style hyperlinks ([hyperlinked text][label])


Each storage implementation bears a large ongoing maintenance cost and needs to be updated every time a feature requires storing a new type. Bugs often require in depth knowledge of the backing software, and much of this work will be done by developers who are not the original authors. Changes to dex which add new storage implementations are not merged lightly.

Those who still want to construct a proposal for a new storage should review the following packages:
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Put this under a third-tier heading ### New storage option references

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wouldn't that imply that it's part of the SQL section (as it's not)?

Copy link
Contributor

Choose a reason for hiding this comment

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

The above second-tier heading is ## adding a new storage option, so putting a third-tier heading should make it obvious that this is a sub-topic of ## adding a new storage option.
This fine-grain organization makes the table of contents on coreos.com more useful.


Migrations are performed automatically on the first connection to the SQL server (it does not support rolling back). Because of this, dex requires being able to add and alter the tables for its database.

NOTE: Previous versions of dex required symmetric keys to encrypt certain values before sending them to the database. This feature has not been ported to V2 yet, though it may be added later (but possibly without a migration path for users of the current implementation).
Copy link
Contributor

Choose a reason for hiding this comment

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

I would make Note bold.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would reword the last second sentence to be

This feature has not yet been ported to dex v2. If it is added later there may not be a migration path for current v2 users.


### Postgres

Dex authenticates to Postgres with a username and password. As stated above, because dex performs migrations, it requires privileged access to its own database. Database table names are not configurable, and to prevent table name clashes with other applications admins should expect to dedicated a database for dex's sole use.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would reword this paragraph to be:

Admins may want to dedicate a database to dex for the following reasons:

  1. Dex requires privileged access to its database because it performs migrations.
  2. Dex's database table names are not configurable; when shared with other applications there may be table name clashes.


Those who still want to construct a proposal for a new storage should review the following packages:

* `github.com/coreos/dex/storage`: Interface definitions which the storage must implement. NOTE: This package is not stable.
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a clickable link.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't link to a godoc.org until we've made this branch the default branch. Part of that getting to that point is writing docs like this :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough. I wanted to click on it and figured readers would too, but if it's technically not an option that's 👍

Those who still want to construct a proposal for a new storage should review the following packages:

* `github.com/coreos/dex/storage`: Interface definitions which the storage must implement. NOTE: This package is not stable.
* `github.com/coreos/dex/storage/conformance`: Conformance tests which storage implementations must pass.
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a clickable link.


* Integration testing setups (Travis and developer workstations).
* Transactional requirements: atomic deletes, updates, etc.
* Is there an established, reasonable Go client?
Copy link
Contributor

Choose a reason for hiding this comment

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

I would reword this last bullet to be:

  • Is there an established and reasonable Go client?

@ericchiang
Copy link
Contributor Author

@ElijahCaine thanks. Have a few counter comments, but other than that will rework this PR later today.

@ericchiang ericchiang force-pushed the dev-docs-storage-options branch from 4475ce7 to 7928ea0 Compare October 26, 2016 17:14
@ericchiang
Copy link
Contributor Author

@ElijahCaine updated with a second commit. Going to leave this here if you want to add any last second notes. Will squash and merge in a bit.

Copy link
Contributor

@pop pop left a comment

Choose a reason for hiding this comment

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

Hey Eric, this all looks really good.

I misspoke earlier when I said sentences were on their own lines, the style guide actually says that it's one paragraph per line. If you could revert that formatting to what you had earlier (sorry again!) and the line numbering change I commented on, I'll give this the thumbs up.

When using Postgres, admins may want to dedicate a database to dex for the following reasons:

1. Dex requires privileged access ot its database because it performs migrations.
1. Dex's database table names are not configurable; when shared with other applications there may be table name clashes.
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be 2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated, thanks

@ericchiang
Copy link
Contributor Author

Haha, thanks I'll update again.

@ericchiang ericchiang force-pushed the dev-docs-storage-options branch from 7928ea0 to 6c48398 Compare October 26, 2016 19:33
@ericchiang ericchiang merged commit 99e312e into dexidp:dev Oct 26, 2016
@ericchiang ericchiang deleted the dev-docs-storage-options branch October 26, 2016 19:34
Sign up for free to 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.

2 participants