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.
 
 
 
 
 
 

73 lines
2.4 KiB

  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 pre-commit run --all-files
  18. .PHONY: test.unit
  19. test.unit:
  20. poetry run coverage run --source=kube_web -m py.test tests/unit
  21. poetry run coverage report
  22. .PHONY: test.e2e
  23. test.e2e: docker
  24. env TEST_IMAGE=$(IMAGE):$(TAG) \
  25. poetry run pytest -v -r=a \
  26. --log-cli-level info \
  27. --log-cli-format '%(asctime)s %(levelname)s %(message)s' \
  28. --cluster-name kube-web-view-e2e \
  29. tests/e2e
  30. docker:
  31. docker build --build-arg "VERSION=$(VERSION)" -t "$(IMAGE):$(TAG)" .
  32. @echo 'Docker image $(IMAGE):$(TAG) can now be used.'
  33. push: docker
  34. docker push "$(IMAGE):$(TAG)"
  35. docker tag "$(IMAGE):$(TAG)" "$(IMAGE):latest"
  36. docker push "$(IMAGE):latest"
  37. mock:
  38. docker run $(TTYFLAGS) -p 8080:8080 "$(IMAGE):$(TAG)" --mock
  39. .PHONY: docs
  40. docs:
  41. poetry run sphinx-build docs docs/_build
  42. .PHONY: run
  43. run:
  44. 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
  45. .PHONY: run.kind
  46. run.kind:
  47. poetry run python3 -m kube_web --kubeconfig-context=kind-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
  48. .PHONY: mirror
  49. mirror:
  50. git push --mirror git@github.com:hjacobs/kube-web-view.git
  51. .PHONY: version
  52. version:
  53. # poetry only accepts a narrow version format
  54. sed -i "s/^version = .*/version = \"${VERSIONPY}\"/" pyproject.toml
  55. sed -i "s/^version = .*/version = \"${VERSION}\"/" docs/conf.py
  56. sed -i "s/^__version__ = .*/__version__ = \"${VERSION}\"/" kube_web/__init__.py
  57. sed -i "s/v=[0-9A-Za-z._-]*/v=${VERSION}/g" kube_web/templates/base.html