Skip to content

Commit

Permalink
Reflect comments
Browse files Browse the repository at this point in the history
Signed-off-by: Daichi Sakaue <[email protected]>
  • Loading branch information
yokaze committed Oct 23, 2024
1 parent 20899f3 commit 4994346
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,27 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup tools
run: make setup
run: make setup download-cilium-cli
- name: Run code check
run: make check-generate
- name: Run lint
run: make lint
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build cilium-agent-proxy
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
load: true
push: false
tags: cilium-agent-proxy:dev
- name: Run environment
working-directory: e2e
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
echo "Tag v${{ inputs.tag }} already exists"
exit 1
fi
- name: Download Cilium CLI
run: make download-cilium-cli
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ RUN go mod download

# Copy the go source
COPY cmd/cilium-agent-proxy/ cmd/cilium-agent-proxy/
COPY Makefile Makefile

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o cilium-agent-proxy ./cmd/cilium-agent-proxy
RUN make build-proxy

# Compose the manager container
FROM ghcr.io/cybozu/ubuntu:22.04
LABEL org.opencontainers.image.source=https://github.com/cybozu-go/network-policy-viewer

WORKDIR /
COPY bin/download/cilium /
COPY --from=builder /work/cilium-agent-proxy /
COPY --from=builder /work/bin/cilium-agent-proxy /

ENTRYPOINT ["/cilium-agent-proxy"]
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

.PHONY: setup
setup: $(CILIUM_CLI) $(CUSTOMCHECKER) $(STATICCHECK) ## Install necessary tools
setup: $(CUSTOMCHECKER) $(STATICCHECK) ## Install necessary tools
if ! which aqua; then \
echo 'setup needs aqua.'; \
exit 1; \
Expand All @@ -28,7 +28,8 @@ setup: $(CILIUM_CLI) $(CUSTOMCHECKER) $(STATICCHECK) ## Install necessary tools
$(HELM) repo add cilium https://helm.cilium.io/
$(HELM) repo update cilium

$(CILIUM_CLI):
.PHONY: download-cilium-cli
download-cilium-cli:
mkdir -p $(TOOLS_DIR)
CONTAINER_ID=$$(docker run --detach --entrypoint pause ghcr.io/cybozu/cilium:$(CILIUM_IMAGE_VERSION)); \
docker cp $${CONTAINER_ID}:/usr/bin/cilium $(CILIUM_CLI); \
Expand All @@ -51,7 +52,12 @@ clean:
.PHONY: build
build: ## Build network-policy-viewer
mkdir -p $(BIN_DIR)
go build -trimpath -ldflags "-w -s" -o $(BIN_DIR)/npv ./cmd/npv
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-w -s" -o $(BIN_DIR)/npv ./cmd/npv

.PHONY: build-proxy
build-proxy: ## Build cilium-agent-proxy
mkdir -p $(BIN_DIR)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-w -s" -o $(BIN_DIR)/cilium-agent-proxy ./cmd/cilium-agent-proxy

.PHONY: check-generate
check-generate:
Expand Down
1 change: 1 addition & 0 deletions e2e/testdata/cilium-agent-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ spec:
- name: cilium-socket
hostPath:
path: /var/run/cilium
# "cilium bpf policy get" reads from /sys/fs/bpf
- name: bpf
hostPath:
path: /sys/fs/bpf
Expand Down

0 comments on commit 4994346

Please sign in to comment.