Skip to content

Commit

Permalink
feat: implement transpire object apply
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhiljha committed Mar 30, 2023
1 parent 08f02da commit eb2940f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions transpire/internal/cli/obj.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import subprocess
import sys
from pathlib import Path
from shutil import rmtree
Expand Down Expand Up @@ -52,6 +53,17 @@ def list_manifests(app_name: Optional[str] = None, **_) -> None:

@commands.command()
@click.argument("app_name", required=True)
def apply(app_name: str, **_):
def apply(app_name: str, **_) -> None:
"""build objects, apply them to current kubernetes context"""
return NotImplemented
# TODO: We should probably use the Kubernetes API here instead of shelling out.
# That said, we do want this to behave exactly like kubectl apply, and what better
# way to do that than to actually use kubectl apply? So maybe we don't want that.
module = get_config(app_name)
subprocess.run(
["kubectl", "create", "ns", module.namespace],
check=False,
)
subprocess.run(
["kubectl", "apply", "-n", module.namespace, "-f", "-"],
input=yaml.safe_dump_all(module.objects).encode("utf_8"),
)

0 comments on commit eb2940f

Please sign in to comment.