// Pool defines the detail of a pool.
type Pool struct {
// Indicates pool name as a DNS_LABEL, which will be used to generate
// pool workload name prefix in the format '<deployment-name>-<pool-name>-'.
// Name should be unique between all of the pools under one UnitedDeployment.
// Name is NodePool Name
Name string `json:"name"`
// Indicates the node selector to form the pool. Depending on the node selector,
// pods provisioned could be distributed across multiple groups of nodes.
// A pool's nodeSelectorTerm is not allowed to be updated.
// +optional
NodeSelectorTerm corev1.NodeSelectorTerm `json:"nodeSelectorTerm,omitempty"`
// Indicates the tolerations the pods under this pool have.
// A pool's tolerations is not allowed to be updated.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
// Indicates the number of the pod to be created under this pool.
// +required
Replicas *int32 `json:"replicas,omitempty"`
// Indicates the patches for the templateSpec
// Now support strategic merge path :https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/#notes-on-the-strategic-merge-patch
// +optional
Patches *runtime.RawExtension `json:"patches,omitempty"`
}
User can use this Patches to apply workloadTemplate.DeploymentTemplate or workloadTemplate.StatefulSetTemplate configuration. and now only support strategic merge path.
For the creation process, workload inherits the workloadTemplate configuration. If Patches are found in the Pool, it applies the workloadTemplate using the strategic merge path. It also saves the patches configuration in the annotation. Please review these documents in detail:
For the update process, the controller determines whether the annotation patches configuration in the workload matches the pool patches configuration. If not, trigger an update operation.
this pr let unitedDeployment support patch for pool.
ref issue 242
for Pool Struct , add new field
Patches
:User can use this
Patches
to applyworkloadTemplate.DeploymentTemplate
orworkloadTemplate.StatefulSetTemplate
configuration. and now only support strategic merge path.For the creation process, workload inherits the
workloadTemplate
configuration. IfPatches
are found in the Pool, it applies theworkloadTemplate
using the strategic merge path. It also saves the patches configuration in the annotation. Please review these documents in detail:pkg/yurtappmanager/controller/uniteddeployment/adapter/deployment_adapter.go
ApplyPoolTemplate
pkg/yurtappmanager/controller/uniteddeployment/adapter/statefulset_adapter.goApplyPoolTemplate
For the update process, the controller determines whether the annotation patches configuration in the workload matches the pool patches configuration. If not, trigger an update operation.
this is an example:
add an
patch
field for poolcc @Fei-Guo @huangyuqi @charleszheng44