From fb29f474061115c5c506038be80c70e3c62ada18 Mon Sep 17 00:00:00 2001 From: Lance Austin Date: Mon, 8 Aug 2022 08:54:50 -0500 Subject: [PATCH 1/4] build: add python-dev-setup target Although this exist in other places it has a lot of dependencies and is hard to figure out what command to run. This adds a simple target that only needs to be run once when developing against the python components of emissary-ingress. It provides a simple developer QOL improvement. Signed-off-by: Lance Austin --- Makefile | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/Makefile b/Makefile index 4215b3fc8e..d8f66a337e 100644 --- a/Makefile +++ b/Makefile @@ -99,3 +99,52 @@ deploy-only: preflight-dev-kubeconfig $(tools/kubectl) build-output/yaml-$(patsu @printf "$(GRN)Your ambassador image:$(END) $(BLD)$$($(tools/kubectl) --kubeconfig $(DEV_KUBECONFIG) get -n ambassador deploy ambassador -o 'go-template={{(index .spec.template.spec.containers 0).image}}')$(END)\n" @printf "$(GRN)Your built image:$(END) $(BLD)$$(sed -n 2p docker/$(LCNAME).docker.push.remote)$(END)\n" .PHONY: deploy-only + +############################################## +##@ Telepresence based runners +############################################## + +.PHONY: tel-quit +tel-quit: ## Quit telepresence + telepresence quit + +tel-list: ## List intercepts + telepresence list + +EMISSARY_AGENT_ENV=emissary-agent.env + +.PHONY: intercept-emissary-agent +intercept-emissary-agent: + telepresence intercept --namespace ambassador ambassador-agent -p 8080:http \ + --http-header=test-$(USER)=1 --preview-url=false --env-file $(EMISSARY_AGENT_ENV) + +.PHONY: leave-emissary-agent +leave-emissary-agent: + telepresence leave ambassador-agent-ambassador + +RUN_EMISSARY_AGENT=bin/run-emissary-agent.sh +$(RUN_EMISSARY_AGENT): + @test -e $(EMISSARY_AGENT_ENV) || echo "Environment file $(EMISSARY_AGENT_ENV) does not exist, please run 'make intercept-emissary-agent' to create it." + echo 'AES_LOG_LEVEL=debug AES_SNAPSHOT_URL=http://ambassador-admin.ambassador:8005/snapshot-external AES_DIAGNOSTICS_URL="http://ambassador-admin.ambassador:8877/ambassador/v0/diag/?json=true" AES_REPORT_DIAGNOSTICS_TO_CLOUD=true go run ./cmd/busyambassador agent' >> $(RUN_EMISSARY_AGENT) + chmod a+x $(RUN_EMISSARY_AGENT) + +.PHONY: irun-emissary-agent +irun-emissary-agent: bin/run-emissary-agent.sh ## Run emissary-agent using the environment variables fetched by the intercept. + bin/run-emissary-agent.sh + +## Helper target for setting up local dev environment when working with python components +## such as pytests, diagd, etc... +.PHONY: python-dev-setup +python-dev-setup: +# recreate venv and upgrade pip + rm -rf venv + python3 -m venv venv + venv/bin/python3 -m pip install --upgrade pip + +# install deps, dev deps and diagd + ./venv/bin/pip install -r python/requirements.txt + ./venv/bin/pip install -r python/requirements-dev.txt + ./venv/bin/pip install -e python + +# activate venv + @echo "run 'source ./venv/bin/activate' to activate venv in local shell" From c20846266ad7412d8a675283cc4ebae4618641cc Mon Sep 17 00:00:00 2001 From: Lance Austin Date: Mon, 8 Aug 2022 08:58:32 -0500 Subject: [PATCH 2/4] deps: upgrade flask version Updates to the latest flask version to address cve warnings and ensures we are on the latest release for our deps. It also updated a few of the indirect dependencies for flask Signed-off-by: Lance Austin --- python/requirements.txt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/python/requirements.txt b/python/requirements.txt index 64234f57e9..33c968f130 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -24,7 +24,7 @@ durationpy==0.5 # via -r requirements.in expiringdict==1.2.1 # via -r requirements.in -flask==2.0.2 +flask==2.2.1 # via -r requirements.in google-auth==2.6.0 # via kubernetes @@ -32,9 +32,11 @@ gunicorn==20.1.0 # via -r requirements.in idna==3.3 # via requests +importlib-metadata==4.12.0 + # via flask itsdangerous==2.0.1 # via flask -jinja2==3.0.3 +jinja2==3.1.2 # via flask jsonpatch==1.32 # via -r requirements.in @@ -44,8 +46,10 @@ jsonschema==4.4.0 # via -r requirements.in kubernetes==21.7.0 # via -r requirements.in -markupsafe==2.0.1 - # via jinja2 +markupsafe==2.1.1 + # via + # jinja2 + # werkzeug oauthlib==3.2.0 # via requests-oauthlib orjson==3.6.6 @@ -92,11 +96,13 @@ urllib3==1.26.8 # requests websocket-client==1.2.3 # via kubernetes -werkzeug==2.0.2 +werkzeug==2.2.1 # via flask +zipp==3.8.1 + # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: -setuptools==60.7.1 +setuptools==63.4.2 # via # -r requirements.in # gunicorn From 95a358f6fabc2dfd6b2319c7e9bbccafc2861f07 Mon Sep 17 00:00:00 2001 From: David Dymko Date: Tue, 13 Sep 2022 08:27:11 -0400 Subject: [PATCH 3/4] dep: make gen Signed-off-by: David Dymko --- DEPENDENCIES.md | 10 ++++++---- tools/src/py-mkopensource/main.go | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index 77c8fe8db8..00878337fd 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -142,11 +142,11 @@ libraries: ---- ------- ---------- CacheControl 0.12.10 Apache License 2.0 Cython 0.29.24 Apache License 2.0 - Flask 2.0.2 3-clause BSD license - Jinja2 3.0.3 3-clause BSD license - MarkupSafe 2.0.1 3-clause BSD license + Flask 2.2.1 3-clause BSD license + Jinja2 3.1.2 3-clause BSD license + MarkupSafe 2.1.1 3-clause BSD license PyYAML 5.4.1 MIT license - Werkzeug 2.0.2 3-clause BSD license + Werkzeug 2.2.1 3-clause BSD license appdirs 1.4.4 MIT license attrs 21.4.0 MIT license cachetools 5.0.0 MIT license @@ -164,6 +164,7 @@ libraries: gunicorn 20.1.0 MIT license html5lib 1.1 MIT license idna 3.3 3-clause BSD license + importlib-metadata 4.12.0 Apache License 2.0 itsdangerous 2.0.1 3-clause BSD license jsonpatch 1.32 3-clause BSD license jsonpointer 2.2 3-clause BSD license @@ -197,3 +198,4 @@ libraries: urllib3 1.26.8 MIT license webencodings 0.5.1 3-clause BSD license websocket-client 1.2.3 Apache License 2.0 + zipp 3.8.1 MIT license diff --git a/tools/src/py-mkopensource/main.go b/tools/src/py-mkopensource/main.go index f6a2fc981b..1cc15a0c09 100644 --- a/tools/src/py-mkopensource/main.go +++ b/tools/src/py-mkopensource/main.go @@ -68,7 +68,7 @@ func parseLicenses(name, version, license string) map[License]struct{} { {"webencodings", "0.5.1", "BSD"}: {BSD3}, {"websocket-client", "0.57.0", "BSD"}: {BSD3}, {"websocket-client", "1.2.3", "Apache-2.0"}: {Apache2}, - {"zipp", "3.6.0", "UNKNOWN"}: {MIT}, + {"zipp", "3.8.1", "None"}: {MIT}, // These are packages with non-trivial strings to parse, and // it's easier to just hard-code it. From 94f38f822ffcd8d9d6c8af3eccfdde663e36c615 Mon Sep 17 00:00:00 2001 From: David Dymko Date: Tue, 13 Sep 2022 10:26:38 -0400 Subject: [PATCH 4/4] dep: make gen Signed-off-by: David Dymko --- tools/src/py-mkopensource/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/src/py-mkopensource/main.go b/tools/src/py-mkopensource/main.go index 1cc15a0c09..a54bdc1a2e 100644 --- a/tools/src/py-mkopensource/main.go +++ b/tools/src/py-mkopensource/main.go @@ -44,6 +44,7 @@ func parseLicenses(name, version, license string) map[License]struct{} { {"gitdb", "4.0.5", "BSD License"}: {BSD3}, {"idna", "2.7", "BSD-like"}: {BSD3, PSF, Unicode2015}, {"idna", "2.8", "BSD-like"}: {BSD3, PSF, Unicode2015}, + {"importlib-metadata", "4.12.0", "None"}: {Apache2}, {"importlib-resources", "5.4.0", "UNKNOWN"}: {Apache2}, {"itsdangerous", "1.1.0", "BSD"}: {BSD3}, {"jsonpatch", "1.32", "Modified BSD License"}: {BSD3},