|
| 1 | +# GEP-917: Gateway API conformance principles |
| 2 | + |
| 3 | +* Issue: [#917](https://github.com/kubernetes-sigs/gateway-api/issues/917) |
| 4 | +* Status: Provisional |
| 5 | + |
| 6 | +## TLDR |
| 7 | + |
| 8 | +This GEP outlines the reasons for and principles by which the Gateway API will |
| 9 | +design its conformance and testing regime. |
| 10 | + |
| 11 | +## Goals |
| 12 | + |
| 13 | +- Record why we are doing conformance and what we hope to achieve with it |
| 14 | +- Record the success criteria for the conformance process and associated artifacts |
| 15 | + |
| 16 | +## Non-Goals |
| 17 | + |
| 18 | +- Designing the conformance process at anything more than a very basic level |
| 19 | +- Designing the conformance testing framework or implementation |
| 20 | +- Designing the process for implementations to prove they are conformant |
| 21 | + |
| 22 | +## Introduction |
| 23 | + |
| 24 | +### What is Conformance |
| 25 | + |
| 26 | +Conformance is the creation of a process that allows everyone, implementors and |
| 27 | +users alike, to check that an implementation conforms to the defined spec. |
| 28 | + |
| 29 | +For core Kubernetes, this also allows for the use of specific badges and branding. |
| 30 | + |
| 31 | +It usually includes some form of test harness that can produce a standard output, |
| 32 | +which can be submitted somewhere for validation. The place where the validations |
| 33 | +are held is then the canonical source of information about what implementations |
| 34 | +are conformant. |
| 35 | + |
| 36 | +### Why do it for Gateway API? |
| 37 | +The Gateway API is a large, complex API with many use cases and implementations. |
| 38 | +Not all implementations support the same features, and some features have |
| 39 | +different required support levels. |
| 40 | + |
| 41 | +One of the primary goals of the Gateway API project is to make it safer and |
| 42 | +easier for end users to move their traffic configuration between implementations. |
| 43 | +Without some form of conformance to guarantee the same behavior between |
| 44 | +implementations, this is simply not achievable. |
| 45 | + |
| 46 | +Possibly a better way to say this is that we are looking to have Route resources |
| 47 | +portable between Gateways with a minimum of spec change. |
| 48 | + |
| 49 | +By creating a standard set of conformance tests and information, we can: |
| 50 | + |
| 51 | +- Make it easier for API consumers to understand what a particular API does |
| 52 | +- Make it possible for tooling to be constructed to check for portability |
| 53 | +between implementations |
| 54 | + |
| 55 | +Additionally, as the first project to develop an "official" set of CRDs, we have |
| 56 | +a responsibility to the community to build out a set of best practices for |
| 57 | +similar efforts in the future. Ensuring that whatever we build is reusable for |
| 58 | +other projects will help to lift everyone who works with CRDs. |
| 59 | + |
| 60 | +### What do we need out of conformance for Gateway API? |
| 61 | +Must have: |
| 62 | + |
| 63 | +- Support for only implementing some of the Gateway API CRD resources. Some resources, |
| 64 | +like Gateway itself, are required for all implementations, but implementations |
| 65 | +may choose what Route resources they support. There will probably be some common |
| 66 | +sets of Route resources supported across similar implementations, but this proposal |
| 67 | +expects that we will make calls about what to call that common experience at a |
| 68 | +later date. |
| 69 | +- Support for fields or features that have Core, Extended, and |
| 70 | +ImplementationSpecific support. In particular, it must be possible for |
| 71 | +implementations to only support some subset of Extended fields, and to be able |
| 72 | +to use the framework for their own ImplementationSpecific features if required. |
| 73 | +- A testing suite that can validate that an implementation meets the conformance |
| 74 | +profiles it claims. |
| 75 | +- A way to retrieve conformance information in a machine-parseable way. |
| 76 | + |
| 77 | +## Proposal |
| 78 | + |
| 79 | +### Conformance profiles principles |
| 80 | + |
| 81 | +#### Basics |
| 82 | + |
| 83 | +The Gateway API project defines conformance purely in terms of what resources an |
| 84 | +implementation supports. |
| 85 | +To support a resource, an implementation must support all "Core" functionality |
| 86 | +defined by the resource. Support for "Extended" functionality will be indicated |
| 87 | +separately. |
| 88 | + |
| 89 | +All implementations must support all the Core functions on the following resources: |
| 90 | + |
| 91 | +- GatewayClass |
| 92 | +- Gateway |
| 93 | +- ReferencePolicy |
| 94 | + |
| 95 | +The following resources are optional to support, but have defined behavior if you |
| 96 | +do: |
| 97 | + |
| 98 | +- HTTPRoute |
| 99 | +- TLSRoute |
| 100 | +- TCPRoute |
| 101 | +- UDPRoute |
| 102 | + |
| 103 | +For all of these resources, we should aim to have the usual range of tests for |
| 104 | +both the happy and unhappy paths for various types of operations. |
| 105 | + |
| 106 | +The conformance is versioned - it tracks the required features for a specific |
| 107 | +version of the API, and must be included in and updated by a version bump in the |
| 108 | +bundle version of the Gateway API. (The _bundle version_ is the thing that we |
| 109 | +mark as a "release", that looks like `v0.4.0`, not `v1alpha2`). |
| 110 | + |
| 111 | +This will enable an implementation to say that it supports a specific version |
| 112 | +of the Gateway API. This is again similar to upstream in that implementations need |
| 113 | +to submit conformance test results for each version of Kubernetes they support. |
| 114 | + |
| 115 | +Because the support is defined in terms of the resources that an implementation |
| 116 | +supports, the conformance is composable, and orthogonal for each object type. |
| 117 | +For example, it's valid to only support HTTPRoute and not TCPRoute, or TLSRoute |
| 118 | +and not HTTPRoute. |
| 119 | + |
| 120 | +#### Interaction with existing support levels |
| 121 | + |
| 122 | +Conformance definitions will ensure that an implementation can provide all the |
| 123 | +features currently marked as "Core" support in the API documentation. |
| 124 | + |
| 125 | +Fields marked "Extended" support will eventually have conformance tests that |
| 126 | +lock in the behavior of that feature, and there will be a mechanism for implementations |
| 127 | +to tell the testing framework what extended fields they support. |
| 128 | + |
| 129 | +#### Testing framework |
| 130 | + |
| 131 | +The Gateway API project will provide a set of tests and harness to run them, such |
| 132 | +that an implementation may point the test harness at a GatewayClass or individual |
| 133 | +Gateway managed by that implementation and have the testing framework deliver a |
| 134 | +report on if it meets the conformance standard. The report must be |
| 135 | +machine-parsable. |
| 136 | + |
| 137 | +There is a _lot_ of work to prepare this framework and introduce the initial |
| 138 | +round of tests, let alone to have complete test coverage. Having a minimal set |
| 139 | +of tests is a requirment for the API to graduate to `v1beta1` API stability level. |
| 140 | +(As per our upstream KEP). It's acceptable to begin with a small set and expand |
| 141 | +outward while the project is in beta, but having a full set of conformance tests |
| 142 | +that cover most of the API scope should be a requirement for declaring the API |
| 143 | +stable. |
| 144 | + |
| 145 | +#### Certification process |
| 146 | + |
| 147 | +The Gateway API project will provide a process by which an implementation may |
| 148 | +submit the results of a run of the conformance test suite to a centralized, |
| 149 | +open repository, and once verified, these results will be used to maintain a |
| 150 | +canonical list of certified conformant implementations. |
| 151 | + |
| 152 | +Ideally, this process should be handled using similar methods to upstream |
| 153 | +Kubernetes, while also learning what we can from what the upstream conformance |
| 154 | +efforts wish they could improve. |
| 155 | + |
| 156 | + |
| 157 | +## Alternatives |
| 158 | + |
| 159 | +There's no real alternative to having some form of conformance testing. |
| 160 | + |
| 161 | + |
| 162 | +## References |
| 163 | + |
| 164 | +[Gateway API Conformance Ideas](https://docs.google.com/document/d/18iECeKMp1OewSGISskv6Chfmjo9u2U0_iUH0jhPdKOk/edit#) |
| 165 | +[Gateway API Conformance Requirements](https://docs.google.com/document/d/1QL-MpIVzqxe32Y2BZ_dYOB8zNsF9c4pnKEIB9ZLt118/edit) |
| 166 | + |
0 commit comments