Skip to content

Commit

Permalink
adding ASUP URL override option to --v3 manage cluster
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Haigh <[email protected]>
  • Loading branch information
MichaelHaigh committed May 29, 2024
1 parent ac33608 commit 5d552ea
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions astraSDK/buckets.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def main(self, nameFilter=None, provider=None):

if ret.ok:
buckets = super().jsonifyResults(ret)
if buckets is None:
return False
bucketsCooked = copy.deepcopy(buckets)
for counter, bucket in enumerate(buckets.get("items")):
if nameFilter and nameFilter.lower() not in bucket.get("name").lower():
Expand Down
4 changes: 4 additions & 0 deletions astraSDK/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,7 @@ def main(
registry=None,
label=None, # should be of 'acs.example.com/policy=allowed' format
disableAutoSupport=False,
asupURL=None,
name="astra-connector",
namespace="astra-connector",
):
Expand Down Expand Up @@ -1045,6 +1046,9 @@ def main(
body["spec"]["labels"] = {label.split("=")[0]: label.split("=")[1]}
if disableAutoSupport:
body["spec"]["autoSupport"] = {"enrolled": False}
elif asupURL:
body["spec"]["autoSupport"] = {"url": asupURL}

return createResource(
quiet=self.quiet,
dry_run=self.dry_run,
Expand Down
3 changes: 3 additions & 0 deletions tkSrc/choices.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,9 @@ def kube_config(argv, acl, verbPosition, v3Position, global_args):
verbPosition.
"""
desired_context = ""
# Catch "actoolkit --v3" command (without any other arguments)
if v3Position + 1 == len(argv):
return None, verbPosition
v3_arg = argv[v3Position + 1]
# This is only needed to properly generate help text ("actoolkit --v3 --help")
if verbPosition is None:
Expand Down
3 changes: 3 additions & 0 deletions tkSrc/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def manageV3Cluster(
ard,
label=None,
disableAutoSupport=False,
asupURL=None,
config=None,
):
helpers.isRFC1123(clusterName)
Expand Down Expand Up @@ -210,6 +211,7 @@ def manageV3Cluster(
registry=registry,
label=label,
disableAutoSupport=disableAutoSupport,
asupURL=asupURL,
)
if not connector:
raise SystemExit("astraSDK.k8s.createAstraConnector() failed")
Expand Down Expand Up @@ -440,6 +442,7 @@ def main(args, ard, config=None):
ard,
label=args.label,
disableAutoSupport=args.disableAutoSupport,
asupURL=args.asupURL,
config=config,
)
else:
Expand Down
11 changes: 10 additions & 1 deletion tkSrc/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1865,12 +1865,21 @@ def manage_cluster_args(self):
help="optionally specify a label to be added to the AstraConnector CR, for "
"example: 'acs.example.com/policy=allowed'",
)
self.subparserManageCluster.add_argument(
asupGroup = self.subparserManageCluster.add_argument_group(
"asupGroup", "NetApp Auto-Support options"
)
asupMEGroup = asupGroup.add_mutually_exclusive_group()
asupMEGroup.add_argument(
"--disableAutoSupport",
default=False,
action="store_true",
help="specify to opt-out of automatic upload of auto support bundles",
)
asupMEGroup.add_argument(
"--asupURL",
default=None,
help="provide a non-default URL to upload auto support bundles",
)
versionGroup = self.subparserManageCluster.add_argument_group(
"operatorGroup", "Astra Connector Operator Version to install"
)
Expand Down

0 comments on commit 5d552ea

Please sign in to comment.