Skip to content

Addition of Cluster DevMesh Analize - #200

Merged
daniel-de-vera merged 2 commits into
mainfrom
cluster-devmesh-analyze
Aug 4, 2025
Merged

daniel-de-vera merged 2 commits into
mainfrom
cluster-devmesh-analyze

Conversation

@daniel-de-vera

Copy link
Copy Markdown
Contributor

Examples:

# List devmesh enabled workloads in the namespace=hotrod-devmesh
#
$ signadot cluster devmesh analyze --cluster test --namespace hotrod-devmesh
KIND         NAMESPACE        NAME       UPDATED   STATUS         REASON
Deployment   hotrod-devmesh   driver     0/1       NEEDS_UPDATE   1 pods without expected version
Deployment   hotrod-devmesh   frontend   0/2       NEEDS_UPDATE   1 pods without expected version, 1 pods with missing sidecar
Deployment   hotrod-devmesh   location   1/1       OK             
Deployment   hotrod-devmesh   route      0/2       MISSING        2 pods with missing sidecar

# Restart workloads
#
$ signadot cluster devmesh analyze --cluster test --namespace hotrod-devmesh --status=NEEDS_UPDATE,MISSING -o json \
  | jq -r '.[] | "kubectl rollout restart \(.workload.kind)/\(.workload.name) -n \(.workload.namespace)"' \
  | bash
deployment.apps/driver restarted
deployment.apps/frontend restarted
deployment.apps/route restarted

# Check again, all are OK
#
$ signadot cluster devmesh analyze --cluster test --namespace hotrod-devmesh
KIND         NAMESPACE        NAME       UPDATED   STATUS   REASON
Deployment   hotrod-devmesh   driver     1/1       OK       
Deployment   hotrod-devmesh   frontend   1/1       OK       
Deployment   hotrod-devmesh   location   1/1       OK       
Deployment   hotrod-devmesh   route      1/1       OK       

When it comes to Rollouts, they can't be restarted by kubectl rollout restart, therefore the solution is to use patches, e.g.:

$ signadot cluster devmesh analyze --cluster test --namespace e2e-multi-devmesh
KIND         NAMESPACE           NAME                    UPDATED   STATUS         REASON
Deployment   e2e-multi-devmesh   e2e-multi-noservice     0/1       NEEDS_UPDATE   1 pods without expected version
Rollout      e2e-multi-devmesh   e2e-multi-rollout       0/1       NEEDS_UPDATE   1 pods without expected version
Deployment   e2e-multi-devmesh   e2e-multi-ws            0/1       MISSING        1 pods with missing sidecar
Deployment   e2e-multi-devmesh   e2e-multi               0/1       NEEDS_UPDATE   1 pods without expected version
Deployment   e2e-multi-devmesh   e2e-multi-httpconnect   0/1       NEEDS_UPDATE   1 pods without expected version

signadot cluster devmesh analyze --cluster test --namespace e2e-multi-devmesh --status=NEEDS_UPDATE,MISSING -o json \
  | jq -r --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" '.[] | "kubectl patch \(.workload.kind)/\(.workload.name) -n \(.workload.namespace) --type merge --patch '\''{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"kubectl.kubernetes.io/restartedAt\":\"\($ts)\"}}}}}'\''"' \
  | bash
deployment.apps/e2e-multi-noservice patched
rollout.argoproj.io/e2e-multi-rollout patched

$ signadot cluster devmesh analyze --cluster test --namespace e2e-multi-devmesh
KIND         NAMESPACE           NAME                    UPDATED   STATUS   REASON
Rollout      e2e-multi-devmesh   e2e-multi-rollout       1/1       OK       
Deployment   e2e-multi-devmesh   e2e-multi-ws            1/1       OK       
Deployment   e2e-multi-devmesh   e2e-multi               1/1       OK       
Deployment   e2e-multi-devmesh   e2e-multi-httpconnect   1/1       OK       
Deployment   e2e-multi-devmesh   e2e-multi-noservice     1/1       OK       

Global view:

$ signadot cluster devmesh analyze --cluster test
KIND         NAMESPACE               NAME                    UPDATED   STATUS         REASON
Deployment   e2e-multi-devmesh       e2e-multi               1/1       OK             
Deployment   e2e-multi-devmesh       e2e-multi-httpconnect   1/1       OK             
Deployment   e2e-multi-devmesh       e2e-multi-noservice     1/1       OK             
Rollout      e2e-multi-devmesh       e2e-multi-rollout       1/1       OK             
Deployment   e2e-multi-devmesh       e2e-multi-ws            0/0       OK             
Deployment   e2e-multi-linkerd       e2e-multi               0/1       NEEDS_UPDATE   1 pods without expected version
Deployment   e2e-multi-linkerd       e2e-multi-httpconnect   0/1       NEEDS_UPDATE   1 pods without expected version
Deployment   e2e-multi-linkerd       e2e-multi-noservice     0/1       NEEDS_UPDATE   1 pods without expected version
Rollout      e2e-multi-linkerd       e2e-multi-rollout       0/1       NEEDS_UPDATE   1 pods without expected version
Deployment   e2e-multi-linkerd       e2e-multi-ws            0/1       NEEDS_UPDATE   1 pods without expected version
Deployment   echo-env                svc1                    0/1       NEEDS_UPDATE   1 pods without expected version
Deployment   hotrod-devmesh          driver                  1/1       OK             
Deployment   hotrod-devmesh          frontend                2/2       OK             
Deployment   hotrod-devmesh          location                1/1       OK             
Deployment   hotrod-devmesh          route                   2/2       OK             
Deployment   hotrod-linkerd          driver                  0/1       NEEDS_UPDATE   1 pods without expected version
Deployment   hotrod-linkerd          frontend                0/1       NEEDS_UPDATE   1 pods without expected version
Deployment   hotrod-linkerd          location                0/1       NEEDS_UPDATE   1 pods without expected version
Deployment   hotrod-linkerd          route                   0/1       NEEDS_UPDATE   1 pods without expected version
Deployment   sandbox-tests-devmesh   sandbox-tests-demo      0/1       NEEDS_UPDATE   1 pods without expected version

@scott-cotton

scott-cotton commented Jul 31, 2025 •

Copy link
Copy Markdown
Member

When it comes to Rollouts, they can't be restarted by kubectl rollout restart, therefore the solution is to use patches, e.g.:

While the api side is based on replica sets and hence seems to sidestep the issue, at the CLI level it looks to me like we may need to take into account https://github.com/signadot/signadot/issues/6019.

Namely, a rollout with spec.workloadRef as opposed to spec.template may not work with a spec.template patch.

Might be worth looking at how https://argo-rollouts.readthedocs.io/en/stable/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_restart/ or https://argo-rollouts.readthedocs.io/en/stable/features/restart/ handle rollouts with workloadRef

@daniel-de-vera

Copy link
Copy Markdown
Contributor Author

When it comes to Rollouts, they can't be restarted by kubectl rollout restart, therefore the solution is to use patches, e.g.:

While the api side is based on replica sets and hence seems to sidestep the issue, at the CLI level it looks to me like we may need to take into account signadot/signadot#6019.

Namely, a rollout with spec.workloadRef as opposed to spec.template may not work with a spec.template patch.

Might be worth looking at how https://argo-rollouts.readthedocs.io/en/stable/generated/kubectl-argo-rollouts/kubectl-argo-rollouts_restart/ or https://argo-rollouts.readthedocs.io/en/stable/features/restart/ handle rollouts with workloadRef

Ok, yes.. even thought that's not a case we would support, here is another way to do it, that seems nicer to me:

$ signadot cluster devmesh analyze --cluster test --namespace e2e-multi-devmesh
KIND         NAMESPACE           NAME                    UPDATED   STATUS    REASON
Deployment   e2e-multi-devmesh   e2e-multi               0/1       MISSING   1 pods with missing sidecar
Deployment   e2e-multi-devmesh   e2e-multi-httpconnect   1/1       OK        
Deployment   e2e-multi-devmesh   e2e-multi-noservice     1/1       OK        
Rollout      e2e-multi-devmesh   e2e-multi-rollout       0/1       MISSING   1 pods with missing sidecar
Deployment   e2e-multi-devmesh   e2e-multi-ws            0/0       OK        


$ signadot cluster devmesh analyze --cluster test --namespace=e2e-multi-devmesh --status=NEEDS_UPDATE,MISSING -o json \
| jq -r '
    .[] |
    if .workload.kind == "Rollout" then
      "kubectl argo rollouts restart " + .workload.name + " -n " + .workload.namespace
    else
      "kubectl rollout restart " + .workload.kind + "/" + .workload.name + " -n " + .workload.namespace
    end
  ' \
| bash

deployment.apps/e2e-multi restarted
rollout 'e2e-multi-rollout' restarts in 0s


$ signadot cluster devmesh analyze --cluster test --namespace e2e-multi-devmesh
KIND         NAMESPACE           NAME                    UPDATED   STATUS   REASON
Deployment   e2e-multi-devmesh   e2e-multi               1/1       OK       
Deployment   e2e-multi-devmesh   e2e-multi-httpconnect   1/1       OK       
Deployment   e2e-multi-devmesh   e2e-multi-noservice     1/1       OK       
Rollout      e2e-multi-devmesh   e2e-multi-rollout       1/1       OK       
Deployment   e2e-multi-devmesh   e2e-multi-ws            0/0       OK       

@scott-cotton

scott-cotton commented Jul 31, 2025 •

Copy link
Copy Markdown
Member

my kubectl rollout states

Manage the rollout of one or many resources.

 Valid resource types include:

  *  deployments
  *  daemonsets
  *  statefulsets

and my kubectl argo states

25-08-01 scott@air sandboxes % kubectl argo
error: unknown command "argo" for "kubectl"

@scott-cotton

Copy link
Copy Markdown
Member

my kubectl rollout states

Manage the rollout of one or many resources.

 Valid resource types include:

  *  deployments
  *  daemonsets
  *  statefulsets

and my kubectl argo states

25-08-01 scott@air sandboxes % kubectl argo
error: unknown command "argo" for "kubectl"

Never mind, despite the above kubectl argo rollout works.

@scott-cotton

Copy link
Copy Markdown
Member

Regarding the workloadRef rollouts question, I am thinking maybe on the api side we should flag rollouts which use workloadRef as missing or invalid. If we do that, I think this interface for checking/updating devmesh on workloads would be coherent with api behavior and >=1.1 operator behavior. wdyt?

@daniel-de-vera

Copy link
Copy Markdown
Contributor Author

Regarding the workloadRef rollouts question, I am thinking maybe on the api side we should flag rollouts which use workloadRef as missing or invalid. If we do that, I think this interface for checking/updating devmesh on workloads would be coherent with api behavior and >=1.1 operator behavior. wdyt?

But... what's wrong with the way it is right now? E.g.:

$ kubectl apply -f - <<EOF
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: location
  namespace: hotrod-devmesh
  labels:
    app: hotrod
    component: location
spec:
  replicas: 1
  workloadRef:
    apiVersion: apps/v1
    kind: Deployment
    name: location
  strategy:
    canary:
      steps:
        - setWeight: 20
        - pause: {duration: 10s}
EOF



$ k get ro,deploy,po -o wide -n hotrod-devmesh -l component=location
NAME                           DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
rollout.argoproj.io/location   1         1         1            1           4m4s

NAME                       READY   UP-TO-DATE   AVAILABLE   AGE    CONTAINERS   IMAGES                     SELECTOR
deployment.apps/location   1/1     1            1           539d   hotrod       signadot/hotrod:e2e-v2.9   app=hotrod,component=location

NAME                            READY   STATUS    RESTARTS   AGE    IP              NODE   NOMINATED NODE   READINESS GATES
pod/location-6657fffd7b-fbvcn   2/2     Running   0          45m    10.244.70.135   test   <none>           <none>
pod/location-d95dcb577-g9x4c    2/2     Running   0          4m4s   10.244.70.149   test   <none>           <none>



$ signadot cluster devmesh analyze --cluster test --namespace hotrod-devmesh
KIND         NAMESPACE        NAME       UPDATED   STATUS   REASON
Deployment   hotrod-devmesh   location   1/1       OK       
Rollout      hotrod-devmesh   location   1/1       OK       

@scott-cotton

Copy link
Copy Markdown
Member

Regarding the workloadRef rollouts question, I am thinking maybe on the api side we should flag rollouts which use workloadRef as missing or invalid. If we do that, I think this interface for checking/updating devmesh on workloads would be coherent with api behavior and >=1.1 operator behavior. wdyt?

But... what's wrong with the way it is right now? E.g.:

$ kubectl apply -f - <<EOF
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: location
  namespace: hotrod-devmesh
  labels:
    app: hotrod
    component: location
spec:
  replicas: 1
  workloadRef:
    apiVersion: apps/v1
    kind: Deployment
    name: location
  strategy:
    canary:
      steps:
        - setWeight: 20
        - pause: {duration: 10s}
EOF



$ k get ro,deploy,po -o wide -n hotrod-devmesh -l component=location
NAME                           DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
rollout.argoproj.io/location   1         1         1            1           4m4s

NAME                       READY   UP-TO-DATE   AVAILABLE   AGE    CONTAINERS   IMAGES                     SELECTOR
deployment.apps/location   1/1     1            1           539d   hotrod       signadot/hotrod:e2e-v2.9   app=hotrod,component=location

NAME                            READY   STATUS    RESTARTS   AGE    IP              NODE   NOMINATED NODE   READINESS GATES
pod/location-6657fffd7b-fbvcn   2/2     Running   0          45m    10.244.70.135   test   <none>           <none>
pod/location-d95dcb577-g9x4c    2/2     Running   0          4m4s   10.244.70.149   test   <none>           <none>



$ signadot cluster devmesh analyze --cluster test --namespace hotrod-devmesh
KIND         NAMESPACE        NAME       UPDATED   STATUS   REASON
Deployment   hotrod-devmesh   location   1/1       OK       
Rollout      hotrod-devmesh   location   1/1       OK       

The rollout is not ok (it can't be sandboxed anyway) nor can it be updated if it were reported as out of date or missing. I think if the api returned an "invalid" status for that, then this interface would work fine. But as is, this reporting seems incorrect to me.

@daniel-de-vera

daniel-de-vera commented Aug 1, 2025 •

Copy link
Copy Markdown
Contributor Author

The rollout is not ok (it can't be sandboxed anyway)

Well... but this is about the devmesh status, not really about baseline status (can it be sandboxed/is it supported or not), and from a devmesh perspective, the above response seems correct to me.

nor can it be updated if it were reported as out of date or missing.

Why you think so? E.g.:

$ k scale deployment.apps/signadot-controller-manager -n signadot --replicas 0


$ k argo rollouts restart location -n hotrod-devmesh


$ k get ro,deploy,po -o wide -n hotrod-devmesh -l component=location
NAME                           DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
rollout.argoproj.io/location   1         1         1            1           27m

NAME                       READY   UP-TO-DATE   AVAILABLE   AGE    CONTAINERS   IMAGES                     SELECTOR
deployment.apps/location   1/1     1            1           539d   hotrod       signadot/hotrod:e2e-v2.9   app=hotrod,component=location

NAME                            READY   STATUS    RESTARTS   AGE   IP              NODE   NOMINATED NODE   READINESS GATES
pod/location-6657fffd7b-fbvcn   2/2     Running   0          68m   10.244.70.135   test   <none>           <none>
pod/location-d95dcb577-ghvsz    1/1     Running   0          49s   10.244.70.150   test   <none>           <none>



$ signadot cluster devmesh analyze --cluster test --namespace hotrod-devmesh
KIND         NAMESPACE        NAME       UPDATED   STATUS    REASON
Deployment   hotrod-devmesh   location   1/1       OK        
Rollout      hotrod-devmesh   location   0/1       MISSING   1 pods with missing sidecar



$ k scale deployment.apps/signadot-controller-manager -n signadot --replicas 1


$ k argo rollouts restart location -n hotrod-devmesh


$ signadot cluster devmesh analyze --cluster test --namespace hotrod-devmesh
KIND         NAMESPACE        NAME       UPDATED   STATUS   REASON
Deployment   hotrod-devmesh   location   1/1       OK       
Rollout      hotrod-devmesh   location   1/1       OK       

@scott-cotton

Copy link
Copy Markdown
Member

The rollout is not ok (it can't be sandboxed anyway)

Well... but this is about the devmesh status, not really about baseline status (can it be sandboxed/is it supported or not), and from a devmesh perspective, the above response seems correct to me.

I don't feel they can be separated, because in a sense having a devmesh on that unsupported rollout cannot serve any purpose, so it can't be ok.

nor can it be updated if it were reported as out of date or missing.

Why you think so? E.g.:

What I mean is that one cannot for example add an annotation to the rollout to inject the sidecar or change how it is injected.

Maybe a quick sync up will help?

@scott-cotton

Copy link
Copy Markdown
Member

@daniel-de-vera I was focused to much on the fork case. Since local/virtual still work, now this LGTM

@daniel-de-vera
daniel-de-vera merged commit 021ab69 into main Aug 4, 2025
@daniel-de-vera
daniel-de-vera deleted the cluster-devmesh-analyze branch August 4, 2025 18:32
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

Successfully merging this pull request may close these issues.

2 participants