github.com/jingruilea/kubeedge@v1.2.0-beta.0.0.20200410162146-4bb8902b3879/cloud/cmd/csidriver/app/options/options.go (about)

     1  /*
     2  Copyright 2019 The KubeEdge Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8     http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package options
    18  
    19  import (
    20  	cliflag "k8s.io/component-base/cli/flag"
    21  )
    22  
    23  // CSIDriverOptions config
    24  type CSIDriverOptions struct {
    25  	Endpoint         string
    26  	DriverName       string
    27  	NodeID           string
    28  	KubeEdgeEndpoint string
    29  	Version          string
    30  }
    31  
    32  // NewCSIDriverOptions returns options object
    33  func NewCSIDriverOptions() *CSIDriverOptions {
    34  	return &CSIDriverOptions{}
    35  }
    36  
    37  // Flags return flag sets
    38  func (o *CSIDriverOptions) Flags() (fss cliflag.NamedFlagSets) {
    39  	fs := fss.FlagSet("csidriver")
    40  	fs.StringVar(&o.Endpoint, "endpoint", "unix:///csi/csi.sock", "CSI endpoint")
    41  	fs.StringVar(&o.DriverName, "drivername", "csidriver", "name of the driver")
    42  	fs.StringVar(&o.NodeID, "nodeid", "", "node id determines which node will be used to create/delete volumes")
    43  	fs.StringVar(&o.KubeEdgeEndpoint, "kubeedge-endpoint", "unix:///kubeedge/kubeedge.sock", "kubeedge endpoint")
    44  	fs.StringVar(&o.Version, "version", "dev", "version")
    45  	return
    46  }