Skip to content

Commit

Permalink
Conformance display profiles on gatewayapi docs (#2874)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
xtineskim authored May 2, 2024
1 parent ab850c3 commit cd175ec
Show file tree
Hide file tree
Showing 8 changed files with 200 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ profiles:
- HTTPRouteRequestTimeout
- HTTPRouteResponseHeaderModification
- HTTPRouteSchemeRedirect
name: HTTP
name: HTTP
- core:
result: success
statistics:
Expand Down
3 changes: 2 additions & 1 deletion hack/mkdocs-copy-geps.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

log = logging.getLogger('mkdocs')


@plugins.event_priority(100)
def on_pre_build(config, **kwargs):
log.info("copying geps")
shutil.copytree("geps","site-src/geps", dirs_exist_ok=True)
shutil.copytree("geps", "site-src/geps", dirs_exist_ok=True)
133 changes: 133 additions & 0 deletions hack/mkdocs-generate-conformance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Copyright 2023 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.

import logging
from mkdocs import plugins
import yaml
import pandas
from fnmatch import fnmatch
import glob

log = logging.getLogger('mkdocs')


@plugins.event_priority(100)
def on_pre_build(config, **kwargs):
log.info("generating conformance")

yamlReports = getYaml()

generate_conformance_tables(yamlReports)


desc = """
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.
Implementations only appear in this page if they pass Core conformance for the resource type, and the features listed should be Extended features.
"""

warning_text = """
???+ warning
This page is under active development and is not in its final form,
especially for the project name and the names of the features.
However, as it is based on submitted conformance reports, the information is correct.
"""

# NOTE: will have to be updated if new (extended) features are added
httproute_extended_conformance_features_list = ['HTTPRouteBackendRequestHeaderModification', 'HTTPRouteQueryParamMatching', 'HTTPRouteMethodMatching', 'HTTPRouteResponseHeaderModification', 'HTTPRoutePortRedirect', 'HTTPRouteSchemeRedirect',
'HTTPRoutePathRedirect', 'HTTPRouteHostRewrite', 'HTTPRoutePathRewrite', 'HTTPRouteRequestMirror', 'HTTPRouteRequestMultipleMirrors', 'HTTPRouteRequestTimeout', 'HTTPRouteBackendTimeout', 'HTTPRouteParentRefPort']


def generate_conformance_tables(reports):

gateway_http_table = generate_profiles_report(reports, 'HTTP')
gateway_http_table = gateway_http_table.rename_axis('Organization')

# Currently no implementation has extended supported features listed.
# Can uncomment once a list is needed to keep track
# gateway_tls_table = generate_profiles_report(reprots,'TLS')

mesh_http_table = generate_profiles_report(reports, 'MESH')
mesh_http_table = mesh_http_table.rename_axis('Organization')

with open('site-src/implementation-table.md', 'w') as f:
f.write(desc)
f.write("\n\n")

f.write(warning_text)
f.write("\n\n")

f.write("## Gateway Profile\n\n")
f.write("### HTTPRoute\n\n")
f.write(gateway_http_table.to_markdown()+'\n\n')

f.write("## Mesh Profile\n\n")
f.write("### HTTPRoute\n\n")
f.write(mesh_http_table.to_markdown())


def generate_profiles_report(reports, route):

http_reports = reports.loc[reports["name"] == route]
http_reports.set_index('organization')
http_reports.sort_values(['organization', 'version'], inplace=True)

http_table = pandas.DataFrame(
columns=http_reports['organization'])
http_table = http_reports[['organization', 'project',
'version', 'extended.supportedFeatures']].T
http_table.columns = http_table.iloc[0]
http_table = http_table[1:].T

for row in http_table.itertuples():
for feat in row._3:
http_table.loc[row.Index, feat] = ':white_check_mark:'
http_table = http_table.fillna(':x:')
http_table = http_table.drop(['extended.supportedFeatures'], axis=1)

http_table = http_table.rename(
columns={"project": "Project", "version": "Version"})

return http_table


# the path should be changed when there is a new version
conformance_path = "conformance/reports/v1.0.0/**"


def getYaml():
log.info("parsing conformance reports ============================")
yamls = []

for p in glob.glob(conformance_path, recursive=True):

if fnmatch(p, "*.yaml"):

x = load_yaml(p)
profiles = pandas.json_normalize(
x, record_path='profiles', meta=["implementation"])

implementation = pandas.json_normalize(profiles.implementation)
yamls.append(pandas.concat([implementation, profiles], axis=1))

yamls = pandas.concat(yamls)
return yamls


def load_yaml(name):
with open(name, 'r') as file:
x = yaml.safe_load(file)

return x
8 changes: 7 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ site_dir: site
docs_dir: site-src
extra_css:
- stylesheets/extra.css
extra_javascript:
- https://unpkg.com/tablesort@5.3.0/dist/tablesort.min.js
- js/implementations.js
hooks:
- hack/mkdocs-copy-geps.py
- hack/mkdocs-generate-conformance.py
watch:
- geps
theme:
Expand Down Expand Up @@ -75,7 +79,9 @@ nav:
Overview: mesh/index.md
GAMMA Initiative: mesh/gamma.md
Service Facets: mesh/service-facets.md
- Implementations: implementations.md
- Implementations:
List: implementations.md
Comparison: implementation-table.md
- FAQ: faq.md
- Glossary: concepts/glossary.md
- Guides:
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ mkdocs-material==9.5.19
mkdocs-material-extensions==1.3.1
mkdocs-redirects==1.2.1
mkdocs-mermaid2-plugin==1.1.1
pandas==2.0.3
pep562==1.1
Pygments==2.17.2
pymdown-extensions==10.8.1
PyYAML==6.0.1
six==1.16.0
tabulate==0.9.0
tornado==6.4
40 changes: 40 additions & 0 deletions site-src/implementation-table.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

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.
Implementations only appear in this page if they pass Core conformance for the resource type, and the features listed should be Extended features.



???+ warning


This page is under active development and is not in its final form,
especially for the project name and the names of the features.
However, as it is based on submitted conformance reports, the information is correct.


## Gateway Profile

### HTTPRoute

| Organization | Project | Version | HTTPRouteMethodMatching | HTTPRouteQueryParamMatching | HTTPRouteResponseHeaderModification | HTTPRouteBackendTimeout | HTTPRouteHostRewrite | HTTPRouteParentRefPort | HTTPRoutePathRedirect | HTTPRoutePathRewrite | HTTPRoutePortRedirect | HTTPRouteRequestMirror | HTTPRouteRequestMultipleMirrors | HTTPRouteRequestTimeout | HTTPRouteSchemeRedirect |
|:---------------|:------------------------------|:--------------|:--------------------------|:------------------------------|:--------------------------------------|:--------------------------|:-----------------------|:-------------------------|:------------------------|:-----------------------|:------------------------|:-------------------------|:----------------------------------|:--------------------------|:--------------------------|
| 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: |
| 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: |
| 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: |
| 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: |
| 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: |
| 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: |
| 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: |
| 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: |
| 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: |
| 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: |
| 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: |

## Mesh Profile

### HTTPRoute

| Organization | Project | Version | HTTPRouteRequestTimeout | HTTPRoutePathRedirect | HTTPRouteRequestMirror | HTTPRoutePathRewrite | HTTPRouteMethodMatching | HTTPRouteRequestMultipleMirrors | HTTPRouteBackendTimeout | HTTPRouteResponseHeaderModification | HTTPRoutePortRedirect | HTTPRouteSchemeRedirect | HTTPRouteHostRewrite | HTTPRouteQueryParamMatching |
|:---------------|:----------|:----------|:--------------------------|:------------------------|:-------------------------|:-----------------------|:--------------------------|:----------------------------------|:--------------------------|:--------------------------------------|:------------------------|:--------------------------|:-----------------------|:------------------------------|
| 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: |
| 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: |
7 changes: 7 additions & 0 deletions site-src/implementations.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Implementors and integrators of Gateway API are encouraged to update this
document with status information about their implementations, the versions they
cover, and documentation to help users get started.


!!! info "Compare extended supported features across implementations"

[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.

## Gateway Controller Implementation Status <a name="gateways"></a>

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

[gamma]:/concepts/gamma/



## Implementations

In this section you will find specific links to blog posts, documentation and other Gateway API references for specific implementations.
Expand Down
8 changes: 8 additions & 0 deletions site-src/js/implementations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
document$.subscribe(function() {
var tables = document.querySelectorAll("article table:not([class])")
tables.forEach(function(table) {
new Tablesort(table)
})
})


0 comments on commit cd175ec

Please sign in to comment.