Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a development guide for building provider images locally #256

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions docs/building-provider-images.md
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this guide is only applicable to the official provider families, I believe upbound/upjet is not the right place. We may consider moving this under to https://github.com/upbound/docs/tree/main/content/providers with the name build-families.md.

If the idea to move this to upbound/docs is rejected, a fallback is upbound/uptest.

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Building Provider Images Locally for Family Providers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Building Provider Images Locally for Family Providers
# Building Locally the Official Provider Family Images

Copy link
Contributor

@mbbush mbbush Sep 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Building the Official Provider Family Images Locally

sounds like a more natural word order to me (from the USA)


1. Check out the provider repo, e.g., upbound/provider-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 `make load-pkg` as follows.

a. If you want to build the monolithic provider image:

```bash
make load-pkg
```

After the command is completed, you can see `provider-gcp-monolith-arm64` and `provider-gcp-monolith-amd64` images:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
After the command is completed, you can see `provider-gcp-monolith-arm64` and `provider-gcp-monolith-amd64` images:
After the command is completed, you will see the installable `provider-gcp-monolith-arm64` and `provider-gcp-monolith-amd64` images:

```
> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
build-38f30a9b/provider-gcp-arm64 latest d475fe99b058 13 hours ago 139MB
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
build-38f30a9b/provider-gcp-arm64 latest d475fe99b058 13 hours ago 139MB

provider-gcp-monolith-arm64 v0.36.0-rc.0.9.g6940237d 81978975bf51 13 hours ago 236MB
build-38f30a9b/provider-gcp-amd64 latest 15fe58d7198f 13 hours ago 146MB
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
build-38f30a9b/provider-gcp-amd64 latest 15fe58d7198f 13 hours ago 146MB

provider-gcp-monolith-amd64 v0.36.0-rc.0.9.g6940237d 1891be45f2ee 13 hours ago 246MB
```

b. If you want to build the subpackages, for instance for provider-family-gcp you need `cloudplatform`, `container`, `dns` packages:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
b. If you want to build the subpackages, for instance for provider-family-gcp you need `cloudplatform`, `container`, `dns` packages:
b. If you want to build the family config provider (`provider-family-gcp`) or any of the family resource providers (e.g., `provider-gcp-cloudplatform`), you can do:


```bash
make load-pkg SUBPACKAGES="config cloudplatform container dns"
```
*Note: You should always include the `config` package in the subpackages list as it is a dependency to all family provider packages.*

After the command is completed, you can see the provider images, e.g. `provider-gcp-dns-arm64`:
```
> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's only keep the installable provider images listed in the following output (as above).

provider-gcp-dns-arm64 v0.36.0-rc.0.9.g6940237d ab4269482718 13 hours ago 216MB
build-38f30a9b/provider-gcp-arm64 latest d475fe99b058 13 hours ago 139MB
provider-gcp-container-arm64 v0.36.0-rc.0.9.g6940237d 6b6791a6659b 13 hours ago 216MB
provider-gcp-cloudplatform-arm64 v0.36.0-rc.0.9.g6940237d 55a9798fd10c 13 hours ago 217MB
provider-gcp-config-arm64 v0.36.0-rc.0.9.g6940237d 4426b77cea2c 13 hours ago 215MB
provider-gcp-dns-amd64 v0.36.0-rc.0.9.g6940237d bf592eaae5de 13 hours ago 225MB
provider-gcp-config-amd64 v0.36.0-rc.0.9.g6940237d ae5affc2cac7 13 hours ago 224MB
provider-gcp-cloudplatform-amd64 v0.36.0-rc.0.9.g6940237d d6eeb6e43e95 13 hours ago 226MB
build-38f30a9b/provider-gcp-amd64 latest 15fe58d7198f 13 hours ago 146MB
provider-gcp-container-amd64 v0.36.0-rc.0.9.g6940237d beb71a5d733e 13 hours ago 226MB
```

## Running Providers with Locally Built Images

One way to install locally built images is publishing them to Dockerhub and installing from there. For example, if you want to install the `cloudplatform` package on a amd64 arch:

1. Tag and publish provider images to Dockerhub:

```bash
# tag the images
docker tag provider-gcp-config-amd64:v0.36.0-rc.0.9.g6940237d <your-dockerhub-org>/provider-gcp-config-amd64:v0.36.0-rc.0.9.g6940237d
docker tag provider-gcp-cloudplatform-amd64:v0.36.0-rc.0.9.g6940237d <your-dockerhub-org>/provider-gcp-cloudplatform-amd64:v0.36.0-rc.0.9.g6940237d
# push the images to your dockerhub org
docker push <your-dockerhub-org>/provider-gcp-config-amd64:v0.36.0-rc.0.9.g6940237d
docker push <your-dockerhub-org>/provider-gcp-cloudplatform-amd64:v0.36.0-rc.0.9.g6940237d
```

2. Install the provider packages using the following yaml:

```yaml
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: upbound-provider-gcp-config
spec:
package: turkenf/provider-gcp-config-amd64:v0.36.0-rc.0.9.g6940237d
skipDependencyResolution: true
---
Comment on lines +67 to +74
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we implement the suggestion here, we may also get rid of the explicit dependency installation here.

I've some concerns surfacing the dependency installation here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: upbound-provider-gcp-cloudplatform
spec:
package: turkenf/provider-gcp-cloudplatform-amd64:v0.36.0-rc.0.9.g6940237d
skipDependencyResolution: true
```

3. Verify that providers are installed and healthy:

```bash
> kubectl get providers.pkg.crossplane.io
NAME INSTALLED HEALTHY PACKAGE AGE
upbound-provider-gcp-cloudplatform True True turkenf/provider-gcp-cloudplatform-amd64:v0.36.0-rc.0.9.g6940237d 3m46s
upbound-provider-gcp-config True True turkenf/provider-gcp-config-amd64:v0.36.0-rc.0.9.g6940237d 3m46s
```