Skip to content

fix(redirects): forward k8s.io Go package URLs to pkg.go.dev#55640

Open
singhvishalkr wants to merge 2 commits intokubernetes:mainfrom
singhvishalkr:redirects-go-vanity-pkg-go-dev
Open

fix(redirects): forward k8s.io Go package URLs to pkg.go.dev#55640
singhvishalkr wants to merge 2 commits intokubernetes:mainfrom
singhvishalkr:redirects-go-vanity-pkg-go-dev

Conversation

@singhvishalkr
Copy link
Copy Markdown

Issue #55628 reports that https://kubernetes.io/api, /apimachinery, and /client-go all 404. Browsers reach these paths through the k8s.io Go vanity URLs: k8s.io/api serves the go-import meta tag for go get, but a browser hitting the same URL gets a normal 302 to kubernetes.io/api and dead-ends there.

The reporter suggested forwarding these to pkg.go.dev/k8s.io/{package}, which is where the canonical Go package documentation lives. This PR does exactly that with three 301 entries in static/_redirects.base:

/api          https://pkg.go.dev/k8s.io/api          301
/apimachinery https://pkg.go.dev/k8s.io/apimachinery 301
/client-go    https://pkg.go.dev/k8s.io/client-go    301

/api, /apimachinery, and /client-go are not currently published as kubernetes.io content, so there is no conflicting page to override. The 301 status follows the convention used by the existing site-internal entries in the same file; the external-redirect form follows the precedent of /docs/tasks/tools/install-minikube/ -> https://minikube.sigs.k8s.io/docs/start/.

Scope is intentionally narrow: only the three paths called out in the issue. Sub-path splat redirects (e.g. /api/core/v1/* -> pkg.go.dev/k8s.io/api/core/v1/...) are easy to add later if a maintainer thinks they are worth it, but the issue is specifically about the package landing pages and I did not want to expand surface beyond what was reported.

Closes #55628

kubernetes.io/api, /apimachinery and /client-go currently 404. These paths receive browser traffic via the k8s.io go-import meta vanity URLs (k8s.io/api -> kubernetes.io/api), so they should forward to canonical package documentation rather than dead-end.
@k8s-ci-robot k8s-ci-robot added sig/docs Categorizes an issue or PR as relevant to SIG Docs. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 2, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented May 2, 2026

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit fbdc901
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-io-main-staging/deploys/69f970912060480007686f9d
😎 Deploy Preview https://deploy-preview-55640--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@singhvishalkr
Copy link
Copy Markdown
Author

/assign @SayakMukhopadhyay

@lmktfy
Copy link
Copy Markdown
Member

lmktfy commented May 2, 2026

Thanks; I suggest a tweak. Use 307 rather than 301 status for the redirects.

I also don't know if we want to make this change. Anyway, it is almost technically correct, and the fixup is easy.

Copy link
Copy Markdown
Member

@Arhell Arhell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from sayakmukhopadhyay. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot removed the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label May 5, 2026
@singhvishalkr
Copy link
Copy Markdown
Author

Switched to 307 in fbdc901. Makes sense since pkg.go.dev could change its URL scheme.

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. sig/docs Categorizes an issue or PR as relevant to SIG Docs. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

browser redirects for Go packages k8s.io/api, k8s.io/apimachinery, and k8s.io/client-go return 404s

5 participants