Skip to content

Commit

Permalink
add subset minReplicas&maxReplicas api for UnitedDeployment
Browse files Browse the repository at this point in the history
Signed-off-by: mingzhou.swx <[email protected]>
  • Loading branch information
mingzhou.swx committed Sep 25, 2023
1 parent 6488455 commit 348e8e8
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
15 changes: 15 additions & 0 deletions apis/apps/v1alpha1/uniteddeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,23 @@ type Subset struct {
// percentage like '10%', which means 10% of UnitedDeployment replicas of pods will be distributed
// under this subset. If nil, the number of replicas in this subset is determined by controller.
// Controller will try to keep all the subsets with nil replicas have average pods.
// Replicas and MinReplicas/MaxReplicas are mutually exclusive in a UnitedDeployment.
// +optional
Replicas *intstr.IntOrString `json:"replicas,omitempty"`

// Indicates the lower bounded replicas of the subset.
// MinReplicas must be more than or equal to 0.
// Spec.Replicas must be more than or equal the sum of MinReplicas of all subsets.
// Defaults to 0.
MinReplicas *intstr.IntOrString `json:"minReplicas"`

// Indicates the upper bounded replicas of the subset.
// MaxReplicas must be more than or equal to MinReplicas.
// MaxReplicas == nil means no limitation.
// Please ensure that at least one subset has empty MaxReplicas(no limitation) to avoid stuck scaling.
// Defaults to nil.
MaxReplicas *intstr.IntOrString `json:"maxReplicas,omitempty"`

// Patch indicates patching to the templateSpec.
// Patch takes precedence over other fields
// If the Patch also modifies the Replicas, NodeSelectorTerm or Tolerations, use value in the Patch
Expand Down
30 changes: 30 additions & 0 deletions apis/apps/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 22 additions & 1 deletion config/crd/bases/apps.kruise.io_uniteddeployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,25 @@ spec:
items:
description: Subset defines the detail of a subset.
properties:
maxReplicas:
anyOf:
- type: integer
- type: string
description: Indicates the upper bounded replicas of the
subset. MaxReplicas must be more than or equal to MinReplicas.
MaxReplicas == nil means no limitation. Please ensure
that at least one subset has empty MaxReplicas(no limitation)
to avoid stuck scaling. Defaults to nil.
x-kubernetes-int-or-string: true
minReplicas:
anyOf:
- type: integer
- type: string
description: Indicates the lower bounded replicas of the
subset. MinReplicas must be more than or equal to 0. Spec.Replicas
must be more than or equal the sum of MinReplicas of all
subsets. Defaults to 0.
x-kubernetes-int-or-string: true
name:
description: Indicates subset name as a DNS_LABEL, which
will be used to generate subset workload name prefix in
Expand Down Expand Up @@ -1072,7 +1091,8 @@ spec:
pods will be distributed under this subset. If nil, the
number of replicas in this subset is determined by controller.
Controller will try to keep all the subsets with nil replicas
have average pods.
have average pods. Replicas and MinReplicas/MaxReplicas
are mutually exclusive in a UnitedDeployment.
x-kubernetes-int-or-string: true
tolerations:
description: Indicates the tolerations the pods under this
Expand Down Expand Up @@ -1120,6 +1140,7 @@ spec:
type: object
type: array
required:
- minReplicas
- name
type: object
type: array
Expand Down

0 comments on commit 348e8e8

Please sign in to comment.