pre-commit hooks and code formatting
Bu işleme şunda yer alıyor:
ebeveyn
0afa3b6f3e
işleme
7ea55f06d9
35 değiştirilmiş dosya ile 247 ekleme ve 129 silme
125
.pre-commit-config.yaml
Normal dosya
125
.pre-commit-config.yaml
Normal dosya
|
|
@ -0,0 +1,125 @@
|
|||
---
|
||||
minimum_pre_commit_version: 1.21.0
|
||||
fail_fast: false
|
||||
default_stages: [commit, push]
|
||||
repos:
|
||||
# meta
|
||||
|
||||
- repo: meta
|
||||
hooks:
|
||||
- id: check-hooks-apply
|
||||
- id: check-useless-excludes
|
||||
|
||||
# formatters
|
||||
|
||||
- repo: https://github.com/asottile/reorder_python_imports
|
||||
rev: v1.9.0
|
||||
hooks:
|
||||
- id: reorder-python-imports
|
||||
|
||||
- repo: https://github.com/ambv/black
|
||||
rev: 19.10b0
|
||||
hooks:
|
||||
- id: black
|
||||
|
||||
# - repo: https://github.com/pre-commit/mirrors-yapf
|
||||
# rev: v0.28.0
|
||||
# hooks:
|
||||
# - id: yapf
|
||||
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v1.26.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
stages: [push]
|
||||
|
||||
# linters
|
||||
|
||||
- repo: https://github.com/PyCQA/bandit
|
||||
rev: 1.6.2
|
||||
hooks:
|
||||
- id: bandit
|
||||
args: ["-x", "tests"]
|
||||
stages: [push]
|
||||
|
||||
#- repo: https://github.com/PyCQA/pydocstyle
|
||||
#rev: 5.0.2
|
||||
# hooks:
|
||||
#- id: pydocstyle
|
||||
#args: ["--ignore=D10,D21,D202"]
|
||||
|
||||
|
||||
- repo: local
|
||||
hooks:
|
||||
|
||||
- id: safety
|
||||
name: safety
|
||||
entry: safety
|
||||
language: system
|
||||
pass_filenames: false
|
||||
args: ["check", "--bare"]
|
||||
stages: [push]
|
||||
|
||||
- id: poetry
|
||||
name: poetry
|
||||
description: Validates the structure of the pyproject.toml file
|
||||
entry: poetry check
|
||||
language: system
|
||||
pass_filenames: false
|
||||
files: ^pyproject.toml$
|
||||
stages: [push]
|
||||
|
||||
- repo: https://github.com/adrienverge/yamllint
|
||||
rev: v1.20.0
|
||||
hooks:
|
||||
- id: yamllint
|
||||
args: ["--strict", "-d", "{rules: {line-length: {max: 180}}}"]
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v0.761
|
||||
hooks:
|
||||
- id: mypy
|
||||
exclude: "^examples/oauth2-log-jwt-sub/hooks.py|docs/conf.py|tests/e2e/$"
|
||||
|
||||
- repo: https://github.com/pryorda/dockerfilelint-precommit-hooks
|
||||
rev: v0.1.0
|
||||
hooks:
|
||||
- id: dockerfilelint
|
||||
stages: [commit] # required
|
||||
|
||||
# miscellaneous
|
||||
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v2.4.0
|
||||
hooks:
|
||||
- id: check-added-large-files
|
||||
- id: check-docstring-first
|
||||
- id: debug-statements
|
||||
- id: end-of-file-fixer
|
||||
- id: flake8
|
||||
additional_dependencies: ["flake8-bugbear"]
|
||||
- id: trailing-whitespace
|
||||
- id: check-ast
|
||||
- id: check-builtin-literals
|
||||
- id: detect-private-key
|
||||
- id: mixed-line-ending
|
||||
#- id: name-tests-test
|
||||
#exclude: "^tests/e2e/utils.py"
|
||||
|
||||
- repo: https://github.com/pre-commit/pygrep-hooks
|
||||
rev: v1.4.4
|
||||
hooks:
|
||||
# - id: rst-backticks
|
||||
- id: python-use-type-annotations
|
||||
- id: python-no-log-warn
|
||||
- id: python-no-eval
|
||||
- id: python-check-mock-methods
|
||||
- id: python-check-blanket-noqa
|
||||
|
||||
# commit-msg
|
||||
# http://jorisroovers.com/gitlint/#using-gitlint-through-pre-commit
|
||||
|
||||
- repo: https://github.com/jorisroovers/gitlint
|
||||
rev: v0.12.0
|
||||
hooks:
|
||||
- id: gitlint
|
||||
4
Makefile
4
Makefile
|
|
@ -18,7 +18,7 @@ poetry:
|
|||
test: poetry lint test.unit test.e2e
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
lint:
|
||||
poetry run flake8
|
||||
poetry run black --check kube_web
|
||||
poetry run mypy --ignore-missing-imports kube_web
|
||||
|
|
@ -37,7 +37,7 @@ test.e2e: docker
|
|||
--cluster-name kube-web-view-e2e \
|
||||
tests/e2e
|
||||
|
||||
docker:
|
||||
docker:
|
||||
docker build --build-arg "VERSION=$(VERSION)" -t "$(IMAGE):$(TAG)" .
|
||||
@echo 'Docker image $(IMAGE):$(TAG) can now be used.'
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
# This file only contains a selection of the most common options. For a full
|
||||
# list see the documentation:
|
||||
# http://www.sphinx-doc.org/en/master/config
|
||||
|
||||
# -- Path setup --------------------------------------------------------------
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
|
|
@ -13,8 +11,6 @@
|
|||
# import os
|
||||
# import sys
|
||||
# sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = "Kubernetes Web View"
|
||||
|
|
@ -56,7 +52,7 @@ try:
|
|||
html_theme = "sphinx_rtd_theme"
|
||||
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
|
|
|
|||
|
|
@ -211,4 +211,3 @@ An example Terraform deployment of the above is below:
|
|||
output "kube-web-view-secret" {
|
||||
description = "Kube Web View App Secret"
|
||||
value = aws_cognito_user_pool_client.kube-web-view.client_secret
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ Example implementation of REST endpoint for a Cluster Registry.
|
|||
|
||||
To be used with --cluster-registry-url option
|
||||
"""
|
||||
|
||||
from aiohttp import web
|
||||
|
||||
KUBERNETES_CLUSTERS = [
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ To be used with --oauth2-authorized-hook option
|
|||
|
||||
See also https://kube-web-view.readthedocs.io/en/latest/oauth2.html
|
||||
"""
|
||||
import aiohttp
|
||||
import logging
|
||||
|
||||
import aiohttp
|
||||
|
||||
|
||||
# list of authorized GitHub usernames
|
||||
AUTHORIZED_USERS = frozenset(["hjacobs"])
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import logging
|
||||
import time
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
from urllib.parse import urljoin
|
||||
|
||||
import requests
|
||||
from pykube import HTTPClient
|
||||
from pykube import KubeConfig
|
||||
from requests.auth import AuthBase
|
||||
from typing import List
|
||||
|
||||
from pykube import HTTPClient, KubeConfig
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -120,7 +120,7 @@ class ClusterRegistryDiscoverer:
|
|||
clusters.append(Cluster(row["alias"], client, labels, row))
|
||||
self._clusters = clusters
|
||||
self._last_cache_refresh = time.time()
|
||||
except:
|
||||
except Exception:
|
||||
logger.exception(f"Failed to refresh from cluster registry {self._url}")
|
||||
|
||||
def get_clusters(self):
|
||||
|
|
|
|||
|
|
@ -2,13 +2,12 @@ import re
|
|||
|
||||
from .resource_registry import ResourceRegistry
|
||||
from .selector import selector_matches
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
|
||||
from .cluster_discovery import OAuth2BearerTokenAuth
|
||||
|
||||
from typing import Dict, List
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
INVALID_CLUSTER_NAME_CHAR_PATTERN = re.compile("[^a-zA-Z0-9:_.-]")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
"""
|
||||
This file contains example hook functions for Kubernetes Web Web
|
||||
"""
|
||||
"""This file contains example hook functions for Kubernetes Web View."""
|
||||
|
||||
|
||||
async def resource_view_prerender(cluster, namespace, resource, context):
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import colorsys
|
||||
import datetime
|
||||
import yaml as pyyaml
|
||||
|
||||
import pygments
|
||||
from pygments.lexers import get_lexer_by_name
|
||||
import yaml as pyyaml
|
||||
from pygments.formatters import HtmlFormatter
|
||||
from pygments.lexers import get_lexer_by_name
|
||||
|
||||
|
||||
def pluralize(singular):
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
import re
|
||||
|
||||
from pykube.query import Query
|
||||
from pykube.http import HTTPClient
|
||||
from pykube.objects import Pod, APIObject, NamespacedAPIObject
|
||||
from functools import partial
|
||||
import asyncio
|
||||
|
||||
import concurrent.futures
|
||||
import re
|
||||
from functools import partial
|
||||
|
||||
from pykube.http import HTTPClient
|
||||
from pykube.objects import APIObject
|
||||
from pykube.objects import NamespacedAPIObject
|
||||
from pykube.objects import Pod
|
||||
from pykube.query import Query
|
||||
|
||||
FACTORS = {
|
||||
"n": 1 / 1000000000,
|
||||
|
|
@ -50,6 +51,8 @@ class PodMetrics(NamespacedAPIObject):
|
|||
|
||||
def parse_resource(v):
|
||||
"""
|
||||
Parse a Kubernetes resource spec.
|
||||
|
||||
>>> parse_resource('100m')
|
||||
0.1
|
||||
>>> parse_resource('100M')
|
||||
|
|
|
|||
|
|
@ -1,24 +1,22 @@
|
|||
import asyncio
|
||||
import aiohttp.web
|
||||
import argparse
|
||||
import asyncio
|
||||
import collections
|
||||
import importlib
|
||||
import logging
|
||||
import re
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from kube_web import __version__
|
||||
from .web import get_app
|
||||
from .selector import parse_selector
|
||||
from .cluster_discovery import (
|
||||
StaticClusterDiscoverer,
|
||||
ClusterRegistryDiscoverer,
|
||||
ServiceAccountClusterDiscoverer,
|
||||
ServiceAccountNotFound,
|
||||
KubeconfigDiscoverer,
|
||||
)
|
||||
import aiohttp.web
|
||||
|
||||
from .cluster_discovery import ClusterRegistryDiscoverer
|
||||
from .cluster_discovery import KubeconfigDiscoverer
|
||||
from .cluster_discovery import ServiceAccountClusterDiscoverer
|
||||
from .cluster_discovery import ServiceAccountNotFound
|
||||
from .cluster_discovery import StaticClusterDiscoverer
|
||||
from .cluster_manager import ClusterManager
|
||||
from .selector import parse_selector
|
||||
from .web import get_app
|
||||
from kube_web import __version__
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
import asyncio
|
||||
import logging
|
||||
from pykube.objects import APIObject, NamespacedAPIObject
|
||||
from typing import List, Type
|
||||
from typing import List
|
||||
from typing import Type
|
||||
|
||||
from pykube.objects import APIObject
|
||||
from pykube.objects import NamespacedAPIObject
|
||||
|
||||
from kube_web import kubernetes
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from typing import Dict, Any
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
|
||||
|
||||
def parse_selector(param: str):
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ def merge_cluster_tables(t1, t2):
|
|||
for i, column in enumerate(t1.columns):
|
||||
column_indicies[column["name"]] = i
|
||||
for row in t1.rows:
|
||||
for i in range(added):
|
||||
for _ in range(added):
|
||||
row["cells"].append(None)
|
||||
for row in t2.rows:
|
||||
new_row_cells = [None] * len(t1.columns)
|
||||
|
|
|
|||
2
kube_web/templates/assets/bulma.min.css
sağlanmış
2
kube_web/templates/assets/bulma.min.css
sağlanmış
Dosya farkları bir veya daha fazla satır çok uzun olduğundan bastırıldı
2
kube_web/templates/assets/fontawesome.min.js
sağlanmış
2
kube_web/templates/assets/fontawesome.min.js
sağlanmış
Dosya farkları bir veya daha fazla satır çok uzun olduğundan bastırıldı
2
kube_web/templates/assets/regular.min.js
sağlanmış
2
kube_web/templates/assets/regular.min.js
sağlanmış
Dosya farkları bir veya daha fazla satır çok uzun olduğundan bastırıldı
2
kube_web/templates/assets/solid.min.js
sağlanmış
2
kube_web/templates/assets/solid.min.js
sağlanmış
Dosya farkları bir veya daha fazla satır çok uzun olduğundan bastırıldı
2
kube_web/templates/assets/sortable.min.js
sağlanmış
2
kube_web/templates/assets/sortable.min.js
sağlanmış
|
|
@ -1,2 +1,2 @@
|
|||
/*! sortable.js 0.8.0 */
|
||||
(function(){var a,b,c,d,e,f,g;a="table[data-sortable]",d=/^-?[£$¤]?[\d,.]+%?$/,g=/^\s+|\s+$/g,c=["click"],f="ontouchstart"in document.documentElement,f&&c.push("touchstart"),b=function(a,b,c){return null!=a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)},e={init:function(b){var c,d,f,g,h;for(null==b&&(b={}),null==b.selector&&(b.selector=a),d=document.querySelectorAll(b.selector),h=[],f=0,g=d.length;g>f;f++)c=d[f],h.push(e.initTable(c));return h},initTable:function(a){var b,c,d,f,g,h;if(1===(null!=(h=a.tHead)?h.rows.length:void 0)&&"true"!==a.getAttribute("data-sortable-initialized")){for(a.setAttribute("data-sortable-initialized","true"),d=a.querySelectorAll("th"),b=f=0,g=d.length;g>f;b=++f)c=d[b],"false"!==c.getAttribute("data-sortable")&&e.setupClickableTH(a,c,b);return a}},setupClickableTH:function(a,d,f){var g,h,i,j,k,l;for(i=e.getColumnType(a,f),h=function(b){var c,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D;if(b.handled===!0)return!1;for(b.handled=!0,m="true"===this.getAttribute("data-sorted"),n=this.getAttribute("data-sorted-direction"),h=m?"ascending"===n?"descending":"ascending":i.defaultSortDirection,p=this.parentNode.querySelectorAll("th"),s=0,w=p.length;w>s;s++)d=p[s],d.setAttribute("data-sorted","false"),d.removeAttribute("data-sorted-direction");if(this.setAttribute("data-sorted","true"),this.setAttribute("data-sorted-direction",h),o=a.tBodies[0],l=[],m){for(D=o.rows,v=0,z=D.length;z>v;v++)g=D[v],l.push(g);for(l.reverse(),B=0,A=l.length;A>B;B++)k=l[B],o.appendChild(k)}else{for(r=null!=i.compare?i.compare:function(a,b){return b-a},c=function(a,b){return a[0]===b[0]?a[2]-b[2]:i.reverse?r(b[0],a[0]):r(a[0],b[0])},C=o.rows,j=t=0,x=C.length;x>t;j=++t)k=C[j],q=e.getNodeValue(k.cells[f]),null!=i.comparator&&(q=i.comparator(q)),l.push([q,k,j]);for(l.sort(c),u=0,y=l.length;y>u;u++)k=l[u],o.appendChild(k[1])}return"function"==typeof window.CustomEvent&&"function"==typeof a.dispatchEvent?a.dispatchEvent(new CustomEvent("Sortable.sorted",{bubbles:!0})):void 0},l=[],j=0,k=c.length;k>j;j++)g=c[j],l.push(b(d,g,h));return l},getColumnType:function(a,b){var c,d,f,g,h,i,j,k,l,m,n;if(d=null!=(l=a.querySelectorAll("th")[b])?l.getAttribute("data-sortable-type"):void 0,null!=d)return e.typesObject[d];for(m=a.tBodies[0].rows,h=0,j=m.length;j>h;h++)for(c=m[h],f=e.getNodeValue(c.cells[b]),n=e.types,i=0,k=n.length;k>i;i++)if(g=n[i],g.match(f))return g;return e.typesObject.alpha},getNodeValue:function(a){var b;return a?(b=a.getAttribute("data-value"),null!==b?b:"undefined"!=typeof a.innerText?a.innerText.replace(g,""):a.textContent.replace(g,"")):""},setupTypes:function(a){var b,c,d,f;for(e.types=a,e.typesObject={},f=[],c=0,d=a.length;d>c;c++)b=a[c],f.push(e.typesObject[b.name]=b);return f}},e.setupTypes([{name:"numeric",defaultSortDirection:"descending",match:function(a){return a.match(d)},comparator:function(a){return parseFloat(a.replace(/[^0-9.-]/g,""),10)||0}},{name:"date",defaultSortDirection:"ascending",reverse:!0,match:function(a){return!isNaN(Date.parse(a))},comparator:function(a){return Date.parse(a)||0}},{name:"alpha",defaultSortDirection:"ascending",match:function(){return!0},compare:function(a,b){return a.localeCompare(b)}}]),setTimeout(e.init,0),"function"==typeof define&&define.amd?define(function(){return e}):"undefined"!=typeof exports?module.exports=e:window.Sortable=e}).call(this);
|
||||
(function(){var a,b,c,d,e,f,g;a="table[data-sortable]",d=/^-?[£$¤]?[\d,.]+%?$/,g=/^\s+|\s+$/g,c=["click"],f="ontouchstart"in document.documentElement,f&&c.push("touchstart"),b=function(a,b,c){return null!=a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)},e={init:function(b){var c,d,f,g,h;for(null==b&&(b={}),null==b.selector&&(b.selector=a),d=document.querySelectorAll(b.selector),h=[],f=0,g=d.length;g>f;f++)c=d[f],h.push(e.initTable(c));return h},initTable:function(a){var b,c,d,f,g,h;if(1===(null!=(h=a.tHead)?h.rows.length:void 0)&&"true"!==a.getAttribute("data-sortable-initialized")){for(a.setAttribute("data-sortable-initialized","true"),d=a.querySelectorAll("th"),b=f=0,g=d.length;g>f;b=++f)c=d[b],"false"!==c.getAttribute("data-sortable")&&e.setupClickableTH(a,c,b);return a}},setupClickableTH:function(a,d,f){var g,h,i,j,k,l;for(i=e.getColumnType(a,f),h=function(b){var c,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D;if(b.handled===!0)return!1;for(b.handled=!0,m="true"===this.getAttribute("data-sorted"),n=this.getAttribute("data-sorted-direction"),h=m?"ascending"===n?"descending":"ascending":i.defaultSortDirection,p=this.parentNode.querySelectorAll("th"),s=0,w=p.length;w>s;s++)d=p[s],d.setAttribute("data-sorted","false"),d.removeAttribute("data-sorted-direction");if(this.setAttribute("data-sorted","true"),this.setAttribute("data-sorted-direction",h),o=a.tBodies[0],l=[],m){for(D=o.rows,v=0,z=D.length;z>v;v++)g=D[v],l.push(g);for(l.reverse(),B=0,A=l.length;A>B;B++)k=l[B],o.appendChild(k)}else{for(r=null!=i.compare?i.compare:function(a,b){return b-a},c=function(a,b){return a[0]===b[0]?a[2]-b[2]:i.reverse?r(b[0],a[0]):r(a[0],b[0])},C=o.rows,j=t=0,x=C.length;x>t;j=++t)k=C[j],q=e.getNodeValue(k.cells[f]),null!=i.comparator&&(q=i.comparator(q)),l.push([q,k,j]);for(l.sort(c),u=0,y=l.length;y>u;u++)k=l[u],o.appendChild(k[1])}return"function"==typeof window.CustomEvent&&"function"==typeof a.dispatchEvent?a.dispatchEvent(new CustomEvent("Sortable.sorted",{bubbles:!0})):void 0},l=[],j=0,k=c.length;k>j;j++)g=c[j],l.push(b(d,g,h));return l},getColumnType:function(a,b){var c,d,f,g,h,i,j,k,l,m,n;if(d=null!=(l=a.querySelectorAll("th")[b])?l.getAttribute("data-sortable-type"):void 0,null!=d)return e.typesObject[d];for(m=a.tBodies[0].rows,h=0,j=m.length;j>h;h++)for(c=m[h],f=e.getNodeValue(c.cells[b]),n=e.types,i=0,k=n.length;k>i;i++)if(g=n[i],g.match(f))return g;return e.typesObject.alpha},getNodeValue:function(a){var b;return a?(b=a.getAttribute("data-value"),null!==b?b:"undefined"!=typeof a.innerText?a.innerText.replace(g,""):a.textContent.replace(g,"")):""},setupTypes:function(a){var b,c,d,f;for(e.types=a,e.typesObject={},f=[],c=0,d=a.length;d>c;c++)b=a[c],f.push(e.typesObject[b.name]=b);return f}},e.setupTypes([{name:"numeric",defaultSortDirection:"descending",match:function(a){return a.match(d)},comparator:function(a){return parseFloat(a.replace(/[^0-9.-]/g,""),10)||0}},{name:"date",defaultSortDirection:"ascending",reverse:!0,match:function(a){return!isNaN(Date.parse(a))},comparator:function(a){return Date.parse(a)||0}},{name:"alpha",defaultSortDirection:"ascending",match:function(){return!0},compare:function(a,b){return a.localeCompare(b)}}]),setTimeout(e.init,0),"function"==typeof define&&define.amd?define(function(){return e}):"undefined"!=typeof exports?module.exports=e:window.Sortable=e}).call(this);
|
||||
|
|
|
|||
|
|
@ -115,4 +115,3 @@ div.section.is-collapsed h4.title { color: #5e6d6f; border-bottom: 1px solid #5e
|
|||
.highlight .vi { color: #40ffff } /* Name.Variable.Instance */
|
||||
.highlight .vm { color: #40ffff } /* Name.Variable.Magic */
|
||||
.highlight .il { color: #3677a9 } /* Literal.Number.Integer.Long */
|
||||
|
||||
|
|
|
|||
|
|
@ -107,4 +107,3 @@ div.section.is-collapsed h4.title { color: #7a7a7a; border-bottom: 1px solid #db
|
|||
.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
|
||||
.highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */
|
||||
.highlight .il { color: #40a070 } /* Literal.Number.Integer.Long */
|
||||
|
||||
|
|
|
|||
|
|
@ -106,4 +106,3 @@ div.section.is-collapsed h4.title { color: #8c9b9d; border-bottom: 1px solid #de
|
|||
.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
|
||||
.highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */
|
||||
.highlight .il { color: #40a070 } /* Literal.Number.Integer.Long */
|
||||
|
||||
|
|
|
|||
|
|
@ -114,4 +114,3 @@ div.section.is-collapsed h4.title { color: #52575c; border-bottom: 1px solid #52
|
|||
.highlight .vi { color: #40ffff } /* Name.Variable.Instance */
|
||||
.highlight .vm { color: #40ffff } /* Name.Variable.Magic */
|
||||
.highlight .il { color: #3677a9 } /* Literal.Number.Integer.Long */
|
||||
|
||||
|
|
|
|||
|
|
@ -111,4 +111,3 @@ div.section.is-collapsed h4.title { color: #8694a4; border-bottom: 1px solid #4e
|
|||
.highlight .vi { color: #fb660a } /* Name.Variable.Instance */
|
||||
.highlight .vm { color: #fb660a } /* Name.Variable.Magic */
|
||||
.highlight .il { color: #0086f7; font-weight: bold } /* Literal.Number.Integer.Long */
|
||||
|
||||
|
|
|
|||
|
|
@ -37,4 +37,3 @@
|
|||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,57 +1,55 @@
|
|||
import asyncio
|
||||
import aiohttp_jinja2
|
||||
import collections
|
||||
import jinja2
|
||||
import csv
|
||||
import zlib
|
||||
import colorsys
|
||||
import base64
|
||||
import jmespath
|
||||
import time
|
||||
import os
|
||||
import pykube
|
||||
import collections
|
||||
import colorsys
|
||||
import csv
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import requests.exceptions
|
||||
import pykube.exceptions
|
||||
from yarl import URL
|
||||
from http import HTTPStatus
|
||||
import yaml
|
||||
|
||||
import time
|
||||
import zlib
|
||||
from functools import partial
|
||||
from http import HTTPStatus
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
|
||||
from pykube import ObjectDoesNotExist, HTTPClient
|
||||
from pykube.objects import NamespacedAPIObject, Namespace, Event, Pod
|
||||
from pykube.query import Query
|
||||
from aiohttp_session import get_session, setup as session_setup
|
||||
from aiohttp_session.cookie_storage import EncryptedCookieStorage
|
||||
from aiohttp_remotes import XForwardedRelaxed
|
||||
import aiohttp_jinja2
|
||||
import jinja2
|
||||
import jmespath
|
||||
import pykube.exceptions
|
||||
import requests.exceptions
|
||||
import yaml
|
||||
from aioauth_client import OAuth2Client
|
||||
from aiohttp import web
|
||||
from aiohttp_remotes import XForwardedRelaxed
|
||||
from aiohttp_session import get_session
|
||||
from aiohttp_session import setup as session_setup
|
||||
from aiohttp_session.cookie_storage import EncryptedCookieStorage
|
||||
from cryptography.fernet import Fernet
|
||||
from pykube import HTTPClient
|
||||
from pykube import ObjectDoesNotExist
|
||||
from pykube.objects import Event
|
||||
from pykube.objects import Namespace
|
||||
from pykube.objects import NamespacedAPIObject
|
||||
from pykube.objects import Pod
|
||||
from pykube.query import Query
|
||||
from yarl import URL
|
||||
|
||||
from .cluster_manager import ClusterNotFound
|
||||
from .resource_registry import ResourceTypeNotFound
|
||||
from .selector import parse_selector, selector_matches
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from aiohttp import web
|
||||
|
||||
from kube_web import query_params as qp
|
||||
|
||||
from .selector import parse_selector
|
||||
from .selector import selector_matches
|
||||
from .table import add_label_columns
|
||||
from .table import filter_table
|
||||
from .table import filter_table_by_predicate
|
||||
from .table import guess_column_classes
|
||||
from .table import merge_cluster_tables
|
||||
from .table import remove_columns
|
||||
from .table import sort_table
|
||||
from kube_web import __version__
|
||||
from kube_web import kubernetes
|
||||
from kube_web import jinja2_filters
|
||||
from .table import (
|
||||
add_label_columns,
|
||||
filter_table_by_predicate,
|
||||
filter_table,
|
||||
remove_columns,
|
||||
guess_column_classes,
|
||||
sort_table,
|
||||
merge_cluster_tables,
|
||||
)
|
||||
from kube_web import kubernetes
|
||||
from kube_web import query_params as qp
|
||||
|
||||
# import tracemalloc
|
||||
# tracemalloc.start()
|
||||
|
|
@ -854,7 +852,7 @@ async def get_resource_list(request, session):
|
|||
tables = []
|
||||
tables_by_resource_type = {}
|
||||
errors_by_cluster = collections.defaultdict(list)
|
||||
for clazz, table, error in await asyncio.gather(*tasks):
|
||||
for _clazz, table, error in await asyncio.gather(*tasks):
|
||||
if error:
|
||||
if len(clusters) == 1:
|
||||
# directly re-raise the exception as single cluster was given
|
||||
|
|
@ -1334,7 +1332,7 @@ async def get_search(request, session):
|
|||
for _cluster in request.app[CLUSTER_MANAGER].clusters:
|
||||
is_match = search_query_lower in _cluster.name.lower()
|
||||
if not is_match:
|
||||
for key, val in _cluster.labels.items():
|
||||
for val in _cluster.labels.values():
|
||||
if search_query_lower in val.lower():
|
||||
is_match = True
|
||||
break
|
||||
|
|
@ -1369,7 +1367,7 @@ async def get_search(request, session):
|
|||
clazz = await _cluster.resource_registry.get_class_by_plural_name(
|
||||
resource_type, False
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
if i >= len(clusters) - 1:
|
||||
raise
|
||||
else:
|
||||
|
|
@ -1447,7 +1445,7 @@ async def auth(request, handler):
|
|||
original_url = base64.urlsafe_b64decode(request.query["state"]).decode(
|
||||
"utf-8"
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
original_url = "/"
|
||||
redirect_uri = str(request.url.with_path(OAUTH2_CALLBACK_PATH))
|
||||
access_token, data = await client.get_access_token(
|
||||
|
|
|
|||
|
|
@ -1,18 +1,19 @@
|
|||
import yaml
|
||||
from tempfile import NamedTemporaryFile
|
||||
import logging
|
||||
from pytest import fixture
|
||||
from pathlib import Path
|
||||
import os
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
from tempfile import NamedTemporaryFile
|
||||
from typing import Generator
|
||||
|
||||
import yaml
|
||||
from pytest import fixture
|
||||
from requests_html import HTMLSession
|
||||
|
||||
kind_cluster_name = "kube-web-view-e2e"
|
||||
|
||||
|
||||
@fixture(scope="session")
|
||||
def cluster(kind_cluster) -> dict:
|
||||
def cluster(kind_cluster) -> Generator[dict, None, None]:
|
||||
docker_image = os.getenv("TEST_IMAGE")
|
||||
kind_cluster.load_docker_image(docker_image)
|
||||
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ def test_list_resources_in_all_clusters(session):
|
|||
|
||||
|
||||
def test_list_pods_wrong_container_image(session):
|
||||
for i in range(10):
|
||||
for _ in range(10):
|
||||
response = session.get(
|
||||
"/clusters/local/namespaces/default/pods?selector=e2e=wrong-container-image"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -152,11 +152,11 @@ def test_object_links(session):
|
|||
|
||||
|
||||
def test_link_added_by_prerender_hook(session):
|
||||
response = session.get("/clusters/local/namespaces/default/deployments/kube-web-view")
|
||||
response = session.get(
|
||||
"/clusters/local/namespaces/default/deployments/kube-web-view"
|
||||
)
|
||||
response.raise_for_status()
|
||||
check_links(response, session)
|
||||
|
||||
link = response.html.find("main h1 a.is-link", first=True)
|
||||
assert link.attrs["href"].startswith(
|
||||
"#this-is-a-custom-link"
|
||||
)
|
||||
assert link.attrs["href"].startswith("#this-is-a-custom-link")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import datetime
|
||||
|
||||
|
||||
from kube_web.jinja2_filters import age_color, yaml, pluralize
|
||||
from kube_web.jinja2_filters import age_color
|
||||
from kube_web.jinja2_filters import pluralize
|
||||
from kube_web.jinja2_filters import yaml
|
||||
|
||||
|
||||
def test_yaml():
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
from kube_web.main import parse_args, main
|
||||
from kube_web.cluster_discovery import KubeconfigDiscoverer
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from kube_web.cluster_discovery import KubeconfigDiscoverer
|
||||
from kube_web.main import main
|
||||
from kube_web.main import parse_args
|
||||
|
||||
|
||||
def test_parse_clusters():
|
||||
args = parse_args(["--clusters=foo=https://foo;bar=https://bar"])
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from kube_web.selector import parse_selector, selector_matches
|
||||
from kube_web.selector import parse_selector
|
||||
from kube_web.selector import selector_matches
|
||||
|
||||
|
||||
def test_parse_selector():
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
import os
|
||||
import pytest
|
||||
import timeit
|
||||
|
||||
import pytest
|
||||
from pykube import Pod
|
||||
from pykube.query import Table
|
||||
|
||||
from kube_web.table import (
|
||||
add_label_columns,
|
||||
remove_columns,
|
||||
filter_table_by_predicate,
|
||||
filter_table,
|
||||
sort_table,
|
||||
merge_cluster_tables,
|
||||
)
|
||||
from kube_web.table import add_label_columns
|
||||
from kube_web.table import filter_table
|
||||
from kube_web.table import filter_table_by_predicate
|
||||
from kube_web.table import merge_cluster_tables
|
||||
from kube_web.table import remove_columns
|
||||
from kube_web.table import sort_table
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import re
|
||||
from kube_web.web import generate_name_from_spec, is_allowed_namespace
|
||||
|
||||
from kube_web.web import generate_name_from_spec
|
||||
from kube_web.web import is_allowed_namespace
|
||||
|
||||
|
||||
def test_generate_name_from_spec():
|
||||
|
|
|
|||
Yükleniyor…
Yeni konuda referans