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

Implement NKG-specific field validation for HTTPRoutes #455

Merged
merged 30 commits into from
Mar 16, 2023

Conversation

pleshakov
Copy link
Contributor

Proposed changes

  • Introduce HTTPFieldsValidator interface for validating fields of HTTP-related Gateway API resources according to the data-plane specific rules.
  • Validate HTTPRoute resources when building the graph using data-plane agnostic rules.
  • Validate HTTPRoute resources when building the graph using HTTPFieldsValidator according to the data-plane rules.
  • Implement an HTTPFieldsValidator for NGINX-specific validation rules.

Fixes #412

Note: the validation uses https://pkg.go.dev/k8s.io/apimachinery/pkg/util/validation/field to generate validation errors. This package generates descriptive messages that can pinpoint specific problematic field. Additionally, such messages would be consistent with the the webhook or Kubernetes API server errors. It will make sense to update #407 after this PR is merged to also use that package.

- Introduce HTTPFieldsValidator interface for validating fields of
HTTP-related Gateway API resources according to the data-plane specific
rules.
- Validate HTTPRoute resources when building the graph using data-plane
agnostic rules.
- Validate HTTPRoute resources when building the graph using
HTTPFieldsValidator according to the data-plane rules.
- Implement an HTTPFieldsValidator for NGINX-specific validation rules.

Fixes #412
@pleshakov pleshakov requested a review from a team as a code owner March 7, 2023 16:21
@github-actions github-actions bot added the enhancement New feature or request label Mar 7, 2023
@pleshakov pleshakov requested a review from kate-osborn March 7, 2023 16:27
internal/nginx/config/servers_template.go Show resolved Hide resolved
internal/nginx/config/validation/common.go Outdated Show resolved Hide resolved
internal/nginx/config/validation/common.go Outdated Show resolved Hide resolved
internal/nginx/config/validation/common.go Outdated Show resolved Hide resolved
internal/nginx/config/validation/common.go Show resolved Hide resolved
internal/state/graph/httproute_test.go Show resolved Hide resolved
internal/state/graph/backend_refs_test.go Outdated Show resolved Hide resolved
@pleshakov pleshakov mentioned this pull request Mar 14, 2023
@pleshakov pleshakov force-pushed the feature/httproute-validation branch from fe026d7 to 3b5a532 Compare March 14, 2023 22:24
@pleshakov pleshakov requested a review from kate-osborn March 14, 2023 22:55
Copy link
Contributor

@kate-osborn kate-osborn left a comment

Choose a reason for hiding this comment

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

👍

@pleshakov pleshakov merged commit 52fab05 into main Mar 16, 2023
@pleshakov pleshakov deleted the feature/httproute-validation branch March 16, 2023 16:46
pleshakov added a commit that referenced this pull request Mar 23, 2023
The PR #455
brought NKG-specific validation for HTTPRoutes. The implementation uses
https://pkg.go.dev/k8s.io/apimachinery/pkg/util/validation/field 
to generate validation errors.

This commit makes generated Gateway-related errors consistent with
HTTPRoute-related errors by starting using that package above.

Fixes #473
pleshakov added a commit that referenced this pull request Mar 23, 2023
The PR #455
brought NKG-specific validation for HTTPRoutes. The implementation uses
https://pkg.go.dev/k8s.io/apimachinery/pkg/util/validation/field 
to generate validation errors.

This commit makes generated Gateway-related errors consistent with
HTTPRoute-related errors by starting using that package above.

Fixes #473
@pleshakov pleshakov changed the title Add NKG-specific field validation for HTTPRoutes Implement NKG-specific field validation for HTTPRoutes Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Implement NKG-specific field validation for HTTPRoute resource
2 participants