Skip to content

Commit

Permalink
use secrets_from
Browse files Browse the repository at this point in the history
  • Loading branch information
drmorr0 committed Jun 24, 2024
1 parent 3e4ad72 commit 31ea777
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 68 deletions.
16 changes: 6 additions & 10 deletions k8s/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,27 @@
SERVER_PORT = 1234


class Prom2Parquet(fire.AppPackage):
class Prom2parquet(fire.AppPackage):
def __init__(self):
try:
with open(os.getenv('BUILD_DIR') + f'/{self.id}-image') as f:
with open(os.getenv('BUILD_DIR') + f'/{self.id()}-image') as f:
image = f.read()
except FileNotFoundError:
image = 'PLACEHOLDER'

env = (fire.EnvBuilder({"AWS_DEFAULT_REGION": "us-east-1"})
.with_secret("AWS_ACCESS_KEY_ID", "simkube", "aws_access_key_id")
.with_secret("AWS_SECRET_ACCESS_KEY", "simkube", "aws_secret_access_key")
.with_secrets_from("simkube")
)

container = fire.ContainerBuilder(
name=self.id,
name=self.id(),
image=image,
args=[
"/prom2parquet",
],
).with_env(env).with_ports(SERVER_PORT).with_security_context(Capability.DEBUG)

self._depl = (fire.DeploymentBuilder(app_label=self.id)
self._depl = (fire.DeploymentBuilder(app_label=self.id())
.with_containers(container)
.with_service()
.with_node_selector("type", "kind-worker")
Expand All @@ -40,15 +39,12 @@ def __init__(self):
def compile(self, chart: Construct):
self._depl.build(chart)

@property
def id(self) -> str:
return "prom2parquet"

if __name__ == "__main__":
dag_path = f"{os.getenv('BUILD_DIR')}/{DAG_FILENAME}"
diff_path = f"{os.getenv('BUILD_DIR')}/{DIFF_FILENAME}"
graph, diff = fire.compile({
"monitoring": [Prom2Parquet()],
"monitoring": [Prom2parquet()],
}, dag_path)

with open(dag_path, "w") as f:
Expand Down
117 changes: 63 additions & 54 deletions k8s/poetry.lock

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

7 changes: 3 additions & 4 deletions k8s/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
[tool.poetry]
name = "manifests"
version = "0.1.0"
description = ""
authors = ["David Morrison <[email protected]>"]
package-mode = false

[tool.poetry.dependencies]
python = "^3.11"
cdk8s = "^2"
fireconfig = { git = "https://github.com/acrlabs/fireconfig", tag = "v0.5.1" }
fireconfig = { path = "../../fireconfig", develop = true }
# fireconfig = { git = "https://github.com/acrlabs/fireconfig", tag = "v0.5.1" }

[tool.poetry.group.dev.dependencies]
mypy = "^1"
Expand Down

0 comments on commit 31ea777

Please sign in to comment.