Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #329

Merged
merged 2 commits into from
Jun 11, 2018
Merged

Fixes #329

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Dockerfile.fuzzer
Original file line number Diff line number Diff line change
@@ -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"]
17 changes: 13 additions & 4 deletions cmd/fuzzer/app/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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) {
Expand All @@ -76,17 +78,24 @@ 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)
if err != nil {
panic(err.Error())
}

gce, err := e2e.NewCloud("bowei-gke")
gce, err := e2e.NewCloud(validateOptions.project)
if err != nil {
panic(err)
}
Expand Down
3 changes: 0 additions & 3 deletions cmd/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:])
Expand Down