{"id":24637952,"url":"https://github.com/upbound/platform-ref-gcp","last_synced_at":"2025-03-20T09:25:50.813Z","repository":{"id":42122702,"uuid":"328280561","full_name":"upbound/platform-ref-gcp","owner":"upbound","description":"Upbound's reference platform for Google Cloud Platform (GCP) services with Crossplane","archived":false,"fork":false,"pushed_at":"2025-03-14T11:57:40.000Z","size":260,"stargazers_count":24,"open_issues_count":3,"forks_count":30,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-03-15T02:50:19.310Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/upbound.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-10T01:30:12.000Z","updated_at":"2025-03-10T12:47:50.000Z","dependencies_parsed_at":"2024-05-20T22:56:07.695Z","dependency_job_id":"ffa78f37-335e-4d78-928d-8f2f07a0ff7b","html_url":"https://github.com/upbound/platform-ref-gcp","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upbound%2Fplatform-ref-gcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upbound%2Fplatform-ref-gcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upbound%2Fplatform-ref-gcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upbound%2Fplatform-ref-gcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/upbound","download_url":"https://codeload.github.com/upbound/platform-ref-gcp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244584450,"owners_count":20476548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-25T10:12:37.087Z","updated_at":"2025-03-20T09:25:50.790Z","avatar_url":"https://github.com/upbound.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google Cloud Platform (GCP) Reference Platform\n\nThis repository contains a reference GCP Platform Configuration for\n[Crossplane](https://crossplane.io/). It's a great starting point for building\ninternal cloud platforms with GCP and offer a self-service API to your internal\ndevelopment teams.\n\nThis platform provides APIs to provision fully configured GKE clusters, with\nsecure networking, and stateful cloud services (Cloud SQL for PostgreSQL) designed to securely\nconnect to the nodes in each GKE cluster — all composed using cloud service\nprimitives from the [Official Upbound GCP\nProvider](https://marketplace.upbound.io/providers/upbound/provider-family-gcp/). App\ndeployments can securely connect to the infrastructure they need using secrets\ndistributed directly to the app namespace.\n\n## Overview\n\nThis reference platform outlines a specialized API for generating an GKE cluster\n([XCluster](apis/cluster/definition.yaml)) that incorporates XRs from the specified configurations:\n\n* [upbound-configuration-app](https://github.com/upbound/configuration-app)\n* [upbound-configuration-gcp-database](https://github.com/upbound/configuration-gcp-database)\n* [upbound-configuration-gcp-gke](https://github.com/upbound/configuration-gcp-gke)\n* [upbound-configuration-gcp-network](https://github.com/upbound/configuration-gcp-network)\n* [upbound-configuration-gitops-flux](https://github.com/upbound/configuration-gitops-flux)\n* [upbound-configuration-observability-oss](https://github.com/upbound/configuration-observability-oss)\n\n\n```mermaid\ngraph LR;\n    MyApp(My App)---MyCluster(XRC: my-cluster);\n    MyCluster---XRD1(XRD: XCluster);\n    MyApp---MyDB(XRC: my-db);\n    MyDB---XRD2(XRD: XPostgreSQLInstance);\n\t\tsubgraph Configuration:upbound/platform-ref-gcp;\n\t    XRD1---Composition(XGKE, XNetwork, XServices);\n\t    XRD2---Composition2(Composition);\n\t\tend\n\t\tsubgraph Provider:upbound/provider-gcp\n\t    Composition---Network.MRs(MRs: Network, Subnetwork);\n\t    Composition---GKE.MRs(MRs: Cluster, NodePool, ServiceAccount, ServiceAccountKey, ProjectIAMMember);\n\t    Composition2---Postgres.MRs(MRs: DatabaseInstance, User, Connection, GlobalAddress);\n\t\tend\n\nstyle MyApp color:#000,fill:#e6e6e6,stroke:#000,stroke-width:2px\nstyle MyCluster color:#000,fill:#D68A82,stroke:#000,stroke-width:2px\nstyle MyDB color:#000,fill:#D68A82,stroke:#000,stroke-width:2px\nstyle Configuration:upbound/platform-ref-gcp fill:#f1d16d,opacity:0.3\nstyle Provider:upbound/provider-gcp fill:#81CABB,opacity:0.3\nstyle XRD1 color:#000,fill:#f1d16d,stroke:#000,stroke-width:2px,stroke-dasharray: 5 5\nstyle XRD2 color:#000,fill:#f1d16d,stroke:#000,stroke-width:2px,stroke-dasharray: 5 5\nstyle Composition color:#000,fill:#f1d16d,stroke:#000,stroke-width:2px\nstyle Composition2 color:#000,fill:#f1d16d,stroke:#000,stroke-width:2px\n\nstyle Network.MRs color:#000,fill:#81CABB,stroke:#000,stroke-width:2px\nstyle GKE.MRs color:#000,fill:#81CABB,stroke:#000,stroke-width:2px\nstyle Postgres.MRs color:#000,fill:#81CABB,stroke:#000,stroke-width:2px\n```\n\nLearn more about Composite Resources in the [Crossplane\nDocs](https://docs.crossplane.io/latest/concepts/compositions/).\n\n## Quickstart\n\n### Pre-Requisites\n\nBefore we can install the reference platform we want to install the `up` CLI.\nThis is a utility that makes following this quickstart guide easier. Everything\ndescribed here can also be done in a declarative approach which we highly\nrecommend for any production type use-case.\n\u003c!-- TODO enhance this guide: Getting ready for Gitops --\u003e\n\nTo install `up` run this install script:\n```console\ncurl -sL https://cli.upbound.io | sh\n```\nSee [up docs](https://docs.upbound.io/cli/) for more install options.\n\nTo intstall `crossplane` CLI follow https://docs.crossplane.io/latest/cli/#installing-the-cli\n\nFor installing the platform we need a running Crossplane control plane. We are\nusing [Universal Crossplane (UXP)\n](https://github.com/upbound/universal-crossplane). Ensure that your kubectl\ncontext is pointing to the correct Kubernetes cluster or for example create a\n[kind](https://kind.sigs.k8s.io) cluster:\n\n```console\nkind create cluster\n```\n\nFinally install UXP into the `upbound-system` namespace:\n\n```console\nup uxp install --set='args[0]=--enable-usages'\n```\n\nWe will need [Usages](https://docs.crossplane.io/latest/concepts/usages/) alpha feature\nfor the correct deployment and eventual de-provisioning of this reference platform.\n\nYou can validate the install by inspecting all installed components:\n\n```console\nkubectl get all -n upbound-system\n```\n\n### Install the GCP Reference Platform\n\nNow you can install this reference platform. It's packaged as a [Crossplane\nconfiguration package](https://docs.crossplane.io/latest/concepts/packages/)\nso there is a single command to install it:\n\n```console\nup ctp configuration install xpkg.upbound.io/upbound/platform-ref-gcp:v0.9.0\n```\n\nValidate the install by inspecting the provider and configuration packages:\n```console\nkubectl get configurations,configurationrevisions\nkubectl get configurations --watch\n```\n\nAfter all Configurations are ready, you can check the status of associated\nProviders that were pulled as dependencies\n\n```console\nkubectl get providers,providerrevision\n```\n\nCheck the\n[marketplace](https://marketplace.upbound.io/configurations/upbound/platform-ref-gcp/)\nfor the latest version of this platform.\n\n### Configure the GCP provider\n\nBefore we can use the reference platform we need to configure it with GCP\ncredentials.\n\nCreate a JSON `gcp.json` key file containing the GCP account credentials. GCP provides documentation on [how to create a key file](https://cloud.google.com/iam/docs/creating-managing-service-account-keys#creating).\n\nExample `gcp.json` key should look similar to the structure below:\n```json\n{\n  \"type\": \"service_account\",\n  \"project_id\": \"caramel-goat-354919\",\n  \"private_key_id\": \"e97e40a4a27661f12345678f4bd92139324dbf46\",\n  \"private_key\": \"-----BEGIN PRIVATE KEY-----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ysAlCWW/dMYw4+tzAgoG9Qm13Iyfi2Ikll7vfeMX7fH1cnJs0\\nnYpN9LYPawKBgQCwMi09QoMLGDH+2pLVc0ZDAoSYJ3NMRUfk7Paqp784VAHW9bqt\\n1zB+W3gTyDjgJdTl5IXVK+tsDUWu4yhUr8LylJY6iDF0HaZTR67HHMVZizLETk4M\\nLfvbKKgmHkPO4NtG6gEmMESRCOVZUtAMKFPhIrIhAV2x9CBBpb1FWBjrgQKBgQCj\\nkP3WRjDQipJ7DkEdLo9PaJ/EiOND60/m6BCzhGTvjVUt4M22XbFSiRrhXTB8W189\\noZ2xrGBCNQ54V7bjE+tBQEQbC8rdnNAtR6kVrzyoU6xzLXp6Wq2nqLnUc4+bQypT\\nBscVVfmO6stt+v5Iomvh+l+x05hAjVZh8Sog0AxzdQKBgQCMgMTXt0ZBs0ScrG9v\\np5CGa18KC+S3oUOjK/qyACmCqhtd+hKHIxHx3/FQPBWb4rDJRsZHH7C6URR1pHzJ\\nmhCWgKGsvYrXkNxtiyPXwnU7PNP9JNuCWa45dr/vE/uxcbccK4JnWJ8+Kk/9LEX0\\nmjtDm7wtLVlTswYhP6AP69RoMQ==\\n-----END PRIVATE KEY-----\\n\",\n  \"client_email\": \"my-sa-313@caramel-goat-354919.iam.gserviceaccount.com\",\n  \"client_id\": \"103735491955093092925\",\n  \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n  \"token_uri\": \"https://oauth2.googleapis.com/token\",\n  \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n  \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/my-sa-313%40caramel-goat-354919.iam.gserviceaccount.com\"\n}\n```\n\n### Create a K8s secret with the GCP creds:\n\n```console\nkubectl create secret generic gcp-creds -n upbound-system --from-file=credentials=./gcp.json\n```\n\nEnsure that the following roles are added to your service account:\n\n* `roles/compute.networkAdmin`\n* `roles/container.admin`\n* `roles/iam.serviceAccountUser`\n* `roles/iam.securityAdmin`\n* `roles/iam.serviceAccountAdmin`\n* `roles/iam.serviceAccountKeyAdmin`\n* `roles/cloudsql.admin`\n\nIt is convenient to assign roles with `gcloud` CLI, e.g.\n\n```console\ngcloud projects add-iam-policy-binding --role=\"$ROLE\" $PROJECT_ID --member \"serviceAccount:$SA\"\n```\n\n### Configure the GCP Provider to use the secret:\n```console\nkubectl apply -f https://raw.githubusercontent.com/upbound/platform-ref-gcp/main/examples/gcp-default-provider.yaml\n```\n\nSee [provider-gcp docs](https://marketplace.upbound.io/providers/upbound/provider-gcp) for more detailed configuration options.\n\n### Using the GCP reference platform\n\n🎉 Congratulations. You have just installed your first Crossplane powered\nplatform!\n\nApplication developers can now use the platform to request resources which than\nwill provisioned in GCP. This would usually done by bundling a claim as part of\nthe application code. In our example here we simply create the claims directly:\n\nCreate a custom defined cluster:\n```console\nkubectl apply -f https://raw.githubusercontent.com/upbound/platform-ref-gcp/main/examples/cluster-claim.yaml\n```\n\nCreate a custom defined database:\n```console\nkubectl apply -f https://raw.githubusercontent.com/upbound/platform-ref-gcp/main/examples/mariadb-claim.yaml\n```\n\n**NOTE**: The database abstraction relies on the cluster claim to be ready - it\nuses the same network to have connectivity with the EKS cluster.\n\nNow deploy the sample application:\n\n```\nkubectl apply -f examples/app-claim.yaml\n```\n\n**NOTE**: application has a strong dependency on mariadb type of the database\n\n\nYou can verify status by inspecting the claims, composites and managed\nresources:\n\n```console\nkubectl get claim,composite,managed\n```\n\nTo get nice representation of the Claim deployment status you can use\n[crossplane beta trace](https://docs.crossplane.io/latest/cli/command-reference/#beta-trace) command\n\n```console\ncrossplane beta trace cluster.gcp.platformref.upbound.io/platform-ref-gcp\n```\n\n\nIf you see an error about the `compute.globalAddresses.list` permission for the project, try running the following gcloud command:\n```\ngcloud projects add-iam-policy-binding HOST_PROJECT_NAME \\\n    --member=serviceAccount:service-HOST_PROJECT_NUMBER@service-networking.iam.gserviceaccount.com \\\n    --role=roles/servicenetworking.serviceAgent\n```\n\nThis recommendation is an excerpt from [the official GCP\ndocumentation](https://cloud.google.com/sql/docs/postgres/configure-private-services-access)\n\nTo delete the provisioned resources, you would simply delete the claims again:\n\n```console\nkubectl delete -f https://raw.githubusercontent.com/upbound/platform-ref-gcp/main/examples/cluster-claim.yaml,https://raw.githubusercontent.com/upbound/platform-ref-gcp/main/examples/mariadb-claim.yaml,https://raw.githubusercontent.com/upbound/platform-ref-gcp/main/examples/app-claim.yaml\n```\n\nTo uninstall the provider \u0026 platform configuration:\n\n```console\nkubectl delete configurations.pkg.crossplane.io upbound-platform-ref-gcp\nkubectl delete configurations.pkg.crossplane.io upbound-configuration-app\nkubectl delete configurations.pkg.crossplane.io upbound-configuration-gcp-database\nkubectl delete configurations.pkg.crossplane.io upbound-configuration-gcp-gke\nkubectl delete configurations.pkg.crossplane.io upbound-configuration-gcp-network\nkubectl delete configurations.pkg.crossplane.io upbound-configuration-gitops-flux\nkubectl delete configurations.pkg.crossplane.io upbound-configuration-observability-oss\n\nkubectl delete provider.pkg.crossplane.io crossplane-contrib-provider-helm\nkubectl delete provider.pkg.crossplane.io crossplane-contrib-provider-kubernetes\nkubectl delete provider.pkg.crossplane.io grafana-provider-grafana\nkubectl delete provider.pkg.crossplane.io upbound-provider-family-gcp\nkubectl delete provider.pkg.crossplane.io upbound-provider-gcp-cloudplatform\nkubectl delete provider.pkg.crossplane.io upbound-provider-gcp-compute\nkubectl delete provider.pkg.crossplane.io upbound-provider-gcp-container\nkubectl delete provider.pkg.crossplane.io upbound-provider-gcp-servicenetworking\nkubectl delete provider.pkg.crossplane.io upbound-provider-gcp-sql\n\nkubectl delete function.pkg.crossplane.io crossplane-contrib-function-patch-and-transform\n```\n\n## Customize for your Organization\n\nSo far we have used the existing reference platform but haven't made any\nchanges. Lets change this and customize the platform by ensuring that GKE\nCluster is deployed to Frankfurt (eu-central-1) and that clusters are limitted\nto 10 nodes.\n\nFor the following examples we are using `my-org` and `my-platform`:\n\n```console\nORG=my-org\nPLATFORM=my-platform\n```\n\n### Pre-Requisites\nFirst you need to create a [free Upbound\naccount](https://accounts.upbound.io/register) to push your custom platform.\nAfterwards you can log in:\n\n```console\nup login\n```\n\n### Make the changes\n\nTo make your changes clone this repository:\n\n```console\ngit clone https://github.com/upbound/platform-ref-gcp.git $PLATFORM \u0026\u0026 cd $PLATFORM\n```\n\n### Build and push your platform\n\nTo share your new platform you need to build and distribute this package.\n\nTo build the package use the `up xpkg build` command:\n\n```console\nup xpkg build --name package.xpkg --package-root=. --examples-root=examples --ignore=\".github/workflows/*.yaml,.github/workflows/*.yml,examples/*.yaml,.work/uptest-datasource.yaml\"\n```\n\nAfterwards you can push it to the marketplace. It will be not automatically\nlisted but the OCI repository will be publicly accessible.\n\n```console\nTAG=v0.1.0\nup repo -a $ORG create ${PLATFORM}\nup xpkg push ${ORG}/${PLATFORM}:${TAG} -f package.xpkg\n```\n\n## Using your custom platform\n\nNow to use your custom platform, you can pull the Configuration package from\nyour repository\n\n```console\nup ctp configuration install xpkg.upbound.io/${ORG}/${PLATFORM}:${TAG} --package-pull-secrets=personal-pull-secret\n```\n\nFor alternative declarative installation approach see the [example Configuration\nmanifest](examples/configuration.yaml). Please update to your org, platform and\ntag before applying.\n\n🎉 Congratulations. You have just build and installed your first custom\nCrossplane powered platform!\n\n\n## Questions?\n\nFor any questions, thoughts and comments don't hesitate to [reach\nout](https://www.upbound.io/contact) or drop by\n[slack.crossplane.io](https://slack.crossplane.io), and say hi!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupbound%2Fplatform-ref-gcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fupbound%2Fplatform-ref-gcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupbound%2Fplatform-ref-gcp/lists"}