From dbe3ffb4fc683e680ea1e34796dc1165e435ce15 Mon Sep 17 00:00:00 2001 From: Gabriel Cuba Date: Tue, 22 Mar 2022 14:40:24 -0500 Subject: [PATCH] Feature 10904: Make all deployment methods optional for K8s cluster Change-Id: Idb900ef102966069cf4a339e9991d397e04bed28 Signed-off-by: Gabriel Cuba --- osmclient/scripts/osm.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index 3ce02df..7af3013 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -3878,6 +3878,24 @@ def sdnc_show(ctx, name): help='''list of VIM networks, in JSON inline format, where the cluster is accessible via L3 routing, e.g. "{(k8s_net1:vim_network1) [,(k8s_net2:vim_network2) ...]}"''', ) +@click.option( + "--init-helm2/--skip-helm2", + required=False, + default=True, + help="Initialize helm v2", +) +@click.option( + "--init-helm3/--skip-helm3", + required=False, + default=True, + help="Initialize helm v3", +) +@click.option( + "--init-jujubundle/--skip-jujubundle", + required=False, + default=True, + help="Initialize juju-bundle", +) @click.option("--description", default=None, help="human readable description") @click.option( "--namespace", @@ -3905,7 +3923,7 @@ def sdnc_show(ctx, name): # help='do not return the control immediately, but keep it until the operation is completed, or timeout') @click.pass_context def k8scluster_add( - ctx, name, creds, version, vim, k8s_nets, description, namespace, wait, cni + ctx, name, creds, version, vim, k8s_nets, init_helm2, init_helm3, init_jujubundle, description, namespace, wait, cni ): """adds a K8s cluster to OSM @@ -3920,6 +3938,10 @@ def k8scluster_add( cluster["k8s_version"] = version cluster["vim_account"] = vim cluster["nets"] = yaml.safe_load(k8s_nets) + if not (init_helm2 and init_jujubundle and init_helm3): + cluster["deployment_methods"] = {"helm-chart": init_helm2, + "juju-bundle": init_jujubundle, + "helm-chart-v3": init_helm3} if description: cluster["description"] = description if namespace: @@ -4049,6 +4071,7 @@ def k8scluster_list(ctx, filter, literal, long): "Version", "VIM", "K8s-nets", + "Deployment methods", "Operational State", "Op. state (details)", "Description", @@ -4086,6 +4109,7 @@ def k8scluster_list(ctx, filter, literal, long): cluster["k8s_version"], vim_info, json.dumps(cluster["nets"]), + json.dumps(cluster["deployment_methods"]), cluster["_admin"]["operationalState"], op_state_details, trunc_text(cluster.get("description") or "", 40), -- 2.25.1