refactor: change name to kubectl-diagrams

This commit is contained in:
Mahyar Mirrashed
2025-06-13 16:51:39 -05:00
parent 4fae752f4a
commit 2df1476164
3 changed files with 105 additions and 104 deletions

View File

@@ -155,7 +155,7 @@ You can use KubeDiagrams as a `kubectl` plugin as well for a more integrated Kub
kubectl graph -o diagram.png
```
To enable this, simply symlink or copy the [`kubectl-graph`](./bin/kubectl-graph) script onto your `$PATH`:
To enable this, simply symlink or copy the [`kubectl-diagrams`](./bin/kubectl-diagrams) script onto your `$PATH`:
```sh
ln -s $(which kube-diagrams) /usr/local/bin/kubectl-diagrams
@@ -168,7 +168,7 @@ ln -s $(which kube-diagrams) /usr/local/bin/kubectl-diagrams
You can alternatively install it via Nix:
```sh
nix shell github:philippemerle/KubeDiagrams#kubectl-graph
nix shell github:philippemerle/KubeDiagrams#kubectl-diagrams
```
### `helm-diagrams`
@@ -226,7 +226,7 @@ docker run -v "$(pwd)":/work philippemerle/kubediagrams helm-diagrams oci://ghcr
**KubeDiagrams** supported the following 47 Kubernetes resource types:
| Kind | ApiGroup | Versions | Icon |
| :--------: | :-------: | :-------: | :-------: |
| :------------------------------: | :----------------------------: | :---------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------: |
| `APIService` | `apiregistration.k8s.io` | `v1beta1` `v1` | ![APIService](https://raw.githubusercontent.com/philippemerle/KubeDiagrams/refs/heads/main/bin/icons/apiservice.png) |
| `ClusterRole` | `rbac.authorization.k8s.io` | `v1beta1` `v1` | ![ClusterRole](https://raw.githubusercontent.com/kubernetes/community/refs/heads/master/icons/png/resources/labeled/c-role-128.png) |
| `ClusterRoleBinding` | `rbac.authorization.k8s.io` | `v1beta1` `v1` | ![ClusterRoleBinding](https://raw.githubusercontent.com/kubernetes/community/refs/heads/master/icons/png/resources/labeled/crb-128.png) |
@@ -283,17 +283,17 @@ docker run -v "$(pwd)":/work philippemerle/kubediagrams helm-diagrams oci://ghcr
Currently, there are 16 unsupported Kubernetes resource types:
| Kind | ApiGroup |
| :--------: | :-------: |
| :--------------------------: | :----------------------------: |
| `Binding` | |
| `ComponentStatus` | |
| `Event`| |
| `ControllerRevision` | `apps`|
| `TokenReview` | `authentication.k8s.io`|
| `Event` | |
| `ControllerRevision` | `apps` |
| `TokenReview` | `authentication.k8s.io` |
| `LocalSubjectAccessReview` | `authorization.k8s.io` |
| `SelfSubjectAccessReview` | `authorization.k8s.io` |
| `SelfSubjectReview` | `authorization.k8s.io` |
| `SelfSubjectRulesReview` | `authorization.k8s.io` |
| `SubjectAccessReview` | `authorization.k8s.io`|
| `SubjectAccessReview` | `authorization.k8s.io` |
| `CertificateSigningRequest` | `certificates.k8s.io` |
| `Event` | `events.k8s.io` |
| `FlowSchema` | `flowcontrol.apiserver.k8s.io` |
@@ -306,7 +306,7 @@ Currently, there are 16 unsupported Kubernetes resource types:
With **KubeDiagrams**, Kubernetes resources can be clustered within the architecture diagrams automatically. **KubeDiagrams** uses the `metadata.namespace` resource field as first clustering criteria. Then, the `metadata.labels` keys can be used to define subclusters. Following table lists the predefined mappings between label keys and cluster titles as defined in the [bin/kube-diagrams.yml](https://github.com/philippemerle/KubeDiagrams/blob/main/bin/kube-diagrams.yaml#L33) file (see the `clusters` list).
| Label Key | Cluster Title |
| :--------: | :-------: |
| :---------------------------: | :----------------------------: |
| `app.kubernetes.io/instance` | K8s Instance: `label value` |
| `release` | Release: `label value` |
| `helm.sh/chart` | Helm Chart: `label value` |
@@ -320,11 +320,11 @@ With **KubeDiagrams**, Kubernetes resources can be clustered within the architec
Resource clustering could be also annotation-based, i.e. based on `metadata.annotations` keys. Following table lists the predefined mappings between annotation keys and cluster titles as defined in the [bin/kube-diagrams.yml](https://github.com/philippemerle/KubeDiagrams/blob/main/bin/kube-diagrams.yaml#L79) file.
| Annotation Key | Cluster Title |
| :--------: | :-------: |
| :------------: | :----------------: |
| `helm.sh/hook` | `annotation value` |
New label/annotation-based mappings can be easily defined in custom configuration files (see [examples/minikube/KubeDiagrams.yml](https://github.com/philippemerle/KubeDiagrams/blob/main/examples/minikube/KubeDiagrams.yml#L2), [examples/k0s/KubeDiagrams.yml](https://github.com/philippemerle/KubeDiagrams/blob/main/examples/k0s/KubeDiagrams.yml#L5), [examples/free5gc-k8s/KubeDiagrams.yml](https://github.com/philippemerle/KubeDiagrams/blob/main/examples/free5gc-k8s/KubeDiagrams.yml#L2), [examples/open5gs-k8s/KubeDiagrams.yml](https://github.com/philippemerle/KubeDiagrams/blob/main/examples/open5gs-k8s/KubeDiagrams.yml#L2), [examples/towards5gs-helm/KubeDiagrams.yml](https://github.com/philippemerle/KubeDiagrams/blob/main/examples/towards5gs-helm/KubeDiagrams.yml#L2), [examples/lws/KubeDiagrams.yml](https://github.com/philippemerle/KubeDiagrams/blob/main/examples/lws/KubeDiagrams.yml#L1), and [examples/argo/KubeDiagrams.yaml](https://github.com/philippemerle/KubeDiagrams/blob/main/examples/argo/KubeDiagrams.yaml#L1))
and provided to **KubeDiagrams** via the `--config` command-line option.
and provided to **KubeDiagrams** via the `--config` command-line option.
### Kubernetes resource relationships
@@ -332,7 +332,7 @@ With **KubeDiagrams**, each relationship between Kubernetes resources is represe
Following table lists the predefined edges as defined in the [bin/kube-diagrams.yml](https://github.com/philippemerle/KubeDiagrams/blob/main/bin/kube-diagrams.yaml#L3) file (see the `edges` map).
| Edge Kind | Edge Style | Edge Color | Meaning |
| :--------: | :--------: | :-------: | :-------: |
| :-------------: | :--------: | :--------: | :-------------------------------------------------------------------: |
| `REFERENCE` | `solid` | `black` | Used when a resource refers to another resource directly |
| `SELECTOR` | `dashed` | `black` | Used when a resource refers to other resources via a selector |
| `OWNER` | `dotted` | `black` | Used when a resource owns another resource |
@@ -371,7 +371,7 @@ jobs:
uses: philippemerle/KubeDiagrams@main
with:
type: "helm"
args: 'https://charts.jetstack.io/cert-manager'
args: "https://charts.jetstack.io/cert-manager"
```
## Architecture
@@ -387,15 +387,17 @@ Following provides links to real-world use cases.
### Documentation
**KubeDiagrams** could be used to generate architectural diagrams documenting your Kubernetes applications (manifests, Helm charts, helmfiles, or cluster state). See following links:
* [duoan/tinyurl](https://github.com/duoan/tinyurl?tab=readme-ov-file#deployment-kubernetes)
- [duoan/tinyurl](https://github.com/duoan/tinyurl?tab=readme-ov-file#deployment-kubernetes)
### Architectural defects identification
Diagrams generated by **KubeDiagrams** could help you to identify architectural defects in your own or used Kubernetes applications. See following links:
* [Gradiant/5g-charts](https://github.com/Gradiant/5g-charts/pull/218)
* [argoproj/argo-cd](https://github.com/argoproj/argo-cd/pull/23313)
* [argoproj/argo-events](https://github.com/argoproj/argo-events/pull/3627)
* [argoproj/argo-helm](https://github.com/argoproj/argo-helm/pull/3350)
- [Gradiant/5g-charts](https://github.com/Gradiant/5g-charts/pull/218)
- [argoproj/argo-cd](https://github.com/argoproj/argo-cd/pull/23313)
- [argoproj/argo-events](https://github.com/argoproj/argo-events/pull/3627)
- [argoproj/argo-helm](https://github.com/argoproj/argo-helm/pull/3350)
### Your own real-world use cases
@@ -425,7 +427,6 @@ Don't hesitate to submit your own real-world use cases as [pull requests](https:
### Social Networks
1. [Christophe Gourdin's post](https://www.linkedin.com/feed/update/urn:li:activity:7338139783220617216/) on LinkedIn, June 10, 2025.
1. [Preview: Kubernetes Content Performance Analysis Report for May 2025](https://www.linkedin.com/posts/amitjayshah_preview-kubernetes-content-performance-activity-7337803162893885440-Z_Ws/), LinkedIn, June 9, 2025. [Full Report Preview](https://drive.google.com/file/d/1Et8ZnCttdvjhj8cHOwcqVJFZ2iLzIMu_/view).
@@ -475,7 +476,7 @@ Don't hesitate to submit your own real-world use cases as [pull requests](https:
1. [KubeDiagrams 0.2.0 is out!](https://www.reddit.com/r/kubernetes/comments/1jjjw6j/kubediagrams_020_is_out/) on Reddit, March 25, 2025.
1. [KubeDiagrams: Revolutionizing Cloud Cluster Management!
](https://www.linkedin.com/posts/pepr-cloud_kubediagrams-activity-7307698605371379713-BqRp/) on LinkedIn, March 18, 2025.
](https://www.linkedin.com/posts/pepr-cloud_kubediagrams-activity-7307698605371379713-BqRp/) on LinkedIn, March 18, 2025.
1. [Anyone know of any repos/open source tools that can create k8 diagrams?](https://www.reddit.com/r/kubernetes/comments/1jabdoa/anyone_know_of_any_reposopen_source_tools_that/) on Reddit, March 13, 2025.

View File

@@ -1,6 +1,6 @@
#!/bin/bash
# kubectl-graph: A kubectl plugin to generate a diagram of Kubernetes resources
# kubectl-diagrams: A kubectl plugin to generate a diagram of Kubernetes resources
# using kube-diagrams from the output of 'kubectl get all -o yaml'
# Check if kube-diagrams is installed

View File

@@ -36,10 +36,10 @@
'';
};
kubectl-graph = pkgs.writeShellApplication {
name = "kubectl-graph";
kubectl-diagrams = pkgs.writeShellApplication {
name = "kubectl-diagrams";
runtimeInputs = [ kube-diagrams ];
text = builtins.readFile ./bin/kubectl-graph;
text = builtins.readFile ./bin/kubectl-diagrams;
};
runtimeEnv =
@@ -49,7 +49,7 @@
graphviz
kubernetes-helm
kube-diagrams
kubectl-graph
kubectl-diagrams
pythonEnv
]
++ lib.optionals pkgs.stdenv.isLinux [ busybox ];
@@ -69,7 +69,7 @@
packages = {
default = kube-diagrams;
kube-diagrams = kube-diagrams;
kubectl-graph = kubectl-graph;
kubectl-diagrams = kubectl-diagrams;
docker = pkgs.dockerTools.buildImage {
name = "ghcr.io/philippemerle/kubediagrams";
tag = "latest";