Skip to content

Commit

Permalink
docs: update krew docs and READMe
Browse files Browse the repository at this point in the history
  • Loading branch information
mateimicu committed Jul 25, 2022
1 parent 75cc932 commit efc8653
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 38 deletions.
4 changes: 2 additions & 2 deletions .krew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ metadata:
spec:
version: {{ .TagName }}
homepage: https://github.com/mateimicu/kdiscover
shortDescription: "Discover Kubernetes clusters and export configs"
shortDescription: "Find/export kubeconfigs for cloud clusters"
description: |
Discover all the cluster from a provider (AWS, GCP, Azure, etc)
and manage there credentials.
and export the kubeconfig credentials.
platforms:
# MacOs
- selector:
Expand Down
24 changes: 24 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# FAQ

### How does it find clusters ?

It searches for Cluster credentials and trying to list all the clusters on all regions.
For example in AWS case will look for the normal credential chain then try to list and describe
all clusters on all regions (from a given partition, see `kdiscover aws --help` expecially `--aws-partitions`)

### What is the heuristic for `exported locally`

The logic is implemented [here](./internal/kubeconfig/kubeconfig.go) in `IsExported` function.
The basic idea is:

- we have a cluster in kubeconfig with the same endpoint
- that cluster is referenced in a `context` block (see [Organizing Cluster Access Using kubeconfig Files][kubeconfig-context])


### Configur context name with `--context-name-alias`

The [kubeconfig context][kubeconfig-context] is used to identify a cluster and user pair, with the `--context-name-alias` you can provide a go template that will be
used to generate the name of the context. In the template you have access to the [Cluster struct](https://github.com/mateimicu/kdiscover/blob/master/internal/cluster/cluster.go#L23). The default template is `{{.Name}}`.


[kubeconfig-context]: https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#context
56 changes: 20 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ Currently we suport only EKS clusters but there are plans to support othe k8s pr
- [Example](#example)
- [Demo](#demo)
- [Install](#install)
- [Binary](#binary)
- [Krew (Recommended)](#krew-recommended)
- [MacOs](#macos)
- [Binary](#binary)
- [Go](#go)
- [Future Plans](#future-plans)
- [FAQ](#faq)
- [FAQ](FAQ.md)


## Demo
Expand All @@ -32,7 +33,7 @@ Currently we suport only EKS clusters but there are plans to support othe k8s pr
## Example

```bash
~ $ kdiscover aws list
~ $ kubectl discover aws list
┌────────────────────────────────────────────────────────────────────────────────┐
│ cluster name region status exported locally │
├────────────────────────────────────────────────────────────────────────────────┤
Expand All @@ -43,7 +44,7 @@ Currently we suport only EKS clusters but there are plans to support othe k8s pr
├────────────────────────────────────────────────────────────────────────────────┤
│ number of clusters 4 │
└────────────────────────────────────────────────────────────────────────────────┘
~ $ kdiscover aws update
~ $ kubectl discover discover aws update
Update all EKS Clusters
Found 4 clusters remote
Backup kubeconfig to /Users/tuxy/.kube/config.bak
Expand Down Expand Up @@ -71,56 +72,39 @@ Columns in the list :

## Install

### Binary
## Krew (Recommended)

You can download a specific version from the [release page](https://github.com/mateimicu/kdiscover/releases)
Using the [Krew](https://krew.sigs.k8s.io/) plugin manager:

```bash
kubectl krew install discover
```
Note that in this context the command will need to invoked using `kubectl discover`.

### macOs
## macOs

You can also install a binary release on macOS using [brew](https://brew.sh/):

```bash
brew install mateimicu/tap/kdiscover
brew upgrade mateimicu/tap/kdiscover
```
Note that in this context the executable is name `kdiscover`.

## Binary

You can download a specific version from the [release page](https://github.com/mateimicu/kdiscover/releases)

### Go
## Go

```bash
GO111MODULE=on go get github.com/mateimicu/kdiscover
```

## Future Plans
# Future Plans


Development is tracked in [this board](https://github.com/mateimicu/kdiscover/projects/1) and we also have specific [milestones](https://github.com/mateimicu/kdiscover/milestones?direction=asc&sort=due_date)


## FAQ

### How does it find clusters ?

It searches for Cluster credentials and trying to list all the clusters on all regions.
For example in AWS case will look for the normal credential chain then try to list and describe
all clusters on all regions (from a given partition, see `kdiscover aws --help` expecially `--aws-partitions`)

### What is the heuristic for `exported locally`

The logic is implemented [here](./internal/kubeconfig/kubeconfig.go) in `IsExported` function.
The basic idea is:

- we have a cluster in kubeconfig with the same endpoint
- that cluster is referenced in a `context` block (see [Organizing Cluster Access Using kubeconfig Files][kubeconfig-context])


### Configur context name with `--context-name-alias`

The [kubeconfig context][kubeconfig-context] is used to identify a cluster and user pair, with the `--context-name-alias` you can provide a go template that will be
used to generate the name of the context. In the template you have access to the [Cluster struct](https://github.com/mateimicu/kdiscover/blob/master/internal/cluster/cluster.go#L23). The default template is `{{.Name}}`.


[kubeconfig-context]: https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#context


## License
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgh.neting.cc%2Fmateimicu%2Fkdiscover.svg?type=large)](https://app.fossa.com/projects/git%2Bgh.neting.cc%2Fmateimicu%2Fkdiscover?ref=badge_large)

0 comments on commit efc8653

Please sign in to comment.