This repository contains an Upbound project, tailored for users establishing their initial control plane with Upbound. This configuration deploys fully managed GCP database instances with private networking and service networking connections.
The core components of a custom API in Upbound Project include:
- CompositeResourceDefinition (XRD): Defines the API's structure.
- Composition(s): Configures the Functions Pipeline
- Embedded Function(s): Encapsulates the Composition logic and implementation within a self-contained, reusable unit
In this specific configuration, the API contains:
- a GCP SQL Database custom resource type.
- Composition: Configured in /apis/composition.yaml
- Embedded Function: The Composition logic is encapsulated within embedded function
This configuration provisions:
- Cloud SQL Database Instance with configurable engine (MySQL/PostgreSQL) and storage
- Private IP networking with VPC peering for secure database access
- Service Networking connection for private service access
- Database user with configurable password via Kubernetes secret
- Default database named "upbound" for application use
- Connection secrets for database connectivity
The configuration can be tested using:
up composition render --xrd=apis/definition.yaml apis/composition.yaml examples/mysql-xr.yaml
to render the MySQL compositionup test run tests/*
to run composition testsup test run tests/* --e2e
to run end-to-end tests
- Execute
up project run
- Alternatively, install the Configuration from the Upbound Marketplace
- Check examples for example XR (Composite Resource)
This configuration depends on:
- configuration-gcp-network for network resources
- GCP SQL Provider for database management
- GCP Service Networking Provider for private connections
The XSQLInstance API supports the following parameters:
engine
: Database engine (mysql
orpostgres
)engineVersion
: Database version (e.g.,8_0
for MySQL,13
for PostgreSQL)storageGB
: Storage size in GBregion
: GCP region for deploymentnetworkRef.id
: Reference to the network from configuration-gcp-networkpasswordSecretRef
: Reference to Kubernetes secret containing database passworddeletionPolicy
: Resource deletion policy (Delete
orOrphan
)providerConfigName
: Crossplane ProviderConfig name
This repository serves as a foundational step. To enhance the configuration, consider:
- create new API definitions in this same repo
- editing the existing API definition to your needs
- adding backup and restore functionality
- implementing high availability configurations
To learn more about how to build APIs for your managed control planes in Upbound, read the guide on Upbound's docs.