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

Updated developer guide with additional guidance #929

Merged
merged 1 commit into from
Dec 6, 2021
Merged
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
36 changes: 18 additions & 18 deletions website/content/en/docs/development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ weight: 80

The following tools are required for contributing to the Karpenter project.

| Package | Version | Install |
| ------------------------------------------------------------------ | -------- | ---------------------- |
| [go](https://golang.org/dl/) | v1.15.3+ | [Instructions](https://golang.org/doc/install) |
| [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) | | `brew install kubectl` |
| [helm](https://helm.sh/docs/intro/install/) | | `brew install helm` |
| Other tools | | `make toolchain` |
| Package | Version | Install |
| ------------------------------------------------------------------ | -------- | ---------------------------------------------- |
| [go](https://golang.org/dl/) | v1.15.3+ | [Instructions](https://golang.org/doc/install) |
| [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) | | `brew install kubectl` |
| [helm](https://helm.sh/docs/intro/install/) | | `brew install helm` |
| Other tools | | `make toolchain` |

## Developing

Expand All @@ -38,38 +38,38 @@ make delete # Uninstall Karpenter
* It's also a good idea to persist `$CLOUD_PROVIDER` in your environment variables to simplify the `make apply` command.

### Build and Deploy
```
make dev # build and test code
kubectl create namespace karpenter # create target namespace for deployment
CLOUD_PROVIDER=<YOUR_PROVIDER> make apply # deploy for your cloud provider
*Note: these commands do not rely on each other and may be executed independently*
```sh
make apply # quickly deploy changes to your cluster
make dev # run codegen, lint, and tests
```

### Testing
```
```sh
make test # E2e correctness tests
make battletest # More rigorous tests run in CI environment
```

### Verbose Logging
```bash
```sh
kubectl patch configmap config-logging -n karpenter --patch '{"data":{"loglevel.controller":"debug"}}'
```

### Debugging Metrics
OSX:
```bash
```sh
open http://localhost:8080/metrics && kubectl port-forward service/karpenter-metrics -n karpenter 8080
```

Linux:
```bash
```sh
gio open http://localhost:8080/metrics && kubectl port-forward service/karpenter-metrics -n karpenter 8080
```

### Tailing Logs
While you can tail Karpenter's logs with kubectl, there's a number of tools out there that enhance the experience. We recommend [Stern](https://pkg.go.dev/github.com/planetscale/stern#section-readme):

```bash
```sh
stern -l karpenter=controller -n karpenter
```

Expand All @@ -78,13 +78,13 @@ stern -l karpenter=controller -n karpenter
### AWS
Set the CLOUD_PROVIDER environment variable to build cloud provider specific packages of Karpenter.

```
```sh
export CLOUD_PROVIDER=aws
```

For local development on Karpenter you will need a Docker repo which can manage your images for Karpenter components.
You can use the following command to provision an ECR repository.
```
```sh
aws ecr create-repository \
--repository-name karpenter/controller \
--image-scanning-configuration scanOnPush=true \
Expand All @@ -97,7 +97,7 @@ aws ecr create-repository \

Once you have your ECR repository provisioned, configure your Docker daemon to authenticate with your newly created repository.

```
```sh
export KO_DOCKER_REPO="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/karpenter"
aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin $KO_DOCKER_REPO
```