This repository contains an Upbound project, tailored for users establishing their initial control plane with Upbound. This configuration deploys fully managed Google Kubernetes Engine (GKE) clusters with secure networking and workload identity.
Version: Crossplane v2 (namespaced resources, embedded KCL functions)
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 GKE custom resource type.
- Composition: Configured in /apis/gke/composition.yaml
- Embedded Function: The Composition logic is encapsulated within embedded function
This configuration creates the following GCP resources in a managed sequence:
- GCP Service Account: Custom service account for GKE node pools
- Service Account Key: JSON key for service account authentication
- Project IAM Member: Grants
roles/container.adminto the service account - GKE Cluster: Managed Kubernetes cluster with VPC-native networking
- Node Pool: Managed node pool with custom service account and security settings
- Provider Configurations: Helm and Kubernetes provider configs for cluster access
- Workload Identity ConfigMap: Settings for GKE workload identity integration
- VPC-Native Networking: Integrates with configuration-gcp-network for secure networking
- Workload Identity: Enables secure pod-to-GCP service authentication with custom service accounts
- Connection Secret Forwarding: Automatically propagates kubeconfig to consuming applications
- Managed Node Pools: Pre-configured with security hardening (shielded instances, integrity monitoring)
- Auto-scaling Support: Configurable node pool scaling with management policies
This configuration follows modern Upbound DevEx best practices:
- Conditional Resource Creation: GKE cluster is only created after service account is ready, preventing immutable field update conflicts
- Embedded KCL Functions: Replaced complex patch-and-transform pipelines with maintainable KCL code
- Status Reference Handling: Uses the pattern
_ocds?.resourceName?.Resource?.status?.atProvider?.fieldfor cross-resource dependencies - Comprehensive Testing: Includes both composition tests and end-to-end deployment tests
This configuration requires (Crossplane v2 compatible):
- configuration-gcp-network v2: Provides VPC and subnet resources (matched via
network-idlabels) - GCP Providers (namespaced): gcp-compute v2.1.0, gcp-container v2.4.0, gcp-cloudplatform v2.1.0
- Additional Providers: helm v1.0.0, kubernetes v1.0.0
- Crossplane Functions: function-auto-ready v0.4.0 for readiness management
- Execute
up project run - Alternatively, install the Configuration from the Upbound Marketplace
- Check examples for example XR (Composite Resource)
Ensure your GCP service account has the following IAM roles:
roles/container.admin- For GKE cluster managementroles/compute.networkAdmin- For network resource managementroles/iam.serviceAccountAdmin- For service account creationroles/iam.serviceAccountKeyAdmin- For service account key management
apiVersion: gcp.platform.upbound.io/v1alpha1
kind: GKE # Note: X-prefix removed in v2
metadata:
name: my-gke-cluster
namespace: default # Required in v2
spec:
parameters:
id: my-gke-cluster
region: us-west2
version: "1.28"
nodes:
count: 3
instanceType: e2-standard-4
managementPolicies: ["*"] # Replaces deletionPolicy in v2
providerConfigName: defaultNote: In Crossplane v2, connection secrets are automatically created with the naming pattern {xr-name}-connection in the same namespace as the XR. The writeConnectionSecretToRef field is no longer used in XR specs.
The configuration can be tested using:
up composition render --xrd=apis/gke/definition.yaml apis/gke/composition.yaml examples/gke-xr.yamlto render the compositionup test run tests/test-*to run composition tests intests/test-gke/up test run tests/e2etest-* --e2eto run end-to-end tests intests/e2etest-gke/
- Composition Tests: Validate resource generation, status reference handling, and conditional resource creation logic
- E2E Tests: Full deployment including network dependencies and provider configuration
This configuration has been migrated from Crossplane v1 to v2. Key changes include:
- API Kind:
XGKE→GKE(X-prefix removed in v2) - Namespace Requirement: All XRs must include
namespace: default(or other namespace) - managementPolicies: Replaces
deletionPolicyparameter - Connection Secrets: Automatically created with pattern
{xr-name}-connection, nowriteConnectionSecretToRefin XR spec - Provider APIs: Namespaced groups (
gcpm,helmm,kubernetesm) instead of cluster-scoped - File Structure: Reorganized into
apis/gke/subdirectory
If upgrading from v1:
- Update all XR manifests: change
kind: XGKEtokind: GKEand addnamespace: default - Replace
deletionPolicywithmanagementPolicies: ["*"] - Remove
writeConnectionSecretToReffrom XR specs (secrets auto-generated) - Update any automation/scripts to use new file paths (
apis/gke/instead ofapis/) - Refer to
.agents/plans/CROSSPLANE_V2_MIGRATION.mdfor detailed migration steps
This repository serves as a foundational step. To enhance your configuration, consider:
- Creating new API definitions in this same repo
- Editing the existing API definition to your needs
- Adding additional GCP services (databases, monitoring, etc.)
- Customizing node pool configurations for different workloads
To learn more about how to build APIs for your managed control planes in Upbound, read the guide on Upbound's docs.