Skip to content

Commit

Permalink
HACK: debugging e2e via local CAPI sources
Browse files Browse the repository at this point in the history
  • Loading branch information
mboersma committed Mar 27, 2024
1 parent 92df662 commit 1132ef1
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 35 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
!/main.go
!/go.mod
!/go.sum
!/manager
61 changes: 31 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,48 @@
# Build architecture
ARG ARCH

# Build the manager binary
FROM golang:1.21 as builder
WORKDIR /workspace
# # Build the manager binary
# FROM golang:1.21 as builder
# WORKDIR /workspace

# Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy
ARG goproxy=https://proxy.golang.org
ENV GOPROXY=$goproxy
# # Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy
# ARG goproxy=https://proxy.golang.org
# ENV GOPROXY=$goproxy

# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# # Copy the Go Modules manifests
# COPY go.mod go.mod
# COPY go.sum go.sum

# 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 --mount=type=cache,target=/go/pkg/mod \
go mod download
# # 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 --mount=type=cache,target=/go/pkg/mod \
# go mod download

# Copy the sources
COPY ./ ./
# # Copy the sources
# COPY ./ ./

# Cache the go build into the the Go’s compiler cache folder so we take benefits of compiler caching across docker build calls
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
go build .
# # Cache the go build into the the Go’s compiler cache folder so we take benefits of compiler caching across docker build calls
# RUN --mount=type=cache,target=/root/.cache/go-build \
# --mount=type=cache,target=/go/pkg/mod \
# go build .

# Build
ARG package=.
ARG ARCH
ARG ldflags
# # Build
# ARG package=.
# ARG ARCH
# ARG ldflags

# Do not force rebuild of up-to-date packages (do not use -a) and use the compiler cache folder
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
go build -ldflags "${ldflags} -extldflags '-static'" \
-o manager ${package}
# # Do not force rebuild of up-to-date packages (do not use -a) and use the compiler cache folder
# RUN --mount=type=cache,target=/root/.cache/go-build \
# --mount=type=cache,target=/go/pkg/mod \
# CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
# go build -ldflags "${ldflags} -extldflags '-static'" \
# -o manager ${package}

# Production image
FROM gcr.io/distroless/static:nonroot-${ARCH}
WORKDIR /
COPY --from=builder /workspace/manager .
COPY manager .
# COPY --from=builder /workspace/manager .
# Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies
USER 65532
ENTRYPOINT ["/manager"]
2 changes: 1 addition & 1 deletion config/capz/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ spec:
spec:
containers:
# Change the value of image field below to your controller image URL
- image: gcr.io/k8s-staging-cluster-api-azure/cluster-api-azure-controller:main
- image: localhost:5000/ci-e2e/cluster-api-azure-controller-arm64:20240326201746
name: manager
2 changes: 1 addition & 1 deletion config/capz/manager_pull_policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ spec:
spec:
containers:
- name: manager
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ require (
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.7.0-beta.1
replace sigs.k8s.io/cluster-api => /Users/matt/projects/cluster-api

// kube-openapi should match the version imported by CAPI.
replace k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,6 @@ sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.0-20240218020800-ba9f211f36bf
sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.0.0-20240218020800-ba9f211f36bf/go.mod h1:cyVxBbpj/UR4Vi4KhxO3vhzBB2JcN08TngoPQ0J0aWc=
sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.0.0-20240218020800-ba9f211f36bf h1:LZRYBmJz2VKh87TKev7qO7r5NE3XiRI8u9mskLIEDhc=
sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.0.0-20240218020800-ba9f211f36bf/go.mod h1:8Y2dnp0FlQcoFllRnUgTZjMykhMAUF7NrPLgw30Ae4I=
sigs.k8s.io/cluster-api v1.7.0-beta.1 h1:AIdBglOQaYTn5LzgyF4VFRA555HclKKMd5D63Qpekow=
sigs.k8s.io/cluster-api v1.7.0-beta.1/go.mod h1:4NCwUXE0ilEYCn4hr0RU304uFUsn7bqcCbRU7FxgpEo=
sigs.k8s.io/cluster-api/test v1.7.0-beta.1 h1:ub/Y9h3l2bb0Bso/aOjWqjs4cQGxb+szv67IOmUo+5Y=
sigs.k8s.io/cluster-api/test v1.7.0-beta.1/go.mod h1:kdAGRM50dSXPsvGgrCjx0SwK4pDC4TzNaBUZMXICskY=
sigs.k8s.io/controller-runtime v0.17.2 h1:FwHwD1CTUemg0pW2otk7/U5/i5m2ymzvOXdbeGOUvw0=
Expand Down

0 comments on commit 1132ef1

Please sign in to comment.