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

A few updates to the getting started docs #1330

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
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
72 changes: 24 additions & 48 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
### Local Development Install

#### When using public registries
#### Create a cluster

Access to a Kubernetes cluster is needed in order to install the kpack controllers.

An easy way to get a cluster up and running is to use [`kind`](https://kind.sigs.k8s.io/docs/user/quick-start/).

You'll also need:
* [`go`](https://go.dev/doc/install)
* [`pack`](https://buildpacks.io/docs/tools/pack/)
* [`docker`](https://docs.docker.com/get-docker/)
* [`ytt`](https://carvel.dev/ytt/docs/v0.44.0/install/)

#### When using public registries

```bash
kubectl cluster-info # ensure you have access to a cluster
./hack/apply.sh <IMAGE/NAME> # <IMAGE/NAME> is a writable and publicly accessible location
docker login <registry namespace> # must be writable and publicly accessible; e.g., your Docker Hub username or gcr.io/<some-project>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

An image "name" such as some-docker-username/random-image causes the tests to fail

./hack/apply.sh <registry namespace>
```

#### When using private registries

Create a kubernetes secret with the registry creds

```bash
kubectl create secret docker-registry regcreds -n kpack --docker-server=gcr.io --docker-username=_json_key --docker-password="$(cat gcp.json)"
kubectl create secret docker-registry regcreds -n kpack --docker-server=gcr.io/<some-project> --docker-username=_json_key --docker-password="$(cat gcp.json)"
```

Create an overlay to use those registry creds
Expand Down Expand Up @@ -65,64 +76,29 @@ EOF
### Running Unit Tests

```bash
go test ./pkg/...
make unit
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using make allows us to inherit the timeout which I hit on one of the suites

```

### Running End-to-end Tests
```bash
go test ./test/...
```

* To run the e2e tests, kpack must be installed and running on a cluster

* The KPACK_TEST_NAMESPACE_LABELS environment variable allows you to define additional labels for the test namespace, e.g.

```bash
export KPACK_TEST_NAMESPACE_LABELS="istio-injection=disabled,purpose=test"
```

* The IMAGE_REGISTRY environment variable must point at a registry with local write access
* 🍿 These tests can take anywhere from 20-30 minutes depending on your setup

```bash
IMAGE_REGISTRY=gcr.io/<some-project> go test ./test/...
IMAGE_REGISTRY=gcr.io/<some-project> \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Side note, while ./hack/apply.sh works with index.docker.io I couldn't get the end-to-end tests to pass this way (they failed with "unauthorized" error). I recall there are some oddities WRT ggcr/docker and Docker Hub specifically, but I didn't dig too much here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ya there are some weirdisms but I forget the exact config needed for running the e2e tests against dockerhub

IMAGE_REGISTRY_USERNAME=_json_key \
IMAGE_REGISTRY_PASSWORD=$(cat gcp.json) \
make e2e
```

### Libgit2 v1.3.0 Dependency and Installation
* The IMAGE_REGISTRY environment variable must point at a registry with local write access - e.g.

Several unit tests depend upon libgit2 v1.3.0.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seems to no longer be true


__macOS Installation Instructions (Intel):__

1. Install `cmake` and `pkg-config`
```bash
brew install cmake pkg-config
```
2. Verify no conflicting version of `libgit2` is installed

```bash
pkg-config --print-provides libgit2
```

You should expect output which reads either: `Package libgit2 was not found in the pkg-config search path` or `libgit2 = 1.3.0`. If a version of `libgit2` other than `1.3.0` is reported as installed, consider uninstalling `1.3.0` or running the unit tests in a different environment.

3. Download `libgit2 v1.3.0` source code
```bash
mkdir libgit2-install && cd libgit2-install
curl -L -O https://github.com/libgit2/libgit2/archive/refs/tags/v1.3.0.tar.gz
export IMAGE_REGISTRY="gcr.io/<some-project>"
```

4. Compile and Install
```bash
tar -zxf libgit2-1.3.0.tar.gz
cd libgit2-1.3.0
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_OSX_ARCHITECTURES="x86_64"
cmake --build . --target install
```
* The KPACK_TEST_NAMESPACE_LABELS environment variable allows you to define additional labels for the test namespace, e.g.

5. Verify installation
```bash
pkg-config --print-provides libgit2
export KPACK_TEST_NAMESPACE_LABELS="istio-injection=disabled,purpose=test"
```

You should expect output which reads: `libgit2 = 1.3.0`
2 changes: 1 addition & 1 deletion hack/apply.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
cd $(dirname "${BASH_SOURCE[0]}")/..

if [ -z "$1" ]; then
echo "Usage: ./hack/apply.sh <DOCKER_REPO>"
echo "Usage: ./hack/apply.sh <registry namespace>"
exit 0
fi

Expand Down