Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Creating a Project

shoenisch edited this page Apr 18, 2017 · 4 revisions

A project carves out a set of resources for a tenant. A project requires a quota, and the project can consume all or part of the resources defined by its quota.

To create a project, you must be logged in as a system administrator.

Project Commands

You can use the photon project command to create and manage projects:

photon project -h
NAME:
   photon project - options for project
USAGE:
   photon project command [command options] [arguments...]
COMMANDS:
   create		Create a new project
   delete		Delete project with specified id
   show			Show project info with specified id
   get			Get project in config file
   set			Set project in config file
   list			List all projects
   tasks		List all tasks related to the project
   set_security_groups	Set security groups for a project
   help, h		Shows a list of commands or help for one command

The photon project create command includes the following options:

photon project create
NAME:
   photon project create - Create a new project

USAGE:
   photon project create [command options] <project-name>

DESCRIPTION:
   Create a new project within a tenant and assigns some or all of its tenant quota.
   Only system administrators can create new projects.
   If default-router-private-ip-cidr option is omitted,
   it will use 192.168.0.0/16 as default router's private IP CIDR.
   A quota for the project can be defined during project creation and    
   it is defined by a set of maximum resource costs. Each usage has a type,
   a numnber (e.g. 1) and a unit (e.g. GB). You must specify at least one cost
   Valid units:  GB, MB, KB, B, or COUNT
   Common costs:
     vm.count:            Total number of VMs (use with COUNT)
     vm.cpu:              Total number of vCPUs for a VM (use with COUNT)
     vm.memory:           Total amount of RAM for a VM (use with GB, MB, KB, or B)
     disk.capacity:       Total disk capacity (use with GB, MB, KB, or B)
     disk.count:          Number of disks (use with COUNT)
     sdn.floatingip.size: Number of floating ip 

OPTIONS:
   --limits value, -l value                          
     Project limits (key value unit)
   --percent value, -p value                         
     Project limits (0 to 100 percent of tenant quota) (default: 0)
   --tenant value, -t value                          
     Tenant name for project
   --security-groups value, -g value                 
     Security Groups for project
   --default-router-private-ip-cidr value, -c value  
     Private IP range of the default router in CIDR format. 
     Default value: 192.168.0.0/16

Example of How To Create a Tenant and a Project

A project is tied to a tenant. A tenant is a unit of administrative control allocated a pool of resources for projects, such as a Kubernetes cluster. The following sequence of commands creates a tenant, gives it a pool of resources by setting a quota, and creates a project that can use use all the resources in the pool.

photon tenant create plato
photon tenant quota set plato 
   --limits 'vm.count 100 COUNT, vm.memory 1000 GB, vm.cpu 500 COUNT' 
photon project create --tenant "plato" --name "plato-prjt" 
   --limits "vm.memory 100 GB, vm.cpu 100 COUNT, vm 100 COUNT, 
   persistent-disk 100 COUNT, persistent-disk.capacity 200 GB"

When you create a project, you can optionally set the project's quota to use a percent of its tenant quota. The following command, for example, sets the project quota to 30 percent of its tenant quota:

  photon project create project2 --tenant tenant1 --percent 30 

Many photon subcommands take place in the context of a tenant or a project. To simplify commands for working with a tenant or a project, you can set each to persist as your default. Here's an example:

photon tenant set "plato"
photon project set "plato-prjt"

Photon saves the values that you supply for the set command in the file named .photon in your home directory. To change your default project or tenant, run the set command again with a new tenant or project name.

Clone this wiki locally