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.

Makefile 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. TAG ?= $(VERSION)
  6. TTYFLAGS = $(shell test -t 0 && echo "-it")
  7. OSNAME := $(shell uname | perl -ne 'print lc($$_)')
  8. default: docker
  9. clean:
  10. rm -f ./kind ./kubectl
  11. kind:
  12. curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.4.0/kind-$(OSNAME)-amd64
  13. chmod +x ./kind
  14. kubectl:
  15. curl -LO https://storage.googleapis.com/kubernetes-release/release/$$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/$(OSNAME)/amd64/kubectl
  16. chmod +x ./kubectl
  17. .PHONY: poetry
  18. poetry:
  19. poetry install
  20. .PHONY: test
  21. test: poetry lint test.unit test.e2e
  22. .PHONY: lint
  23. lint:
  24. flake8
  25. poetry run black --check kube_web
  26. .PHONY: test.unit
  27. test.unit:
  28. poetry run coverage run --source=kube_web -m py.test tests/unit
  29. poetry run coverage report
  30. .PHONY: test.e2e
  31. test.e2e: kind kubectl docker
  32. env TEST_KIND=./kind TEST_KUBECTL=./kubectl TEST_IMAGE=$(IMAGE):$(TAG) \
  33. poetry run pytest -v -r=a \
  34. --log-cli-level info \
  35. --log-cli-format '%(asctime)s %(levelname)s %(message)s' \
  36. tests/e2e $(PYTEST_OPTIONS)
  37. .PHONY: clean.e2e
  38. clean.e2e:
  39. ./kind delete cluster --name=kube-web-view-e2e
  40. docker:
  41. docker build --build-arg "VERSION=$(VERSION)" -t "$(IMAGE):$(TAG)" .
  42. @echo 'Docker image $(IMAGE):$(TAG) can now be used.'
  43. push: docker
  44. docker push "$(IMAGE):$(TAG)"
  45. docker tag "$(IMAGE):$(TAG)" "$(IMAGE):latest"
  46. docker push "$(IMAGE):latest"
  47. mock:
  48. docker run $(TTYFLAGS) -p 8080:8080 "$(IMAGE):$(TAG)" --mock
  49. .PHONY: docs
  50. docs:
  51. poetry run sphinx-build docs docs/_build
  52. .PHONY: run
  53. run:
  54. 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}')"
  55. .PHONY: run.kind
  56. run.kind:
  57. poetry run python3 -m kube_web --kubeconfig-path=$$(./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
  58. .PHONY: mirror
  59. mirror:
  60. git push --mirror git@github.com:hjacobs/kube-web-view.git
  61. .PHONY: version
  62. version:
  63. sed -i "s/version = .*/version = \"${VERSION}\"/" pyproject.toml
  64. sed -i "s/__version__ = .*/__version__ = '${VERSION}'/" kube_web/__init__.py
  65. sed -i "s/BUILD_VERSION/${VERSION}/g" kube_web/templates/base.html