Skip to content

Commit

Permalink
kubectl: Document --for's Unicode case-folding condition-value compar…
Browse files Browse the repository at this point in the history
…ison

When the wait command was added in 7679464 (add wait, 2018-05-18, kubernetes#64034),
this comparison was via ToLower.  It moved to use Unicode case folding
[1,2] in f4940cf (Staticcheck:
vendor/k8s.io/kubectl/pkg/scale|describe/versioned|cmd/top|cmd/util/editor|cmd/top,
2020-01-21, kubernetes#87403).

[1]: https://pkg.go.dev/strings#EqualFold
[2]: http://www.unicode.org/reports/tr30/tr30-1.html
  • Loading branch information
wking authored and yanghesong committed Jan 8, 2022
1 parent a4bd4f8 commit 9d3ede4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions staging/src/k8s.io/kubectl/pkg/cmd/wait/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var (
# Wait for the pod "busybox1" to contain the status condition of type "Ready"
kubectl wait --for=condition=Ready pod/busybox1
# The default value of status condition is true; you can set it to false
# The default value of status condition is true; you can wait for other targets after an equal delimiter (compared after Unicode simple case folding, which is a more general form of case-insensitivity):
kubectl wait --for=condition=Ready=false pod/busybox1
# Wait for the pod "busybox1" to contain the status phase to be "Running".
Expand Down Expand Up @@ -142,7 +142,7 @@ func (flags *WaitFlags) AddFlags(cmd *cobra.Command) {
flags.ResourceBuilderFlags.AddFlags(cmd.Flags())

cmd.Flags().DurationVar(&flags.Timeout, "timeout", flags.Timeout, "The length of time to wait before giving up. Zero means check once and don't wait, negative means wait for a week.")
cmd.Flags().StringVar(&flags.ForCondition, "for", flags.ForCondition, "The condition to wait on: [delete|condition=condition-name|jsonpath='{JSONPath expression}'=JSONPath Condition]. The default status value of condition-name is true, you can set false with condition=condition-name=false.")
cmd.Flags().StringVar(&flags.ForCondition, "for", flags.ForCondition, "The condition to wait on: [delete|condition=condition-name[=condition-value]|jsonpath='{JSONPath expression}'=JSONPath Condition]. The default condition-value is true. Condition values are compared after Unicode simple case folding, which is a more general form of case-insensitivity.")
}

// ToOptions converts from CLI inputs to runtime inputs
Expand Down

0 comments on commit 9d3ede4

Please sign in to comment.