Skip to content

Commit

Permalink
Update README.md (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
yonahd committed Sep 7, 2023
1 parent 1f31864 commit e54e37f
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Kor is a tool to discover unused Kubernetes resources. Currently, Kor can identi
- Services
- ServiceAccounts
- Deployments
- Statefulsets
- StatefulSets
- Roles
- Hpas
- Pvcs
Expand Down Expand Up @@ -46,10 +46,11 @@ Kor provides various subcommands to identify and list unused resources. The avai

### Supported Flags
```
-h, --help help for role
-k, --kubeconfig string Path to kubeconfig file (optional)
-n, --namespace string Namespace to run on
--output string Output format (table, json or yaml) (default "table")
-e, --exclude-namespaces string Namespaces to be excluded, splited by comma. Example: --exclude-namespace ns1,ns2,ns3. If --include-namespace is set, --exclude-namespaces will be ignored.
-h, --help help for kor
-n, --include-namespaces string Namespaces to run on, splited by comma. Example: --include-namespace ns1,ns2,ns3.
-k, --kubeconfig string Path to kubeconfig file (optional)
--output string Output format (table or json) (default "table")
```

To use a specific subcommand, run `kor [subcommand] [flags]`.
Expand All @@ -73,12 +74,12 @@ kor [subcommand] --help
| Services | Services with no endpoints | |
| Deployments | Deployments with 0 Replicas | |
| ServiceAccounts | ServiceAccounts unused by pods<br/>ServiceAccounts unused by roleBinding or clusterRoleBinding | |
| Statefulsets | Statefulsets with 0 Replicas | |
| StatefulSets | Statefulsets with 0 Replicas | |
| Roles | Roles not used in roleBinding | |
| Pvcs | Pvcs not used in pods | |
| Ingresses | Ingresses not pointing at any service. | |
| Hpas | Hpas not used in Deployments <br/> Hpas not used in Statefulsets | |
| Pdbs | Pdbs not used in Deployments <br/> Pdbs not used in Statefulsets | |
| Hpas | Hpas not used in Deployments <br/> Hpas not used in StatefulSets | |
| Pdbs | Pdbs not used in Deployments <br/> Pdbs not used in StatefulSets | |



Expand All @@ -87,15 +88,19 @@ You can also use kor as a Go library to programmatically discover unused resourc

```go
import (
"github.com/yonahd/kor/pkg/kor"
"github.com/yonahd/kor/pkg/kor"
)



func main() {
namespace := "my-namespace"
outputFormat := "json" // Set to "json" for JSON output
myNamespaces := kor.IncludeExcludeLists{
IncludeListStr: "my-namespace1, my-namespace2",
}
outputFormat := "json" // Set to "json" for JSON output

if outputFormat == "json" {
jsonResponse, err := kor.GetUnusedDeploymentsJSON(namespace, kubeconfig)
jsonResponse, err := kor.GetUnusedDeploymentsStructured(myNamespaces, kubeconfig, "json")
if err != nil {
// Handle error
}
Expand Down

0 comments on commit e54e37f

Please sign in to comment.