We have clarified our Privacy Statement even further. Please have a look at our changes.
Browse Source

use example prerender hook in e2e

tags/19.11.0^2
Henning Jacobs 2 weeks ago
parent
commit
db94154516
3 changed files with 21 additions and 1 deletions
  1. +1
    -1
      Makefile
  2. +19
    -0
      kube_web/example_hooks.py
  3. +1
    -0
      tests/e2e/deployment.yaml

+ 1
- 1
Makefile View File

@@ -58,7 +58,7 @@ run:

.PHONY: run.kind
run.kind:
poetry run python3 -m kube_web --kubeconfig-path=$$(.pytest-kind/kube-web-view-e2e/kind get kubeconfig-path --name=kube-web-view-e2e) --debug --show-container-logs --search-default-resource-types=deployments,pods,configmaps --default-label-columns=pods=app "--default-hidden-columns=pods=Nominated Node" --exclude-namespaces=.*forbidden.*
poetry run python3 -m kube_web --kubeconfig-path=$$(.pytest-kind/kube-web-view-e2e/kind get kubeconfig-path --name=kube-web-view-e2e) --debug --show-container-logs --search-default-resource-types=deployments,pods,configmaps --default-label-columns=pods=app "--default-hidden-columns=pods=Nominated Node" --exclude-namespaces=.*forbidden.* --resource-view-prerender-hook=kube_web.example_hooks.resource_view_prerender

.PHONY: mirror
mirror:

+ 19
- 0
kube_web/example_hooks.py View File

@@ -0,0 +1,19 @@
"""
This file contains example hook functions for Kubernetes Web Web
"""


async def resource_view_prerender(cluster, namespace, resource, context):
"""
Example hook function for the resource view page. Adds a link (icon button) for deployments.

Usage: --resource-view-prerender-hook=kube_web.example_hooks.resource_view_prerender
"""
if resource.kind == "Deployment":
link = {
"href": "#this-isa-custom-link",
"class": "is-link",
"title": "Some example link to nowhere",
"icon": "external-link-alt",
}
context["links"].append(link)

+ 1
- 0
tests/e2e/deployment.yaml View File

@@ -72,4 +72,5 @@ spec:
- --show-container-logs
- --object-links=pods=#cluster={cluster};namespace={namespace};name={name}
- --exclude-namespaces=.*forbidden.*
- --resource-view-prerender-hook=kube_web.example_hooks.resource_view_prerender
env: []

Loading…
Cancel
Save