def create_node(ctx, cluster_name, node_count, org, vdc, cpu, memory, network_name, storage_profile, ssh_key_file, template_name, template_revision, enable_nfs, disable_rollback): """Add node(s) to a cluster that uses native Kubernetes provider.""" try: if (template_name and not template_revision) or \ (not template_name and template_revision): raise Exception("Both --template-name (-t) and " "--template-revision (-r) must be specified.") restore_session(ctx) client = ctx.obj['client'] if org is None and not client.is_sysadmin(): org = ctx.obj['profiles'].get('org_in_use') cluster = Cluster(client) ssh_key = None if ssh_key_file is not None: ssh_key = ssh_key_file.read() result = cluster.add_node( network_name, cluster_name, node_count=node_count, org=org, vdc=vdc, cpu=cpu, memory=memory, storage_profile=storage_profile, ssh_key=ssh_key, template_name=template_name, template_revision=template_revision, enable_nfs=enable_nfs, rollback=not disable_rollback) stdout(result, ctx) except Exception as e: stderr(e, ctx)
def create_node(ctx, name, node_count, cpu, memory, network_name, storage_profile, ssh_key_file, template, node_type, disable_rollback): """Add a node to a Kubernetes cluster.""" try: restore_session(ctx) client = ctx.obj['client'] cluster = Cluster(client) ssh_key = None if ssh_key_file is not None: ssh_key = ssh_key_file.read() result = cluster.add_node(ctx.obj['profiles'].get('vdc_in_use'), network_name, name, node_count=node_count, cpu=cpu, memory=memory, storage_profile=storage_profile, ssh_key=ssh_key, template=template, node_type=node_type, disable_rollback=disable_rollback) stdout(result, ctx) except Exception as e: stderr(e, ctx)
def create_node(ctx, cluster_name, node_count, org, vdc, cpu, memory, network_name, storage_profile, ssh_key_file, template_name, template_revision, enable_nfs, disable_rollback): """Add node(s) to a cluster that uses native Kubernetes provider. \b Example vcd cse node create mycluster --nodes 2 --enable-nfs --network mynetwork \\ --template-name photon-v2 --template-revision 1 --cpu 3 --memory 1024 \\ --storage-profile mystorageprofile --ssh-key ~/.ssh/id_rsa.pub \\ Add 2 nfs nodes to vApp named 'mycluster' on vCD. The nodes will be connected to org VDC network 'mynetwork'. All VMs will use the template 'photon-v2'. Each VM will have 3 vCPUs and 1024mb of memory. All VMs will use the storage profile 'mystorageprofile'. The public ssh key at '~/.ssh/id_rsa.pub' will be placed into all VMs for user accessibility. """ CLIENT_LOGGER.debug(f'Executing command: {ctx.command_path}') try: if (template_name and not template_revision) or \ (not template_name and template_revision): raise Exception("Both --template-name (-t) and " "--template-revision (-r) must be specified.") client_utils.cse_restore_session(ctx) client = ctx.obj['client'] if org is None and not client.is_sysadmin(): org = ctx.obj['profiles'].get('org_in_use') cluster = Cluster(client) ssh_key = None if ssh_key_file is not None: ssh_key = ssh_key_file.read() result = cluster.add_node( network_name, cluster_name, node_count=node_count, org=org, vdc=vdc, cpu=cpu, memory=memory, storage_profile=storage_profile, ssh_key=ssh_key, template_name=template_name, template_revision=template_revision, enable_nfs=enable_nfs, rollback=not disable_rollback) stdout(result, ctx) CLIENT_LOGGER.debug(result) except Exception as e: stderr(e, ctx) CLIENT_LOGGER.error(str(e), exc_info=True)
def create_node(ctx, name, node_count, cpu, memory, network_name, storage_profile, ssh_key_file, template, node_type): try: client = ctx.obj['client'] cluster = Cluster(client) ssh_key = None if ssh_key_file is not None: ssh_key = ssh_key_file.read() result = cluster.add_node( ctx.obj['profiles'].get('vdc_in_use'), network_name, name, node_count=node_count, cpu=cpu, memory=memory, storage_profile=storage_profile, ssh_key=ssh_key, template=template) stdout(result, ctx) except Exception as e: stderr(e, ctx)