Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
bonnefoa committed Aug 28, 2022
1 parent 30fc9f4 commit 90c54ae
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Table of Contents
* [Shell autocompletion](#shell-autocompletion)
* [Using zplug](#using-zplug)
* [Usage](#usage)
* [cache_builder](#cache_builder)
* [kubectl-fzf-server](#kubectl-fzf-server)
* [Configuration](#configuration)
* [kubectl_fzf](#kubectl_fzf)
* [Options](#options)
Expand All @@ -36,16 +36,16 @@ Table of Contents

# Requirements

- go (minimum version 1.12)
- go (minimum version 1.18)
- [fzf](https://github.com/junegunn/fzf)

# Installation

## Cache builder
## kubectl-fzf-server

### Local installation

Install `cache_builder`:
Install `kubectl-fzf-server`:
```shell
# Mac
FILE="kubectl-fzf_darwin_amd64.tar.gz"
Expand All @@ -55,7 +55,7 @@ FILE="kubectl-fzf_linux_amd64.tar.gz"
cd /tmp
wget "https://github.com/bonnefoa/kubectl-fzf/releases/latest/download/$FILE"
tar -xf $FILE
install cache_builder ~/local/bin/cache_builder
install kubectl-fzf-server ~/local/bin/kubectl-fzf-server
```

### As a kubernetes deployment
Expand All @@ -64,7 +64,7 @@ You can deploy the cache builder as a pod in your cluster.

```shell

helm template --namespace myns --set image.cache_builder.tag=1.0.11 --set toleration=aToleration . | kubectl apply -f -
helm template --namespace myns --set image.kubectl_fzf_server.tag=1.0.11 --set toleration=aToleration . | kubectl apply -f -
```

You can check the latest image version [here](https://cloud.docker.com/repository/docker/bonnefoa/kubectl-fzf/general).
Expand Down Expand Up @@ -96,25 +96,25 @@ zplug "bonnefoa/kubectl-fzf", defer:3

# Usage

## cache_builder: local version
## kubectl-fzf-server: local version

`cache_builder` will watch cluster resources and keep the current state of the cluster in local files.
`kubectl-fzf-server` will watch cluster resources and keep the current state of the cluster in local files.
By default, files are written in `/tmp/kubectl_fzf_cache` (defined by `KUBECTL_FZF_CACHE`)

To create cache files necessary for `kubectl_fzf`, just run in a tmux or a screen

```shell
cache_builder
kubectl-fzf-server
```

It will watch the cluster in the current context. If you switch context, `cache_builder` will detect and start watching the new cluster.
It will watch the cluster in the current context. If you switch context, `kubectl-fzf-server` will detect and start watching the new cluster.
The initial resource listing can be long on big clusters and autocompletion might need 30s+.

`connect: connection refused` or similar messages are expected if there's network issues/interruptions and `cache_builder` will automatically reconnect.
`connect: connection refused` or similar messages are expected if there's network issues/interruptions and `kubectl-fzf-server` will automatically reconnect.

### Configuration

You can configure `cache_builder` with the configuration file `$HOME/.kubectl_fzf.yaml`
You can configure `kubectl-fzf-server` with the configuration file `$HOME/.kubectl_fzf.yaml`

```yaml
# Role to hide from the role list in node completion
Expand All @@ -140,7 +140,7 @@ excluded-namespaces:
- It can be CPU and memory intensive on big clusters
- It also can be bandwidth intensive. The most expensive is the initial listing at startup and on error/disconnection. Big namespace can increase the probability of errors during initial listing.
## cache_builder: pod version
## kubectl-fzf-server: pod version
If the pod is deployed in your cluster, the autocompletion fetch the cache files from the pod using rsync.
Expand All @@ -165,7 +165,7 @@ If you want to avoid this, you can keep the `open_port_forward.sh` script runnin

### Advantages

- No need to run a local `cache_builder`
- No need to run a local `kubectl-fzf-server`
- Bandwidth usage is limited to the rsync transfert which is low.

### Drawbacks
Expand All @@ -174,7 +174,7 @@ If you want to avoid this, you can keep the `open_port_forward.sh` script runnin

## kubectl_fzf

Once `cache_builder` is running, you will be able to use `kubectl_fzf` by calling the kubectl completion
Once `kubectl-fzf-server` is running, you will be able to use `kubectl_fzf` by calling the kubectl completion
```shell
kubectl get pod <TAB>
```
Expand Down Expand Up @@ -227,9 +227,9 @@ Changing the zstyle to `zstyle ':completion:*' matcher-list 'r:|=*'` fixes the i

## Debug logs

To launch cache_builder with debug logs
To launch kubectl-fzf-server with debug logs
```shell
cache_builder -logtostderr -v 14
kubectl-fzf-server -logtostderr -v 14
```

## The normal autocompletion is used
Expand Down

0 comments on commit 90c54ae

Please sign in to comment.