Skip to content

Commit

Permalink
Allows bonfire to deploy to an operator-created namespace (#143)
Browse files Browse the repository at this point in the history
* Allows bonfire to deploy to an ns operator-created namespace

Co-authored-by: Brandon Squizzato <[email protected]>
  • Loading branch information
Jason-RH and bsquizz authored Oct 28, 2021
1 parent b2ffdd4 commit aafce9a
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion bonfire/bonfire.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,16 @@ def _cmd_config_deploy(
):
"""Process app templates and deploy them to a cluster"""
requested_ns = namespace
used_ns_reservation_system, ns = _get_target_namespace(duration, retries, requested_ns)

log.debug("checking if namespace has been reserved via ns operator...")
operator_reservation = get_reservation(namespace=requested_ns)

if not operator_reservation:
log.debug("no ns operator reservation found, using old ns reservation system")
used_ns_reservation_system, ns = _get_target_namespace(duration, retries, requested_ns)
else:
log.debug("found existing ns operator reservation")
used_ns_reservation_system, ns = False, requested_ns

if import_secrets:
import_secrets_from_dir(secrets_dir)
Expand Down Expand Up @@ -1266,6 +1275,12 @@ def _err_handler(err):
msg = f"reservation extension failed: {str(err)}"
_error(msg)

if not (name or namespace or requester):
_err_handler(
"To extend a reservation provide one of name, "
"namespace, or requester. See 'bonfire reservation extend -h'"
)

try:
res = get_reservation(name, namespace, requester)
if res:
Expand Down Expand Up @@ -1303,6 +1318,12 @@ def _err_handler(err):
msg = f"reservation deletion failed: {str(err)}"
_error(msg)

if not (name or namespace or requester):
_err_handler(
"To delete a reservation provide one of name, "
"namespace, or requester. See 'bonfire reservation delete -h'"
)

try:
res = get_reservation(name, namespace, requester)
if res:
Expand Down

0 comments on commit aafce9a

Please sign in to comment.