Skip to main content

Naming Conventions

Kubernetes Resources

Kusion adheres to specific rules when generating the Kubernetes resources for users' applications. The table below lists some common Kubernetes resource naming conventions.

ResourceConcatenation RuleExample ID
Namespaceproject namev1:Namespace:wordpress
Deploymentproject name-stack name-app nameapps/v1:Deployment:wordpress:wordpress-dev-wordpress
CronJobproject name-stack name-app namebatch/v1:CronJob:helloworld:helloworld-dev-helloworld
Serviceproject name-stack name-app name-public/privatev1:Service:helloworld:helloworld-dev-helloworld-public

Terraform Resources

Similarly, Kusion also adheres to specific naming conventions when generating the Terraform Resources. Some common resources are listed below.

ResourceConcatenation RuleExample ID
random_passwordapp name-dbhashicorp:random:random_password:wordpress-db
aws_security_groupapp name-dbhashicorp:aws:aws_security_group:wordpress-db
aws_db_instanceapp namehashicorp:aws:aws_db_instance:wordpress
alicloud_db_instanceapp namealiyun:alicloud:alicloud_db_instance:wordpress
alicloud_db_connectionapp namealiyun:alicloud:alicloud_db_connection:wordpress
alicloud_rds_accountapp namealiyun:alicloud:alicloud_rds_account:wordpress

Apply Options

Before applying the project, users may need to export some environment variables to specify the Provider information for provisioning cloud resources. The relevant environment variables are listed in the table below.

Environment VariableExplanationExample
AWS_PROVIDER_REGIONThe region where the aws provider provisions the resourcesus-east-1
AWS_ACCESS_KEY_IDThe access key for the aws provider to provision the resources
AWS_SECRET_ACCESS_KEYThe secret key for the aws provider to provision the resources
ALICLOUD_PROVIDER_REGIONThe region where the alicloud provider provisions the resourcescn-beijing
ALICLOUD_ACCESS_KEYThe access key for the alicloud provider to provision the resources
ALICLOUD_SECRET_KEYThe secret key for the alicloud provider to provision the resources

Magic Variables

Concept Explanation

Magic variables are preconfigured variables representing fundamental metadata or environment variables automatically generated and injected into the application container by Kusion, which are typically used for accessories such as databases.

List of Magic Variables

Sensitive Database Information

For sensitive information such as the host address, username and password for the database instance, Kusion will automatically inject them into the application container for users through environment variables. The relevant environment variables are listed in the table below.

NameExplanation
KUSION_DB_HOSTHost address for accessing the database instance
KUSION_DB_USERNAMEAccount username for accessing the database instance
KUSION_DB_PASSWORDAccount password for accessing the database instance