v6d icon indicating copy to clipboard operation
v6d copied to clipboard

Add a general field to the Vineyardd CRD for supporting the most APIs of Kubernetes Deployment

Open dashanji opened this issue 2 years ago • 12 comments

Describe your problem

At present, we have the Vineyardd CRD to deploy a Kubernetes Deployment, but it only contains the parts of Kubernetes Deployment APIs refer to vineyardd template file, it's better to add a field to the Vineyardd CRD which allows users to input their custom APIs rather than the fields of CRD.

Some examples:

apiVersion: k8s.v6d.io/v1alpha1
kind: Vineyardd
metadata:
  name: vineyardd-sample
spec:
  replicas: 3
  vineyard:
    image: vineyardcloudnative/vineyardd:latest
    imagePullPolicy: IfNotPresent
  # the patchFields are only patched into the vineyard deployment
  patchFields:
    spec:
      template:
        spec:
          tolerations:
          - effect: NoSchedule
            key: disktype
            value: ssd

Additional context

  • Users want to add taints and tolerations to the Vineyard Deployment. #1355
  • You could get some inspiration from the kubectl patch

dashanji avatar Jun 29 '23 03:06 dashanji

I don't quite understand, do you want to say add a field, if the field is filled then execute the filled API, otherwise follow the original logic?

jingchu000 avatar Jul 10 '23 02:07 jingchu000

I'm sorry the extraFields maybe confuse you, it actually acts like patchFields. If the field is filled and then it will be patched into the original logic. As the general patch strategy:

  • if some fields defined in the patchFields exist in the original Deployment API, then Update.
  • if some fields do not exist, then Merge.

dashanji avatar Jul 10 '23 03:07 dashanji

On the current CRD definition, an additional field called patchFields is added to listen to the registered payload, and then the patchFields field is typed on the created yaml, which is then handed over to Apiserver for execution. It sounds like a webhook.

jingchu000 avatar Jul 10 '23 08:07 jingchu000

Yeah, using webhook can also work, but we don't want to add a new one. Actually, we want to do the Patch during Rendering the Vineyardd CRD as the deployment. As you said, we just put some logic like a webhook in the Vineyardd controller.

dashanji avatar Jul 10 '23 08:07 dashanji

I think I can try to fix it, but still need to look at the project and get a clear understanding of the requirements and changes.

jingchu000 avatar Jul 10 '23 08:07 jingchu000

No problem, assigned to you. If you have any question, feel free to contact us.

dashanji avatar Jul 10 '23 09:07 dashanji

Thanks,Is there a community or other place for communication?

jingchu000 avatar Jul 10 '23 09:07 jingchu000

@jingchu000, we have a slack channel refer to doc. Also, we have a DingDing group for communication. You could choose the like one.

dashanji avatar Jul 10 '23 10:07 dashanji

ok,I want to join Dingding

jingchu000 avatar Jul 10 '23 10:07 jingchu000

Can you invite me?

jingchu000 avatar Jul 10 '23 10:07 jingchu000

Ok, would you mind telling me your Dingding number here or via email [email protected].

dashanji avatar Jul 10 '23 10:07 dashanji

/cc @jingchu000, this issus/pr has had no activity for for a long time, could you folks help to review the status ? If the issue/pr is waiting for further response from the reporter/author, please help to add the label requires-further-info to suppress further notification.

github-actions[bot] avatar Feb 27 '24 13:02 github-actions[bot]