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

Generate a canonical coordinator resource #141

Merged
merged 2 commits into from
Feb 14, 2024
Merged

Conversation

burgerdev
Copy link
Contributor

@burgerdev burgerdev commented Feb 9, 2024

This PR provides a nix rule that generates a coordinator k8s resource that is portable across namespaces.

Rationale see individual commit messages.

@burgerdev burgerdev force-pushed the burgerdev/namespace-policy branch from e86056a to 475ea74 Compare February 9, 2024 13:24
@burgerdev burgerdev changed the title genpolicy-msft: relax namespace check in dev WIP: release with coordinator manifest and policy Feb 9, 2024
@burgerdev burgerdev force-pushed the burgerdev/namespace-policy branch 2 times, most recently from 09940b7 to c865109 Compare February 12, 2024 12:48
@burgerdev burgerdev force-pushed the burgerdev/namespace-policy branch from c865109 to 08b1273 Compare February 12, 2024 14:26
@burgerdev burgerdev marked this pull request as ready for review February 12, 2024 14:29
@burgerdev burgerdev changed the title WIP: release with coordinator manifest and policy Generate a canonical coordinator resource Feb 12, 2024
We would like to have a coordinator policy that is portable across
namespaces. This is not possible with the upstream rules.rego, because
the namespace annotation on the OCI spec is checked against the original
namespace in the resource definition, or a default.

It turns out that this check is not necessary for our coordinator,
though:

1. The namespace check guarantees a specific pattern of the log path. As
   there's only one container in the VM, we don't care about potential
   conflicts and only need to ensure that we're not writing into a
   totally unrelated directory.
2. The namespace check guarantees that the Kubernetes downward API is
   resolved correctly. We're not using that, so we don't need the check.

A minimally invasive change that still addresses (1) is to relax the
check so that it only guarantees namespace validity [1].

[1]: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/#namespaces-and-dns
In order to embed a coordinator policy hash on release, we first need to
establish what the default coordinator policy should be.

This commit adds a nix rule that generates the canonical coordinator k8s
resources, which can then be used to obtain a policy hash for inclusion
in the CLI. Since the generated resources are then guaranteed to be
compatible with the released CLI, we can include the resource
definitions in the release and encourage users to take the coordinator
from there.
@burgerdev burgerdev force-pushed the burgerdev/namespace-policy branch from 08b1273 to 5804032 Compare February 12, 2024 14:36
@katexochen katexochen requested a review from malt3 February 12, 2024 15:05
Copy link
Contributor

@malt3 malt3 left a comment

Choose a reason for hiding this comment

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

Sorry for the slow response. LGTM, too.

@burgerdev burgerdev merged commit 57a0eef into main Feb 14, 2024
5 checks passed
@burgerdev burgerdev deleted the burgerdev/namespace-policy branch February 14, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants