Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "csc", Short: "a command line container storage interface (CSI) client", PersistentPreRunE: func(cmd *cobra.Command, args []string) error { if debug { root.logLevel.Set(log.DebugLevel.String()) root.withReqLogging = true root.withReqLogging = true } lvl, _ := root.logLevel.Val() log.SetLevel(lvl) if debug { log.Warn("debug mode enabled") } root.ctx = context.Background() log.Debug("assigned the root context") if root.format == "" { switch cmd.Name() { case listVolumesCmd.Name(): if listVolumes.paging { root.format = volumeInfoFormat } else { root.format = listVolumesFormat } case listSnapshotsCmd.Name(): if listSnapshots.paging { root.format = snapshotInfoFormat } else { root.format = listSnapshotsFormat } case createSnapshotCmd.Name(): root.format = snapshotInfoFormat case createVolumeCmd.Name(): root.format = volumeInfoFormat case pluginInfoCmd.Name(): root.format = pluginInfoFormat case pluginCapsCmd.Name(): root.format = pluginCapsFormat case probeCmd.Name(): root.format = probeFormat case nodeGetVolumeStatsCmd.Name(): root.format = statsFormat case nodeGetInfoCmd.Name(): root.format = nodeInfoFormat } } if root.format != "" { tpl, err := template.New("t").Funcs(template.FuncMap{ "isa": func(o interface{}, t string) bool { return fmt.Sprintf("%T", o) == t }, }).Parse(root.format) if err != nil { return err } root.tpl = tpl } root.secrets = utils.ParseMap(os.Getenv("X_CSI_SECRETS")) opts := []grpc.DialOption{ grpc.WithDialer( func(string, time.Duration) (net.Conn, error) { proto, addr, err := utils.ParseProtoAddr(root.endpoint) log.WithFields(map[string]interface{}{ "proto": proto, "addr": addr, "timeout": root.timeout, }).Debug("parsed endpoint info") if err != nil { return nil, err } return net.DialTimeout(proto, addr, root.timeout) }), } if root.insecure { opts = append(opts, grpc.WithInsecure()) } if o := getClientInterceptorsDialOpt(); o != nil { opts = append(opts, o) } ctx, cancel := context.WithTimeout(root.ctx, root.timeout) defer cancel() client, err := grpc.DialContext(ctx, root.endpoint, opts...) if err != nil { return err } root.client = client return nil }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.
Source Files ¶
- controller.go
- controller_create_snapshot.go
- controller_create_volume.go
- controller_delete_snapshot.go
- controller_delete_volume.go
- controller_expand_volume.go
- controller_get_capabilities.go
- controller_get_capacity.go
- controller_list_snapshots.go
- controller_list_volumes.go
- controller_publish_volume.go
- controller_unpublish_volume.go
- controller_validate_volume_capabilities.go
- flags.go
- formats.go
- identity.go
- identity_get_plugin_capabilities.go
- identity_get_plugin_info.go
- identity_probe.go
- interceptors.go
- node.go
- node_expand_volume.go
- node_get_capabilities.go
- node_get_info.go
- node_get_volume_stats.go
- node_publish_volume.go
- node_stage_volume.go
- node_unpublish_volume.go
- node_unstage_volume.go
- root.go
- usage.go
- vartypes.go
Click to show internal directories.
Click to hide internal directories.