Commit Graph

108 Commits

Author SHA1 Message Date
Patrick East 9a97b4d41f docs: Fix config reference doc links
We pulled the config docs out into their own section from the
/management page. In the process we missed some links that needed
updating.

Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-09-19 13:12:48 -07:00
Patrick East a64cef4deb docs: Add pretty download URLs
This gives nicer download URLs for OPA binaries via:

https://openpolicyagent.org/downloads/<version>/<binary>

Under the hood we just use Netlify to rewrite the url to the normal
github and s3 locations.

With this you can also use:

https://openpolicyagent.org/downloads/edge/<binary>

and

https://openpolicyagent.org/downloads/latest/<binary>

For quick links to the current master and latest release binaries.

Fixes: #1771
Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-09-19 12:01:30 -07:00
Patrick East 212884e4e7 docs: Minor fixups to terraform guide
Just fixing a couple of little things I noticed while following the
guide.

Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-09-18 10:01:52 -07:00
Patrick East 249ce31ad1 docs: Add note about edge docker image tag
We have info for the `latest` tag, `*-dev` tags, and this just adds
a blurb about the `edge` tag.

Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-09-13 19:44:54 -04:00
Tim Hinrichs 1aae0a4b2d docs: Clarify type-checking functions
Previously the behavior of the type-checking functions was arguably
underdescribed in the docs when the type-check failed.

This change specifies that the result is undefined.

Signed-off-by: Tim Hinrichs <tim@styra.com>
2019-09-12 18:37:05 -04:00
Torin Sandall ac74fc77ff docs: Refresh docs on how to extend OPA
Users frequently ask how to implement custom built-in functions and up
until now the information has been a bit hidden. This change improves
the visibility of the docs that describe how to customize/extend
OPA. We should revisit the section on how to customize the OPA daemon
to demonstrate how to use dep or modules as well as how to instantiate
only select portions of OPA (e.g., the plugin manager with a custom
gRPC server.)

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-09-12 17:12:41 -04:00
Torin Sandall 4c21b4401b docs: Add overview to management APIs page
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-09-12 17:12:10 -04:00
Torin Sandall b107ef2618 docs: Reorganize operations pages
* Move the integration guide into the core docs. This is one of the
  most common questions when people get started.
* Split the configuration and monitoring sections into their own
  pages. This prepares the management page for an introduction that
  explains the control plane concept.
* Move bundle section up to the top of the page since basic policy
  distribution is usually the first concern.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-09-12 17:12:10 -04:00
Torin Sandall 583b67cb57 docs: Refresh the introduction page
This commit updates the introduction page to focus on Rego and
integrating with OPA (whereas the old introduction content focused on
high-level concepts like policy-decoupling, the data document, etc.)

The new introduction content provides a concise overview of OPA and
then launches into an tour of Rego (by example) that shows the core
concepts in the language. The content ends with an overview of
different ways you can interact with OPA.

The old introduction content has been moved into the Philosophy page
and the How Does OPA Work? page has been removed/replaced by the new
introduction page.

With these changes we can update the frontpage with links to core OPA
introduction and then different use cases (e.g., Kubernetes, Envoy,
etc.)

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-09-11 13:36:19 -04:00
omerlh c8b9985e2c documentation
Signed-off-by: omerlh <omerl@soluto.com>
2019-09-10 10:10:41 -07:00
Patrick East e8f652c436 docs: Fix all broken links
Any links that were caught by the link checker have been
repaired. This also standardizes some to ensure we are
always using URLs with trailing `/` when possible.

Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-09-10 09:58:50 -07:00
Patrick East 4ea7c206fe docs: Rename data-replication.md to external-data.md
We changed the title in the doc but the file still had the old name.

Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-09-10 09:58:50 -07:00
Torin Sandall ccf263c3be runtime: Add build commit to runtime info
With #1715 we updated opa.runtime() to include the OPA semantic
version in the output. This change extends that to include the build
commit which is useful for development purposes.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-09-10 08:49:05 -04:00
Teemu Koponen 515e29b4c6 builtins: Enhance io.jwt.verify_* builtins to accept JWK as a cert parameter.
Signed-off-by: Teemu Koponen <koponen@styra.com>
2019-09-09 10:22:01 -04:00
Ashutosh Narkar fe14bdf754 docs: Create tutorial for Envoy-OPA integration.
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2019-09-05 06:06:33 -07:00
omerlh f43bae2509 document the new field
Signed-off-by: omerlh <omerl@soluto.com>
2019-09-04 12:14:40 -06:00
Omer Levi Hevroni d3ecbcb9c5 added examples for decision and multi bundle
Signed-off-by: omerlh <omerl@soluto.com>
2019-09-04 11:32:56 -06:00
Patrick East 1991bd9032 docs: Remove ceph guide temporarily (again)
It snuck back in.. see 5fd445eab7 for
the original removal.

Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-08-29 10:10:10 -07:00
Tim Hinrichs c47f9da450 docs: Substitute "decouple policy" for "policy-enablement"
We no longer describe OPA as policy-enabling a service.  Instead we talk about
OPA as decoupling policy from a service.  This seems to be the one place we
talk about it.

Also modify the introduction to describe authentication versus authorization.

Signed-off-by: Tim Hinrichs <tim@styra.com>
2019-08-29 09:29:08 -07:00
Tim Hinrichs 6760303a47 docs: Reorganize the docs navigation
The docs have grown organically and it was time for a reorganization, specifically
helping people understand at a single glance the information
that is available in the docs.

The new docs are organized as follows:
- Core docs (policy and data)
- Use-case specific docs
- Operations
- Support

As part of the reorganization, several files were renamed and/or combined.

Also made an editing pass over what was previously the user-attribute docs
and generalized them to focus on data-replication, an issue that is
now promoted to the core docs.  As part of that, updated the images
and removed the old ones; new image sources are in google slides.

Tweaked the navigation bar to give more space on the left-hand column
so that more of the topics are visible without scrolling.

Signed-off-by: Tim Hinrichs <tim@styra.com>
2019-08-29 09:29:08 -07:00
Torin Sandall 5fd445eab7 docs: Removing Ceph tutorial until issues can be resolved
There are a few issues with the Ceph tutorial in it's current
state. I've documented a few of them in the commit message on this
branch: https://github.com/tsandall/opa/tree/fix-ceph-authz.

Once those issues are addressed we can re-introduce the Ceph tutorial.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-08-27 17:29:51 -07:00
Vincent Gramer 79e2e4a770 docs: update terraform tutorial to works with v.0.12.6
Signed-off-by: Vincent Gramer <vgramer@gmail.com>
2019-08-26 16:05:16 -07:00
Torin Sandall 4ee04ca358 docs: Add language reference section for units
Also fix-up built-in function declaration to match updated name.

Fixes #1561

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-08-26 12:13:16 -04:00
Torin Sandall 41fbf6eb13 docs: Update to show undefined example with !=
Fixes #1626

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-08-23 16:50:32 -04:00
Torin Sandall 74d67c5de1 docs: Update to use live blocks
These changes update most of the docs to use live blocks. The
following pages have not been touched or updated significantly:

* Get Started - this page is based entirely on the REPL. We should
  revisit the "Get Started" page once these changes have
  landed. The existing page can live on as an introduction to the REPL
  while the Get Started page can be tailored to live blocks.

* Ceph Authorization - this page has not been updated aside from
  making the policy example use the live blocks for syntax
  highlighting. We need to revisit the policy example and refactor the
  tutorial a bit to emphasize the policy as opposed to the manifests
  required to install.

* Terraform - this page has not been touched because @vgramer is
  planning to update for Terraform v0.12. We can update this page once
  those changes are in to avoid conflicts.

These changes also remove the use of non-Markdown code examples. All
the examples are inlined into Markdown now.

A few OPA deployment examples have been updated to enable the console
decision logging. This is better than the request/response debug logs.

Fixes #1650

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-08-23 16:50:32 -04:00
Patrick East 37c1d0be59 docs: Update warning for multi-bundle root overlap
The behavior has since changed and we do check for overlaps.

The warning has been updated to give advice on monitoring for errors
and to describe the somewhat racy nature of loading multiple bundles.

Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-08-22 12:33:13 -07:00
David Boles 91d98c7205 docs: Add live-editable code blocks to the docs.
This commit adds a postprocessor to the docs build that enables
examples to be edited and have the results show up live. See the
additions to `docs/README.md` for more about what writing these
blocks looks like or the netlify PR preview
(e.g. at `docs/edge/how-do-i-write-policies/`)
to see them in action (you'll need to disable CORS for live output).

Signed-off-by: David Boles <me@davidbol.es>
2019-08-21 10:12:49 -07:00
Torin Sandall b0523466c1 Refactor metric provider implementation
* Remove metric provider config to avoid introducing new public
  interfaces. Since there is only one provider (prometheus) and it
  doesn't have any configurable settings, remove the configuration
  changes for now. We can always add these in the future.

* Remove dummy metric provider implementation. This isn't needed now
  that we're using the metrics.Metrics interface instead of
  metrics.GlobalMetrics.

* Remove metrics.GlobalMetrics in favour of metrics.Metrics. Move the
  HTTP handler instrumentation interfaces into the server package to
  avoid coupling the metrics package to the net/http package.

* Refactor the prometheus provider to implement the metrics.Metrics
  interface. Since the prometheus registry can error on Gather()
  calls, the provider has been updated to accept a logger and use ti
  when the Gather() call fails. This doesn't affect any public
  interfaces so it can be revisited in future if needed. Alteratnively
  we could add a Gather() interface onto metrics.Metrics which could
  return the error.

* Refactor status plugin to include metrics in status update by
  default. Users implementing the status API are likely to need
  performance metrics to gauge the OPA's health. Moreover if they are
  implementing the status API it's unlikely they will want to poll the
  /metrics endpoint on the OPA HTTP API (which may not even be
  exposed.)

* Move the prometheus endpoint test case into the e2e package so the
  server package has no dependencies on prometheus anymore.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-08-15 15:08:38 -04:00
Stan Lagun 69fbaacfde Add Prometheus metrics to the status updates
Prometheus metrics can give much of insight into OPA's health.
Run-time metrics are a natural part of the application state
so having them in status update seems like a right change
that can help server understand what's going in with the OPA
instance.

The commit also encapsulates all prometheus-related code in one package
and abstracts it with generic interface so that it would be possible
to add other metrics providers

Addresses #1606

Signed-off-by: Stan Lagun <stan@styra.com>
2019-08-15 15:08:38 -04:00
Torin Sandall 7ef72c191b docs: Refactor admission control content into top-level section
The goal is to have the Kubernetes admission control content organized
into one section. This should make it easier to incorporate Gatekeeper
content in the future.

Since the layouts are not versioned the layout logic had to be
enhanced to filter out sections that have no content for the current
version. Doing a semantic version comparison was considered but it was
unclear how to implement that properly within the Hugo template
system. Since it's unlikely that we will want to ever display empty
sections this approach seems fine.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-08-14 16:38:09 -04:00
Torin Sandall 00de0208e9 docs: Add initial stab at integration guide
This is not complete (e.g., more detail on management APIs would be
great, detail on CLI invocation would be nice, detail on partial
evaluation would be very helpful, etc.) but it provides a starting
point.

Fixes #372

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-08-12 17:15:30 -04:00
Torin Sandall 516461dda5 docs: Update docs to mention rules declared with :=
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-08-07 14:22:45 -04:00
Torin Sandall 6995cd61a3 docs: Fix bundle configuration example
The configuration was using the old 'bundle' key when it should be
using the new 'bundles' key.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-08-06 11:38:23 -04:00
Torin Sandall 4033f3d945 server: Remove deprecated diagnostic feature
This commit removes the deprecated diagnostic feature from the
server. The feature has been deprecated since November 2018 and it was
essentially unused at the time so it should be safe to
remove. Removing the diagnostic support from the server saves having
to perform an extra policy evaluation in the server.

Once the buffer is removed from the runtime.Params struct the related
issue can be closed (there is still one known user of that so it has
been left intact for backwards compatibility.)

Ref #1052

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-08-06 02:25:09 +09:00
Charlie Egan 89eacaccb6 Add livenessProbe to demo deployment
I expect many install OPA following this guide (as we did). Recent PRs
have made steps to 'productionize' this (e.g.
[#1435](https://github.com/open-policy-agent/opa/pull/1435))

We had an incident involving the controller where a stuck container was
not restarted. We would have been helped if a liveness probe was
configured. We copied the docs and this is our bad but we'd like to do
our best to make sure others don't make the same mistake.

I figured it'd be ok to use the health endpoint
[here](https://github.com/open-policy-agent/opa/blob/master/docs/content/rest-api.md#health-api)

We've made this change and it seems to be working ok for us.

Signed-off-by: Charlie Egan <charlieegan3@users.noreply.github.com>
2019-08-02 12:42:46 -07:00
Patrick East 346aa964e8 Add support for multiple bundles
This change brings in support for multiple bundles to be downloaded
and activated OPA.

This is enabled by using the new config option `bundles` to define
the bundles, and deprecates the older `bundle` option.

The new `bundles` keyword and structure is propagated through to the
decision logs, status API, provenance, stored manifests, etc. Check
out the doc changes for all the updated structures.

That being said any existing configuration using `bundle` will *not*
see the new structure, everything is intended to be backwards
compatible (almost to a fault).

Fixes: #721

Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-07-31 03:43:38 -04:00
Torin Sandall 221974f28a docs: Add example of merging two objects
This is answers a common question that was recently raised in #1588.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-07-30 08:54:53 -07:00
repenno 15725be32a Add jws encoding built-in functions
fixes #1174

Signed-off-by: repenno <rapenno@gmail.com>
2019-07-16 09:04:36 -04:00
Jason Hoch 26e0b325cb docs: Tweaks to improve consistency
The preceding example uses `x>y`, without which the variable `y`
is unused.

Signed-off-by: Jason Hoch <jrshoch@gmail.com>
2019-07-15 12:34:43 -07:00
Patrick East 41c0c97aee docs: Add details for .'s in --set keys
It is not very discoverable as to how the `--set` options work when
keys have `.` characters in them. This adds in a section to the config
docs on how to do it.

Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-07-09 17:26:51 -07:00
Jessica de Leeuw 543b3a677f content: Fixed typo in language-reference.md
Signed-off-by: Jessica de Leeuw <jessicadl@google.com>
2019-07-03 06:48:09 +08:00
Torin Sandall 7d15f462ec docs: Add section on how to express "FOR ALL" in Rego
This is a common question that comes up. Until we have a keyword that
lets users express "FOR ALL" we should have docs we can point to.

Fixes #1307

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-06-29 01:20:40 +08:00
Xin Jin 00db47315a docs: fix minor typos and add principal in AWS example.
Signed-off-by: Xin Jin <xin@styra.com>
2019-06-29 00:46:29 +08:00
Torin Sandall 6aa521515c docs: Remove cast_xyz functions from docs
Fixes #1405

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-06-28 03:30:30 +08:00
Patrick East 1b6ee8de21 docs: Clarify config for console decision logger
Clarify the requirements/caveats for using the local decision logger
and include a blurb on the decision log.

Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-06-26 06:37:32 -07:00
Torin Sandall 096670bda4 ast: Update rule index to support glob.match
These changes update the rule index to support glob.match calls. The
changes update the build step to transform glob.match(pattern,
delimiter, match) calls into ref/value pairs like equality
expressions. In addition, the build step creates a mapper function
that transforms resolved values into lookup values during traversal.

As part of these changes, the build operation has been refactored so
that most of the process is encapsulated by a new refindices struct
that's separate from the actual rule index/trie. Hopefully this makes
the code easier to follow.

The index build step for glob.match only recognizes statements where
the match operand was given as a reference (and then was rewritten by
the earlier step in the compiler.) If this is too brittle we could
revisit the build step and close over all intermediate assignments.

Fixes #1496

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-06-26 08:57:25 +08:00
Julien Garcia Gonzalez 758f1bbcc9 Fix link in the kubernetes-admission-control docs
This PR is fixing docs link in the kubernetes-admission-control-validation docs

Signed-off-by: Julien Garcia Gonzalez <julien@giantswarm.io>
2019-06-24 12:11:01 -07:00
Ken Fukuyama 4412102707 Add example of JSON pointers using array indexes.
Add specific example using array indexes to show what expression is
allowed and what is not explicitly.

Signed-off-by: Ken Fukuyama <kenfdev@gmail.com>
2019-06-19 15:57:16 -07:00
Patrick East a1abbbf4c9 logs: console decision logging option
Add option to log decision logs locally. They'll get logged via
Logrus at info level.

To enable configure OPA with something like:

```
decision_logs:
    console: true
```

This will work alongside remote services and plugins. It will also
log the masked events in the case a masking policy is set.

Fixes: #1334
Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-06-13 13:27:51 -07:00
Torin Sandall 0b326b0a3e docs: Remove mention of persistent storage
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-06-13 09:21:52 -07:00