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

docs: Simplify developer guide to use a single ECR repository across multiple projects #4385

Merged
merged 1 commit into from
Aug 4, 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
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 @@ -131,13 +131,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
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