Skip to content

Commit

Permalink
Merge pull request #303 from opsani/fred/eng-101-argo-rollout-support
Browse files Browse the repository at this point in the history
Fred/eng 101 argo rollout support
  • Loading branch information
linkous8 authored Aug 13, 2021
2 parents 172d813 + 7b7f944 commit efd4eb4
Show file tree
Hide file tree
Showing 15 changed files with 1,867 additions and 208 deletions.
15 changes: 10 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ typer = "^0.3.0"
bullet = "^2.1.0"
jsonschema = "^3.2.0"
timeago = "^1.0.14"
kubernetes_asyncio = ">=11.3,<13.0"
orjson = "^3.5.0"
uvloop = "^0.15.2"
statesman = "^1.0.0"
Expand All @@ -37,6 +36,7 @@ toml = "^0.10.2"
colorama = "^0.4.4"
pyfiglet = "^0.8.post1"
curlify2 = "^1.0.0"
kubernetes-asyncio = {git = "https://github.com/opsani/kubernetes_asyncio", rev = "v12.1.2-custom-resource-patch-fix"}

[tool.poetry.dev-dependencies]
pytest = "^6.2.4"
Expand Down Expand Up @@ -81,6 +81,7 @@ pytest-vscodedebug = "^0.1.0"
pytest-html = "^3.1.1"
bandit = "^1.7.0"
watchgod = "^0.7"
filelock = "^3.0.12"

[tool.poetry.scripts]
servo = "servo.entry_points:run_cli"
Expand Down
2 changes: 1 addition & 1 deletion servo/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ async def run_all(
spec = getattr(method, "__check__", None)
if spec:
# once all filtered methods are removed, only run non-decorated
if not spec.critical or not filtered_methods:
if not spec.critical or not filtered_methods or (matching and matching.exclusive):
continue

check = await method() if asyncio.iscoroutinefunction(method) else method()
Expand Down
17 changes: 15 additions & 2 deletions servo/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1729,8 +1729,8 @@ def inject_sidecar(
"""
Inject an Envoy sidecar to capture metrics
"""
if not target.startswith(("deploy/", "deployment/", "pod/")):
raise typer.BadParameter("target must prefixed with Kubernetes object kind of \"deployment\" or \"pod\"")
if not target.startswith(("deploy/", "deployment/", "pod/", "rollout/")):
raise typer.BadParameter("target must prefixed with Kubernetes object kind of \"deployment\", \"rollout\" or \"pod\"")

if not (service or port):
raise typer.BadParameter("service or port must be given")
Expand Down Expand Up @@ -1759,6 +1759,19 @@ def inject_sidecar(
)
typer.echo(f"Envoy sidecar injected to Deployment {deployment.name} in {namespace}")

elif target.startswith("rollout"):
rollout = run_async(
servo.connectors.kubernetes.Rollout.read(
target.split('/', 1)[1], namespace
)
)
run_async(
rollout.inject_sidecar(
'opsani-envoy', ENVOY_SIDECAR_IMAGE_TAG, service=service, port=port
)
)
typer.echo(f"Envoy sidecar injected to Rollout {rollout.name} in {namespace}")

elif target.startswith("pod"):
raise typer.BadParameter("Pod sidecar injection is not yet implemented")
else:
Expand Down
Loading

0 comments on commit efd4eb4

Please sign in to comment.