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

admission-control: validate that Ingress and RouteGroup hosts in hosted zone domain #8436

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

AlexanderYastrebov
Copy link
Member

Add ValidatingAdmissionPolicy that validates Ingress and RouteGroup hosts from hosted zone parent domain are in hosted zone domain.

E.g. for hosted zone foo.bar.test its parent domain is bar.test and therefore Ingress and RouteGroup hosts from bar.test domain must also be in foo.bar.test domain.

@AlexanderYastrebov AlexanderYastrebov added the major Major feature changes or updates, e.g. feature rollout to a new country, new API calls. label Oct 23, 2024
@AlexanderYastrebov AlexanderYastrebov force-pushed the admission/validate-ingress-routegroup-hosts branch from 8cb970f to 91154d2 Compare October 23, 2024 13:00
@@ -0,0 +1,56 @@
# {{ if or (eq .Cluster.ConfigItems.ingresses_validation "enabled") (eq .Cluster.ConfigItems.routegroups_validation "enabled") }}
# {{ $hosted_zone_parent_domain := slice (split .Values.hosted_zone ".") 1 | join "." }}
Copy link
Member Author

@AlexanderYastrebov AlexanderYastrebov Oct 23, 2024

Choose a reason for hiding this comment

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

This assumes .Values.hosted_zone is a three-level domain like foo.bar.test

@AlexanderYastrebov AlexanderYastrebov force-pushed the admission/validate-ingress-routegroup-hosts branch 11 times, most recently from eb927a5 to 3ae69ac Compare October 24, 2024 11:56
…ed zone domain

Add ValidatingAdmissionPolicies that validates Ingress and RouteGroup hosts
from hosted zone parent domain are in hosted zone domain.

E.g. for hosted zone `foo.bar.test` its parent domain is `bar.test`
and therefore Ingress and RouteGroup hosts from `bar.test` domain
must also be in `foo.bar.test` domain.

Signed-off-by: Alexander Yastrebov <[email protected]>
@AlexanderYastrebov AlexanderYastrebov force-pushed the admission/validate-ingress-routegroup-hosts branch from 3ae69ac to 2348432 Compare October 25, 2024 10:30
@AlexanderYastrebov AlexanderYastrebov marked this pull request as ready for review October 25, 2024 10:30
@@ -0,0 +1,93 @@
# {{ $hosted_zone_parent_domain := slice (split .Values.hosted_zone ".") 1 | join "." }}

# {{ if eq .Cluster.ConfigItems.ingresses_validation "enabled" }}
Copy link
Member Author

@AlexanderYastrebov AlexanderYastrebov Oct 25, 2024

Choose a reason for hiding this comment

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

Do we need another new config to toggle theses policies off?

@mikkeloscar
Copy link
Contributor

Maybe this stuff deserves an e2e test?

@AlexanderYastrebov
Copy link
Member Author

E.g. for hosted zone foo.bar.test its parent domain is bar.test and therefore Ingress and RouteGroup hosts from bar.test domain must also be in foo.bar.test domain.

There could be multiple hosted zones (e.g. foo.bar.test and qux.bar.test) in the same cluster using the same parent domain (bar.test) so this validation logic will not accept *.qux.bar.test because it only accepts *.foo.bar.test

@AlexanderYastrebov AlexanderYastrebov marked this pull request as draft October 25, 2024 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge major Major feature changes or updates, e.g. feature rollout to a new country, new API calls.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants