From f37eeddb09619bed41b78df3025884ea33f074ba Mon Sep 17 00:00:00 2001 From: Bowei Du Date: Mon, 11 Jun 2018 11:56:30 -0700 Subject: [PATCH 1/2] Fixed invalid reference to personal project --- cmd/fuzzer/app/validate.go | 17 +++++++++++++---- cmd/fuzzer/fuzzer.go | 3 --- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cmd/fuzzer/app/validate.go b/cmd/fuzzer/app/validate.go index 9f15a0ec0a..2c2bd7bde5 100644 --- a/cmd/fuzzer/app/validate.go +++ b/cmd/fuzzer/app/validate.go @@ -44,6 +44,7 @@ var ( name string listFeatures bool featureRegex string + project string } // ValidateFlagSet is the flag set for the validate subcommand. ValidateFlagSet = flag.NewFlagSet("validate", flag.ExitOnError) @@ -59,6 +60,7 @@ func init() { ValidateFlagSet.StringVar(&validateOptions.ns, "ns", "default", "namespace of the Ingress object to validate") ValidateFlagSet.BoolVar(&validateOptions.listFeatures, "listFeatures", false, "list features available to be validated") ValidateFlagSet.StringVar(&validateOptions.featureRegex, "featureRegex", "", "features matching regex will be included in validation") + ValidateFlagSet.StringVar(&validateOptions.project, "project", "", "GCP project where the load balancer will be created") // Merges in the global flags into the subcommand FlagSet. flag.VisitAll(func(f *flag.Flag) { @@ -76,9 +78,16 @@ func Validate() { os.Exit(0) } - if validateOptions.name == "" { - fmt.Fprint(ValidateFlagSet.Output(), "You must specify a -name.\n") - os.Exit(1) + for _, o := range []struct { + flag, val string + }{ + {validateOptions.name, "-name"}, + {validateOptions.project, "-project"}, + } { + if o.val == "" { + fmt.Fprintf(ValidateFlagSet.Output(), "You must specify the %s flag.\n", o.flag) + os.Exit(1) + } } config, err := clientcmd.BuildConfigFromFlags("", validateOptions.kubeconfig) @@ -86,7 +95,7 @@ func Validate() { panic(err.Error()) } - gce, err := e2e.NewCloud("bowei-gke") + gce, err := e2e.NewCloud(validateOptions.project) if err != nil { panic(err) } diff --git a/cmd/fuzzer/fuzzer.go b/cmd/fuzzer/fuzzer.go index 8e487ad6dd..8c4f6c9a93 100644 --- a/cmd/fuzzer/fuzzer.go +++ b/cmd/fuzzer/fuzzer.go @@ -40,9 +40,6 @@ func main() { os.Exit(1) } - // Make glog not complain about flags not being parsed. - // flag.CommandLine.Parse([]string{}) - switch os.Args[1] { case "validate": app.ValidateFlagSet.Parse(os.Args[2:]) From a266b899b01b5f6b2b7fb8f086e9a377387354ec Mon Sep 17 00:00:00 2001 From: Bowei Du Date: Mon, 11 Jun 2018 11:56:46 -0700 Subject: [PATCH 2/2] Add Dockerfile for the fuzzer --- Dockerfile.fuzzer | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Dockerfile.fuzzer diff --git a/Dockerfile.fuzzer b/Dockerfile.fuzzer new file mode 100644 index 0000000000..cdd8f38a43 --- /dev/null +++ b/Dockerfile.fuzzer @@ -0,0 +1,20 @@ +# Copyright 2015 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. + +FROM alpine:3.6 + +RUN apk add --no-cache ca-certificates + +ADD bin/ARG_ARCH/ARG_BIN /ARG_BIN +ENTRYPOINT ["/ARG_BIN"]