mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-17 12:28:07 +00:00
adding option to only deploy the rbac resources (#818)
adds option to only deploy the rbac resources closes #814
This commit is contained in:
@ -888,11 +888,14 @@ def arg_file(arg: str) -> str:
|
|||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
states = [
|
rbac_only_states = [
|
||||||
("check_region", Client.check_region),
|
("check_region", Client.check_region),
|
||||||
("rbac", Client.setup_rbac),
|
("rbac", Client.setup_rbac),
|
||||||
("arm", Client.deploy_template),
|
("arm", Client.deploy_template),
|
||||||
("assign_scaleset_identity_role", Client.assign_scaleset_identity_role),
|
("assign_scaleset_identity_role", Client.assign_scaleset_identity_role),
|
||||||
|
]
|
||||||
|
|
||||||
|
full_deployment_states = rbac_only_states + [
|
||||||
("apply_migrations", Client.apply_migrations),
|
("apply_migrations", Client.apply_migrations),
|
||||||
("queues", Client.create_queues),
|
("queues", Client.create_queues),
|
||||||
("eventgrid", Client.create_eventgrid),
|
("eventgrid", Client.create_eventgrid),
|
||||||
@ -948,8 +951,8 @@ def main() -> None:
|
|||||||
parser.add_argument("--client_secret")
|
parser.add_argument("--client_secret")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--start_at",
|
"--start_at",
|
||||||
default=states[0][0],
|
default=full_deployment_states[0][0],
|
||||||
choices=[x[0] for x in states],
|
choices=[x[0] for x in full_deployment_states],
|
||||||
help=(
|
help=(
|
||||||
"Debug deployments by starting at a specific state. "
|
"Debug deployments by starting at a specific state. "
|
||||||
"NOT FOR PRODUCTION USE. (default: %(default)s)"
|
"NOT FOR PRODUCTION USE. (default: %(default)s)"
|
||||||
@ -994,6 +997,12 @@ def main() -> None:
|
|||||||
"--subscription_id",
|
"--subscription_id",
|
||||||
type=str,
|
type=str,
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--rbac_only",
|
||||||
|
action="store_true",
|
||||||
|
help="execute only the steps required to create the rbac resources",
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if shutil.which("func") is None:
|
if shutil.which("func") is None:
|
||||||
@ -1030,6 +1039,15 @@ def main() -> None:
|
|||||||
|
|
||||||
logging.getLogger("deploy").setLevel(logging.INFO)
|
logging.getLogger("deploy").setLevel(logging.INFO)
|
||||||
|
|
||||||
|
if args.rbac_only:
|
||||||
|
logger.warning(
|
||||||
|
"'rbac_only' specified. The deployment will execute "
|
||||||
|
"only the steps required to create the rbac resources"
|
||||||
|
)
|
||||||
|
states = rbac_only_states
|
||||||
|
else:
|
||||||
|
states = full_deployment_states
|
||||||
|
|
||||||
if args.start_at != states[0][0]:
|
if args.start_at != states[0][0]:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"*** Starting at a non-standard deployment state. "
|
"*** Starting at a non-standard deployment state. "
|
||||||
|
Reference in New Issue
Block a user