Add bootstrap flag for cluster creation and registration 01/14701/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 6 Nov 2024 09:35:20 +0000 (10:35 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 6 Nov 2024 09:35:20 +0000 (10:35 +0100)
Change-Id: I775cef617e91ef97ef4e5bc3c94f6d2f9239b4ae
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osmclient/cli_commands/cluster.py

index e486eee..147ce70 100755 (executable)
@@ -43,6 +43,12 @@ logger = logging.getLogger("osmclient")
     default=None,
     help="resource group in VIM account where the cluster will be created",
 )
+@click.option(
+    "--bootstrap/--no-bootstrap",
+    required=False,
+    default=True,
+    help="bootstrap the cluster with Flux (prepare for GitOps) (default=True)",
+)
 @click.pass_context
 def cluster_create(
     ctx,
@@ -54,6 +60,7 @@ def cluster_create(
     description,
     region_name,
     resource_group,
+    bootstrap,
     **kwargs
 ):
     """creates a K8s cluster
@@ -74,6 +81,7 @@ def cluster_create(
         cluster["region_name"] = region_name
     if resource_group:
         cluster["resource_group"] = resource_group
+    cluster["bootstrap"] = bootstrap
     ctx.obj.cluster.create(name, content_dict=cluster)
 
 
@@ -200,6 +208,12 @@ def cluster_get_kubeconfig(ctx, name, **kwargs):
     "--creds", prompt=True, help="credentials file, i.e. a valid `.kube/config` file"
 )
 @click.option("--description", default="", help="human readable description")
+@click.option(
+    "--bootstrap/--no-bootstrap",
+    required=False,
+    default=True,
+    help="bootstrap the cluster with Flux (prepare for GitOps) (default=True)",
+)
 @click.pass_context
 def cluster_register(
     ctx,
@@ -207,6 +221,7 @@ def cluster_register(
     vim_account,
     creds,
     description,
+    bootstrap,
 ):
     """registers a K8s cluster to OSM
 
@@ -232,4 +247,5 @@ def cluster_register(
     #     cluster["namespace"] = namespace
     # if cni:
     #     cluster["cni"] = yaml.safe_load(cni)
+    cluster["bootstrap"] = bootstrap
     ctx.obj.cluster.register(name, cluster)