Skip to content

Commit

Permalink
fix(trait): changing data type for rollingUpdateMaxSurge and rollingU…
Browse files Browse the repository at this point in the history
…pdateMaxUnavailable to strings are also supported
  • Loading branch information
lsergio authored and squakez committed Mar 11, 2024
1 parent dbedcb5 commit d74c2d9
Show file tree
Hide file tree
Showing 16 changed files with 160 additions and 47 deletions.
4 changes: 2 additions & 2 deletions docs/modules/ROOT/partials/apis/camel-k-crds.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6682,7 +6682,7 @@ is considered to be failed. It defaults to `60s`.
The deployment strategy to use to replace existing pods with new ones.
|`rollingUpdateMaxUnavailable` +
int
k8s.io/apimachinery/pkg/util/intstr.IntOrString
|
Expand All @@ -6693,7 +6693,7 @@ This can not be 0 if MaxSurge is 0.
Defaults to `25%`.
|`rollingUpdateMaxSurge` +
int
k8s.io/apimachinery/pkg/util/intstr.IntOrString
|
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/traits/pages/deployment.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ is considered to be failed. It defaults to `60s`.
| The deployment strategy to use to replace existing pods with new ones.

| deployment.rolling-update-max-unavailable
| int
| k8s.io/apimachinery/pkg/util/intstr.IntOrString
| The maximum number of pods that can be unavailable during the update.
Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
Absolute number is calculated from percentage by rounding down.
This can not be 0 if MaxSurge is 0.
Defaults to `25%`.

| deployment.rolling-update-max-surge
| int
| k8s.io/apimachinery/pkg/util/intstr.IntOrString
| The maximum number of pods that can be scheduled above the desired number of
pods.
Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
Expand Down
20 changes: 16 additions & 4 deletions helm/camel-k/crds/crd-integration-platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -852,20 +852,26 @@ spec:
format: int32
type: integer
rollingUpdateMaxSurge:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be scheduled
above the desired number of pods. Value can be an absolute
number (ex: 5) or a percentage of desired pods (ex: 10%).
This can not be 0 if MaxUnavailable is 0. Absolute number
is calculated from percentage by rounding up. Defaults to
`25%`.'
type: integer
x-kubernetes-int-or-string: true
rollingUpdateMaxUnavailable:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be unavailable
during the update. Value can be an absolute number (ex:
5) or a percentage of desired pods (ex: 10%). Absolute number
is calculated from percentage by rounding down. This can
not be 0 if MaxSurge is 0. Defaults to `25%`.'
type: integer
x-kubernetes-int-or-string: true
strategy:
description: The deployment strategy to use to replace existing
pods with new ones.
Expand Down Expand Up @@ -2736,20 +2742,26 @@ spec:
format: int32
type: integer
rollingUpdateMaxSurge:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be scheduled
above the desired number of pods. Value can be an absolute
number (ex: 5) or a percentage of desired pods (ex: 10%).
This can not be 0 if MaxUnavailable is 0. Absolute number
is calculated from percentage by rounding up. Defaults to
`25%`.'
type: integer
x-kubernetes-int-or-string: true
rollingUpdateMaxUnavailable:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be unavailable
during the update. Value can be an absolute number (ex:
5) or a percentage of desired pods (ex: 10%). Absolute number
is calculated from percentage by rounding down. This can
not be 0 if MaxSurge is 0. Defaults to `25%`.'
type: integer
x-kubernetes-int-or-string: true
strategy:
description: The deployment strategy to use to replace existing
pods with new ones.
Expand Down
20 changes: 16 additions & 4 deletions helm/camel-k/crds/crd-integration-profile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -734,20 +734,26 @@ spec:
format: int32
type: integer
rollingUpdateMaxSurge:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be scheduled
above the desired number of pods. Value can be an absolute
number (ex: 5) or a percentage of desired pods (ex: 10%).
This can not be 0 if MaxUnavailable is 0. Absolute number
is calculated from percentage by rounding up. Defaults to
`25%`.'
type: integer
x-kubernetes-int-or-string: true
rollingUpdateMaxUnavailable:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be unavailable
during the update. Value can be an absolute number (ex:
5) or a percentage of desired pods (ex: 10%). Absolute number
is calculated from percentage by rounding down. This can
not be 0 if MaxSurge is 0. Defaults to `25%`.'
type: integer
x-kubernetes-int-or-string: true
strategy:
description: The deployment strategy to use to replace existing
pods with new ones.
Expand Down Expand Up @@ -2507,20 +2513,26 @@ spec:
format: int32
type: integer
rollingUpdateMaxSurge:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be scheduled
above the desired number of pods. Value can be an absolute
number (ex: 5) or a percentage of desired pods (ex: 10%).
This can not be 0 if MaxUnavailable is 0. Absolute number
is calculated from percentage by rounding up. Defaults to
`25%`.'
type: integer
x-kubernetes-int-or-string: true
rollingUpdateMaxUnavailable:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be unavailable
during the update. Value can be an absolute number (ex:
5) or a percentage of desired pods (ex: 10%). Absolute number
is calculated from percentage by rounding down. This can
not be 0 if MaxSurge is 0. Defaults to `25%`.'
type: integer
x-kubernetes-int-or-string: true
strategy:
description: The deployment strategy to use to replace existing
pods with new ones.
Expand Down
10 changes: 8 additions & 2 deletions helm/camel-k/crds/crd-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6753,20 +6753,26 @@ spec:
format: int32
type: integer
rollingUpdateMaxSurge:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be scheduled
above the desired number of pods. Value can be an absolute
number (ex: 5) or a percentage of desired pods (ex: 10%).
This can not be 0 if MaxUnavailable is 0. Absolute number
is calculated from percentage by rounding up. Defaults to
`25%`.'
type: integer
x-kubernetes-int-or-string: true
rollingUpdateMaxUnavailable:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be unavailable
during the update. Value can be an absolute number (ex:
5) or a percentage of desired pods (ex: 10%). Absolute number
is calculated from percentage by rounding down. This can
not be 0 if MaxSurge is 0. Defaults to `25%`.'
type: integer
x-kubernetes-int-or-string: true
strategy:
description: The deployment strategy to use to replace existing
pods with new ones.
Expand Down
10 changes: 8 additions & 2 deletions helm/camel-k/crds/crd-kamelet-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7040,20 +7040,26 @@ spec:
format: int32
type: integer
rollingUpdateMaxSurge:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be scheduled
above the desired number of pods. Value can be an absolute
number (ex: 5) or a percentage of desired pods (ex:
10%). This can not be 0 if MaxUnavailable is 0. Absolute
number is calculated from percentage by rounding up.
Defaults to `25%`.'
type: integer
x-kubernetes-int-or-string: true
rollingUpdateMaxUnavailable:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be unavailable
during the update. Value can be an absolute number (ex:
5) or a percentage of desired pods (ex: 10%). Absolute
number is calculated from percentage by rounding down.
This can not be 0 if MaxSurge is 0. Defaults to `25%`.'
type: integer
x-kubernetes-int-or-string: true
strategy:
description: The deployment strategy to use to replace
existing pods with new ones.
Expand Down
10 changes: 8 additions & 2 deletions helm/camel-k/crds/crd-pipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7038,20 +7038,26 @@ spec:
format: int32
type: integer
rollingUpdateMaxSurge:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be scheduled
above the desired number of pods. Value can be an absolute
number (ex: 5) or a percentage of desired pods (ex:
10%). This can not be 0 if MaxUnavailable is 0. Absolute
number is calculated from percentage by rounding up.
Defaults to `25%`.'
type: integer
x-kubernetes-int-or-string: true
rollingUpdateMaxUnavailable:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be unavailable
during the update. Value can be an absolute number (ex:
5) or a percentage of desired pods (ex: 10%). Absolute
number is calculated from percentage by rounding down.
This can not be 0 if MaxSurge is 0. Defaults to `25%`.'
type: integer
x-kubernetes-int-or-string: true
strategy:
description: The deployment strategy to use to replace
existing pods with new ones.
Expand Down
5 changes: 3 additions & 2 deletions pkg/apis/camel/v1/trait/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package trait

import (
appsv1 "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)

// The Deployment trait is responsible for generating the Kubernetes deployment that will make sure
Expand All @@ -38,12 +39,12 @@ type DeploymentTrait struct {
// Absolute number is calculated from percentage by rounding down.
// This can not be 0 if MaxSurge is 0.
// Defaults to `25%`.
RollingUpdateMaxUnavailable *int `property:"rolling-update-max-unavailable" json:"rollingUpdateMaxUnavailable,omitempty"`
RollingUpdateMaxUnavailable *intstr.IntOrString `property:"rolling-update-max-unavailable" json:"rollingUpdateMaxUnavailable,omitempty"`
// The maximum number of pods that can be scheduled above the desired number of
// pods.
// Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
// This can not be 0 if MaxUnavailable is 0.
// Absolute number is calculated from percentage by rounding up.
// Defaults to `25%`.
RollingUpdateMaxSurge *int `property:"rolling-update-max-surge" json:"rollingUpdateMaxSurge,omitempty"`
RollingUpdateMaxSurge *intstr.IntOrString `property:"rolling-update-max-surge" json:"rollingUpdateMaxSurge,omitempty"`
}
5 changes: 3 additions & 2 deletions pkg/apis/camel/v1/trait/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -852,20 +852,26 @@ spec:
format: int32
type: integer
rollingUpdateMaxSurge:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be scheduled
above the desired number of pods. Value can be an absolute
number (ex: 5) or a percentage of desired pods (ex: 10%).
This can not be 0 if MaxUnavailable is 0. Absolute number
is calculated from percentage by rounding up. Defaults to
`25%`.'
type: integer
x-kubernetes-int-or-string: true
rollingUpdateMaxUnavailable:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be unavailable
during the update. Value can be an absolute number (ex:
5) or a percentage of desired pods (ex: 10%). Absolute number
is calculated from percentage by rounding down. This can
not be 0 if MaxSurge is 0. Defaults to `25%`.'
type: integer
x-kubernetes-int-or-string: true
strategy:
description: The deployment strategy to use to replace existing
pods with new ones.
Expand Down Expand Up @@ -2736,20 +2742,26 @@ spec:
format: int32
type: integer
rollingUpdateMaxSurge:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be scheduled
above the desired number of pods. Value can be an absolute
number (ex: 5) or a percentage of desired pods (ex: 10%).
This can not be 0 if MaxUnavailable is 0. Absolute number
is calculated from percentage by rounding up. Defaults to
`25%`.'
type: integer
x-kubernetes-int-or-string: true
rollingUpdateMaxUnavailable:
anyOf:
- type: integer
- type: string
description: 'The maximum number of pods that can be unavailable
during the update. Value can be an absolute number (ex:
5) or a percentage of desired pods (ex: 10%). Absolute number
is calculated from percentage by rounding down. This can
not be 0 if MaxSurge is 0. Defaults to `25%`.'
type: integer
x-kubernetes-int-or-string: true
strategy:
description: The deployment strategy to use to replace existing
pods with new ones.
Expand Down
Loading

0 comments on commit d74c2d9

Please sign in to comment.