Files
charts/.devcontainer/postCreateCommand.sh
Oliver Simons 2eb7770519 fix(devcontainer): Export KREW_PATH to fish shell (#40021)
**Description**

This allow us to actually use krew and installed plugins from fish
shells inside our devcontainer

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [x] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code
- [ ] 📜 Documentation Changes

**🧪 How Has This Been Tested?**

On local vs-code install, I was hitting
```
talos_clustertool on  main [$] 
⬢ [Docker] ❯ kubectl krew
error: unknown command "krew" for "kubectl"

talos_clustertool on  main [$] 
⬢ [Docker] ❯ kubectl pv-mounter
error: unknown command "pv-mounter" for "kubectl"
```
before fix inside a devcontainer. After exporting the krew path to fish,
we can find the installed plugins.

```
talos_clustertool on  main [!] 
⬢ [Docker] ❯ kubectl pv-mounter
pv-mounter is a kubectl plugin that allows you to easily mount and unmount
Kubernetes PersistentVolumeClaims (PVCs) locally via SSHFS.

It transparently manages proxy pods, ephemeral containers, port-forwarding,
and SSHFS connections.
...
``` 

**📃 Notes:**
Not sure if relevant, but I used:
```
(base) ➜  truecharts git:(orippler/export_krew_path_to_fish) code --version
1.104.1
0f0d87fa9e96c856c5212fc86db137ac0d783365
x64
```
on Ubuntu 22.04
**✔️ Checklist:**

- [ ] ⚖️ My code follows the style guidelines of this project
- [x] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made changes to the documentation
- [ ] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [ ] ⬆️ I increased versions for any altered app according to semantic
versioning
- [x] I made sure the title starts with `feat(chart-name):`,
`fix(chart-name):`, `chore(chart-name):`, `docs(chart-name):` or
`fix(docs):`

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._
2025-09-26 06:05:35 +02:00

33 lines
991 B
Bash
Executable File

#!/usr/bin/env bash
set -e
set -o noglob
# Setup fisher plugin manager for fish and install plugins
/usr/bin/fish -c "
curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
fisher install decors/fish-colored-man
fisher install edc/bass
fisher install jorgebucaran/autopair.fish
fisher install nickeb96/puffer-fish
fisher install PatrickF1/fzf.fish
"
(
set -x; cd "$(mktemp -d)" &&
OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
KREW="krew-${OS}_${ARCH}" &&
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
tar zxvf "${KREW}.tar.gz" &&
./"${KREW}" install krew
)
KREW_PATH="${KREW_ROOT:-$HOME/.krew}/bin"
export PATH="$KREW_PATH:$PATH"
# add KREW_PATH to fish shell path
/usr/bin/fish -c "fish_add_path $KREW_PATH"
kubectl krew install pv-mounter
kubectl krew install cnpg
kubectl krew install df-pv