From c588eac465ad7f51fe1d3ad85b31e7dadc83882b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20T=C3=BCrken?= Date: Thu, 18 Apr 2024 09:26:20 +0300 Subject: [PATCH] Add a development guide for building provider images locally MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fatih Türken --- README.md | 22 ++++++-- docs/family/Development.md | 108 +++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 docs/family/Development.md diff --git a/README.md b/README.md index 9ebaee3b6..9f9de3669 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ SPDX-License-Identifier: CC-BY-4.0 -`provider-gcp` is a [Crossplane](https://crossplane.io/) provider that +`provider-upjet-gcp` is a [Crossplane](https://crossplane.io/) provider that is built using [Upjet](https://github.com/crossplane/upjet) code generation tools and exposes XRM-conformant managed resources for the GCP API. @@ -43,16 +43,30 @@ Follow the guide [here](https://github.com/crossplane/upjet/blob/v0.10.0/docs/ad ### Local Development -For building provider images locally, follow the guide [here](https://github.com/upbound/upjet/blob/main/docs/buliding-provider-images.md). +1. Check out the provider repo, crossplane-contrib/provider-upjet-gcp, and go to the project +directory on your local machine. + +2. Do the necessary changes locally and please make sure you have comitted all of them. + +3. Run the `make load-pkg` command for family providers as follows. + +If you want to build any of the family resource providers (e.g., `provider-gcp-cloudplatform`, `provider-gcp-container`), you can do: + +```shell +make load-pkg PROVIDERS="cloudplatform container" REPO="index.docker.io/" +``` +*Note: Installable images for the family config provider will be created by default.* + +For more information, follow the guide [here](https://marketplace.upbound.io/providers/upbound/provider-family-gcp/v1.1.0/docs/development). ## Report a Bug For filing bugs, suggesting improvements, or requesting new features, please -open an [issue](https://github.com/crossplane-contrib/provider-upjet-gcp/issues). +open an [issue](https://github.com/crossplane-contrib/provider-upjet-gcp/issues/new/choose). ## Contact -[#upbound-provider-gcp](https://crossplane.slack.com/archives/C05E7EVM459) channel in +[#upjet-provider-gcp](https://crossplane.slack.com/archives/C05E7EVM459) channel in [Crossplane Slack](https://slack.crossplane.io) ## Licensing diff --git a/docs/family/Development.md b/docs/family/Development.md new file mode 100644 index 000000000..445f443a0 --- /dev/null +++ b/docs/family/Development.md @@ -0,0 +1,108 @@ +--- +title: Development +weight: 3 +--- + +# Building the Official Provider Family Images Locally + +1. Check out the provider repo, crossplane-contrib/provider-upjet-gcp, and go to the project +directory on your local machine. + +2. Do the necessary changes locally and please make sure you have comitted all of them. + +3. Run the `make load-pkg` command for family providers as follows. + +If you want to build any of the family resource providers (e.g., `provider-gcp-cloudplatform`, `provider-gcp-container`), you can do: + +```shell +make load-pkg PROVIDERS="cloudplatform container" REPO="index.docker.io/" +``` +*Note: Installable images for the family config provider will be created by default.* + +After the command is completed, you will see the installable images for `provider-gcp-cloudplatform`, `provider-gcp-container` +and family config provider `provider-family-gcp`: + +```shell +> docker image ls +REPOSITORY TAG IMAGE ID CREATED SIZE +turkenf/provider-family-gcp-amd64 v1.1.0-rc.0.42.g42cf069b9 baac1f7e697d 6 minutes ago 179MB +turkenf/provider-gcp-cloudplatform-amd64 v1.1.0-rc.0.42.g42cf069b9 fe2106877bf9 6 minutes ago 181MB +turkenf/provider-gcp-container-amd64 v1.1.0-rc.0.42.g42cf069b9 94f8d11c2709 6 minutes ago 181MB +turkenf/provider-gcp-cloudplatform-arm64 v1.1.0-rc.0.42.g42cf069b9 edbf18e9d01f 6 minutes ago 176MB +turkenf/provider-gcp-container-arm64 v1.1.0-rc.0.42.g42cf069b9 0d3ab205ef66 6 minutes ago 176MB +turkenf/provider-family-gcp-arm64 v1.1.0-rc.0.42.g42cf069b9 a6ef52d83555 6 minutes ago 175MB +``` + +## Running Providers with Locally Built Images + +One way to install locally built images is pushing them to Dockerhub and installing from there. For example, if you want to +install the `cloudplatform` package on a arm64 arch: + +1. Push provider images to Dockerhub: + +```shell +# push the images to your dockerhub org +docker push /provider-family-gcp-arm64:v1.1.0-rc.0.42.g42cf069b9 +docker push /provider-gcp-cloudplatform-arm64:v1.1.0-rc.0.42.g42cf069b9 +``` + +2. Install the provider packages by setting `skipDependencyResolution: true` with the following yaml: + +```yaml +apiVersion: pkg.crossplane.io/v1 +kind: Provider +metadata: + name: upbound-provider-gcp-config +spec: + package: index.docker.io/turkenf/provider-family-gcp-arm64:v1.1.0-rc.0.42.g42cf069b9 + skipDependencyResolution: true +--- +apiVersion: pkg.crossplane.io/v1 +kind: Provider +metadata: + name: upbound-provider-gcp-cloudplatform +spec: + package: index.docker.io/turkenf/provider-gcp-cloudplatform-arm64:v1.1.0-rc.0.42.g42cf069b9 + skipDependencyResolution: true +``` + +3. Verify that providers are installed and healthy: + +```shell +> kubectl get providers.pkg.crossplane.io +NAME INSTALLED HEALTHY PACKAGE AGE +upbound-provider-gcp-cloudplatform True True index.docker.io/turkenf/provider-gcp-cloudplatform-arm64:v1.1.0-rc.0.42.g42cf069b9 115s +upbound-provider-gcp-config True True index.docker.io/turkenf/provider-family-gcp-arm64:v1.1.0-rc.0.42.g42cf069b9 115s +``` + +*Note: If you don't want to set `skipDependencyResolution: true`, please follow the steps below:* + +- Tag the family config provider image as provider-family-gcp + +```shell +# get rid of the arch to resolve package dependencies +docker tag /provider-family-gcp-arm64:v1.1.0-rc.0.42.g42cf069b9 /provider-family-gcp:v1.1.0-rc.0.42.g42cf069b9 +# push the images to your dockerhub org +docker push /provider-family-gcp:v1.1.0-rc.0.42.g42cf069b9 +docker push /provider-gcp-cloudplatform-arm64:v1.1.0-rc.0.42.g42cf069b9 +``` + +- Install the provider package: + +```yaml +apiVersion: pkg.crossplane.io/v1 +kind: Provider +metadata: + name: upbound-provider-gcp-cloudplatform +spec: + package: index.docker.io/turkenf/provider-gcp-cloudplatform-arm64:v1.1.0-rc.0.42.g42cf069b9 +``` + +- Verify that providers are installed and healthy: + +```shell +> kubectl get providers.pkg.crossplane.io +NAME INSTALLED HEALTHY PACKAGE AGE +turkenf-provider-family-gcp True True index.docker.io/turkenf/provider-family-gcp:v1.1.0-rc.0.42.g42cf069b9 73s +upbound-provider-gcp-cloudplatform True True index.docker.io/turkenf/provider-gcp-cloudplatform-arm64:v1.1.0-rc.0.42.g42cf069b9 2m1s +``` \ No newline at end of file