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

Conformance profiles prototype #1967

Merged
merged 10 commits into from
May 18, 2023

Conversation

mlavacca
Copy link
Member

@mlavacca mlavacca commented Apr 24, 2023

What type of PR is this?

/kind feature
/area conformance

What this PR does / why we need it:

This PR introduces the conformance profile machinery to verify compliance with given conformance profiles. It should be considered an implementation of https://github.com/kubernetes-sigs/gateway-api/blob/main/geps/gep-1709.md. The conformance profile test suite has been integrated and tested with Kong Kubernetes Ingress Controller, and below it is possible to see the outcome of such a test:

{
  "implementation": {
    "organization": "Kong",
    "project": "Kubernetes Ingress Controller",
    "url": "https://github.com/Kong/kubernetes-ingress-controller",
    "version": "2.9.3",
    "contact": [
      "@mlavacca"
    ]
  },
  "date": "2023-04-24T13:24:05+02:00",
  "gatewayAPIVersion": "TODO",
  "profiles": [
    {
      "name": "HTTP",
      "core": {
        "result": "partial",
        "summary": "",
        "statistics": {
          "Passed": 26,
          "Skipped": 3,
          "Failed": 0
        },
        "skippedTests": [
          "GatewayModifyListeners",
          "HTTPRouteHeaderMatching",
          "GatewayWithAttachedRoutes"
        ]
      },
      "extended": {
        "status": {
          "result": "success",
          "summary": "",
          "statistics": {
            "Passed": 1,
            "Skipped": 0,
            "Failed": 0
          }
        },
        "supportedFeatures": [
          "HTTPRouteMethodMatching"
        ],
        "unsupportedFeatures": [
          "HTTPRouteSchemeRedirect",
          "HTTPRoutePathRedirect",
          "HTTPRouteHostRewrite",
          "HTTPRoutePathRewrite",
          "HTTPRouteQueryParamMatching",
          "HTTPResponseHeaderModification",
          "HTTPRoutePortRedirect"
        ]
      }
    },
    {
      "name": "TLS",
      "core": {
        "result": "partial",
        "summary": "",
        "statistics": {
          "Passed": 7,
          "Skipped": 3,
          "Failed": 0
        },
        "skippedTests": [
          "GatewayModifyListeners",
          "GatewayWithAttachedRoutes",
          "TLSRouteSimpleSameNamespace"
        ]
      }
    }
  ]
}

The result above has been produced by using the following settings:

cSuite, err := suite.NewExperimentalConformanceTestSuite(suite.ExperimentalConformanceOptions{
  Options: suite.Options{
	  Client:               client,
	  GatewayClassName:     gatewayClass.Name,
	  Debug:                showDebug,
	  CleanupBaseResources: shouldCleanup,
	  BaseManifests:        conformanceTestsBaseManifests,
	  SupportedFeatures: sets.New(
		  // core
		  suite.SupportGateway,
		  suite.SupportReferenceGrant,
		  suite.SupportHTTPRoute,
		  suite.SupportTLSRoute,
  
		  // extended
		  suite.SupportHTTPRouteMethodMatching,
		  suite.SupportRouteDestinationPortMatching,
	  ),
	  SkipTests: []string{
		  // standard conformance
		  tests.HTTPRouteHeaderMatching.ShortName,
		  tests.GatewayWithAttachedRoutes.ShortName,
		  tests.GatewayModifyListeners.ShortName,
  
		  // TLSRoute
		  // https://github.com/Kong/kubernetes-ingress-controller/issues/3678
		  tests.TLSRouteSimpleSameNamespace.ShortName,
	  },
  },
  ConformanceProfiles: sets.New(
	  suite.HTTPConformanceProfileName,
	  suite.TLSConformanceProfileName,
  ),
  Implementation: confv1alpha1.Implementation{
	  Organization: "Kong",
	  Project:      "Kubernetes Ingress Controller",
	  URL:          "https://github.com/Kong/kubernetes-ingress-controller",
	  Version:      "2.9.3",
	  Contact:      []string{"@mlavacca"},
  },
})
assert.NoError(t, err)

cSuite.Setup(t)
cSuite.Run(t, tests.ConformanceTests)
report, err := cSuite.Report()
assert.NoError(t, err)

Which issue(s) this PR fixes:

Fixes #1784

Does this PR introduce a user-facing change?:

Addition of the conformance profiles. This feature enables an implementation to check compliance against a set of predetermined supported features and to produce a standard result (in the form of the `ConformanceProfile` API).

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. area/conformance cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 24, 2023
@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Apr 24, 2023
@mlavacca mlavacca marked this pull request as ready for review April 24, 2023 11:29
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 24, 2023
@shaneutt shaneutt added this to the v0.7.1 milestone Apr 24, 2023
@shaneutt shaneutt added the tide/merge-method-rebase Denotes a PR that should be rebased by tide when it merges. label Apr 24, 2023
@arkodg
Copy link
Contributor

arkodg commented Apr 24, 2023

looks good @mlavacca, added some minor comments

@shaneutt shaneutt added the priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. label Apr 25, 2023
@shaneutt shaneutt requested a review from Xunzhuo April 26, 2023 18:22
Copy link
Member

@sunjayBhatia sunjayBhatia left a comment

Choose a reason for hiding this comment

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

interesting data point (run with all supported features enabled and a few skipped tests):

{
  "implementation": {
    "organization": "projectcontour",
    "project": "contour",
    "url": "https://github.com/projectcontour/contour",
    "version": "foo",
    "contact": [
      "@bar"
    ]
  },
  "date": "2023-05-01T21:55:53Z",
  "gatewayAPIVersion": "TODO",
  "profiles": [
    {
      "name": "HTTP",
      "core": {
        "result": "failure",
        "summary": "",
        "statistics": {
          "Passed": 27,
          "Skipped": 1,
          "Failed": 1
        },
        "skippedTests": [
          "HTTPRouteRedirectHostAndStatus"
        ],
        "failedTests": [
          "GatewayObservedGenerationBump"
        ]
      },
      "extended": {
        "status": {
          "result": "partial",
          "summary": "",
          "statistics": {
            "Passed": 6,
            "Skipped": 2,
            "Failed": 0
          },
          "skippedTests": [
            "HTTPRouteRedirectScheme",
            "HTTPRouteRedirectPath"
          ]
        }
      }
    },
    {
      "name": "TLS",
      "core": {
        "result": "failure",
        "summary": "",
        "statistics": {
          "Passed": 9,
          "Skipped": 0,
          "Failed": 1
        },
        "failedTests": [
          "GatewayObservedGenerationBump"
...

looks like GatewayObservedGenerationBump (or any other common test between multiple profiles) shows up in two separate profiles, which I guess makes sense but could be a bit confusing when we go over the summary stats

Copy link
Member

@Xunzhuo Xunzhuo left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for working on it @mlavacca !

@mlavacca
Copy link
Member Author

mlavacca commented May 2, 2023

looks like GatewayObservedGenerationBump (or any other common test between multiple profiles) shows up in two separate profiles, which I guess makes sense but could be a bit confusing when we go over the summary stats

Yes, all the failing tests for a specific profile are enumerated in their own failingTests section. When multiple profiles share the same failing tests, we have the result you posted above. Where would you put such a piece of shared information to improve the interface readability?

@youngnick
Copy link
Contributor

This LGTM, so I'll approve and hold, and wait for further maintainer review.

/approve
/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 3, 2023
@mlavacca
Copy link
Member Author

@robscott Can you please take another look? All your comments should be addressed.

Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks @mlavacca! Sorry for the delay on getting back to this one. This LGTM, have one tiny non-blocking nit but that can be handled in a follow up.

/lgtm
/approve
/hold cancel

conformance/utils/suite/experimental_suite.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 18, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 18, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: keithmattix, mlavacca, robscott, sunjayBhatia, Xunzhuo, youngnick

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 18, 2023
shaneutt and others added 9 commits May 18, 2023 11:32
This adds a prototype for conformance profiles, which
are subscribable named profiles which indicate high
level testing conformance features.
This adds a prototype for tooling which can be used to
produce a ConformanceReport as defined in GEP-1709.
This introduces a prototype of the test suite which
is conformance profiles and conformance reporting
enabled.
This applies the needed changes to the commits above to make the code
actually usable by any implementation. The changes have been tested with
Kong Kubernetes Ingress Controller.

Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
The HTTPExtendedFeatures from conformance/utils/features.go has been
reused in the conformance profile.

Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
conformanceProfile file renamed to profileReport.

Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
@mlavacca mlavacca force-pushed the conformance-profiles-proto branch from 76dcc19 to 66298af Compare May 18, 2023 09:33
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 18, 2023
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 18, 2023
@mlavacca
Copy link
Member Author

mlavacca commented May 18, 2023

@robscott there were conflicts, and the rebase removed the LGTM label. Can you please lgtm it again?

Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/conformance cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tide/merge-method-rebase Denotes a PR that should be rebased by tide when it merges.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Initial conformance profiles and reporting prototype
9 participants