Add containerdVersion flag

Add version flag that only prints the static version for the binary.

This commit does not include build details for containers since
Makefile does not build them.

Closes #8

Signed-off-by: Christopher M. Luciano <cmluciano@us.ibm.com>
This commit is contained in:
Christopher M. Luciano
2017-04-18 15:07:00 -04:00
parent d6978e3b7f
commit 683fd7f0e5
5 changed files with 98 additions and 2 deletions

View File

@@ -17,11 +17,14 @@ limitations under the License.
package main
import (
"os"
"github.com/golang/glog"
"github.com/spf13/pflag"
"github.com/kubernetes-incubator/cri-containerd/cmd/cri-containerd/options"
"github.com/kubernetes-incubator/cri-containerd/pkg/server"
"github.com/kubernetes-incubator/cri-containerd/pkg/version"
)
func main() {
@@ -29,6 +32,11 @@ func main() {
o.AddFlags(pflag.CommandLine)
options.InitFlags()
if o.CRIContainerdVersion {
version.PrintVersion()
os.Exit(0)
}
glog.V(2).Infof("Connect to containerd socket %q with timeout %v", o.ContainerdSocketPath, o.ContainerdConnectionTimeout)
conn, err := server.ConnectToContainerd(o.ContainerdSocketPath, o.ContainerdConnectionTimeout)
if err != nil {