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

Allow persisting discovery bundles #2886

Closed
anderseknert opened this issue Nov 9, 2020 · 9 comments · Fixed by #5597
Closed

Allow persisting discovery bundles #2886

anderseknert opened this issue Nov 9, 2020 · 9 comments · Fixed by #5597
Assignees
Labels
distribution Issues related to the bundle plugin

Comments

@anderseknert
Copy link
Member

With systems configured with discovery, it would be great if the new persist option was available to persist both the discovery bundle itself, as well as any from discovery config included bundles, in case the remote service was unreachable when re-starting an OPA instance.

For the configured policy bundles, I suppose one could add persist: true in the config provided by the discovery bundle, but whether to persist bundles feels more like a decision to make locally (like log level) than something that should be centrally managed. Having persist: true in the bootstrap configuration would thus be desirable.

@tsandall
Copy link
Member

We should support persistence of discovery bundles because otherwise the persistence feature doesn't work when discovery is used (e.g., the OPA would start, attempt to download a discovery bundle, and then fail and remain inoperable.) The implementation should just persist the discovery bundle like any other one (i.e., there's no need to persist the configuration produced by the discovery bundle.)

@tsandall
Copy link
Member

@ashutosh-narkar could you take a look and see how much work this would be?

@anderseknert
Copy link
Member Author

The implementation should just persist the discovery bundle like any other one (i.e., there's no need to persist the configuration produced by the discovery bundle.)

Right, what I meant was that if the discovery bundle has configuration to download other bundles those should also be persisted if the discovery bundle bootstrap config has the persist: true attribute. Does that make sense?

@tsandall
Copy link
Member

I'd just have the discovered configuration specify the persist option on each of the configured bundles rather than trying to bake in some kind of inheritance.

@anderseknert
Copy link
Member Author

The discovered configuration is not necessarily even managed by the OPA admin, but rather the "bundle server admin". If I configure my OPA bootstrap config with persist: true it should be pretty clear that the intent is for the server to persist whatever it needs in order to be able to start with the remote system temporarily unavailable. If this is not an exclusively local decision we'd have no idea about whether what was persisted would actually help in that goal. On the other side of the this - if we don't care for this option, would like to disable it and run our OPAs on read-only file systems, the bundle server admin should still be able to configure our bundles to be written to disk?

Even when these two admins are the same person, having to administer this in two disparate systems sounds less than ideal.

(..additionally, our current bundle server of choice does not provide us with options to meddle with the configuration provided in discovery bundles, so unless that feature was added in that product too, this would not be available to us)

@tsandall
Copy link
Member

That sounds like a limitation in the bundle server of choice that ought to be addressed...

RE: the implementation, I'm advocating for the option with the least amount of magic/implicit behaviour. I don't know how common the separation of duty between "OPA admin" and "bundle server admin" is. It sounds especially odd when Discovery is enabled since that means that all the "OPA admin" is doing is enabling Discovery--the "bundle server admin" would be in complete control of the discovered configuration so the "OPA admin" is really not in control. My guess is that this stems from the limitation in the bundle service you mentioned...

@anderseknert
Copy link
Member Author

I can kinda get behind the no magic / implicit behavior from a developers point of view, but as an "OPA admin" I'm mainly interested in knowing that I can trust the config I provide will do what I intended, and if I say "persist my bundles" in hopes I can start OPA in a last known working state, it's hard to see the appeal of having that option scattered over many places - especially so given how saving something to local disk feels like a decision to make.. well, locally. The bundle server admin does not control the level of which logs should be written to console, and to me this feels like it's in the same category.

Is there even a use case for configuring say 2 out of 3 bundles with persist: true but leaving it off for the third? Unless there is, this just seems like an easy mistake to make - and one you won't probably won't notice until you really would have needed the "offline restore", and then it's of course gonna be too late. If some "magic" can help me avoid that, I'll take it ;)

Oh well, if that's not the direction this will take, I'll make sure to at least file a feature request to have this supported in our bundle server.

@tsandall
Copy link
Member

I can kinda get behind the no magic / implicit behavior from a developers point of view, but as an "OPA admin" I'm mainly interested in knowing that I can trust the config I provide will do what I intended, and if I say "persist my bundles" in hopes I can start OPA in a last known working state, it's hard to see the appeal of having that option scattered over many places - especially so given how saving something to local disk feels like a decision to make.. well, locally. The bundle server admin does not control the level of which logs should be written to console, and to me this feels like it's in the same category.

We could add a global "persist my bundles" option to the bootstrap config however the same could be said for any of the other config setting (e.g., verification keys). I'd like to avoid the problem of merging config/desired state from multiple sources (in this case the bootstrap config and the discovered config) because that always causes headaches. Putting as little information as possible in the bootstrap config helps ensure that a central service can manage as much of the OPA instance as possible.

As far as logging and other server settings go...there is no good reason for them being outside of the rest of the config.

@anderseknert
Copy link
Member Author

Thanks Torin! This isn't the hill I'm planning to die on ( 😄 ), so I'll have a chat with our dear bundle server provider to have this feature taken into account from their end, and I'm looking forward to seeing the discovery bundle included in the persist options on the OPA side 👍

@tsandall tsandall added distribution Issues related to the bundle plugin and removed enhancement labels Dec 2, 2021
@ashutosh-narkar ashutosh-narkar self-assigned this Jan 11, 2023
ashutosh-narkar added a commit to ashutosh-narkar/opa that referenced this issue Jan 26, 2023
ashutosh-narkar added a commit to ashutosh-narkar/opa that referenced this issue Jan 26, 2023
ashutosh-narkar added a commit to ashutosh-narkar/opa that referenced this issue Feb 3, 2023
ashutosh-narkar added a commit to ashutosh-narkar/opa that referenced this issue Feb 3, 2023
…disk

This commit adds support to persist and load discovery bundle from disk.
Only the discovery bundle itself is persisted and not the configuration produced
by the discovery bundle. A new field is introduced in OPA's discovery
configuration that can be optionally set to enable OPA to write and
read the discovery bundle from disk. This feature would enable OPA to evaluate
the discovery bundle in scenarios where it is unable to communicate with the
bundle server on start-up.

Fixes open-policy-agent#2886

Signed-off-by: Ashutosh Narkar <[email protected]>
ashutosh-narkar added a commit to ashutosh-narkar/opa that referenced this issue Feb 6, 2023
…disk

This commit adds support to persist and load discovery bundle from disk.
Only the discovery bundle itself is persisted and not the configuration produced
by the discovery bundle. A new field is introduced in OPA's discovery
configuration that can be optionally set to enable OPA to write and
read the discovery bundle from disk. This feature would enable OPA to evaluate
the discovery bundle in scenarios where it is unable to communicate with the
bundle server on start-up.

Fixes open-policy-agent#2886

Signed-off-by: Ashutosh Narkar <[email protected]>
ashutosh-narkar added a commit that referenced this issue Feb 6, 2023
…disk

This commit adds support to persist and load discovery bundle from disk.
Only the discovery bundle itself is persisted and not the configuration produced
by the discovery bundle. A new field is introduced in OPA's discovery
configuration that can be optionally set to enable OPA to write and
read the discovery bundle from disk. This feature would enable OPA to evaluate
the discovery bundle in scenarios where it is unable to communicate with the
bundle server on start-up.

Fixes #2886

Signed-off-by: Ashutosh Narkar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distribution Issues related to the bundle plugin
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants