ahmetb / kubectl-tree

kubectl plugin to browse Kubernetes object hierarchies as a tree 🎄 (star the repo if you are using)
Apache License 2.0
2.91k stars 118 forks source link

"kubectl tree" not working for Kubeflow profiles (not namespaced) #43

Closed iptizer closed 3 years ago

iptizer commented 3 years ago

Maybe I am doing something horrrably wrong here (please correct me if so), or there seems to be a problem for getting the graph from a Kubeflow profiles CRD.

❯ kubectl tree profiles my-kubeflow-user
No resources are owned by this object through ownerReferences.

This resoruce look slike as follows (removed not necessary parts):

❯ kubectl get profiles my-kubeflow-user -o yaml
apiVersion: kubeflow.org/v1
kind: Profile
metadata:
  name: my-kubeflow-user
spec:
  owner:
    kind: User
    name: myuser@domain.com

This resource then creates e.g. a namespace:

❯ kubectl get ns my-kubeflow-user -o yaml
apiVersion: v1
kind: Namespace
metadata:
  annotations:
    owner: myuser@domain.com
  labels:
    app.kubernetes.io/part-of: kubeflow-profile
    istio-injection: enabled
  name: my-kubeflow-user
  ownerReferences:
  - apiVersion: kubeflow.org/v1
    blockOwnerDeletion: true
    controller: true
    kind: Profile
    name: my-kubeflow-user
    uid: c39a1fbe-7805-4696-85a6-1234f902cc2b
status:
  phase: Active

Maybe it is because it is a CRD, or because it is not namespaced?

ahmetb commented 3 years ago

Yes non-namespaced nature of it impacts the result. I think we have a flag for that.

iptizer commented 3 years ago

I see. Was not obvious that the -A is required. But it makes sense in a kubectl-way thinking.

❯ kubectl tree profiles my-kubeflow-user -A
NAMESPACE                  NAME                                                          READY  REASON  AGE
                           Profile/my-kubeflow-user                             -              20d
                           ├─Namespace/my-kubeflow-user                         -              20d
ns-datalake-user-uib53682  │ ├─ConfigMap/metadata-grpc-configmap                         -              20d
ns-datalake-user-uib53682  │ ├─Deployment/ml-pipeline-ui-artifact                        -              20d
ns-datalake-user-uib53682  │ │ └─ReplicaSet/ml-pipeline-ui-artifact-84f654dd94           -              20d
ns-datalake-user-uib53682  │ │   └─Pod/ml-pipeline-ui-artifact-84f654dd94-dxw4w          True           3h6m
ns-datalake-user-uib53682  │ ├─Deployment/ml-pipeline-visualizationserver                -              20d
ns-datalake-user-uib53682  │ │ └─ReplicaSet/ml-pipeline-visualizationserver-5ff65bf999   -              20d
ns-datalake-user-uib53682  │ │   └─Pod/ml-pipeline-visualizationserver-5ff65bf999-4d4kk  True           20d
ns-datalake-user-uib53682  │ ├─DestinationRule/ml-pipeline-visualizationserver           -              20d
ns-datalake-user-uib53682  │ ├─Secret/mlpipeline-minio-artifact                          -              20d
ns-datalake-user-uib53682  │ ├─Service/ml-pipeline-ui-artifact                           -              20d
ns-datalake-user-uib53682  │ ├─Service/ml-pipeline-visualizationserver                   -              20d
ns-datalake-user-uib53682  │ ├─ServiceRole/ml-pipeline-visualizationserver               -              20d
ns-datalake-user-uib53682  │ └─ServiceRoleBinding/ml-pipeline-visualizationserver        -              20d
ns-datalake-user-uib53682  ├─RoleBinding/default-editor                                  -              20d
ns-datalake-user-uib53682  ├─RoleBinding/default-viewer                                  -              20d
ns-datalake-user-uib53682  ├─RoleBinding/namespaceAdmin                                  -              20d
ns-datalake-user-uib53682  ├─ServiceAccount/default-editor                               -              20d
ns-datalake-user-uib53682  ├─ServiceAccount/default-viewer                               -              20d
ns-datalake-user-uib53682  ├─ServiceRole/ns-access-istio                                 -              20d
ns-datalake-user-uib53682  └─ServiceRoleBinding/owner-binding-istio                      -              20d

Maybe think about -A as default (if feasable)?

ahmetb commented 3 years ago

18 has some discussion on this. It caused a lot of slowness, so we turned it off.