Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: dependencies vs dependents #6

Open
guettli opened this issue Apr 4, 2023 · 3 comments
Open

docs: dependencies vs dependents #6

guettli opened this issue Apr 4, 2023 · 3 comments

Comments

@guettli
Copy link

guettli commented Apr 4, 2023

Thank your very much for this great tool.

Could you please explain in the README (and/or in -h) the difference between dependencies and dependents?

Are you sure "dependencies" is the correct term?

❯ k lineage cluster host-cluster -o=wide
NAME                                                             READY   STATUS   AGE   RELATIONSHIPS
Cluster/host-cluster                                             True             69d   []
├── HCloudMachineTemplate/host-cluster-control-plane             -                69d   [OwnerReference]
├── HCloudMachineTemplate/host-cluster-md-0                      -                69d   [OwnerReference]
├── HetznerCluster/host-cluster                                  -                69d   [ControllerReference OwnerReference]
│   ├── Secret/hetzner                                           -                69d   [OwnerReference]
│   └── Secret/host-cluster-kubeconfig                           -                69d   [OwnerReference]

With option -D

❯ k lineage -D Secret/host-cluster-kubeconfig
NAME                                                 READY   STATUS   AGE
Secret/host-cluster-kubeconfig                       -                69d
├── HetznerCluster/host-cluster                      -                69d
│   └── Cluster/host-cluster                         True             69d
└── KubeadmControlPlane/host-cluster-control-plane   True             69d
    └── Cluster/host-cluster                         True             69d

For me -D looks like reverse-dependencies to me.

@tohjustin
Copy link
Owner

Hi @guettli, really appreciate your feedback on this 🙏 Here's my initial idea for these two operations:

  1. Default command (e.g. kubectl lineage <RESOURCE>)

    1. Recursively list all dependents — "dependents" are k8s resources that have the specified <RESOURCE> in its metadata.ownerReferences field, consistent with the terminology used in Kubernetes official documentation
      1. DeploymentReplicaSetPod
    2. Recursively list all dependents — "dependents" here means k8s resources referencing/using the specified <RESOURCE>
      1. PodServiceIngress
      2. PodServiceAPIService
      3. PersistentVolumePersistentVolumeClaimPod
      4. ConfigMapPod
      5. ClusterRoleClusterRoleBindingServiceAccountPod
  2. Inverse of the default command (e.g. kubectl lineage --<BOOLEAN_FLAG_FOR_INVERSE_OPERATION> <RESOURCE>)

    1. Recursively list all owners — "owners" are k8s resource(s) that are found in the specified <RESOURCE> metadata.ownerReferences field, consistent with the terminology used in Kubernetes official documentation
      1. PodReplicaSetDeployment
    2. Recursively list all dependencies — "dependencies" are k8s resources referenced/used by the specified <RESOURCE>
      1. IngressServicePod
      2. APIServiceServicePod
      3. PodPersistentVolumeClaimPersistentVolume
      4. PodConfigMap
      5. PodServiceAccountClusterRoleBindingClusterRole

For

1.ii. Recursively list all dependents — "dependents" here means k8s resources referencing/using the specified <RESOURCE>

I think it still makes sense to call them dependents (eg. Service references/depends on the Pod to work, Ingress references/depends on Service to work)

As for

2.ii. Recursively list all dependencies — "dependencies" are k8s resources referenced/used by the specified <RESOURCE>

I guess the word "dependencies" is a little ambiguous/awkward, perhaps a better way is to just describe this as "printing the dependents in reverse order" & I should use the --reverse/-r flags instead 🤔

What's your thoughts on this?

@guettli
Copy link
Author

guettli commented Aug 10, 2023

I like the list owners, since this is easy to understand. But -r for "reverse" is good, too.

@mattcockrell
Copy link

Since the plugin is named lineage, would using "children" and "parents" be appropriate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants