Skip to content

Vendorless Knative #134

@chizhg

Description

@chizhg

Currently, all the Knative projects are using go mod vendor, resulting in a huge number of files in the vendor directory.

Reasons for vendor dir removal

Maintenance burden for productivity

Having the vendor directory in every project creates a huge maintenance burden for productivity. Every single tool we use (various linters, compilers, formatters etc.) needs to be properly filtered, so it will give off false-positives. Here's a live example: knative-extensions/knobots#259 (there were multiple similar issues in the past)

Hard to count the contributions

Counting contributions is important for OSS projects, as it provides some insights into the health of the project. Having a vendor dir, impedes that, immensely. We need to filter out bots that contribute, and moreover, filter out the people contributions in vendor directory (or vendors in go.work is in place). Otherwise, the amount of the vendor code overwhelms any statistics.

Project looks dated

The enhancements in Go that made it possible to work without vendor directory safely has been made a long time ago - Go 1.13 released Sep 3, 2019 (over 3y ago). Since then, most of the code in Go has moved away from having the vendor directory. Sticking with it shows the project is old-fashioned, especially for newcomers. Remember when people attached external jar files to their Java projects, manually? That was before Maven was created to solve dependency management. The same was done for Go in 1.13+ releases.

Bad code habits

Having a vendor directory allows for relying on bad code habits, and hacks. Instead of using that just for Go code, we sometimes use it as a general tool for doing path traversal to some of the resources in the dependent projects. That's a smell, and may lead even to a vulnerability. Example of such smell can be seen in Knative-Serving:

$ find . -type l -printf '%p -> ' -exec readlink {} ';' | grep vendor
./config/core/configmaps/network.yaml -> ../../../vendor/knative.dev/networking/config/config-network.yaml
./config/core/300-imagecache.yaml -> ../../vendor/knative.dev/caching/config/image.yaml
./config/core/300-resources/certificate.yaml -> ../../../vendor/knative.dev/networking/config/certificate.yaml
./config/core/300-resources/domain-claim.yaml -> ../../../vendor/knative.dev/networking/config/domain-claim.yaml
./config/core/300-resources/ingress.yaml -> ../../../vendor/knative.dev/networking/config/ingress.yaml
./config/core/300-resources/serverlessservice.yaml -> ../../../vendor/knative.dev/networking/config/serverlessservice.yaml

(This is code smell, as symlinks are not cross-platform)

Status

The proposed roadmap has been presented at TOC (slides: https://docs.google.com/presentation/d/1eK7vhSRnahOq34WYkKJde8hvXMvb8eY3r76Wem5Ia9A) and was accepted.

Roadmap

Below is a list of issues that form this Epic.

  1. First phase (the ordering is relevant)
    1. Hacks needs to be sourced without the vendor directory
    2. Knative hack scripts need to work with repos with vendor and without
    3. Notify the Knative contributors they can remove vendor if not using code-gen, or having symlinks to vendor/
    4. Check is it possible to execute K8s's shell scripts in vendorless project
  2. Second phase (could be done in any order)

Metadata

Metadata

Labels

EpicEpics to group issuespriority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next release.triage/acceptedIssues which should be fixed (post-triage)

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions