Skip to content

Commit

Permalink
fix up docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dturn committed Jan 9, 2018
1 parent f65bd72 commit 71f214d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,16 @@ You can add additional variables using the `--bindings=BINDINGS` option. For exa
- `kubernetes-deploy.shopify.io/timeout-override`: Override the tool's hard timeout for one specific resource. Both full ISO8601 durations and the time portion of ISO8601 durations are valid. Value must be between 1 second and 24 hours.
- _Example values_: 45s / 3m / 1h / PT0.25H
- _Compatibility_: all resource types (Note: `Deployment` timeouts are based on `spec.progressDeadlineSeconds` if present, and that field has a default value as of the `apps/v1beta1` group version. Using this annotation will have no effect on `Deployment`s that time out with "Timeout reason: ProgressDeadlineExceeded".)
- `kubernetes-deploy.shopify.io/required-rollout` (deployment): Modifies the conditions a deployment is
considered to be successful
- `maxUnavailable`: Only for `RollingUpdate deploys`. The deploy is successful when there are less
than `strategy.RollingUpdate.maxUnavailable` (supports both the % and fixed number) updated & ready replicas.
- `full`: maintain current behavior
- `none`: deploy is successful as soon as the new `replicaSet` is created for the deploy
- `kubernetes-deploy.shopify.io/required-rollout`: Modifies how much of the rollout needs to finish
before the deployment is considered successful.
- _Compatibility_: Deployment
- `full`: The deploy is successful when all pods in the new ReplicaSet are ready.
- `none`: The deploy is successful as soon as the new `replicaSet` is created for the deploy
- `maxUnavailable`: The deploy is successful when minimum availability is reached in the new ReplicaSet.
In other words, the number of new pods that must be ready is equal to `spec.replicas` - `strategy.RollingUpdate.maxUnavailable`
(converted from percentages by rounding up, if applicable). This option is only valid for deployments
that use the `RollingUpdate` strategy.


### Running tasks at the beginning of a deploy

Expand Down
8 changes: 3 additions & 5 deletions lib/kubernetes-deploy/kubernetes_resource/deployment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,19 @@ def exists?
end

def validate_definition
valid = super
super

unless REQUIRED_ROLLOUT_TYPES.include?(required_rollout)
@validation_errors << "#{REQUIRED_ROLLOUT_ANNOTATION}:#{required_rollout} is invalid "\
"Acceptable options: #{REQUIRED_ROLLOUT_TYPES.join(',')}"
valid = false
end

if required_rollout == 'maxUnavailable' && @definition.dig('spec', 'strategy') == 'recreate'
if required_rollout.downcase == 'maxunavailable' && @definition.dig('spec', 'strategy').downcase == 'recreate'
@validation_errors << "#{REQUIRED_ROLLOUT_ANNOTATION}:#{required_rollout} is invalid "\
"with strategy 'rollingUpdate'"
valid = false
end

valid
@validation_errors.empty?
end

private
Expand Down

0 comments on commit 71f214d

Please sign in to comment.