Skip to content

Commit

Permalink
docs: Simplify developer guide to use a single ECR repository across …
Browse files Browse the repository at this point in the history
…multiple projects (aws#4385)
  • Loading branch information
ellistarn authored Aug 4, 2023
1 parent 9b9ea9a commit 68af309
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 21 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ HELM_OPTS ?= --set serviceAccount.annotations.eks\\.amazonaws\\.com/role-arn=${K
# CR for local builds of Karpenter
SYSTEM_NAMESPACE ?= karpenter
KARPENTER_VERSION ?= $(shell git tag --sort=committerdate | tail -1)
KO_DOCKER_REPO ?= ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/karpenter
KO_DOCKER_REPO ?= ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/dev
GETTING_STARTED_SCRIPT_DIR = website/content/en/preview/getting-started/getting-started-with-karpenter/scripts

# Common Directories
Expand Down Expand Up @@ -133,13 +133,13 @@ licenses: download ## Verifies dependency licenses
setup: ## Sets up the IAM roles needed prior to deploying the karpenter-controller. This command only needs to be run once
CLUSTER_NAME=${CLUSTER_NAME} ./$(GETTING_STARTED_SCRIPT_DIR)/add-roles.sh $(KARPENTER_VERSION)

build: ## Build the Karpenter controller images using ko build
$(eval CONTROLLER_IMG=$(shell $(WITH_GOFLAGS) KO_DOCKER_REPO="$(KO_DOCKER_REPO)" ko build -B github.com/aws/karpenter/cmd/controller))
image: ## Build the Karpenter controller images using ko build
$(eval CONTROLLER_IMG=$(shell $(WITH_GOFLAGS) KO_DOCKER_REPO="$(KO_DOCKER_REPO)" ko build --bare github.com/aws/karpenter/cmd/controller))
$(eval IMG_REPOSITORY=$(shell echo $(CONTROLLER_IMG) | cut -d "@" -f 1 | cut -d ":" -f 1))
$(eval IMG_TAG=$(shell echo $(CONTROLLER_IMG) | cut -d "@" -f 1 | cut -d ":" -f 2 -s))
$(eval IMG_DIGEST=$(shell echo $(CONTROLLER_IMG) | cut -d "@" -f 2))

apply: build ## Deploy the controller from the current state of your git repository into your ~/.kube/config cluster
apply: image ## Deploy the controller from the current state of your git repository into your ~/.kube/config cluster
helm upgrade --install karpenter charts/karpenter --namespace ${SYSTEM_NAMESPACE} \
$(HELM_OPTS) \
--set controller.image.repository=$(IMG_REPOSITORY) \
Expand Down
13 changes: 5 additions & 8 deletions website/content/en/docs/contributing/development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ make presubmit # run codegen, lint, and tests
If you are only interested in building the Karpenter images and not deploying the updated release to your cluster immediately with Helm, you can run

```bash
make build # build and push the karpenter images
make image # build and push the karpenter images
```

### Testing
Expand Down Expand Up @@ -106,23 +106,20 @@ stern -n karpenter -l app.kubernetes.io/name=karpenter
### 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.
You can use the following command to provision an ECR repository. We recommend using a single "dev" repository for
development across multiple projects, and to use specific image hashes instead of image tags.

```bash
aws ecr create-repository \
--repository-name karpenter/controller \
--image-scanning-configuration scanOnPush=true \
--region "${AWS_DEFAULT_REGION}"
aws ecr create-repository \
--repository-name karpenter/webhook \
--repository-name dev \
--image-scanning-configuration scanOnPush=true \
--region "${AWS_DEFAULT_REGION}"
```

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

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

Expand Down
13 changes: 5 additions & 8 deletions website/content/en/preview/contributing/development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ make presubmit # run codegen, lint, and tests
If you are only interested in building the Karpenter images and not deploying the updated release to your cluster immediately with Helm, you can run

```bash
make build # build and push the karpenter images
make image # build and push the karpenter images
```

### Testing
Expand Down Expand Up @@ -106,23 +106,20 @@ stern -n karpenter -l app.kubernetes.io/name=karpenter
### 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.
You can use the following command to provision an ECR repository. We recommend using a single "dev" repository for
development across multiple projects, and to use specific image hashes instead of image tags.

```bash
aws ecr create-repository \
--repository-name karpenter/controller \
--image-scanning-configuration scanOnPush=true \
--region "${AWS_DEFAULT_REGION}"
aws ecr create-repository \
--repository-name karpenter/webhook \
--repository-name dev \
--image-scanning-configuration scanOnPush=true \
--region "${AWS_DEFAULT_REGION}"
```

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

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

Expand Down
2 changes: 1 addition & 1 deletion website/content/en/v0.29/contributing/development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ make presubmit # run codegen, lint, and tests
If you are only interested in building the Karpenter images and not deploying the updated release to your cluster immediately with Helm, you can run

```bash
make build # build and push the karpenter images
make image # build and push the karpenter images
```

### Testing
Expand Down

0 comments on commit 68af309

Please sign in to comment.