feat: Embed NetworkPolicy to extensions #105
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #32
This PR introduces an opinionated security for sandboxes by integrating the automated creation of K8s
NetworkPolicyresources. The change is introduced in theextensionsfolder.This is achieved by extending the
SandboxTemplateAPI and implementing the corresponding lifecycle management logic within thesandboxclaim-controller. These changes ensure that all sandboxes are secure by default with a "deny-all" network posture.Key Changes
NetworkPolicy Integration:
The
SandboxTemplateCRD has been extended with aspec.networkPolicysection, allowing administrators to define a secure "blueprint" for sandbox networking.The
sandboxclaim-controllernow reconciles these settings, creating a unique, "default-deny" NetworkPolicy for each SandboxClaim.This implementation directly fulfills key security requirements:
Restricts pod-to-pod communication: Each sandbox gets an individual policy, ensuring it is isolated from other sandboxes.
Controls ingress: The policy only allows traffic from trusted sources defined in the template (e.g., an L7XLB).
Restricts egress: All outgoing traffic is blocked by default, except for essential DNS lookups.
Blocks API server access: This is a direct result of the default-deny egress posture.
Controller RBAC Updates:
sandboxclaim-controllerhas been updated to include the necessary permissions to manage networkpolicies across the cluster.Unit Tests: