Skip to content

Commit

Permalink
fix how we check in the TUI if bitwarden credentials are required (#103)
Browse files Browse the repository at this point in the history
* fix how we check in the TUI if bitwarden credentials are required

* update alpha version

* updating poetry lock

* fix argo_cd typo

* updates docker container pull for bweso
  • Loading branch information
jessebot authored Dec 2, 2023
1 parent a8d8bdc commit a6d93e7
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 19 deletions.
30 changes: 25 additions & 5 deletions poetry.lock

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "smol_k8s_lab"
version = "2.0.0a2"
version = "2.0.0a3"
description = "Bootstrap simple projects on Kubernetes with kind, k3d, and k3s. this is an alpha release"
authors = ["Jesse Hitch <[email protected]>",
"Max Roby <[email protected]>"]
Expand Down
4 changes: 2 additions & 2 deletions smol_k8s_lab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def main(config: str = "",
# if we're using bitwarden, unlock the vault
pw_mngr = USR_CFG['smol_k8s_lab']['local_password_manager']
using_bw_pw_manager = pw_mngr['enabled'] and pw_mngr['name'] == 'bitwarden'
using_bweso = USR_CFG['apps']['bitwarden_eso_provider']['enabled']
using_bweso = SECRETS['global_external_secrets']

if using_bw_pw_manager or using_bweso:
# get bitwarden credentials from the env if there are any
Expand Down Expand Up @@ -216,7 +216,7 @@ def main(config: str = "",
apps.pop('ingress_nginx'),
apps['cert_manager'],
argo_enabled,
apps['argocd']['argo']['directory_recursion'],
apps['argo_cd']['argo']['directory_recursion'],
SECRETS,
bw)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def setup_bweso_provider(k8s_obj: K8s, distro: str, bitwarden: BwCLI = None) ->
"BW_HOST": bitwarden.host})

if distro == 'kind':
image = "docker.io/jessebot/bweso:v0.5.0"
image = "docker.io/jessebot/bweso:v0.4.0"
cmds = [f"docker pull --platform=linux/amd64 {image}",
f"kind load docker-image {image} --name smol-k8s-lab-kind"]
subproc(cmds)
Expand Down
13 changes: 3 additions & 10 deletions smol_k8s_lab/tui/confirm_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,14 @@ def confirm_or_back_button(self, event: Button.Pressed) -> None:
"""
if event.button.id == "confirm-button":
# First, check if we need bitwarden credentials before proceeding

# this is the official small-hack repo
repo = "https://github.com/small-hack/argocd-apps"
pw_mngr = self.smol_k8s_cfg['local_password_manager']
bweso = self.apps['bitwarden_eso_provider']


secrets_provider = self.cfg['apps_global_config']['external_secrets']

# if local_password_manager is enabled, and is bitwarden
local_bitwarden = pw_mngr['enabled'] and pw_mngr['name'] == "bitwarden"

# check if bweso is enabled and we're using the default repo
official_bweso = bweso['enabled'] and bweso['argo']['repo'] == repo

# if local password manager is bitwarden/enabled or we're using bweso
if local_bitwarden or official_bweso:
if local_bitwarden or secrets_provider == 'bitwarden':
self.get_bitwarden_credentials()
else:
self.append_sensitive_values()
Expand Down

0 comments on commit a6d93e7

Please sign in to comment.