generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 215
feat(conformance): add version for conformance test report. #1133
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b47502d
feat(conformance): add version for conformance test report.
zetxqx eb26562
add conformance.go update.
zetxqx dd708d8
remove redundancy.
zetxqx 877ad89
update release.md
zetxqx f8abcd5
fix typos.
zetxqx e4dc446
fix typos.
zetxqx f43af26
rename to version.go.
zetxqx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,57 @@ | ||
| /* | ||
| Copyright 2025 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 conformance contains the core setup and execution logic | ||
| // for the Gateway API Inference Extension conformance test suite. | ||
| package conformance | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "os" | ||
|
|
||
| confapis "sigs.k8s.io/gateway-api/conformance/apis/v1" | ||
| "sigs.k8s.io/yaml" | ||
| ) | ||
|
|
||
| // GatewayAPIInferenceExtentionConformanceReport | ||
| // GatewayAPIInferenceExtentionConformanceReport is a report of conformance testing results of | ||
| // gateway-api-inference-extention including the specific conformance profiles that were tested | ||
| // and the results of the tests with summaries and statistics. | ||
| type GatewayAPIInferenceExtentionConformanceReport struct { | ||
| // GatewayAPIInferenceExtensionVersion is the version of the gateway-api-inference-extention the tests run against. | ||
| GatewayAPIInferenceExtensionVersion string | ||
| // ConformanceReport is the fields reused from the gateway-api conformance reports. | ||
| confapis.ConformanceReport | ||
| } | ||
|
|
||
| // WriteReport writes the generated conformance report to the specified output file or logs it. | ||
| func (report *GatewayAPIInferenceExtentionConformanceReport) WriteReport(logf func(string, ...any), output string) error { | ||
| rawReport, err := yaml.Marshal(*report) | ||
| if err != nil { | ||
| return fmt.Errorf("error marshaling report: %w", err) | ||
| } | ||
|
|
||
| if output != "" { | ||
| if err = os.WriteFile(output, rawReport, 0o600); err != nil { | ||
| return fmt.Errorf("error writing report file %s: %w", output, err) | ||
| } | ||
| logf("Conformance report written to %s", output) | ||
| } else { | ||
| // Log the report YAML to stdout if no output file is specified. | ||
| logf("Conformance report:\n%s", string(rawReport)) | ||
| } | ||
| return nil | ||
| } |
This file contains hidden or 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
This file contains hidden or 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,22 @@ | ||
| /* | ||
| Copyright 2025 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 consts | ||
|
|
||
| const ( | ||
| // BundleVersion is the value used for labeling the version of the gateway-api-inference-extension. | ||
| BundleVersion = "v0.5.0" | ||
zetxqx marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ) | ||
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
shared offline with @zetxqx my concern about the name selection consts and it's location under pkg which may become a place where everybody put their non related consts, like a centralized place for putting all constants of the repo which I'm generally against.
we agreed to create a
version/version.goat the root level to specify versioning related consts (packageversion).for example like this project:
https://github.com/kubernetes/kops/blob/master/kops-version.go
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.
not related to this PR, but using
version.gowill also allow us to define in this fileCommitSHAandBuildRefvars which are currently located under/epp/pkg/metrics/metrics.go(I don't see how is it related tometrics.go).gateway-api-inference-extension/pkg/epp/metrics/metrics.go
Lines 39 to 45 in 48966b8
I will push it in a follow up PR. (cc @kfswain)
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.
Good point! thanks @nirrozenbaum , renamed to version/version.go. Could you take another look?
cc: @robscott
Uh oh!
There was an error while loading. Please reload this page.
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.
@JeffLuoo wrote this, I believe, to emit the commitSHA to help give context to any logs emitted (so when debugging, you can look at the specific SHA & know what the codebase looked like at that point in time). I think same with the pull base. I believe that is the fork the build is based on. Jeff to confirm however.
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 placed the var in
metrics.gofor adding the metadata metric related to the IG https://github.com/kubernetes-sigs/gateway-api-inference-extension/blob/main/cmd/epp/runner/runner.go#L245. The metric tells you the build hash and version (usually tag) of the image.Those two variables are passed in from the Dockerfile in
go buildhere: https://github.com/kubernetes-sigs/gateway-api-inference-extension/blob/main/Dockerfile#L25 where the variables are passed in from:gateway-api-inference-extension/cloudbuild.yaml
Lines 12 to 15 in c46a7e7
PULL_BASE_SHAis a keyword that cloudbuild job will use to set the environment variable, check https://docs.prow.k8s.io/docs/jobs/ for environment variables. I usedPULL_BASE_REFandPULL_BASE_SHA.When you add the change, can you make sure the metric will still have the hash and build tag?
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.
@JeffLuoo sure!
thanks for the detailed response 👍