Key Characteristics
Each resource in Ctrlplane has:- Identifier: Unique identifier within a workspace (e.g.,
k8s-us-east-prod-cluster) - Name: Human-readable display name
- Kind: Resource type (e.g.,
kubernetes-cluster,ec2-instance,database) - Version: Schema version for the resource kind
- Config: Structured JSON data specific to the resource type
- Metadata: Key-value pairs used for filtering and selection
- Provider: Optional reference to the resource provider that manages this resource
- Workspace: Every resource belongs to a specific workspace
Resource Metadata
Metadata is crucial for resource selection in environments and deployments. Common metadata includes:environment: “production”, “staging”, “development”region: “us-east-1”, “eu-west-1”cluster: Kubernetes cluster nametier: “web”, “database”, “cache”- Custom attributes specific to your infrastructure
How Resources Work
Resource Discovery
Resources are added to Ctrlplane via:- Resource Providers: Automated discovery from cloud providers (AWS, GCP, Azure, etc.)
- API: Manual creation via REST API
- Integrations: Kubernetes operators, Terraform, or custom scripts
Resource Providers
Resource providers automatically discover and sync resources from external systems:- AWS Provider: Discovers EC2 instances, ECS clusters, etc.
- Kubernetes Provider: Discovers clusters and namespaces
- GCP Provider: Discovers GCE instances, GKE clusters, etc.
- Azure Provider: Discovers Azure VMs, AKS clusters, etc.
- Custom Providers: Build your own using the Resource Provider SDK
Resource Selection
Environments and deployments use selectors to filter resources. Selectors query resource metadata:Resource Variables
Attach variables to resources for deployment-specific configuration:- Kubernetes namespace names
- Database connection strings
- API endpoints
- Secrets references
- Custom deployment parameters
Resource Relationships
Resources can have relationships to other resources:- associated_with: General association (e.g., a VM associated with a VPC)
- depends_on: Dependency relationship (e.g., an app depends on a database)
Release Targets
When you create a deployment in a system, Ctrlplane creates release targets for each valid combination of:- The deployment
- An environment in the system
- A resource matching both the environment and deployment selectors
Creating Resources
Via API
Via Resource Provider
Resource providers automatically sync resources:Best Practices
- Consistent Metadata: Use standardized metadata keys across all resources for reliable filtering.
- Unique Identifiers: Ensure resource identifiers are unique and descriptive.
- Resource Providers: Use resource providers for automated discovery rather than manual creation.
-
Metadata Organization: Structure metadata hierarchically (e.g.,
cloud.aws.region). - Regular Sync: Keep resources in sync with actual infrastructure state.
- Resource Variables: Use resource variables for deployment-specific configuration instead of hardcoding in job configs.