/* Copyright 2024 p5x. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package main import ( "flag" "fmt" "os" "k8s.io/klog" "csi-driver/pkg/csi" ) var ( endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI Endpoint") version = flag.Bool("version", false, "Print the version and exit.") nodeID = flag.String("nodeid", "", "Node ID") p5xEndpoint = flag.String("p5x-endpoint", "", "HTTPS endpoint of the P5x API server (e.g. https://p5x.example.local)") p5xToken = flag.String("p5x-token", "", "P5x API access token") p5xPort = flag.Int64("p5x-port", 3450, "P5x API port") ) func main() { flag.Parse() if *version { info, err := csi.GetVersionJSON() if err != nil { klog.Fatalln(err) } fmt.Println(info) os.Exit(0) } if *nodeID == "" { klog.Fatalln("--nodeid must be provided") } if *p5xEndpoint == "" { klog.Fatalln("--p5x-endpoint must be provided") } if *p5xToken == "" { klog.Fatalln("--p5x-token must be provided") } drv := csi.NewDriver(*endpoint, *nodeID, *p5xEndpoint, *p5xToken, *p5xPort) if err := drv.Run(); err != nil { klog.Fatalln(err) } }