Skip to content

feat: add pod clique pod index to pod names#634

Open
steved wants to merge 4 commits into
ai-dynamo:mainfrom
steved:steved/pod-name-pod-index
Open

feat: add pod clique pod index to pod names#634
steved wants to merge 4 commits into
ai-dynamo:mainfrom
steved:steved/pod-name-pod-index

Conversation

@steved

@steved steved commented May 28, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

For better at-a-glance visibility, we'd like to encode the PCLQ pod index in the pod name.

Which issue(s) this PR fixes:

Fixes #635

Special notes for your reviewer:

  • This moves the pod name generation out of GenerateName and into Grove. Rather than appending a 5-char suffix, we can rely on the randomness of 3 characters since pod names can only conflict with their same index.
  • This tightens the validation to check names against replicas. Previously, if a 45 char name had many replicas it could exceed the hostname limit of 63 characters.
    • A PCS that was previously valid may now be invalid, but that should be theoretically impossible since the pod hostnames are invalid.
  • Pod names can now go up to 69 chars, which is allowed (though discouraged), since we're explicitly setting the hostname and subdomain.
  • Note: there is currently no validation on /scale API calls

Does this PR introduce a API change?

Pod names now contain the pod clique pod index and may exceed the 63-character DNS limit

Additional documentation e.g., enhancement proposals, usage docs, etc.:

N/A

@steved steved force-pushed the steved/pod-name-pod-index branch 2 times, most recently from ab1c617 to d161433 Compare May 30, 2026 02:41
@steved steved changed the title feat: add pod index to pod name prefix feat: add pod clique index to created pod names May 30, 2026
@steved steved force-pushed the steved/pod-name-pod-index branch 2 times, most recently from 814344e to 02d199a Compare May 30, 2026 02:44
@steved steved changed the title feat: add pod clique index to created pod names feat: add pod clique pod index to pod names May 30, 2026
@steved steved marked this pull request as ready for review May 30, 2026 02:44
Comment thread operator/internal/controller/podclique/register.go
Comment thread operator/internal/webhook/admission/pcs/validation/podcliqueset.go Outdated
Comment thread operator/api/core/v1alpha1/podclique.go
@renormalize renormalize self-assigned this Jun 2, 2026

@renormalize renormalize 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 the PR! A few comments from me.

Comment thread operator/api/common/namegen.go
Comment thread operator/api/common/namegen.go
Comment thread operator/api/common/namegen.go
Comment thread operator/api/core/v1alpha1/podclique.go Outdated
Comment thread operator/api/core/v1alpha1/podcliqueset.go Outdated
Comment thread operator/api/core/v1alpha1/podcliqueset.go Outdated
Comment thread operator/internal/controller/podclique/register.go
Comment thread operator/internal/controller/podclique/components/pod/pod.go
Comment thread operator/internal/webhook/admission/pcs/validation/podcliqueset.go Outdated
Comment thread operator/internal/webhook/admission/pcs/validation/podcliqueset.go Outdated
@steved steved force-pushed the steved/pod-name-pod-index branch from 02d199a to 9a14940 Compare June 24, 2026 19:05
renormalize
renormalize previously approved these changes Jun 25, 2026

@renormalize renormalize 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 comments @steved!

The PR looks good now - just a couple nits. We can push this in once we have more approvals from reviewers.

Comment thread operator/internal/webhook/admission/pcs/validation/podcliqueset.go
Comment thread operator/internal/webhook/admission/pcs/validation/podcliqueset.go Outdated
@steved

steved commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for addressing the comments @steved!

The PR looks good now - just a couple nits. We can push this in once we have more approvals from reviewers.

Thanks for taking a look @renormalize!

if err := validatePodNameConstraints(v.pcs.Name, pcsgName, pclqName); err != nil {
maxPCLQReplicas := int32(1)
if templateSpec := componentutils.FindPodCliqueTemplateSpecByName(v.pcs, pclqName); templateSpec != nil {
maxPCLQReplicas = templateSpec.Spec.MaxReplicas()

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.

If HPA is not used but lets say dynamo planner is used, then ScaleConfig is not set. This means that at best you will take template replicas. This is not an accurate representation of real time replicas since PCLQ and PCSG have their own Scale subresources and any scale-out will directly change the PCLQ and PCSG replicas and will never be reflected in PCS. So at best this check is only valuable when you solely look at PCS spec (using templates) - but with scale-outs this no longer provides any guard.

Therefore MaxReplicas name for the function is highly misleading - as it gives an impression that it always returns an accurate value during the lifetime of the PCS but that is not really true.
On top of that the doc string:

// MaxReplicas returns the maximum number of replicas for this PodClique.

is also very misleading.

maxPCLQReplicas = templateSpec.Spec.MaxReplicas()
}

if err := validatePodNameConstraints(v.pcs.Name, v.pcs.Spec.Replicas, scalingGroupConfig.Name, scalingGroupConfig.MaxReplicas(), pclqName, maxPCLQReplicas); err != nil {

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.

If you wish to keep this then clearly document that this is best-effort and pre-flight and does not reflect the current state of PCS and its constituent PCLQs and PCSGs.

Comment thread operator/internal/controller/podclique/register.go

func validatePodResourceClaimReferenceNames(ownerName string, maxReplicas int32, refs []grovecorev1alpha1.ResourceSharingSpec, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
maxReplicaIndex := int(max(0, maxReplicas-1))

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.

maxReplicas is not the correct representation of what the actual max is. This value is solely derived from template spec.

}

// MaxAllowedReplicas returns the maximum number of replicas that can be configured for this PodClique.
func (p *PodCliqueSpec) MaxAllowedReplicas() int32 {

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.

Grove allows external pluggable horizontal autoscalers. ScaleConfig is only applicable when you wish to use HPA, otherwise this is not set (is nil). Dynamo uses planner to horizontally scale replicas. So in this case the max allowed will be limited by spec.Replicas which will not be correct.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just so I understand - theoretically, this is still accurate, but because we're not validating the PCLQ and /scale admission we're missing changes that are applied directly? Would you recommend we add validation to those admission paths?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Bump @unmarshall if you have any thoughts, thanks!

}

// MaxAllowedReplicas returns the maximum number of replicas that can be configured with this scaling group config.
func (p *PodCliqueScalingGroupConfig) MaxAllowedReplicas() int32 {

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 see comment

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.

Add pod clique pod index to pod name for better visibility

5 participants