Skip to content

add optional netrc authentication support for plugin downloads#897

Merged
k8s-ci-robot merged 9 commits intokubernetes-sigs:masterfrom
dkulchinsky:dannyk/netrc_fetch
Feb 24, 2026
Merged

add optional netrc authentication support for plugin downloads#897
k8s-ci-robot merged 9 commits intokubernetes-sigs:masterfrom
dkulchinsky:dannyk/netrc_fetch

Conversation

@dkulchinsky
Copy link
Copy Markdown
Contributor

@dkulchinsky dkulchinsky commented Feb 17, 2026

Related issue: #896

This PR adds support for netrc authentication when downloading kubectl plugins, allowing users to access private plugin repositories that require HTTP Basic authentication.

Changes

New CLI flags:

--enable-netrc: Enable netrc authentication for downloads
--netrc-file: Specify custom netrc file path (defaults to ~/.netrc)

Implementation:

  • Updated HTTP fetcher to conditionally check netrc credentials
  • Added support for both plugin archive downloads and manifest URL downloads
  • netrc support is opt-in and disabled by default
  • When netrc is enabled and credentials cannot be loaded/parsed (including missing netrc file), the command fails with an error

Usage

# Use default ~/.netrc file
kubectl krew install --enable-netrc my-private-plugin

# Use custom netrc file
kubectl krew install --enable-netrc --netrc-file /path/to/netrc my-plugin

# Install from manifest URL with authentication
kubectl krew install --enable-netrc --manifest-url https://private-repo.com/manifest.yaml

Example .netrc entry:

machine private-repo.com
  login myuser
  password mypass

This enables krew to work with private plugin repositories while maintaining backward compatibility and security best practices.

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Feb 17, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Welcome @dkulchinsky!

It looks like this is your first PR to kubernetes-sigs/krew 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/krew has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 17, 2026
Copy link
Copy Markdown
Member

@ahmetb ahmetb left a comment

Choose a reason for hiding this comment

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

mostly good

@dkulchinsky
Copy link
Copy Markdown
Contributor Author

mostly good

thank you @ahmetb for the review, I believe I addressed all the comments, very helpful!

let me know if you have any other concerns.

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 24, 2026
@ahmetb
Copy link
Copy Markdown
Member

ahmetb commented Feb 24, 2026

/lgtm
/approve
Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 24, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahmetb, dkulchinsky

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

The pull request process is described 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 merged commit c939c5f into kubernetes-sigs:master Feb 24, 2026
7 checks passed
@dkulchinsky
Copy link
Copy Markdown
Contributor Author

wonderful news @ahmetb! thank you again for the review & approval 😄

not to sound pushy 😅 but any chance a release can be triggered to include this change? we can't wait to drop our private fork, haha

@ahmetb
Copy link
Copy Markdown
Member

ahmetb commented Feb 24, 2026

@dkulchinsky I don't think you've sent a docs PR yet?

@dkulchinsky
Copy link
Copy Markdown
Contributor Author

@dkulchinsky I don't think you've sent a docs PR yet?

@ahmetb not yet, was just looking for it.

Looks like:

I'll get that PR ready 👍🏼

@dkulchinsky dkulchinsky mentioned this pull request Feb 24, 2026
@dkulchinsky
Copy link
Copy Markdown
Contributor Author

@ahmetb here's the docs PR: #899

I ended up adding it to https://github.com/kubernetes-sigs/krew/blob/master/site/content/docs/user-guide/using-custom-indexes.md as I felt it's more appropriate context-wise, but happy to revise or add more info if needed.

@dkulchinsky
Copy link
Copy Markdown
Contributor Author

Hey @ahmetb 👋🏼

With the docs changes now merged & live, I'm hoping a krew release can be triggered? 🙏🏼

@ahmetb
Copy link
Copy Markdown
Member

ahmetb commented Feb 25, 2026

I can help shortly. Have you had a chance to compile and test it locally by the way?

@dkulchinsky
Copy link
Copy Markdown
Contributor Author

I can help shortly. Have you had a chance to compile and test it locally by the way?

@ahmetb sure did! works as designed :)

❯ ~/bin/krew install --enable-netrc foo/rt
Updated the local copy of plugin index.
Updated the local copy of plugin index "foo".
Installing plugin: rt
Installed plugin: rt
\
 | Use this plugin:
 |      kubectl rt
 | Documentation:
 |      https://github.com/foo/foo-krew/tree/main/src/rt
 | Caveats:
 | \
 |  | * foo
 |  | * bar
 |  | * baz
 | /
/

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Mar 2, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [kubernetes-sigs/krew](https://github.com/kubernetes-sigs/krew) | minor | `v0.4.5` → `v0.5.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>kubernetes-sigs/krew (kubernetes-sigs/krew)</summary>

### [`v0.5.0`](https://github.com/kubernetes-sigs/krew/releases/tag/v0.5.0)

[Compare Source](kubernetes-sigs/krew@v0.4.5...v0.5.0)

## Installation

To install this release, refer to the instructions at <https://github.com/kubernetes-sigs/krew/blob/v0.5.0/README.md>.

## Release Assets

Artifacts for this release can be downloaded from the following links.
It is recommended to follow [installation instructions](https://github.com/kubernetes-sigs/krew/blob/v0.5.0/README.md)
and not using these artifacts directly.

- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew-darwin_amd64.tar.gz>
- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew-darwin_amd64.tar.gz.sha256>
- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew-darwin_arm64.tar.gz>
- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew-darwin_arm64.tar.gz.sha256>
- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew-linux_amd64.tar.gz>
- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew-linux_amd64.tar.gz.sha256>
- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew-linux_arm.tar.gz>
- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew-linux_arm.tar.gz.sha256>
- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew-linux_arm64.tar.gz>
- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew-linux_arm64.tar.gz.sha256>
- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew-linux_ppc64le.tar.gz>
- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew-linux_ppc64le.tar.gz.sha256>
- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew-windows_amd64.tar.gz>
- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew-windows_amd64.tar.gz.sha256>
- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew.exe>
- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew.exe.sha256>
- <https://github.com/kubernetes-sigs/krew/releases/download/v0.5.0/krew.yaml>

Thanks to our contributors for helping out with v0.5.0:

- Tyler Auerbeck
- Danny Kulchinsky
- mattn
- ls-2018
- Mikel Olasagasti Uranga
- Ishaan Mittal
- Ahmet Alp Balkan

(krew v0.5.0 was tagged on Thu Feb 26 02:31:09 UTC 2026.)

<details>
<summary>Merged pull requests</summary>

- add optional netrc authentication support for plugin downloads [#&#8203;897](kubernetes-sigs/krew#897)
- docs for netrc auth [#&#8203;899](kubernetes-sigs/krew#899)
- Update to Go 1.25 and latest Go dependencies [#&#8203;890](kubernetes-sigs/krew#890)
- feat: speed up ci [#&#8203;884](kubernetes-sigs/krew#884)
- Fix: Non-constant format string in PrintWarning [#&#8203;877](kubernetes-sigs/krew#877)
- Bump GitHub actions to latest stable [#&#8203;881](kubernetes-sigs/krew#881)
- bump golangci-lint to v2 [#&#8203;880](kubernetes-sigs/krew#880)
- Add workaround for msys2/cygwin git [#&#8203;873](kubernetes-sigs/krew#873)

</details>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4zNS4xIiwidXBkYXRlZEluVmVyIjoiNDMuMzUuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants