Skip to content

Commit

Permalink
Updated Cedar, default to docker
Browse files Browse the repository at this point in the history
Signed-off-by: Micah Hausler <mhausler@amazon.com>
  • Loading branch information
micahhausler committed Jan 23, 2025
1 parent ba854b1 commit f5a3c6c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cedar-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:
branches: [ main ]
env:
CEDAR_VERSION: 4.2.2
CEDAR_VERSION: 4.3.0
jobs:
cedar:
name: Cedar
Expand Down
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ webhook.image.tar

# Go workspace file
go.work
go.work.sum

# Kubernetes Generated files - skip generated files, except for vendored files
!vendor/**/zz_generated.*

# Flags
.finch

# editor and IDE paraphernalia
.idea
.vscode
Expand All @@ -39,6 +43,3 @@ go.work
/build
gen
bin
go.work
go.work.sum

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ COPY go.sum go.sum

# :oldmanshakesfistatcloud:
# Amazon's internal networks block the Go module proxy, so for now we set to direct
ENV GOPROXY direct
ENV GOPROXY=direct
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
Expand Down
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ GOBIN=$(shell go env GOBIN)
endif

# CONTAINER_TOOL defines the container tool to be used for building images.
# Be aware that the target commands are only tested with finch.
# However, you may be able to replace this with docker
CONTAINER_TOOL ?= finch

FINCH_FEATURE ?= KIND_EXPERIMENTAL_PROVIDER=finch
ifneq ($(wildcard .finch),)
CONTAINER_TOOL ?= finch
KIND_FEATURE = KIND_EXPERIMENTAL_PROVIDER=finch
else
CONTAINER_TOOL ?= docker
endif

# Setting SHELL to bash allows bash commands to be executed by recipes.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
Expand Down Expand Up @@ -45,7 +46,7 @@ kind-image: image-build ## Build the kind node image

.PHONY: kind
kind: kind-image ## Start a kind cluster configured to use the local authorization webhook
$(FINCH_FEATURE) kind create cluster --config kind.yaml -v2
$(KIND_FEATURE) kind create cluster --config kind.yaml -v2
kubectl apply -f config/crd/bases/cedar.k8s.aws_policies.yaml
kubectl apply -f demo/authorization-policy.yaml
kubectl apply -f demo/admission-policy.yaml
Expand All @@ -58,7 +59,7 @@ kind: kind-image ## Start a kind cluster configured to use the local authorizati

.PHONY: clean-kind
clean-kind: ## Delete the kind cluster and clean up genereated files
$(FINCH_FEATURE) kind delete cluster --name $(KIND_NAME)
$(KIND_FEATURE) kind delete cluster --name $(KIND_NAME)
rm \
./mount/policies/cedar-kubeconfig.yaml \
./mount/*-user-kubeconfig.yaml \
Expand Down
13 changes: 10 additions & 3 deletions docs/Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

### Prerequisites

To run this project locally, you'll need to install [finch][finch], [Go][go], [kubectl][kubectl], [kind][kind], and [kubebuilder][kubebuilder] (if creating/modifying CRDs).
To run this project locally, you'll need to install [Go][go], [kubectl][kubectl], [kind][kind], [kubebuilder][kubebuilder] (if creating/modifying CRDs), and either [finch][finch] or [docker][docker].

[finch]: https://github.com/runfinch/finch
[go]: https://go.dev/dl
[kubectl]: https://kubernetes.io/docs/tasks/tools/
[kind]: https://kind.sigs.k8s.io/
[kubebuilder]: https://book.kubebuilder.io/quick-start
[finch]: https://github.com/runfinch/finch
[docker]: https://docs.docker.com/desktop/

### Kind

Expand All @@ -37,6 +38,7 @@ kind --version

### Finch

You can optionally use Finch as an alternative to Docker.
Use `brew` to install Finch, other installation options can be found [here](https://github.com/runfinch/finch?tab=readme-ov-file#installing-finch).

```bash
Expand Down Expand Up @@ -65,6 +67,11 @@ finch vm status
# Running
```

Finally, signal to the Makefile that you want to use Finch by creating a `.finch` file.
```bash
touch .finch
```

## Local Quickstart

1. Clone this repository to your local environment or IDE.
Expand Down Expand Up @@ -146,7 +153,7 @@ For tearing down the Kind cluster.
make clean-kind
```
And to cleanup the Finch VM.
And if you're using Finch, in order to cleanup the Finch VM run:

```bash
finch vm stop
Expand Down

0 comments on commit f5a3c6c

Please sign in to comment.