Kubernetes Web View to list and view all Kubernetes resources https://kube-web-view.readthedocs.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.5KB

  1. .PHONY: clean test appjs docker push mock
  2. IMAGE ?= hjacobs/kube-web-view
  3. GITDIFFHASH = $(shell git diff | md5sum | cut -c 1-4)
  4. VERSION ?= $(shell git describe --tags --always --dirty=-dirty-$(GITDIFFHASH))
  5. VERSIONPY = $(shell echo $(VERSION) | cut -d- -f 1)
  6. TAG ?= $(VERSION)
  7. TTYFLAGS = $(shell test -t 0 && echo "-it")
  8. OSNAME := $(shell uname | perl -ne 'print lc($$_)')
  9. default: docker
  10. .PHONY: poetry
  11. poetry:
  12. poetry install
  13. .PHONY: test
  14. test: poetry lint test.unit test.e2e
  15. .PHONY: lint
  16. lint:
  17. poetry run flake8
  18. poetry run black --check kube_web
  19. poetry run mypy --ignore-missing-imports kube_web
  20. .PHONY: test.unit
  21. test.unit:
  22. poetry run coverage run --source=kube_web -m py.test tests/unit
  23. poetry run coverage report
  24. .PHONY: test.e2e
  25. test.e2e: docker
  26. env TEST_IMAGE=$(IMAGE):$(TAG) \
  27. poetry run pytest -v -r=a \
  28. --log-cli-level info \
  29. --log-cli-format '%(asctime)s %(levelname)s %(message)s' \
  30. --cluster-name kube-web-view-e2e \
  31. tests/e2e
  32. docker:
  33. docker build --build-arg "VERSION=$(VERSION)" -t "$(IMAGE):$(TAG)" .
  34. @echo 'Docker image $(IMAGE):$(TAG) can now be used.'
  35. push: docker
  36. docker push "$(IMAGE):$(TAG)"
  37. docker tag "$(IMAGE):$(TAG)" "$(IMAGE):latest"
  38. docker push "$(IMAGE):latest"
  39. mock:
  40. docker run $(TTYFLAGS) -p 8080:8080 "$(IMAGE):$(TAG)" --mock
  41. .PHONY: docs
  42. docs:
  43. poetry run sphinx-build docs docs/_build
  44. .PHONY: run
  45. run:
  46. poetry run python3 -m kube_web --show-container-logs --debug "--object-links=ingresses=javascript:alert('{name}')" "--label-links=application=javascript:alert('Application label has value {label_value}')|eye|This is a link!" --preferred-api-versions=deployments=apps/v1
  47. .PHONY: run.kind
  48. run.kind:
  49. 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
  50. .PHONY: mirror
  51. mirror:
  52. git push --mirror git@github.com:hjacobs/kube-web-view.git
  53. .PHONY: version
  54. version:
  55. # poetry only accepts a narrow version format
  56. sed -i "s/^version = .*/version = \"${VERSIONPY}\"/" pyproject.toml
  57. sed -i "s/^version = .*/version = \"${VERSION}\"/" docs/conf.py
  58. sed -i "s/^__version__ = .*/__version__ = \"${VERSION}\"/" kube_web/__init__.py
  59. sed -i "s/v=[0-9A-Za-z._-]*/v=${VERSION}/g" kube_web/templates/base.html