argo-rollouts icon indicating copy to clipboard operation
argo-rollouts copied to clipboard

Rollout `spec.template.metadata.name` is an invalid field, breaking compatibility with apps/v1 Deployment

Open jasondamour opened this issue 1 year ago • 4 comments

Checklist:

  • [x] I've included steps to reproduce the bug.
  • [x] I've included the version of argo rollouts.

Describe the bug

Creating/Updating a rollout with spec.template.metadata.name field set causes the following client side validation error:

Error: UPGRADE FAILED: error validating "": error validating data:  ValidationError(Rollout.spec.template.metadata): unknown field "name" in io.argoproj.v1alpha1.Rollout.spec.template.metadata

However setting the same field in the apps/v1 Deployment causes no issue. Disabling client validation succeeds.

I understand setting the field has no effect on the final deployment object, but the field cannot be removed from our workflow as we set the same default metadata object (name, labels, annotations) on all resources in our clusters.

Docs state:

Template describes the pods that will be created. Same as deployment.

To Reproduce

  1. kubectl apply the snippet and observe the valid Deployment
  2. Change the apiVersion/kind to ArgoRollout, and try to apply. Observe the validation error
  3. Comment out the spec.template.spec.metadata.name field and try to apply again, and observe success
apiVersion: apps/v1
kind: Deployment
# apiVersion: argoproj.io/v1alpha1
# kind: Rollout
metadata:
  name: test
spec:
  selector:
    matchLabels:
      app: test
  template:
    metadata:
      name: test
      labels:
        app: test
    spec:
      containers:
      - name: test
        image: argoproj/rollouts-demo:blue

Expected behavior Argo Rollout spec.template.spec should be fully interchangable with Deployment (POD) spec

Version

v1.5.0

Logs

Logs are N/A, this is a client side validation issue


Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritize the issues with the most 👍.

jasondamour avatar Sep 28 '23 20:09 jasondamour

  1. Argo Rollouts uses k8s.io/api/core/v1 PodTemplateSpec as seen here...
  2. PodTemplateSpec uses k8s.io/apimachinery/pkg/apis/meta/v1 ObjectMetadata, as seen here...
  3. ObjectMetdata has a name field, as seen here!

So why does the generated CRD not have the name field, since it seems to be in the golang struct?

jasondamour avatar Oct 04 '23 17:10 jasondamour

This issue is stale because it has been open 60 days with no activity.

github-actions[bot] avatar Dec 04 '23 02:12 github-actions[bot]

Continued the discussion a bit on the PR: https://github.com/argoproj/argo-rollouts/pull/3068#issuecomment-1747662029

jasondamour avatar Dec 06 '23 19:12 jasondamour

I'd love to see this fixed to include all ObjectMeta fields, we're hitting this issue with creationTimestamp. I'm really curious what is excluding these fields from the generated CRDs?

com6056 avatar Jul 16 '24 22:07 com6056