generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 437
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
conformance: Gateway Infrastructure Metadata #2845
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
Copyright 2024 The Kubernetes Authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package tests | ||
|
||
import ( | ||
"testing" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
|
||
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" | ||
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes" | ||
"sigs.k8s.io/gateway-api/conformance/utils/suite" | ||
"sigs.k8s.io/gateway-api/pkg/features" | ||
) | ||
|
||
func init() { | ||
ConformanceTests = append(ConformanceTests, GatewayInfraMetadata) | ||
} | ||
|
||
var GatewayInfraMetadata = suite.ConformanceTest{ | ||
ShortName: "GatewayInfraMetadata", | ||
Description: "A Gateway should accept infrastructure metadata", | ||
Features: []features.SupportedFeature{ | ||
features.SupportGateway, | ||
features.SupportGatewayInfrastructureMetadata, | ||
}, | ||
Manifests: []string{ | ||
"tests/gateway-infrastructure-metadata.yaml", | ||
}, | ||
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { | ||
gwNN := types.NamespacedName{ | ||
Name: "gateway-infra-metadata", | ||
Namespace: "gateway-conformance-infra", | ||
} | ||
|
||
conditions := []metav1.Condition{ | ||
{ | ||
Type: string(gatewayv1.GatewayConditionAccepted), | ||
Status: metav1.ConditionTrue, | ||
Reason: "", // any reason | ||
}, | ||
{ | ||
Type: string(gatewayv1.GatewayConditionProgrammed), | ||
Status: metav1.ConditionTrue, | ||
Reason: "", // any reason | ||
}, | ||
} | ||
|
||
kubernetes.GatewayMustHaveLatestConditions(t, suite.Client, suite.TimeoutConfig, gwNN) | ||
for _, condition := range conditions { | ||
kubernetes.GatewayMustHaveCondition(t, suite.Client, suite.TimeoutConfig, gwNN, condition) | ||
} | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: Gateway | ||
metadata: | ||
name: gateway-infra-metadata | ||
namespace: gateway-conformance-infra | ||
spec: | ||
gatewayClassName: "{GATEWAY_CLASS_NAME}" | ||
infrastructure: | ||
labels: | ||
label-key: label-value | ||
annotations: | ||
annotation-key: annotation-value | ||
listeners: | ||
- name: http | ||
port: 8080 | ||
protocol: HTTP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo I dont know this test is very useful, we ideally need a way to retrieve the metatdata from the data plane but since its unique, we are add a conformance test for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's implementation specific.
The test really just asserts that we're able to set this property on the
infrastructure
stanza and it's accepted by the implementation - nothing else.Also I think it's important to have a
Feature
enum so end users know they can use this feature and it's surfaced on the GatewayClassThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the real use case is to surface the feature in the
GatewayClass
:) ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's part of it.
Like as an end-user I want to know if a class supports this feature. Likewise if an implementation advertises that then I expect I can set these attributes and the gateway is accepted and programmed. (which this test is doing)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this one, it's not necessarily wrong, just also not clear that it provides much value. Just being able to set a value doesn't really mean it's not supported, it may just mean the Gateway implementation hasn't gone out of it's way to block this from being set. I know we don't really have strong guidelines for what does or doesn't fit as a conformance test, but this feels like it's on the edge, and I'd lean to say that it doesn't really provide sufficient value.
It seems conceptually similar to confirming that an implementation supports setting TLS options to some arbitrary value, I'm not sure how useful a test like this is without also confirming the desired result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with dropping this conformance tests - I guess I'm trying to answer the question
Is the conformance report a good place for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe PR'ing the feature string makes sense and then we enable report generation to include additional features that don't have tests?