Skip to content

feat: Add replicas and minAvailable fields for PodCliquesScalingGroups#116

Merged
renormalize merged 13 commits into
ai-dynamo:mainfrom
julienmancuso:jsm/115
Aug 1, 2025
Merged

feat: Add replicas and minAvailable fields for PodCliquesScalingGroups#116
renormalize merged 13 commits into
ai-dynamo:mainfrom
julienmancuso:jsm/115

Conversation

@julienmancuso

@julienmancuso julienmancuso commented Jul 21, 2025

Copy link
Copy Markdown
Contributor

Here is an example for :

apiVersion: grove.io/v1alpha1
kind: PodGangSet
metadata:
  name: simple1
  labels:
    app: simple1
spec:
  replicas: 1
  template:
    cliques:
      - name: pca
        spec:
          roleName: rolea
          replicas: 2
          podSpec:
            containers:
              - name: pca
                image: nginx:latest
                resources:
                  requests:
                    cpu: 10m
          autoScalingConfig:
            maxReplicas: 5
            metrics:
              - type: Resource
                resource:
                  name: cpu
                  target:
                    type: Utilization
                    averageUtilization: 80
      - name: pcb
        spec:
          roleName: roleb
          replicas: 2
          podSpec:
            containers:
              - name: pcb
                image: nginx:latest
                resources:
                  requests:
                    cpu: 10m
      - name: pcc
        spec:
          roleName: rolec
          replicas: 1
          podSpec:
            containers:
              - name: pcc
                image: nginx:latest
                resources:
                  requests:
                    cpu: 10m
      - name: pcd
        spec:
          roleName: roled
          replicas: 1
          podSpec:
            containers:
              - name: pcd
                image: nginx:latest
                resources:
                  requests:
                    cpu: 10m
    podCliqueScalingGroups:
      - name: sga
        minAvailable: 2
        replicas: 4
        cliqueNames:
          - pcb
          - pcc
        scaleConfig:
          maxReplicas: 6
          metrics:
            - type: Resource
              resource:
                name: cpu
                target:
                  type: Utilization
                  averageUtilization: 80

it creates these podgangs :
Screenshot 2025-07-24 at 8 36 39 PM

base podgang :

apiVersion: scheduler.grove.io/v1alpha1
kind: PodGang
metadata:
  creationTimestamp: "2025-07-25T02:29:43Z"
  generation: 28
  labels:
    app.kubernetes.io/component: podgang
    app.kubernetes.io/managed-by: grove-operator
    app.kubernetes.io/part-of: simple1
  name: simple1-0
  namespace: jsm
  ownerReferences:
  - apiVersion: grove.io/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: PodGangSet
    name: simple1
    uid: 70eeefa0-1c48-4639-9924-b83cc58d6ba7
  resourceVersion: "1514534"
  uid: a57617dd-70b8-4758-8b18-057626adb89c
spec:
  podgroups:
  - minReplicas: 2
    name: simple1-0-pca
    podReferences:
    - name: simple1-0-pca-mjfhc
      namespace: jsm
    - name: simple1-0-pca-r7h9h
      namespace: jsm
  - minReplicas: 2
    name: simple1-0-sga-0-pcb
    podReferences:
    - name: simple1-0-sga-0-pcb-frh4t
      namespace: jsm
    - name: simple1-0-sga-0-pcb-p44pm
      namespace: jsm
  - minReplicas: 2
    name: simple1-0-sga-1-pcb
    podReferences:
    - name: simple1-0-sga-1-pcb-qhh7p
      namespace: jsm
    - name: simple1-0-sga-1-pcb-wgpjv
      namespace: jsm
  - minReplicas: 1
    name: simple1-0-sga-0-pcc
    podReferences:
    - name: simple1-0-sga-0-pcc-n4bbk
      namespace: jsm
  - minReplicas: 1
    name: simple1-0-sga-1-pcc
    podReferences:
    - name: simple1-0-sga-1-pcc-qz8n2
      namespace: jsm
  - minReplicas: 1
    name: simple1-0-pcd
    podReferences:
    - name: simple1-0-pcd-hzcck
      namespace: jsm

podgang for replica 3 :

apiVersion: scheduler.grove.io/v1alpha1
kind: PodGang
metadata:
  creationTimestamp: "2025-07-25T02:29:42Z"
  generation: 12
  labels:
    app.kubernetes.io/component: podgang
    app.kubernetes.io/managed-by: grove-operator
    app.kubernetes.io/part-of: simple1
  name: simple1-0-sga-0
  namespace: jsm
  ownerReferences:
  - apiVersion: grove.io/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: PodGangSet
    name: simple1
    uid: 70eeefa0-1c48-4639-9924-b83cc58d6ba7
  resourceVersion: "1514449"
  uid: 1ffc75e1-49fc-49ce-8a21-d04af7d1365f
spec:
  podgroups:
  - minReplicas: 2
    name: simple1-0-sga-2-pcb
    podReferences:
    - name: simple1-0-sga-2-pcb-n4scn
      namespace: jsm
    - name: simple1-0-sga-2-pcb-b8fcs
      namespace: jsm
  - minReplicas: 1
    name: simple1-0-sga-2-pcc
    podReferences:
    - name: simple1-0-sga-2-pcc-99q7c
      namespace: jsm

podgang for replica 4 :

apiVersion: scheduler.grove.io/v1alpha1
kind: PodGang
metadata:
  creationTimestamp: "2025-07-25T02:29:42Z"
  generation: 12
  labels:
    app.kubernetes.io/component: podgang
    app.kubernetes.io/managed-by: grove-operator
    app.kubernetes.io/part-of: simple1
  name: simple1-0-sga-1
  namespace: jsm
  ownerReferences:
  - apiVersion: grove.io/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: PodGangSet
    name: simple1
    uid: 70eeefa0-1c48-4639-9924-b83cc58d6ba7
  resourceVersion: "1514304"
  uid: 9ab48c1e-003f-4701-a170-72b36709c51a
spec:
  podgroups:
  - minReplicas: 2
    name: simple1-0-sga-3-pcb
    podReferences:
    - name: simple1-0-sga-3-pcb-2lcwp
      namespace: jsm
    - name: simple1-0-sga-3-pcb-lkr9v
      namespace: jsm
  - minReplicas: 1
    name: simple1-0-sga-3-pcc
    podReferences:
    - name: simple1-0-sga-3-pcc-knqfx
      namespace: jsm

and follwing pods (replicas pods are in pending state while all the pods of the base podgang are not running) :
Screenshot 2025-07-24 at 8 41 23 PM

and pocliques :
Screenshot 2025-07-24 at 8 36 26 PM

@julienmancuso julienmancuso force-pushed the jsm/115 branch 3 times, most recently from 593e522 to c3e5275 Compare July 25, 2025 15:24
@julienmancuso julienmancuso marked this pull request as ready for review July 25, 2025 16:21
Comment thread operator/api/core/v1alpha1/scalinggroup.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
@julienmancuso julienmancuso force-pushed the jsm/115 branch 4 times, most recently from 95422d6 to b7930f4 Compare July 26, 2025 03:38
Comment thread operator/internal/component/utils/podgang.go Outdated
Comment thread operator/internal/component/podgangset/podgang/syncflow.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/api/core/v1alpha1/namegen.go Outdated
Comment thread operator/internal/component/podgangset/hpa/hpa.go Outdated
Comment thread operator/internal/component/podgangset/hpa/hpa.go Outdated
Comment thread operator/internal/component/podgangset/podclique/podclique.go Outdated
Comment thread operator/internal/component/podgangset/podgang/syncflow.go Outdated

@Ronkahn21 Ronkahn21 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will complete the review later

Comment thread operator/api/core/v1alpha1/podgangset.go
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/podcliquescalinggroup/podclique/podclique.go Outdated
Comment thread operator/internal/component/podgangset/podgang/syncflow.go Outdated

@Ronkahn21 Ronkahn21 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had some questions regarding the base vs individual pod gang
Do we have documentation why did we decide this flow

Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/utils/podgang.go Outdated
Comment thread operator/internal/errors/errors.go Outdated

@renormalize renormalize left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @julienmancuso!

1/n review, covers the API, and the webhooks primarily.

Comment thread operator/api/core/v1alpha1/namegen.go Outdated
Comment thread operator/api/core/v1alpha1/constants.go
Comment thread operator/api/core/v1alpha1/scalinggroup.go Outdated
Comment thread operator/api/core/v1alpha1/scalinggroup.go Outdated
Comment thread operator/api/core/v1alpha1/scalinggroup.go Outdated
Comment thread operator/internal/component/podgangset/hpa/hpa.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/podgangset/hpa/hpa.go Outdated
Comment thread operator/internal/component/podgangset/hpa/hpa.go Outdated
Comment thread operator/internal/component/podgangset/hpa/hpa.go Outdated
Signed-off-by: Julien Mancuso <jmancuso@nvidia.com>
Signed-off-by: Julien Mancuso <jmancuso@nvidia.com>
Signed-off-by: Julien Mancuso <jmancuso@nvidia.com>
Signed-off-by: Julien Mancuso <jmancuso@nvidia.com>
Signed-off-by: Julien Mancuso <jmancuso@nvidia.com>
Signed-off-by: Julien Mancuso <jmancuso@nvidia.com>
Signed-off-by: Julien Mancuso <jmancuso@nvidia.com>
Signed-off-by: Julien Mancuso <jmancuso@nvidia.com>
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/utils/podgang.go Outdated
Comment thread operator/internal/component/utils/podgang.go Outdated
Comment thread operator/internal/component/podgangset/podgang/syncflow.go Outdated
Signed-off-by: Julien Mancuso <jmancuso@nvidia.com>

@renormalize renormalize left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review 2/n.

I strongly believe utils/podgang.go needs a re-look as it is very complicated right now. Many utils defined there are redundant.

Will review the syncflow.go files in the next review.

Comment thread operator/README.md Outdated
Comment thread operator/internal/component/podgangset/podclique/podclique.go Outdated
Comment thread operator/internal/component/utils/podgang.go Outdated
Comment thread operator/internal/component/utils/podgang.go Outdated
Comment thread operator/internal/component/podcliquescalinggroup/podclique/podclique.go Outdated
Signed-off-by: Julien Mancuso <jmancuso@nvidia.com>

@renormalize renormalize left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3/n. This is about it from me. Sorry for the delayed reviews; the PR is very large after all! Thanks!

Comment thread operator/internal/component/podcliquescalinggroup/podclique/podclique.go Outdated
Comment thread operator/internal/component/utils/podgang.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go Outdated
Comment thread operator/internal/component/podclique/pod/syncflow.go
Comment thread operator/internal/component/podclique/pod/syncflow.go
Comment thread operator/internal/component/podgangset/podgang/syncflow.go Outdated
Comment thread operator/internal/component/podgangset/podgang/syncflow.go Outdated
Comment thread operator/internal/component/podgangset/podgang/syncflow.go Outdated
Signed-off-by: Julien Mancuso <jmancuso@nvidia.com>
Comment thread operator/README.md
Comment thread operator/api/core/v1alpha1/podgangset.go Outdated
Comment thread operator/api/core/v1alpha1/podgangset.go Outdated
Replicas *int32 `json:"replicas,omitempty"`
// MinAvailable specifies the minimum number of ready replicas required for the group to be considered operational.
// A scaling group replica is considered "ready" when its associated PodClique has sufficient ready Pods
// (PodClique.Status.ReadyReplicas >= PodClique.Status.MinAvailable), where a Pod is ready when its PodReady condition is True.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this as this has changed.

// MinAvailable specifies the minimum number of ready replicas required for the group to be considered operational.
// A scaling group replica is considered "ready" when its associated PodClique has sufficient ready Pods
// (PodClique.Status.ReadyReplicas >= PodClique.Status.MinAvailable), where a Pod is ready when its PodReady condition is True.
// If MinAvailable is breached, it will trigger gang-termination of the podGangs.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// If MinAvailable is breached, it will trigger gang-termination of the podGangs.
// If MinAvailable is breached, it will be used to signal that the PodCliqueScalingGroup is no longer operating with the desired availability.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this not trigger gang-termination after the terminationDelay?

Comment thread operator/internal/component/utils/podgang.go Outdated
Comment thread operator/internal/component/utils/podgang.go Outdated
Comment thread operator/internal/component/utils/podgang_test.go Outdated
Comment thread operator/internal/component/utils/podgang_test.go Outdated
Comment thread operator/internal/webhook/admission/pgs/defaulting/podgangset.go Outdated
Signed-off-by: Julien Mancuso <jmancuso@nvidia.com>
Signed-off-by: Julien Mancuso <jmancuso@nvidia.com>

@renormalize renormalize left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing all the comments!

@unmarshall unmarshall left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the review comments

@sanjaychatterjee sanjaychatterjee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved!

@renormalize renormalize merged commit 37eedaf into ai-dynamo:main Aug 1, 2025
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.

6 participants