rebase: update kubernetes and libraries to v1.22.0 version

Kubernetes v1.22 version has been released and this update
ceph csi dependencies to use the same version.

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Chirammal
2021-08-09 12:49:24 +05:30
committed by mergify[bot]
parent e077c1fdf5
commit aa698bc3e1
759 changed files with 61864 additions and 6514 deletions

View File

@ -22,9 +22,14 @@ import (
"io"
"strings"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
const (
usageFmt = "Usage:\n %s\n"
)
// NamedFlagSets stores named flag sets in the order of calling FlagSet.
type NamedFlagSets struct {
// Order is an ordered list of flag set names.
@ -84,3 +89,17 @@ func PrintSections(w io.Writer, fss NamedFlagSets, cols int) {
}
}
}
// SetUsageAndHelpFunc set both usage and help function.
// Print the flag sets we need instead of all of them.
func SetUsageAndHelpFunc(cmd *cobra.Command, fss NamedFlagSets, cols int) {
cmd.SetUsageFunc(func(cmd *cobra.Command) error {
fmt.Fprintf(cmd.OutOrStderr(), usageFmt, cmd.UseLine())
PrintSections(cmd.OutOrStderr(), fss, cols)
return nil
})
cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
fmt.Fprintf(cmd.OutOrStdout(), "%s\n\n"+usageFmt, cmd.Long, cmd.UseLine())
PrintSections(cmd.OutOrStdout(), fss, cols)
})
}

View File

@ -18,6 +18,7 @@ package flag
import (
goflag "flag"
"fmt"
"strings"
"github.com/spf13/pflag"
@ -45,9 +46,11 @@ func (s *StringSlice) String() string {
}
func (s *StringSlice) Set(val string) error {
if s.value == nil || !s.changed {
v := make([]string, 0)
s.value = &v
if s.value == nil {
return fmt.Errorf("no target (nil pointer to []string)")
}
if !s.changed {
*s.value = make([]string, 0)
}
*s.value = append(*s.value, val)
s.changed = true