Skip to content

Commit 18728fc

Browse files
authored
chore: remove vendor (#4201)
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
1 parent 1884404 commit 18728fc

File tree

8,463 files changed

+27
-2950722
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

8,463 files changed

+27
-2950722
lines changed

.github/workflows/license-lint.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ on:
44
paths:
55
- "go.mod"
66
- "go.sum"
7-
- "vendor/**"
87
- "third_party/k8s.io/kubernetes/hack/verify-licenses.sh"
98
pull_request:
109
paths:
1110
- "go.mod"
1211
- "go.sum"
13-
- "vendor/**"
1412
- "third_party/k8s.io/kubernetes/hack/verify-licenses.sh"
1513

1614
permissions:

.gitignore

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ _dist
2323
config/overlays/dev/manager_image_patch.yaml
2424
config/overlays/dev_mutation/manager_image_patch.yaml
2525

26-
# Kubernetes Generated files - skip generated files, except for vendored files
27-
28-
!vendor/**/zz_generated.*
26+
# Kubernetes Generated files - skip generated files
2927

3028
# editor and IDE paraphernalia
3129
.idea
@@ -350,9 +348,6 @@ __pycache__/
350348
*.odx.cs
351349
*.xsd.cs
352350

353-
# always include vendor directory
354-
!/vendor/**
355-
356351
# tilt
357352
tilt-settings.json
358353
.tiltbuild

AGENTS.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Gatekeeper is a Kubernetes admission controller that provides policy-based gover
1515

1616
**Repository Details:**
1717
- **Size & Type:** Large-scale Go project (~165k lines) focused on Kubernetes admission control and policy governance with extensive test coverage
18-
- **Primary Language:** Go 1.24+ with vendored dependencies
18+
- **Primary Language:** Go 1.24+ with Go modules
1919
- **Key Frameworks:** controller-runtime, OPA/Rego, Common Expression Language (CEL)
2020
- **Container Technology:** Docker with multi-stage builds using buildx
2121
- **Testing Stack:** Go test, BATS (Bash Automated Testing System), envtest for Kubernetes integration
@@ -100,7 +100,6 @@ Gatekeeper is a Kubernetes admission controller that provides policy-based gover
100100
│ ├── externaldata/ # External data provider tests
101101
│ └── testutils/ # Test utilities and helpers
102102
├── third_party/ # Third-party dependencies
103-
├── vendor/ # Go vendor dependencies
104103
└── website/ # Documentation website source
105104
```
106105

@@ -125,7 +124,6 @@ Gatekeeper is a Kubernetes admission controller that provides policy-based gover
125124
**Critical Prerequisites:**
126125
- **Always install Go 1.24.2 or later** - verified compatible version
127126
- **Docker with buildx support** - required for all builds
128-
- **vendor/ directory must be present** - run `go mod vendor` if missing
129127

130128
**Essential Build Commands:**
131129
```bash
@@ -146,14 +144,12 @@ make deploy # Deploy to Kubernetes cluster
146144
**Critical Build Issues & Solutions:**
147145
- **Empty test files cause lint failures** - remove any empty `.go` files in `pkg/` directories
148146
- **Docker buildx required** - standard docker build will fail, must use buildx
149-
- **Vendor dependencies** - run `go mod vendor` before building if vendor/ missing
150147
- **Tool versions matter** - golangci-lint v2.3.0 specifically required
151148

152149
**Development Environment Setup:**
153150
1. Install Go 1.24.2+ and Docker with buildx
154151
2. Clone with full dependency chain: `git clone --recurse-submodules`
155-
3. **Always run `go mod vendor` after fresh clone**
156-
4. **Always run `make lint` before committing** - catches common issues
152+
3. **Always run `make lint` before committing** - catches common issues
157153
5. Use `make native-test` for fast feedback during development
158154

159155
### Testing Strategy
@@ -312,7 +308,7 @@ When contributing to Gatekeeper, maintain clear and human-friendly communication
312308
**Common Validation Failures:**
313309
- **Lint failures:** Usually formatting or import issues, run `make lint` locally first
314310
- **Test timeouts:** E2E tests can timeout after 15 minutes, check cluster resources
315-
- **Build failures:** Often vendor/ or Docker buildx issues, ensure prerequisites met
311+
- **Build failures:** Often Docker buildx issues, ensure prerequisites met
316312

317313
**Security & Performance Notes:**
318314
- **All admission webhook changes require security review** - validate input sanitization

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ ENV GO111MODULE=on \
1616
WORKDIR /go/src/github.com/open-policy-agent/gatekeeper
1717
COPY . .
1818

19-
RUN go build -mod vendor -a -ldflags "${LDFLAGS}" -o manager
19+
RUN \
20+
--mount=type=cache,target=/go/pkg/mod \
21+
--mount=type=cache,target=/root/.cache/go-build \
22+
go build -a -ldflags "${LDFLAGS}" -o manager
2023

2124
FROM gcr.io/distroless/static-debian12@sha256:4b2a093ef4649bccd586625090a3c668b254cfe180dee54f4c94f3e9bd7e381e
2225

Makefile

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ all: lint test manager
184184
native-test: envtest
185185
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(KUBERNETES_VERSION) --bin-dir $(LOCALBIN) -p path)" \
186186
GO111MODULE=on \
187-
go test -mod vendor ./pkg/... ./apis/... ./cmd/gator/... -race -bench . -coverprofile cover.out
187+
go test ./pkg/... ./apis/... ./cmd/gator/... -race -bench . -coverprofile cover.out
188188

189189
.PHONY: benchmark-test
190190
benchmark-test:
@@ -327,19 +327,19 @@ e2e-reader-build-image:
327327

328328
# Build manager binary
329329
manager: generate
330-
GO111MODULE=on go build -mod vendor -o bin/manager -ldflags $(LDFLAGS)
330+
GO111MODULE=on go build -o bin/manager -ldflags $(LDFLAGS)
331331

332332
# Build manager binary
333333
manager-osx: generate
334-
GO111MODULE=on go build -mod vendor -o bin/manager GOOS=darwin -ldflags $(LDFLAGS)
334+
GO111MODULE=on go build -o bin/manager GOOS=darwin -ldflags $(LDFLAGS)
335335

336336
# Run against the configured Kubernetes cluster in ~/.kube/config
337337
run: generate manifests
338-
GO111MODULE=on go run -mod vendor ./main.go
338+
GO111MODULE=on go run ./main.go
339339

340340
# Install CRDs into a cluster
341341
install: manifests
342-
docker run -v $(shell pwd)/config:/config -v $(shell pwd)/vendor:/vendor \
342+
docker run -v $(shell pwd)/config:/config \
343343
registry.k8s.io/kustomize/kustomize:v${KUSTOMIZE_VERSION} build \
344344
/config/crd | kubectl apply -f -
345345

@@ -351,7 +351,6 @@ ifeq ($(ENABLE_GENERATOR_EXPANSION),true)
351351
endif
352352
docker run \
353353
-v $(shell pwd)/config:/config \
354-
-v $(shell pwd)/vendor:/vendor \
355354
registry.k8s.io/kustomize/kustomize:v${KUSTOMIZE_VERSION} build \
356355
/config/overlays/dev | kubectl apply -f -
357356

@@ -364,6 +363,9 @@ manifests: __controller-gen
364363
paths="./apis/..." \
365364
paths="./pkg/..." \
366365
output:crd:artifacts:config=config/crd/bases
366+
@# Copy constraint template CRD from frameworks module
367+
go mod download github.com/open-policy-agent/frameworks/constraint
368+
cp $$(go list -m -f '{{.Dir}}' github.com/open-policy-agent/frameworks/constraint)/deploy/crds.yaml config/crd/bases/constrainttemplate-customresourcedefinition.yaml
367369
./build/update-match-schema.sh
368370
rm -rf manifest_staging
369371
mkdir -p manifest_staging/deploy
@@ -547,7 +549,7 @@ promote-staging-manifest:
547549

548550
# Delete gatekeeper from a cluster. Note this is not a complete uninstall, just a dev convenience
549551
uninstall:
550-
docker run -v $(shell pwd)/config:/config -v $(shell pwd)/vendor:/vendor \
552+
docker run -v $(shell pwd)/config:/config \
551553
registry.k8s.io/kustomize/kustomize:v${KUSTOMIZE_VERSION} build \
552554
/config/overlays/dev | kubectl delete -f -
553555

@@ -585,11 +587,6 @@ envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
585587
$(ENVTEST): $(LOCALBIN)
586588
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20250729155826-ada80794ea8f
587589

588-
.PHONY: vendor
589-
vendor:
590-
go mod vendor
591-
go mod tidy
592-
593590
.PHONY: gator
594591
gator: bin/gator-$(GOOS)-$(GOARCH)
595592
mv bin/gator-$(GOOS)-$(GOARCH) bin/gator

Tiltfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ COPY bin/manager .
3434
def build_manager():
3535
cmd = [
3636
"make tilt-prepare",
37-
"GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -mod vendor -a -o .tiltbuild/bin/manager",
37+
"GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o .tiltbuild/bin/manager",
3838
]
3939
local_resource(
4040
"manager",
4141
cmd=";".join(cmd),
42-
deps=["pkg", "third_party", "vendor",
42+
deps=["pkg", "third_party",
4343
"apis", "go.mod", "go.sum", "main.go"],
4444
labels=["bin"],
4545
)
@@ -81,14 +81,14 @@ def build_crds():
8181
# deploy_gatekeeper defines the deploy process for the gatekeeper chart from manifest_staging/charts/gatekeeper.
8282
def deploy_gatekeeper():
8383
local("kubectl create namespace gatekeeper-system || true")
84-
84+
8585
local_resource(
8686
name="generate-helm-values",
8787
cmd="cat tilt-settings.json | jq '.helm_values' > .tiltbuild/helm_values.generated.yaml",
8888
deps=["tilt-settings.json"],
8989
labels=["helm"],
9090
)
91-
91+
9292
helm_values = settings.get("helm_values", {})
9393

9494
k8s_yaml(helm(

apis/apis.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
*/
1515

16-
// Generate deepcopy for apis
17-
//go:generate go run ../../vendor/k8s.io/code-generator/cmd/deepcopy-gen/main.go -O zz_generated.deepcopy -i ./... -h ../../hack/boilerplate.go.txt
18-
1916
// Package apis contains Kubernetes API groups.
2017
package apis
2118

vendor/github.com/open-policy-agent/frameworks/constraint/deploy/crds.yaml renamed to config/crd/bases/constrainttemplate-customresourcedefinition.yaml

File renamed without changes.

config/crd/kustomization.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ resources:
1717
- bases/status.gatekeeper.sh_connectionpodstatuses.yaml
1818
- bases/status.gatekeeper.sh_providerpodstatuses.yaml
1919
- bases/connection.gatekeeper.sh_connections.yaml
20+
- bases/constrainttemplate-customresourcedefinition.yaml
2021
# +kubebuilder:scaffold:crdkustomizeresource
2122

22-
bases:
23-
- ../../vendor/github.com/open-policy-agent/frameworks/constraint/deploy
24-
2523
patches:
2624
- target:
2725
group: apiextensions.k8s.io

gator.Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ ENV GO111MODULE=on \
1515
COPY . /go/src/github.com/open-policy-agent/gatekeeper
1616
WORKDIR /go/src/github.com/open-policy-agent/gatekeeper/cmd/gator
1717

18-
RUN go build -mod vendor -a -ldflags "${LDFLAGS}" -o /gator
18+
RUN \
19+
--mount=type=cache,target=/go/pkg/mod \
20+
--mount=type=cache,target=/root/.cache/go-build \
21+
go build -a -ldflags "${LDFLAGS}" -o /gator
1922

2023
FROM --platform=$BUILDPLATFORM gcr.io/distroless/static-debian12@sha256:4b2a093ef4649bccd586625090a3c668b254cfe180dee54f4c94f3e9bd7e381e AS build
2124
USER 65532:65532

0 commit comments

Comments
 (0)