-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Connectedk8s extension helm chart cleanup #2321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 85 commits
68800b6
5090698
fda117d
e781176
969a45f
d60bd23
45e2db7
678c2b7
85aa7d9
d345685
4e90290
836e6fc
a1bea49
6522421
dec8fab
9bd5580
854b36f
576704d
b26a0eb
6d445c3
9df8269
031639b
47ca292
b237d9c
6249ea7
5223949
c1ecbf8
f43ebfb
d237667
32c5089
a97f36e
025522c
1967b02
df87f51
b747e92
9d9c954
2db8c30
bd26f72
9dbfa0b
c45a3a6
f27610a
9852a51
ddad5b7
6e6cd75
eb723fb
a5407c1
3b8f930
9f72a47
5515568
fac6740
e0f5022
c9d1071
3b78ee8
96a2cbe
2c7b8b3
b9fdd1e
cfb21ab
005e414
ba268a1
0ff1943
d77e433
44f4547
3fa9b10
5c56299
4ddea41
47fc01b
9239f83
ccdbff0
e6333d7
1ef6cdd
c1612c2
3ed99da
8b26810
fdacc2b
3860c00
b9b4915
f8c4e04
b752e92
9404057
669071f
65e69b8
13b8795
da4a59b
fcbda96
48be4bd
2655e77
00f3250
93247c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| import os | ||
| import shutil | ||
| import subprocess | ||
| from subprocess import Popen, PIPE | ||
|
|
||
|
|
@@ -22,6 +23,15 @@ | |
| logger = get_logger(__name__) | ||
|
|
||
| # pylint: disable=line-too-long | ||
| # pylint: disable=bare-except | ||
|
|
||
|
|
||
| def cleanup_helm_chart_directory(path): | ||
| try: | ||
| if os.path.isdir(path): | ||
| shutil.rmtree(path) | ||
| except: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
What are the chances of this happening?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might happen if some other program(not terminal) is accessing the charts directory. I saw this when I had opened the charts in VS code. |
||
| logger.warning("Unable to cleanup the azure-arc helm charts already present on the machine. In case of failure, please cleanup the directory '%s' and try again.", path) | ||
|
|
||
|
|
||
| def validate_location(cmd, location): | ||
|
|
@@ -52,6 +62,7 @@ def get_chart_path(registry_path, kube_config, kube_context): | |
|
|
||
| # Exporting helm chart | ||
| chart_export_path = os.path.join(os.path.expanduser('~'), '.azure', 'AzureArcCharts') | ||
| cleanup_helm_chart_directory(chart_export_path) | ||
|
akashkeshari marked this conversation as resolved.
Outdated
|
||
| export_helm_chart(registry_path, chart_export_path, kube_config, kube_context) | ||
| # Helm Install | ||
| helm_chart_path = os.path.join(chart_export_path, 'azure-arc-k8sagents') | ||
|
|
@@ -74,7 +85,6 @@ def pull_helm_chart(registry_path, kube_config, kube_context): | |
|
|
||
|
|
||
| def export_helm_chart(registry_path, chart_export_path, kube_config, kube_context): | ||
| chart_export_path = os.path.join(os.path.expanduser('~'), '.azure', 'AzureArcCharts') | ||
| cmd_helm_chart_export = ["helm", "chart", "export", registry_path, "--destination", chart_export_path] | ||
| if kube_config: | ||
| cmd_helm_chart_export.extend(["--kubeconfig", kube_config]) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,6 +115,11 @@ def create_connectedk8s(cmd, client, resource_group_name, cluster_name, https_pr | |
| helm_version = check_helm_version(kube_config, kube_context) | ||
| telemetry.add_extension_event('connectedk8s', {'Context.Default.AzureCLI.HelmVersion': helm_version}) | ||
|
|
||
| # Check for faulty pre-release helm versions | ||
| if "3.3.0-rc" in helm_version: | ||
| telemetry.set_user_fault() | ||
| raise CLIError("The current helm version is not supported for azure-arc onboarding. Please upgrade the helm version and try again.") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Please upgrade to a stabel helm release may be as the message? or specify the version minimum needed? #Closed
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed the message to upgrade to stable version as 3.0.0 also works but 3.3.0-rc dosent as it was a pre-release version
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| # Validate location | ||
| utils.validate_location(cmd, location) | ||
| resourceClient = _resource_client_factory(cmd.cli_ctx, subscription_id=subscription_id) | ||
|
|
@@ -688,6 +693,11 @@ def update_agents(cmd, client, resource_group_name, cluster_name, https_proxy="" | |
| helm_version = check_helm_version(kube_config, kube_context) | ||
| telemetry.add_extension_event('connectedk8s', {'Context.Default.AzureCLI.HelmVersion': helm_version}) | ||
|
|
||
| # Check for faulty pre-release helm versions | ||
| if "3.3.0-rc" in helm_version: | ||
| telemetry.set_user_fault() | ||
| raise CLIError("The current helm version is not supported for azure-arc onboarding. Please upgrade the helm version and try again.") | ||
|
|
||
| # Check whether Connected Cluster is present | ||
| if not connected_cluster_exists(client, resource_group_name, cluster_name): | ||
| telemetry.set_user_fault() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.