-
Notifications
You must be signed in to change notification settings - Fork 80
[Feature] Consider polymorphic for ContainerizedWorkload implementation #211
Comments
/cc @krmayankk |
please assign me |
容器工作负载多态设计:1.功能目标
2. 新增trait CRD volumeTrait
type VolumeTrait struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec VolumeTraitSpec `json:"spec,omitempty"`
Status VolumeTraitStatus `json:"status,omitempty"`
}
// A VolumeTraitSpec defines the desired state of a VolumeTrait.
type VolumeTraitSpec struct {
VolumeList []VolumeMountItem `json:"volumeList"`
// WorkloadReference to the workload this trait applies to.
WorkloadReference runtimev1alpha1.TypedReference `json:"workloadRef"`
}
type VolumeMountItem struct {
ContainerIndex int `json:"containerIndex"`
Paths []PathItem `json:"paths"`
}
type PathItem struct {
StorageClassName string `json:"storageClassName"`
Size string `json:"size"`
Path string `json:"path"`
} 3. 实现逻辑
|
@ryanzhang-oss Please help to review the implementation plan? It generally looks good to me. @xishengcai Please contribute the code to https://github.com/oam-dev/catalog/tree/master/workloads , we will keep this repo clean and provide building block primitives of OAM only. |
BTW, this featrue seems similar to issue #13 . |
Agree With @captainroy-hy, using a trait to determine the behavior of a workload controller is the designed behavior. In addition, I don't know what to put in the childResources fields in the workloadDefinition CR in this case. |
@ryanzhang-oss according to this implementation plan, I believe we could reserve some value like The concern I can see here is this design will couple with volume trait in oam runtime. The alternative IMO is let @captainroy-hy OAM policy is actually equivalent to special labels on Component, so you are basically suggesting using label instead of volume trait to determine the In this case, we can decouple this feature further by introducing a component level label such as |
@LEI Zhang (Harry) component label ContainerizedWorkload, volumeTrait create or delete pvc(can't update has created pvc). code has been implemented: https://github.com/xishengcai/oam-kubernetes-runtime/tree/caixisheng |
I agree, we could do this work in podspecworkload in kubevela |
@xishengcai It's great to see the PoC code is shipped! Let's we split the workload and trait code from runtime and move them to https://github.com/oam-dev/catalog? The plan is we will not maintain any workload/trait/scope code in runtime in the future. |
Note: this is a requirement from two end users (https://github.com/goodrain/rainbond and https://xlauncher.com/) so it seems worth a design and fix.
For now, in OAM Kubernetes runtime the child resource of
ContainerizedWorkload
is Deployment. But the users hope this become polymorphic so in certain cases and generate StatefulSet instead.The users' proposal is let persistent volume trait determine if StatefulSet should be generated. Not very sure if it's reliable enough though, open for discussion.
The implementation is straightforward, when persistent volume trait is attached to certain component, OAM runtime will add a label on generated
ContainerizedWorkload
CR metadata to indicate its child resource is a Deployment or StatefulSet.The text was updated successfully, but these errors were encountered: