Skip to content

Commit cd175ec

Browse files
authored
Conformance display profiles on gatewayapi docs (#2874)
* Conformance display profiles on gatewayapi docs * Update requirements.txt for pandas and tabulate * Change np requirement * Adjust pandas for python version * Remove unused imports * Clean up requirements.txt * Changed display per comments * Switched axis, display the mesh and gateway profiles * Updated axis, small fixes * Addressed comments * nits, created standalone py for conformance reports * remove conformance report code from copy-geps.py
1 parent ab850c3 commit cd175ec

File tree

8 files changed

+200
-3
lines changed

8 files changed

+200
-3
lines changed

conformance/reports/v1.0.0/cilium/v1.15.0-pre.3-report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ profiles:
3838
- HTTPRouteRequestTimeout
3939
- HTTPRouteResponseHeaderModification
4040
- HTTPRouteSchemeRedirect
41-
name: HTTP
41+
name: HTTP
4242
- core:
4343
result: success
4444
statistics:

hack/mkdocs-copy-geps.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818

1919
log = logging.getLogger('mkdocs')
2020

21+
2122
@plugins.event_priority(100)
2223
def on_pre_build(config, **kwargs):
2324
log.info("copying geps")
24-
shutil.copytree("geps","site-src/geps", dirs_exist_ok=True)
25+
shutil.copytree("geps", "site-src/geps", dirs_exist_ok=True)

hack/mkdocs-generate-conformance.py

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Copyright 2023 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import logging
16+
from mkdocs import plugins
17+
import yaml
18+
import pandas
19+
from fnmatch import fnmatch
20+
import glob
21+
22+
log = logging.getLogger('mkdocs')
23+
24+
25+
@plugins.event_priority(100)
26+
def on_pre_build(config, **kwargs):
27+
log.info("generating conformance")
28+
29+
yamlReports = getYaml()
30+
31+
generate_conformance_tables(yamlReports)
32+
33+
34+
desc = """
35+
The following tables are populated from the conformance reports [uploaded by project implementations](https://github.com/kubernetes-sigs/gateway-api/tree/main/conformance/reports). They are separated into the extended features that each project supports listed in their reports.
36+
Implementations only appear in this page if they pass Core conformance for the resource type, and the features listed should be Extended features.
37+
"""
38+
39+
warning_text = """
40+
???+ warning
41+
42+
43+
This page is under active development and is not in its final form,
44+
especially for the project name and the names of the features.
45+
However, as it is based on submitted conformance reports, the information is correct.
46+
"""
47+
48+
# NOTE: will have to be updated if new (extended) features are added
49+
httproute_extended_conformance_features_list = ['HTTPRouteBackendRequestHeaderModification', 'HTTPRouteQueryParamMatching', 'HTTPRouteMethodMatching', 'HTTPRouteResponseHeaderModification', 'HTTPRoutePortRedirect', 'HTTPRouteSchemeRedirect',
50+
'HTTPRoutePathRedirect', 'HTTPRouteHostRewrite', 'HTTPRoutePathRewrite', 'HTTPRouteRequestMirror', 'HTTPRouteRequestMultipleMirrors', 'HTTPRouteRequestTimeout', 'HTTPRouteBackendTimeout', 'HTTPRouteParentRefPort']
51+
52+
53+
def generate_conformance_tables(reports):
54+
55+
gateway_http_table = generate_profiles_report(reports, 'HTTP')
56+
gateway_http_table = gateway_http_table.rename_axis('Organization')
57+
58+
# Currently no implementation has extended supported features listed.
59+
# Can uncomment once a list is needed to keep track
60+
# gateway_tls_table = generate_profiles_report(reprots,'TLS')
61+
62+
mesh_http_table = generate_profiles_report(reports, 'MESH')
63+
mesh_http_table = mesh_http_table.rename_axis('Organization')
64+
65+
with open('site-src/implementation-table.md', 'w') as f:
66+
f.write(desc)
67+
f.write("\n\n")
68+
69+
f.write(warning_text)
70+
f.write("\n\n")
71+
72+
f.write("## Gateway Profile\n\n")
73+
f.write("### HTTPRoute\n\n")
74+
f.write(gateway_http_table.to_markdown()+'\n\n')
75+
76+
f.write("## Mesh Profile\n\n")
77+
f.write("### HTTPRoute\n\n")
78+
f.write(mesh_http_table.to_markdown())
79+
80+
81+
def generate_profiles_report(reports, route):
82+
83+
http_reports = reports.loc[reports["name"] == route]
84+
http_reports.set_index('organization')
85+
http_reports.sort_values(['organization', 'version'], inplace=True)
86+
87+
http_table = pandas.DataFrame(
88+
columns=http_reports['organization'])
89+
http_table = http_reports[['organization', 'project',
90+
'version', 'extended.supportedFeatures']].T
91+
http_table.columns = http_table.iloc[0]
92+
http_table = http_table[1:].T
93+
94+
for row in http_table.itertuples():
95+
for feat in row._3:
96+
http_table.loc[row.Index, feat] = ':white_check_mark:'
97+
http_table = http_table.fillna(':x:')
98+
http_table = http_table.drop(['extended.supportedFeatures'], axis=1)
99+
100+
http_table = http_table.rename(
101+
columns={"project": "Project", "version": "Version"})
102+
103+
return http_table
104+
105+
106+
# the path should be changed when there is a new version
107+
conformance_path = "conformance/reports/v1.0.0/**"
108+
109+
110+
def getYaml():
111+
log.info("parsing conformance reports ============================")
112+
yamls = []
113+
114+
for p in glob.glob(conformance_path, recursive=True):
115+
116+
if fnmatch(p, "*.yaml"):
117+
118+
x = load_yaml(p)
119+
profiles = pandas.json_normalize(
120+
x, record_path='profiles', meta=["implementation"])
121+
122+
implementation = pandas.json_normalize(profiles.implementation)
123+
yamls.append(pandas.concat([implementation, profiles], axis=1))
124+
125+
yamls = pandas.concat(yamls)
126+
return yamls
127+
128+
129+
def load_yaml(name):
130+
with open(name, 'r') as file:
131+
x = yaml.safe_load(file)
132+
133+
return x

mkdocs.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ site_dir: site
55
docs_dir: site-src
66
extra_css:
77
- stylesheets/extra.css
8+
extra_javascript:
9+
- https://unpkg.com/[email protected]/dist/tablesort.min.js
10+
- js/implementations.js
811
hooks:
912
- hack/mkdocs-copy-geps.py
13+
- hack/mkdocs-generate-conformance.py
1014
watch:
1115
- geps
1216
theme:
@@ -75,7 +79,9 @@ nav:
7579
Overview: mesh/index.md
7680
GAMMA Initiative: mesh/gamma.md
7781
Service Facets: mesh/service-facets.md
78-
- Implementations: implementations.md
82+
- Implementations:
83+
List: implementations.md
84+
Comparison: implementation-table.md
7985
- FAQ: faq.md
8086
- Glossary: concepts/glossary.md
8187
- Guides:

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ mkdocs-material==9.5.19
1414
mkdocs-material-extensions==1.3.1
1515
mkdocs-redirects==1.2.1
1616
mkdocs-mermaid2-plugin==1.1.1
17+
pandas==2.0.3
1718
pep562==1.1
1819
Pygments==2.17.2
1920
pymdown-extensions==10.8.1
2021
PyYAML==6.0.1
2122
six==1.16.0
23+
tabulate==0.9.0
2224
tornado==6.4

site-src/implementation-table.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
The following tables are populated from the conformance reports [uploaded by project implementations](https://github.com/kubernetes-sigs/gateway-api/tree/main/conformance/reports). They are separated into the extended features that each project supports listed in their reports.
3+
Implementations only appear in this page if they pass Core conformance for the resource type, and the features listed should be Extended features.
4+
5+
6+
7+
???+ warning
8+
9+
10+
This page is under active development and is not in its final form,
11+
especially for the project name and the names of the features.
12+
However, as it is based on submitted conformance reports, the information is correct.
13+
14+
15+
## Gateway Profile
16+
17+
### HTTPRoute
18+
19+
| Organization | Project | Version | HTTPRouteMethodMatching | HTTPRouteQueryParamMatching | HTTPRouteResponseHeaderModification | HTTPRouteBackendTimeout | HTTPRouteHostRewrite | HTTPRouteParentRefPort | HTTPRoutePathRedirect | HTTPRoutePathRewrite | HTTPRoutePortRedirect | HTTPRouteRequestMirror | HTTPRouteRequestMultipleMirrors | HTTPRouteRequestTimeout | HTTPRouteSchemeRedirect |
20+
|:---------------|:------------------------------|:--------------|:--------------------------|:------------------------------|:--------------------------------------|:--------------------------|:-----------------------|:-------------------------|:------------------------|:-----------------------|:------------------------|:-------------------------|:----------------------------------|:--------------------------|:--------------------------|
21+
| Kong | kubernetes-ingress-controller | v3.0.2 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
22+
| Kong | kubernetes-ingress-controller | v3.1.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
23+
| cilium | cilium | v1.15.0-pre.3 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
24+
| envoyproxy | envoy-gateway | v0.6.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
25+
| istio | istio | 1.2 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
26+
| kumahq | kuma | 2.6.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :white_check_mark: |
27+
| nginxinc | nginx-kubernetes-gateway | v1.1.0 | :white_check_mark: | :white_check_mark: | :x: | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :white_check_mark: |
28+
| nginxinc | nginx-gateway-fabric | v1.2.0 | :white_check_mark: | :white_check_mark: | :x: | :x: | :white_check_mark: | :x: | :x: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :white_check_mark: |
29+
| projectcontour | contour | v1.28.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
30+
| projectcontour | contour | v1.28.2 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
31+
| solo.io | gloo-gateway | v2.0.0-beta1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :white_check_mark: | :x: | :white_check_mark: | :x: | :x: | :x: | :white_check_mark: |
32+
33+
## Mesh Profile
34+
35+
### HTTPRoute
36+
37+
| Organization | Project | Version | HTTPRouteRequestTimeout | HTTPRoutePathRedirect | HTTPRouteRequestMirror | HTTPRoutePathRewrite | HTTPRouteMethodMatching | HTTPRouteRequestMultipleMirrors | HTTPRouteBackendTimeout | HTTPRouteResponseHeaderModification | HTTPRoutePortRedirect | HTTPRouteSchemeRedirect | HTTPRouteHostRewrite | HTTPRouteQueryParamMatching |
38+
|:---------------|:----------|:----------|:--------------------------|:------------------------|:-------------------------|:-----------------------|:--------------------------|:----------------------------------|:--------------------------|:--------------------------------------|:------------------------|:--------------------------|:-----------------------|:------------------------------|
39+
| istio | istio | 1.2 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
40+
| kumahq | kuma | 2.6.0 | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |

site-src/implementations.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ Implementors and integrators of Gateway API are encouraged to update this
77
document with status information about their implementations, the versions they
88
cover, and documentation to help users get started.
99

10+
11+
!!! info "Compare extended supported features across implementations"
12+
13+
[View a table to quickly compare supported features of projects](/implementation-table). These outline Gateway controller implementations that have passed core conformance tests, and focus on extended conformance features that they have implemented.
14+
1015
## Gateway Controller Implementation Status <a name="gateways"></a>
1116

1217
- [Acnodal EPIC][1]
@@ -85,6 +90,8 @@ cover, and documentation to help users get started.
8590

8691
[gamma]:/concepts/gamma/
8792

93+
94+
8895
## Implementations
8996

9097
In this section you will find specific links to blog posts, documentation and other Gateway API references for specific implementations.

site-src/js/implementations.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
document$.subscribe(function() {
2+
var tables = document.querySelectorAll("article table:not([class])")
3+
tables.forEach(function(table) {
4+
new Tablesort(table)
5+
})
6+
})
7+
8+

0 commit comments

Comments
 (0)