Add skeleton for mkcmp

This PR adds a skeleton for mkcmp, a binary to compare the performance
of two versions of minikube. It adds a Makefile rule out/mkcmp which
builds the binary.
pull/5659/head
Priya Wadhwa 2019-10-18 16:55:58 -07:00
parent 56a23cab4a
commit 484a66e082
3 changed files with 72 additions and 0 deletions

View File

@ -551,3 +551,7 @@ site: site/themes/docsy/assets/vendor/bootstrap/package.js out/hugo/hugo
--navigateToChanged \
--ignoreCache \
--buildFuture)
.PHONY: out/mkcmp
out/mkcmp:
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $@ cmd/performance/main.go

View File

@ -0,0 +1,48 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 cmd
import (
"errors"
"fmt"
"os"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "mkcmp [path to first binary] [path to second binary]",
Short: "mkcmp is used to compare performance of two minikube binaries",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
return validateArgs(args)
},
Run: func(cmd *cobra.Command, args []string) {
return
},
}
func validateArgs(args []string) error {
if len(args) != 2 {
return errors.New("mkcmp requries two minikube binaries to compare: mkcmp [path to first binary] [path to second binary]")
}
return nil
}
// Execute runs the mkcmp command
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}

20
cmd/performance/main.go Normal file
View File

@ -0,0 +1,20 @@
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 "k8s.io/minikube/cmd/performance/cmd"
func main() {
cmd.Execute()
}