From 7424330984493a59cc10b78f1ff154d8aebf8692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Wed, 17 Apr 2019 15:01:06 +0200 Subject: [PATCH 01/17] feature(service describe): Output of service details `kn service show` mimics `kubectl describe ` as that it output detail information in human readable output. A future extension should add machine readable output with `-o` to export a single object in json/yaml (that is missing from `kn service list`) This command shows information about the service itself, but also a summary about the associated revisions. It also knows about scaling and concurrency options. Options: `--details` : Print more information. By default only are shorter summary is shown --- docs/cmd/kn_service.md | 2 +- docs/cmd/kn_service_describe.md | 12 +- go.mod | 2 + go.sum | 8 + pkg/kn/commands/service/service_describe.go | 535 +++++++++++++++++- .../commands/service/service_describe_test.go | 51 +- pkg/printers/prefixwriter.go | 100 ++++ pkg/printers/tableprinter.go | 2 +- pkg/printers/tabwriter.go | 4 +- pkg/serving/v1alpha1/client.go | 16 + test/e2e-smoke-tests.sh | 4 +- test/e2e/basic_workflow_test.go | 13 +- vendor/golang.org/x/sys/unix/syscall_linux.go | 14 + .../golang.org/x/sys/unix/ztypes_linux_386.go | 6 + .../x/sys/unix/ztypes_linux_amd64.go | 6 + .../golang.org/x/sys/unix/ztypes_linux_arm.go | 6 + .../x/sys/unix/ztypes_linux_arm64.go | 6 + .../x/sys/unix/ztypes_linux_mips.go | 6 + .../x/sys/unix/ztypes_linux_mips64.go | 6 + .../x/sys/unix/ztypes_linux_mips64le.go | 6 + .../x/sys/unix/ztypes_linux_mipsle.go | 6 + .../x/sys/unix/ztypes_linux_ppc64.go | 6 + .../x/sys/unix/ztypes_linux_ppc64le.go | 6 + .../x/sys/unix/ztypes_linux_riscv64.go | 6 + .../x/sys/unix/ztypes_linux_s390x.go | 6 + .../x/sys/unix/ztypes_linux_sparc64.go | 6 + .../x/sys/windows/security_windows.go | 2 +- vendor/modules.txt | 2 +- 28 files changed, 787 insertions(+), 58 deletions(-) create mode 100644 pkg/printers/prefixwriter.go diff --git a/docs/cmd/kn_service.md b/docs/cmd/kn_service.md index fb6f8e4802..8c2bffd787 100644 --- a/docs/cmd/kn_service.md +++ b/docs/cmd/kn_service.md @@ -29,7 +29,7 @@ kn service [flags] * [kn](kn.md) - Knative client * [kn service create](kn_service_create.md) - Create a service. * [kn service delete](kn_service_delete.md) - Delete a service. -* [kn service describe](kn_service_describe.md) - Describe available services. +* [kn service describe](kn_service_describe.md) - Show details for a given service * [kn service list](kn_service_list.md) - List available services. * [kn service update](kn_service_update.md) - Update a service. diff --git a/docs/cmd/kn_service_describe.md b/docs/cmd/kn_service_describe.md index 9f041fe230..b0edf79abd 100644 --- a/docs/cmd/kn_service_describe.md +++ b/docs/cmd/kn_service_describe.md @@ -1,10 +1,10 @@ ## kn service describe -Describe available services. +Show details for a given service ### Synopsis -Describe available services. +Show details for a given service ``` kn service describe NAME [flags] @@ -13,11 +13,9 @@ kn service describe NAME [flags] ### Options ``` - --allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true) - -h, --help help for describe - -n, --namespace string List the requested object(s) in given namespace. - -o, --output string Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file. (default "yaml") - --template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. + -d, --details Show all details. + -h, --help help for describe + -n, --namespace string List the requested object(s) in given namespace. ``` ### Options inherited from parent commands diff --git a/go.mod b/go.mod index f3e4e36950..fcd738d338 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/knative/client require ( github.com/cpuguy83/go-md2man v1.0.10 // indirect github.com/evanphx/json-patch v4.5.0+incompatible // indirect + github.com/fatih/color v1.7.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/gogo/protobuf v1.2.1 // indirect github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect @@ -22,6 +23,7 @@ require ( github.com/knative/serving v0.6.0 github.com/knative/test-infra v0.0.0-20190702025031-91d37e4abc30 // indirect github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a // indirect + github.com/mattn/go-colorable v0.1.2 // indirect github.com/mitchellh/go-homedir v1.1.0 github.com/modern-go/reflect2 v1.0.1 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect diff --git a/go.sum b/go.sum index 1031a2e8bb..bc9918b004 100644 --- a/go.sum +++ b/go.sum @@ -49,6 +49,8 @@ github.com/evanphx/json-patch v4.2.0+incompatible h1:fUDGZCv/7iAN7u0puUVhvKCcsR6 github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680 h1:ZktWZesgun21uEDrwW7iEV1zPCGQldM2atlJZ3TdvVM= @@ -171,6 +173,10 @@ github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a h1:TpvdAwDAt1K4ANV github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a h1:+J2gw7Bw77w/fbK7wnNJJDKmw1IbWft2Ul5BzrG1Qm8= github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a/go.mod h1:M1qoD/MqPgTZIk0EWKB38wE28ACRfVcn+cU08jyArI0= +github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -316,6 +322,8 @@ golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a h1:1n5lsVfiQW3yfsRGu98756EH1 golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/pkg/kn/commands/service/service_describe.go b/pkg/kn/commands/service/service_describe.go index 2e09f2e06e..b16231719f 100644 --- a/pkg/kn/commands/service/service_describe.go +++ b/pkg/kn/commands/service/service_describe.go @@ -16,21 +16,90 @@ package service import ( "errors" + "fmt" + "io" + "regexp" + "sort" + "strconv" + "strings" + "time" + + "github.com/knative/serving/pkg/apis/autoscaling" + "github.com/knative/serving/pkg/apis/serving" + + "github.com/knative/client/pkg/printers" + serving_kn_v1alpha1 "github.com/knative/client/pkg/serving/v1alpha1" + + "github.com/knative/pkg/apis" + "github.com/knative/pkg/apis/duck/v1beta1" + "github.com/knative/serving/pkg/apis/serving/v1alpha1" - "github.com/knative/client/pkg/kn/commands" "github.com/spf13/cobra" - "k8s.io/cli-runtime/pkg/genericclioptions" + corev1 "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/util/duration" + + "github.com/knative/client/pkg/kn/commands" ) +// Command for printing out a description of a service, meant to be consumed by humans +// It will show information about the serivce itself, but also a summary +// about the associated revisions. + +// Whether to print extended information +var printDetails bool + +// Max length When to truncate long strings (when not "all" mode switched on) +var truncateAt = 100 + +// View object for collecting revision related information in the context +// of a Service +type revisionDesc struct { + name string + configuration string + configurationGeneration int + creationTimestamp time.Time + + percent int + latest *bool + + logUrl string + timeoutSeconds *int64 + + image string + imageDigest string + env []string + port *int32 + + // concurrency options + maxScale *int + minScale *int + concurrencyTarget *int + concurrencyLimit *int64 +} + +// [REMOVE COMMENT WHEN MOVING TO 0.7.0] +// For transition to v1beta1 this command uses the migration approach as described +// in https://docs.google.com/presentation/d/1mOhnhy8kA4-K9Necct-NeIwysxze_FUule-8u5ZHmwA/edit#slide=id.p +// With serving 0.6.0 we are at step #1 +// I.e we first look at new fields of the v1alpha1 API before falling back to the original ones. +// As this command does not do any writes/updates, it's just a matter of fallbacks. +// [/REMOVE COMMENT WHEN MOVING TO 0.7.0] + +// Return a new command for describing a service. func NewServiceDescribeCommand(p *commands.KnParams) *cobra.Command { - serviceDescribePrintFlags := genericclioptions.NewPrintFlags("").WithDefaultOutput("yaml") - serviceDescribeCommand := &cobra.Command{ + command := &cobra.Command{ Use: "describe NAME", - Short: "Describe available services.", + Short: "Show details for a given service", RunE: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { - return errors.New("requires the service name.") + return errors.New("no service name provided") + } + if len(args) > 1 { + return errors.New("more than one service name provided") } + serviceName := args[0] + namespace, err := p.GetNamespace(cmd) if err != nil { return err @@ -41,23 +110,461 @@ func NewServiceDescribeCommand(p *commands.KnParams) *cobra.Command { return err } - describeService, err := client.GetService(args[0]) + printDetails, err = cmd.Flags().GetBool("details") if err != nil { return err } - printer, err := serviceDescribePrintFlags.ToPrinter() + service, err := client.GetService(serviceName) if err != nil { return err } - err = printer.PrintObj(describeService, cmd.OutOrStdout()) + revisionDescs, err := getRevisionDescriptions(client, service, printDetails) + + return describe(cmd.OutOrStdout(), service, revisionDescs) + }, + } + flags := command.Flags() + commands.AddNamespaceFlags(flags, false) + flags.BoolP("details", "d", false, "Show all details.") + return command +} + +// Main action describing the service +func describe(w io.Writer, service *v1alpha1.Service, revisions []*revisionDesc) error { + dw := printers.NewPrefixWriter(w) + + // Service info + writeService(dw, service) + dw.WriteLine() + if err := dw.Flush(); err != nil { + return err + } + + // Revisions summary info + writeRevisions(dw, revisions) + dw.WriteLine() + if err := dw.Flush(); err != nil { + return err + } + + // Condition info + writeConditions(dw, service) + if err := dw.Flush(); err != nil { + return err + } + + return nil +} + +// Write out main service information. Use colors for major items. +func writeService(dw printers.PrefixWriter, service *v1alpha1.Service) { + dw.WriteColsLn(printers.LEVEL_0, l("Name"), service.Name) + dw.WriteColsLn(printers.LEVEL_0, l("Namespace"), service.Namespace) + dw.WriteColsLn(printers.LEVEL_0, l("URL"), extractURL(service)) + if service.Status.Address != nil { + url := service.Status.Address.GetURL() + dw.WriteColsLn(printers.LEVEL_0, l("Address"), url.String()) + } + writeMapDesc(dw, printers.LEVEL_0, service.Labels, l("Labels"), "") + writeMapDesc(dw, printers.LEVEL_0, service.Annotations, l("Annotations"), "") + dw.WriteColsLn(printers.LEVEL_0, l("Age"), age(service.CreationTimestamp.Time)) +} + +// Write out revisions associated with this service. By default only active +// target revisions are printed, but with --all also inactive revisions +// created by this services are shown +func writeRevisions(dw printers.PrefixWriter, revisions []*revisionDesc) { + dw.WriteColsLn(printers.LEVEL_0, l("Revisions")) + for _, revisionDesc := range revisions { + dw.WriteColsLn(printers.LEVEL_1, formatPercentage(revisionDesc.percent), l("Name"), getRevisionNameWithGenerationAndAge(revisionDesc)) + dw.WriteColsLn(printers.LEVEL_1, "", l("Image"), getImageDesc(revisionDesc)) + if revisionDesc.port != nil { + dw.WriteColsLn(printers.LEVEL_1, "", l("Port"), strconv.FormatInt(int64(*revisionDesc.port), 10)) + } + writeSliceDesc(dw, printers.LEVEL_1, revisionDesc.env, l("Env"), "\t") + + // Scale spec if given + if revisionDesc.maxScale != nil || revisionDesc.minScale != nil { + dw.WriteColsLn(printers.LEVEL_1, "", l("Scale"), formatScale(revisionDesc.minScale, revisionDesc.maxScale)) + } + + // Concurrency specs if given + if revisionDesc.concurrencyLimit != nil || revisionDesc.concurrencyTarget != nil { + dw.WriteColsLn(printers.LEVEL_1, "", l("Concurrency")) + if revisionDesc.concurrencyLimit != nil { + dw.WriteColsLn(printers.LEVEL_2, "", "", l("Limit"), strconv.FormatInt(*revisionDesc.concurrencyLimit, 10)) + } + if revisionDesc.concurrencyTarget != nil { + dw.WriteColsLn(printers.LEVEL_2, "", "", l("Target"), strconv.Itoa(*revisionDesc.concurrencyTarget)) + } + } + } +} + +func formatScale(minScale *int, maxScale *int) string { + ret := "0" + if minScale != nil { + ret = strconv.Itoa(*minScale) + } + + ret += " ... " + + if maxScale != nil { + ret += strconv.Itoa(*maxScale) + } else { + ret += "∞" + } + + return ret +} + +// Print out a table with conditions. Use green for 'ok', and red for 'nok' if color is enabled +func writeConditions(dw printers.PrefixWriter, service *v1alpha1.Service) { + dw.WriteColsLn(printers.LEVEL_0, l("Conditions")) + maxLen := getMaxTypeLen(service.Status.Conditions) + formatHeader := "%-2s %-" + strconv.Itoa(maxLen) + "s %6s %-s\n" + formatRow := "%-2s %-" + strconv.Itoa(maxLen) + "s %6s %-s\n" + dw.Write(printers.LEVEL_1, formatHeader, "OK", "TYPE", "AGE", "REASON") + for _, condition := range service.Status.Conditions { + ok := formatStatus(condition.Status) + reason := condition.Reason + if printDetails && reason != "" { + reason = fmt.Sprintf("%s (%s)", reason, condition.Message) + } + dw.Write(printers.LEVEL_1, formatRow, ok, formatConditionType(condition), age(condition.LastTransitionTime.Inner.Time), reason) + } +} + +// ====================================================================================== +// Helper functions + +// Format label depending whether color mode is on or not +func l(label string) string { + return label + ":" +} + +// ====================================================================================== + +// Format the revision name along with its generation. Use colors if enabled. +func getRevisionNameWithGenerationAndAge(desc *revisionDesc) string { + return desc.name + " " + + "[" + strconv.Itoa(desc.configurationGeneration) + "]" + + " " + + "(" + age(desc.creationTimestamp) + ")" +} + +// Used for conditions table to do own formatting for the table, +// as the tabbed writer doesn't work nicely with colors +func getMaxTypeLen(conditions v1beta1.Conditions) int { + max := 0 + for _, condition := range conditions { + if len(condition.Type) > max { + max = len(condition.Type) + } + } + return max +} + +// Color the type of the conditions +func formatConditionType(condition apis.Condition) string { + return string(condition.Type) +} + +// Status in ASCII format +func formatStatus(status corev1.ConditionStatus) string { + switch status { + case v1.ConditionTrue: + return "++" + case v1.ConditionFalse: + return "--" + default: + return "" + } +} + +// Return either image name with tag or together with its resolved digest +func getImageDesc(desc *revisionDesc) string { + image := desc.image + if printDetails && desc.imageDigest != "" { + digest := "(" + shortenDigest(desc.imageDigest) + ")" + return fmt.Sprintf("%s %s", image, digest) + } + return image +} + +// Extract pure sha sum and shorten to 8 digits, +// as the digest should to be user consumable. Use the resource via `kn service get` +// to get to the full sha +func shortenDigest(digest string) string { + digestRegexp := regexp.MustCompile(`(?i)sha256:([0-9a-f]+)`) + match := digestRegexp.FindStringSubmatch(digest) + if len(match) > 1 { + return string(match[1][:12]) + } + return digest +} + +// Write a map either compact in a single line (possibly truncated) or, if printDetails is set, +// over multiple line, one line per key-value pair +func writeMapDesc(dw printers.PrefixWriter, indent int, m map[string]string, label string, labelPrefix string) { + if len(m) == 0 { + return + } + + if printDetails { + l := labelPrefix + label + for key, value := range m { + dw.WriteColsLn(indent, l, key+"="+value) + l = labelPrefix + } + return + } + + dw.WriteColsLn(indent, label, joinAndTruncate(m)) +} + +// Writer a slice compact (printDetails == false) in one line, or over multiple line +// with key-value line-by-line (printDetails == true) +func writeSliceDesc(dw printers.PrefixWriter, indent int, s []string, label string, labelPrefix string) { + + if len(s) == 0 { + return + } + + if printDetails { + l := labelPrefix + label + for _, value := range s { + dw.WriteColsLn(indent, l, value) + l = labelPrefix + } + return + } + + joined := strings.Join(s, ", ") + if len(joined) > truncateAt { + joined = joined[:truncateAt-4] + " ..." + } + dw.WriteColsLn(indent, labelPrefix+label, joined) +} + +// Join to key=value pair, comma separated, and truncate if longer than a limit +func joinAndTruncate(m map[string]string) string { + ret := "" + for key, value := range m { + ret += fmt.Sprintf("%s=%s, ", key, value) + if len(ret) > truncateAt { + break + } + } + // cut of two latest chars + ret = strings.TrimRight(ret, ", ") + if len(ret) <= truncateAt { + return ret + } + return string(ret[:truncateAt-4]) + " ..." +} + +// Format target percentage that it fits in the revision table +func formatPercentage(percentage int) string { + if percentage == 0 { + return " -" + } + return fmt.Sprintf("%-3d%%", percentage) +} + +func age(t time.Time) string { + if t.IsZero() { + return "" + } + return duration.ShortHumanDuration(time.Now().Sub(t)) +} + +// Call the backend to query revisions for the given service and build up +// the view objects used for output +func getRevisionDescriptions(client serving_kn_v1alpha1.KnClient, service *v1alpha1.Service, withDetails bool) ([]*revisionDesc, error) { + revisionDescs := make(map[string]*revisionDesc) + + trafficTargets := service.Status.Traffic + + for _, target := range trafficTargets { + revision, err := extractRevisionFromTarget(client, target) + if err != nil { + return nil, fmt.Errorf("cannot extract revision from service %s: %v", service.Name, err) + } + revisionDescs[revision.Name], err = newRevisionDesc(revision, &target) + if err != nil { + return nil, err + } + } + if withDetails { + if err := completeWithUntargetedRevisions(client, service, revisionDescs); err != nil { + return nil, err + } + } + return orderByConfigurationGeneration(revisionDescs), nil +} + +// Order the list of revisions so that the newest revisions are at the top +func orderByConfigurationGeneration(descs map[string]*revisionDesc) []*revisionDesc { + descsList := make([]*revisionDesc, len(descs)) + idx := 0 + for _, desc := range descs { + descsList[idx] = desc + idx++ + } + sort.SliceStable(descsList, func(i, j int) bool { + return descsList[i].configurationGeneration > descsList[j].configurationGeneration + }) + return descsList +} + +func completeWithUntargetedRevisions(client serving_kn_v1alpha1.KnClient, service *v1alpha1.Service, descs map[string]*revisionDesc) error { + revisions, err := client.ListRevisions(serving_kn_v1alpha1.WithService(service.Name)) + if err != nil { + return err + } + for _, revision := range revisions.Items { + if _, ok := descs[revision.Name]; !ok { + descs[revision.Name], err = newRevisionDesc(&revision, nil) if err != nil { return err } - return nil - }, + } + } + return nil +} + +func newRevisionDesc(revision *v1alpha1.Revision, target *v1alpha1.TrafficTarget) (*revisionDesc, error) { + container := extractContainer(revision) + generation, err := strconv.ParseInt(revision.Labels[serving.ConfigurationGenerationLabelKey], 0, 0) + if err != nil { + return nil, fmt.Errorf("cannot extract configuration generation for revision %s: %v", revision.Name, err) + } + revisionDesc := revisionDesc{ + name: revision.Name, + logUrl: revision.Status.LogURL, + timeoutSeconds: revision.Spec.TimeoutSeconds, + imageDigest: revision.Status.ImageDigest, + creationTimestamp: revision.CreationTimestamp.Time, + + configurationGeneration: int(generation), + configuration: revision.Labels["serving.knative.dev/configuration"], + } + + addTargetInfo(&revisionDesc, target) + addContainerInfo(&revisionDesc, container) + err = addConcurrencyAndScaleInfo(&revisionDesc, revision) + if err != nil { + return nil, err + } + return &revisionDesc, nil +} + +func addTargetInfo(desc *revisionDesc, target *v1alpha1.TrafficTarget) { + if target != nil { + desc.percent = target.Percent + desc.latest = target.LatestRevision + } +} + +func addContainerInfo(desc *revisionDesc, container *v1.Container) { + addImage(desc, container) + addEnv(desc, container) + addPort(desc, container) +} + +func addConcurrencyAndScaleInfo(desc *revisionDesc, revision *v1alpha1.Revision) error { + min, err := annotationAsInt(revision, autoscaling.MinScaleAnnotationKey) + if err != nil { + return err + } + desc.minScale = min + + max, err := annotationAsInt(revision, autoscaling.MaxScaleAnnotationKey) + if err != nil { + return err + } + desc.maxScale = max + + target, err := annotationAsInt(revision, autoscaling.TargetAnnotationKey) + if err != nil { + return err + } + desc.concurrencyTarget = target + + if revision.Spec.ContainerConcurrency != 0 { + limit := int64(revision.Spec.ContainerConcurrency) + desc.concurrencyLimit = &limit + } + + return nil +} + +func annotationAsInt(revision *v1alpha1.Revision, annotationKey string) (*int, error) { + annos := revision.Annotations + if val, ok := annos[annotationKey]; ok { + valInt, err := strconv.Atoi(val) + if err != nil { + return nil, err + } + return &valInt, nil + } + return nil, nil +} + +func addEnv(desc *revisionDesc, container *v1.Container) { + envVars := make([]string, 0, len(container.Env)) + for _, env := range container.Env { + var value string + if env.ValueFrom != nil { + value = "[ref]" + } else { + value = env.Value + } + envVars = append(envVars, fmt.Sprintf("%s=%s", env.Name, value)) + } + desc.env = envVars +} + +func addPort(desc *revisionDesc, container *v1.Container) { + if len(container.Ports) > 0 { + port := container.Ports[0].ContainerPort + desc.port = &port + } +} + +func addImage(desc *revisionDesc, container *v1.Container) { + desc.image = container.Image +} + +func extractContainer(revision *v1alpha1.Revision) *v1.Container { + if revision.Spec.Containers != nil && len(revision.Spec.Containers) > 0 { + return &revision.Spec.Containers[0] + } + return revision.Spec.DeprecatedContainer +} + +func extractRevisionFromTarget(client serving_kn_v1alpha1.KnClient, target v1alpha1.TrafficTarget) (*v1alpha1.Revision, error) { + var revisionName = target.RevisionName + if revisionName == "" { + configurationName := target.ConfigurationName + if configurationName == "" { + return nil, fmt.Errorf("neither RevisionName nor ConfigurationName set") + } + configuration, err := client.GetConfiguration(configurationName) + if err != nil { + return nil, err + } + revisionName = configuration.Status.LatestCreatedRevisionName + } + return client.GetRevision(revisionName) +} + +func extractURL(service *v1alpha1.Service) string { + status := service.Status + if status.URL != nil { + return status.URL.String() } - commands.AddNamespaceFlags(serviceDescribeCommand.Flags(), false) - serviceDescribePrintFlags.AddFlags(serviceDescribeCommand) - return serviceDescribeCommand + return status.DeprecatedDomain } diff --git a/pkg/kn/commands/service/service_describe_test.go b/pkg/kn/commands/service/service_describe_test.go index a80b139a49..326eb2c0d5 100644 --- a/pkg/kn/commands/service/service_describe_test.go +++ b/pkg/kn/commands/service/service_describe_test.go @@ -15,23 +15,24 @@ package service import ( - "encoding/json" + "regexp" + "strings" "testing" - "github.com/knative/client/pkg/kn/commands" + duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1" "github.com/knative/serving/pkg/apis/serving/v1alpha1" - "k8s.io/apimachinery/pkg/api/equality" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - client_testing "k8s.io/client-go/testing" - "sigs.k8s.io/yaml" + clienttesting "k8s.io/client-go/testing" + + "github.com/knative/client/pkg/kn/commands" ) -func fakeServiceDescribe(args []string, response *v1alpha1.Service) (action client_testing.Action, output string, err error) { +func fakeServiceDescribe(args []string, response *v1alpha1.Service) (action clienttesting.Action, output string, err error) { knParams := &commands.KnParams{} cmd, fakeServing, buf := commands.CreateTestKnCommand(NewServiceCommand(knParams), knParams) fakeServing.AddReactor("*", "*", - func(a client_testing.Action) (bool, runtime.Object, error) { + func(a clienttesting.Action) (bool, runtime.Object, error) { action = a return true, response, nil }) @@ -46,9 +47,11 @@ func fakeServiceDescribe(args []string, response *v1alpha1.Service) (action clie func TestEmptyServiceDescribe(t *testing.T) { _, _, err := fakeServiceDescribe([]string{"service", "describe"}, &v1alpha1.Service{}) - expectedError := "requires the service name." - if err == nil || err.Error() != expectedError { - t.Fatal("expect to fail with missing service name") + if err == nil || + !strings.Contains(err.Error(), "no") || + !strings.Contains(err.Error(), "service") || + !strings.Contains(err.Error(), "provided") { + t.Fatalf("expect to fail with missing service name (got: %v)", err) } } @@ -62,6 +65,12 @@ func TestServiceDescribeDefaultOutput(t *testing.T) { Name: "foo", Namespace: "default", }, + Status: v1alpha1.ServiceStatus{ + RouteStatusFields: v1alpha1.RouteStatusFields{ + DeprecatedDomain: "foo.default.example.com", + Address: &duckv1alpha1.Addressable{Hostname: "foo.default.svc.cluster.local"}, + }, + }, } action, output, err := fakeServiceDescribe([]string{"service", "describe", "test-foo"}, &expectedService) if err != nil { @@ -73,17 +82,19 @@ func TestServiceDescribeDefaultOutput(t *testing.T) { t.Fatalf("Bad action %v", action) } - jsonData, err := yaml.YAMLToJSON([]byte(output)) - if err != nil { - t.Fatal(err) - } - var returnedService v1alpha1.Service - err = json.Unmarshal(jsonData, &returnedService) + assertMatches(t, output, "Name:\\s+foo") + assertMatches(t, output, "Namespace:\\s+default") + assertMatches(t, output, "Address:\\s+http://foo.default.svc.cluster.local") + assertMatches(t, output, "URL:\\s+foo.default.example.com") + assertMatches(t, output, "Age:") +} + +func assertMatches(t *testing.T, value, expr string) { + ok, err := regexp.MatchString(expr, value) if err != nil { - t.Fatal(err) + t.Fatalf("invalid pattern %q. %v", expr, err) } - - if !equality.Semantic.DeepEqual(expectedService, returnedService) { - t.Fatal("mismatched objects") + if !ok { + t.Errorf("got %s which does not match %s\n", value, expr) } } diff --git a/pkg/printers/prefixwriter.go b/pkg/printers/prefixwriter.go new file mode 100644 index 0000000000..a9b06b9b97 --- /dev/null +++ b/pkg/printers/prefixwriter.go @@ -0,0 +1,100 @@ +// Copyright © 2019 The Knative Authors +// +// 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 printers + +import ( + "fmt" + "io" + "strings" + "text/tabwriter" +) + +type flusher interface { + Flush() error +} + +// NewPrefixWriter creates a new PrefixWriter. +func NewPrefixWriter(out io.Writer) PrefixWriter { + tabWriter := tabwriter.NewWriter(out, 0, 8, 2, ' ', 0) + return &prefixWriter{out: tabWriter} +} + +// PrefixWriter can write text at various indentation levels. +type PrefixWriter interface { + // Write writes text with the specified indentation level. + Write(level int, format string, a ...interface{}) + // WriteLine writes an entire line with no indentation level. + WriteLine(a ...interface{}) + // Write columns with an initial indentation + WriteCols(level int, cols ...string) + // Write columns with an initial indentation and a newline at the end + WriteColsLn(level int, cols ...string) + // Flush forces indentation to be reset. + Flush() error +} + +// prefixWriter implements PrefixWriter +type prefixWriter struct { + out io.Writer +} + +var _ PrefixWriter = &prefixWriter{} + +// Each level has 2 spaces for PrefixWriter +const ( + LEVEL_0 = iota + LEVEL_1 + LEVEL_2 + LEVEL_3 +) + +func (pw *prefixWriter) Write(level int, format string, a ...interface{}) { + levelSpace := " " + prefix := "" + for i := 0; i < level; i++ { + prefix += levelSpace + } + fmt.Fprintf(pw.out, prefix+format, a...) +} + +func (pw *prefixWriter) WriteCols(level int, cols ...string) { + ss := make([]string, len(cols)) + for i := range cols { + ss[i] = "%s" + } + format := strings.Join(ss, "\t") + s := make([]interface{}, len(cols)) + for i, v := range cols { + s[i] = v + } + + pw.Write(level, format, s...) +} + +func (pw *prefixWriter) WriteColsLn(level int, cols ...string) { + pw.WriteCols(level, cols...) + pw.WriteLine() +} + +func (pw *prefixWriter) WriteLine(a ...interface{}) { + fmt.Fprintln(pw.out, a...) +} + +func (pw *prefixWriter) Flush() error { + if f, ok := pw.out.(flusher); ok { + return f.Flush() + } + return fmt.Errorf("output stream %v doesn't support Flush", pw.out) +} diff --git a/pkg/printers/tableprinter.go b/pkg/printers/tableprinter.go index ff49ed52b7..0f3c18d6cc 100644 --- a/pkg/printers/tableprinter.go +++ b/pkg/printers/tableprinter.go @@ -43,7 +43,7 @@ func NewTablePrinter(options PrintOptions) *HumanReadablePrinter { func (h *HumanReadablePrinter) PrintObj(obj runtime.Object, output io.Writer) error { w, found := output.(*tabwriter.Writer) if !found { - w = GetNewTabWriter(output) + w = NewTabWriter(output) output = w defer w.Flush() } diff --git a/pkg/printers/tabwriter.go b/pkg/printers/tabwriter.go index 717e5e6e1b..c29efe4837 100644 --- a/pkg/printers/tabwriter.go +++ b/pkg/printers/tabwriter.go @@ -30,7 +30,7 @@ const ( tabwriterFlags = tabwriter.TabIndent ) -// GetNewTabWriter returns a tabwriter that translates tabbed columns in input into properly aligned text. -func GetNewTabWriter(output io.Writer) *tabwriter.Writer { +// NewTabWriter returns a tabwriter that translates tabbed columns in input into properly aligned text. +func NewTabWriter(output io.Writer) *tabwriter.Writer { return tabwriter.NewWriter(output, tabwriterMinWidth, tabwriterWidth, tabwriterPadding, tabwriterPadChar, tabwriterFlags) } diff --git a/pkg/serving/v1alpha1/client.go b/pkg/serving/v1alpha1/client.go index 5e12ee9197..cc3b5d53b0 100644 --- a/pkg/serving/v1alpha1/client.go +++ b/pkg/serving/v1alpha1/client.go @@ -54,6 +54,9 @@ type KnClient interface { // Wait for a service to become ready, but not longer than provided timeout WaitForService(name string, timeout time.Duration) error + // Get a configuration by name + GetConfiguration(name string) (*v1alpha1.Configuration, error) + // Get a revision by name GetRevision(name string) (*v1alpha1.Revision, error) @@ -195,6 +198,19 @@ func (cl *knClient) WaitForService(name string, timeout time.Duration) error { return waitForReady.Wait(name, timeout) } +// Get the configuration for a service +func (cl *knClient) GetConfiguration(name string) (*v1alpha1.Configuration, error) { + configuration, err := cl.client.Configurations(cl.namespace).Get(name, v1.GetOptions{}) + if err != nil { + return nil, err + } + err = updateServingGvk(configuration) + if err != nil { + return nil, err + } + return configuration, nil +} + // Get a revision by name func (cl *knClient) GetRevision(name string) (*v1alpha1.Revision, error) { revision, err := cl.client.Revisions(cl.namespace).Get(name, v1.GetOptions{}) diff --git a/test/e2e-smoke-tests.sh b/test/e2e-smoke-tests.sh index 457643dacf..1f87e85d48 100755 --- a/test/e2e-smoke-tests.sh +++ b/test/e2e-smoke-tests.sh @@ -56,8 +56,8 @@ kubectl create ns $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test ./kn service create foo --force --image gcr.io/knative-samples/helloworld-go -e TARGET=foo -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test ./kn revision list -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test ./kn service list -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test -./kn service describe hello -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test -./kn service describe svc1 -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test +./kn service show hello -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test +./kn service show svc1 -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test ./kn route list -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test ./kn service delete hello -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test ./kn service delete foo -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test diff --git a/test/e2e/basic_workflow_test.go b/test/e2e/basic_workflow_test.go index a4337a7f5e..3bf8b24367 100644 --- a/test/e2e/basic_workflow_test.go +++ b/test/e2e/basic_workflow_test.go @@ -94,17 +94,12 @@ func (test *e2eTest) serviceList(t *testing.T, serviceName string) { } func (test *e2eTest) serviceDescribe(t *testing.T, serviceName string) { - out, err := test.kn.RunWithOpts([]string{"service", "describe", serviceName}, runOpts{NoNamespace: false}) + out, err := test.kn.RunWithOpts([]string{"service", "show", serviceName}, runOpts{NoNamespace: false}) assert.NilError(t, err) - expectedOutputHeader := `apiVersion: serving.knative.dev/v1alpha1 -kind: Service -metadata:` - expectedOutput := `generation: 1 - name: %s - namespace: %s` - expectedOutput = fmt.Sprintf(expectedOutput, serviceName, test.kn.namespace) - assert.Check(t, util.ContainsAll(out, expectedOutputHeader, expectedOutput)) + assert.Assert(t, util.ContainsAll(out, serviceName, test.kn.namespace, KnDefaultTestImage)) + assert.Assert(t, util.ContainsAll(out, "Conditions", "ConfigurationsReady", "Ready", "RoutesReady")) + assert.Assert(t, util.ContainsAll(out, "Name", "Namespace", "URL", "Address", "Annotations", "Age", "Revisions")) } func (test *e2eTest) serviceUpdate(t *testing.T, serviceName string, args []string) { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index a07ee49ea3..4bb86aa0fe 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -994,6 +994,20 @@ func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) { return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq)) } +// SetsockoptSockFprog attaches a classic BPF or an extended BPF program to a +// socket to filter incoming packets. See 'man 7 socket' for usage information. +func SetsockoptSockFprog(fd, level, opt int, fprog *SockFprog) error { + return setsockopt(fd, level, opt, unsafe.Pointer(fprog), unsafe.Sizeof(*fprog)) +} + +func SetsockoptCanRawFilter(fd, level, opt int, filter []CanFilter) error { + var p unsafe.Pointer + if len(filter) > 0 { + p = unsafe.Pointer(&filter[0]) + } + return setsockopt(fd, level, opt, p, uintptr(len(filter)*SizeofCanFilter)) +} + // Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html) // KeyctlInt calls keyctl commands in which each argument is an int. diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index d262150cc0..3e9c18e681 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -405,6 +405,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -434,6 +439,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index e492caacda..14365ff6cf 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -406,6 +406,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -435,6 +440,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index ad4342156e..80ad473c61 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -409,6 +409,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -438,6 +443,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index ef76a362d9..20e78cc1f6 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -407,6 +407,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -436,6 +441,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index dbf05903d4..bdeb0cb24f 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -408,6 +408,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -437,6 +442,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index 1b7e670793..2d3f591129 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -407,6 +407,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -436,6 +441,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 57379005b5..5fb57ff2a3 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -407,6 +407,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -436,6 +441,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index 0e88bf47bc..b46b26f6ce 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -408,6 +408,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -437,6 +442,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index 5ac91b3f7a..e14e3c90ab 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -408,6 +408,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -437,6 +442,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index 1e59b45068..2332e8fd12 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -408,6 +408,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -437,6 +442,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index 508885f11f..efec4f8193 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -407,6 +407,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -436,6 +441,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index d315f2c3a7..71cc23f2e1 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -406,6 +406,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -435,6 +440,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index a1a9279c22..48805ba195 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -410,6 +410,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -439,6 +444,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go index 4f17a3331f..9f946da6fe 100644 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -149,7 +149,7 @@ const ( DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS = 0x22b DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS = 0x22c DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS = 0x22d - DOMAIN_ALIAS_RID_MONITORING_USERS = 0X22e + DOMAIN_ALIAS_RID_MONITORING_USERS = 0x22e DOMAIN_ALIAS_RID_LOGGING_USERS = 0x22f DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS = 0x230 DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS = 0x231 diff --git a/vendor/modules.txt b/vendor/modules.txt index 825e0803af..8481a2bbf0 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -133,7 +133,7 @@ golang.org/x/oauth2/google golang.org/x/oauth2/internal golang.org/x/oauth2/jws golang.org/x/oauth2/jwt -# golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a +# golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 golang.org/x/sys/unix golang.org/x/sys/windows # golang.org/x/text v0.3.0 From b549a3dc20bc817c081eec746758ea4478b8533e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Wed, 24 Jul 2019 16:18:08 +0200 Subject: [PATCH 02/17] chore: Cleanup up and refreshed dependencies --- go.mod | 13 +- go.sum | 245 +----------------- .../golang/protobuf/proto/properties.go | 5 +- vendor/github.com/json-iterator/go/adapter.go | 2 +- vendor/github.com/json-iterator/go/go.mod | 11 + vendor/github.com/json-iterator/go/go.sum | 14 + .../github.com/json-iterator/go/iter_skip.go | 25 +- .../json-iterator/go/reflect_native.go | 14 +- .../go/reflect_struct_decoder.go | 2 +- .../json-iterator/go/stream_float.go | 17 ++ vendor/golang.org/x/net/http2/transport.go | 2 +- vendor/golang.org/x/sys/unix/syscall_linux.go | 14 - .../golang.org/x/sys/unix/ztypes_linux_386.go | 6 - .../x/sys/unix/ztypes_linux_amd64.go | 6 - .../golang.org/x/sys/unix/ztypes_linux_arm.go | 6 - .../x/sys/unix/ztypes_linux_arm64.go | 6 - .../x/sys/unix/ztypes_linux_mips.go | 6 - .../x/sys/unix/ztypes_linux_mips64.go | 6 - .../x/sys/unix/ztypes_linux_mips64le.go | 6 - .../x/sys/unix/ztypes_linux_mipsle.go | 6 - .../x/sys/unix/ztypes_linux_ppc64.go | 6 - .../x/sys/unix/ztypes_linux_ppc64le.go | 6 - .../x/sys/unix/ztypes_linux_riscv64.go | 6 - .../x/sys/unix/ztypes_linux_s390x.go | 6 - .../x/sys/unix/ztypes_linux_sparc64.go | 6 - .../x/sys/windows/security_windows.go | 2 +- vendor/modules.txt | 12 +- 27 files changed, 91 insertions(+), 365 deletions(-) create mode 100644 vendor/github.com/json-iterator/go/go.mod create mode 100644 vendor/github.com/json-iterator/go/go.sum diff --git a/go.mod b/go.mod index fcd738d338..b70167a452 100644 --- a/go.mod +++ b/go.mod @@ -3,27 +3,24 @@ module github.com/knative/client require ( github.com/cpuguy83/go-md2man v1.0.10 // indirect github.com/evanphx/json-patch v4.5.0+incompatible // indirect - github.com/fatih/color v1.7.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/gogo/protobuf v1.2.1 // indirect github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect - github.com/golang/protobuf v1.3.1 // indirect + github.com/golang/protobuf v1.3.2 // indirect github.com/google/btree v1.0.0 // indirect github.com/google/go-cmp v0.3.0 // indirect - github.com/google/go-containerregistry v0.0.0-20190623150931-ca8b66cb1b79 // indirect - github.com/google/gofuzz v1.0.0 // indirect + github.com/google/go-containerregistry v0.0.0-20190723205234-74f764b9c575 // indirect github.com/googleapis/gnostic v0.3.0 // indirect github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect github.com/hashicorp/golang-lru v0.5.1 // indirect github.com/imdario/mergo v0.3.7 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/json-iterator/go v1.1.6 // indirect + github.com/json-iterator/go v1.1.7 // indirect github.com/knative/build v0.7.0 // indirect github.com/knative/pkg v0.0.0-20190617142447-13b093adc272 github.com/knative/serving v0.6.0 github.com/knative/test-infra v0.0.0-20190702025031-91d37e4abc30 // indirect github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a // indirect - github.com/mattn/go-colorable v0.1.2 // indirect github.com/mitchellh/go-homedir v1.1.0 github.com/modern-go/reflect2 v1.0.1 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect @@ -31,7 +28,7 @@ require ( github.com/spf13/cobra v0.0.3 github.com/spf13/pflag v1.0.3 github.com/spf13/viper v1.3.1 - golang.org/x/net v0.0.0-20190628185345-da137c7871d7 // indirect + golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 // indirect golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 // indirect golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect gopkg.in/inf.v0 v0.9.1 // indirect @@ -40,7 +37,7 @@ require ( k8s.io/apimachinery v0.0.0-20190221084156-01f179d85dbc k8s.io/cli-runtime v0.0.0-20190325194458-f2b4781c3ae1 k8s.io/client-go v0.0.0-20190226174127-78295b709ec6 - k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208 // indirect + k8s.io/kube-openapi v0.0.0-20190722073852-5e22f3d471e6 // indirect knative.dev/test-infra v0.0.0-20190730202142-17f2331e80ad sigs.k8s.io/yaml v1.1.0 ) diff --git a/go.sum b/go.sum index bc9918b004..73956d18e8 100644 --- a/go.sum +++ b/go.sum @@ -1,34 +1,9 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0 h1:eOI3/cP2VTU6uZLDYAoic+eyzzB9YyGmJ7eIjl8rOPg= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.37.4 h1:glPeL3BQJsbF6aIIYfZizMwc5LTYz250bDMjttbBGAU= -cloud.google.com/go v0.37.4/go.mod h1:NHPJ89PdicEuT9hdPXMROBD91xc5uRDxsMtSB16k7hw= -contrib.go.opencensus.io/exporter/ocagent v0.4.12 h1:jGFvw3l57ViIVEPKKEUXPcLYIXJmQxLUh6ey1eJhwyc= -contrib.go.opencensus.io/exporter/ocagent v0.4.12/go.mod h1:450APlNTSR6FrvC3CTRqYosuDstRB9un7SOx2k/9ckA= -contrib.go.opencensus.io/exporter/stackdriver v0.11.0 h1:PV4m31gF3xT3oFDou7SxUVver/jja9sJ20HeTIGR2nM= -contrib.go.opencensus.io/exporter/stackdriver v0.11.0/go.mod h1:hA7rlmtavV03FGxzWXAPBUnZeZBhWN/QYQAuMtxc9Bk= -contrib.go.opencensus.io/resource v0.0.0-20190131005048-21591786a5e0 h1:ICrSnXeuT4427bpR8X9I7GxiyT4X5qgLtFT7m1IjK2c= -contrib.go.opencensus.io/resource v0.0.0-20190131005048-21591786a5e0/go.mod h1:F361eGI91LCmW1I/Saf+rX0+OFcigGlFvXwEGEnkRLA= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= -github.com/PuerkitoBio/purell v1.0.0 h1:0GoNN3taZV6QI81IXgCbxMyEaJDXMSIjArYBCYzVVvs= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2 h1:JCHLVE3B+kJde7bIEo5N4J+ZbLhp0J1Fs+ulyRws4gE= github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/aws/aws-sdk-go v1.18.6 h1:NuUz/+bi6C5v3BpIXW/VfovfMpvlhl1WUnD0EiDkOwQ= -github.com/aws/aws-sdk-go v1.18.6/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/census-instrumentation/opencensus-proto v0.2.0 h1:LzQXZOgg4CQfE6bFvXGM30YZL1WW/M337pXml+GrcZ4= -github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -38,198 +13,98 @@ github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633 h1:H2pdYOb3KQ1/YsqVWoWNLQO+fusocsw354rqGTZtAgw= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= -github.com/evanphx/json-patch v4.1.0+incompatible h1:K1MDoo4AZ4wU0GIU/fPmtZg7VpzLjCxu+UwBD1FvwOc= -github.com/evanphx/json-patch v4.1.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch v4.2.0+incompatible h1:fUDGZCv/7iAN7u0puUVhvKCcsR6vRfwrJatElLBEf0I= -github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680 h1:ZktWZesgun21uEDrwW7iEV1zPCGQldM2atlJZ3TdvVM= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1 h1:wSt/4CYxs70xbATrGXhokKF1i0tZjENLOo1ioIO13zk= github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= -github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9 h1:tF+augKRWlWx0J0B7ZyyKSiTyV6E1zZe+7b3qQlcEf8= github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= -github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501 h1:C1JKChikHGpXwT5UQDFaryIpDtyyGL/CR6C2kB7F1oc= github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= -github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87 h1:zP3nY8Tk2E6RTkqGYrarZXuzh+ffyLDljLxCy1iJw80= github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0 h1:xU6/SpYbvkNYiptHJYEDRseDLvYE7wSqhYYNy0QSUzI= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef h1:veQD95Isof8w9/WXiA+pa3tz3fJXkt5B7QaRBrM62gk= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCydnIczKteheJEzHRToSGK3Bnlw= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-containerregistry v0.0.0-20190424210018-7d6d1d3cd63b h1:3KvxrcCoYX4wIZoeCMFfBPD840fopFkyjQeZDv5B+T8= -github.com/google/go-containerregistry v0.0.0-20190424210018-7d6d1d3cd63b/go.mod h1:yZAFP63pRshzrEYLXLGPmUt0Ay+2zdjmMN1loCnRLUk= -github.com/google/go-containerregistry v0.0.0-20190503220729-1c6c7f61e8a5 h1:wXZCVr9/0naJbZhAzKDzj/sgnduf8qn9ldjkI/CND9k= -github.com/google/go-containerregistry v0.0.0-20190503220729-1c6c7f61e8a5/go.mod h1:yZAFP63pRshzrEYLXLGPmUt0Ay+2zdjmMN1loCnRLUk= github.com/google/go-containerregistry v0.0.0-20190623150931-ca8b66cb1b79 h1:iObax0KHGJG3zG66UocaycSspWe9P7OT0SA9dL759sM= github.com/google/go-containerregistry v0.0.0-20190623150931-ca8b66cb1b79/go.mod h1:yZAFP63pRshzrEYLXLGPmUt0Ay+2zdjmMN1loCnRLUk= +github.com/google/go-containerregistry v0.0.0-20190723205234-74f764b9c575 h1:ftd0T3Vm1eHYBeX57PFeXjoLaIHsTZj9qCF4gOHF4pA= +github.com/google/go-containerregistry v0.0.0-20190723205234-74f764b9c575/go.mod h1:yZAFP63pRshzrEYLXLGPmUt0Ay+2zdjmMN1loCnRLUk= github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/licenseclassifier v0.0.0-20190501212618-47b603fe1b8c h1:UmyQvw1iOARMPiuZDuH5T/kkKgdQth4da/uHxNVKK2M= -github.com/google/licenseclassifier v0.0.0-20190501212618-47b603fe1b8c/go.mod h1:qsqn2hxC+vURpyBRygGUuinTO42MFRLcsmQ/P8v94+M= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/googleapis/gax-go/v2 v2.0.4 h1:hU4mGcQI4DaAYW+IbTun+2qEZVFxK0ySjQLTbS0VQKc= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gnostic v0.0.0-20170426233943-68f4ded48ba9/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= -github.com/googleapis/gnostic v0.2.0 h1:l6N3VoaVzTncYYW+9yOz2LJJammFZGBO13sqgEhpy9g= -github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= +github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.3.0 h1:CcQijm0XKekKjP/YCz28LXVSpgguuB+nCxaSjCe09y0= github.com/googleapis/gnostic v0.3.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc h1:f8eY6cV/x1x+HLjOp4r72s/31/V2aTUtg5oKRRPf8/Q= -github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 h1:+ngKgrYPPJrOjhax5N+uePQ0Fh1Z7PheYoUI/0nzkPA= github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/grpc-gateway v1.8.5 h1:2+KSC78XiO6Qy0hIjfc1OD9H+hsaJdJlb8Kqsd41CTE= -github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/imdario/mergo v0.3.7 h1:Y+UAYTZ7gDEuOfhxKWy+dvb5dRQ6rJjFSdX2HZY1/gI= github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024 h1:rBMNdlhTLzJjJSDIjNEXX1Pz3Hmwmz91v+zycvx9PJc= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/knative/build v0.5.0 h1:q2W4+BmT3jEOSOXZ44UXndJUAHLWUd20QtMQAFGWzsU= -github.com/knative/build v0.5.0/go.mod h1:/sU74ZQkwlYA5FwYDJhYTy61i/Kn+5eWfln2jDbw3Qo= -github.com/knative/build v0.6.0 h1:tAhqGbRL3/wFOfEc4srO8XDNV8DxUE+z6TzKW0JPWsE= -github.com/knative/build v0.6.0/go.mod h1:/sU74ZQkwlYA5FwYDJhYTy61i/Kn+5eWfln2jDbw3Qo= github.com/knative/build v0.7.0 h1:YqqiShED6wILhPRZyUJjTX2B6OgbgEqWe1WNrAcDclw= github.com/knative/build v0.7.0/go.mod h1:/sU74ZQkwlYA5FwYDJhYTy61i/Kn+5eWfln2jDbw3Qo= -github.com/knative/pkg v0.0.0-20190329155329-916205998db9 h1:DnGe2nwEq+ibifGZt4HoD4akmX1K9Tcx3CjNwFpSZow= -github.com/knative/pkg v0.0.0-20190329155329-916205998db9/go.mod h1:7Ijfhw7rfB+H9VtosIsDYvZQ+qYTz7auK3fHW/5z4ww= -github.com/knative/pkg v0.0.0-20190518173526-34792a92cec2 h1:OA4f02os85BMZbC6DxNL5gbGHRxPgjQW+IDENES7QFc= -github.com/knative/pkg v0.0.0-20190518173526-34792a92cec2/go.mod h1:7Ijfhw7rfB+H9VtosIsDYvZQ+qYTz7auK3fHW/5z4ww= github.com/knative/pkg v0.0.0-20190617142447-13b093adc272 h1:8reWGJv6V0UUy8XFclP1uHEypLKPGvN9wEk4uhQVGAg= github.com/knative/pkg v0.0.0-20190617142447-13b093adc272/go.mod h1:7Ijfhw7rfB+H9VtosIsDYvZQ+qYTz7auK3fHW/5z4ww= -github.com/knative/serving v0.5.2 h1:jsmeIN7B6oDHrK0jmtFRf7hWWr+KrjXVHuArK8jo5Nw= -github.com/knative/serving v0.5.2/go.mod h1:ljvMfwQy2qanaM/8xnBSK4Mz3Vv2NawC2fo5kFRJS1A= github.com/knative/serving v0.6.0 h1:2SOr1jAvrUPO1y0mJvpiTe3bJTSMd2tKXflmHCM0MAA= github.com/knative/serving v0.6.0/go.mod h1:ljvMfwQy2qanaM/8xnBSK4Mz3Vv2NawC2fo5kFRJS1A= github.com/knative/test-infra v0.0.0-20190702025031-91d37e4abc30/go.mod h1:l77IWBscEV5T4sYb64/9iwRCVY4UXEIqMcAppsblHW4= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a h1:TpvdAwDAt1K4ANVOfcihouRdvP+MgAfDWwBuct4l6ZY= github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a h1:+J2gw7Bw77w/fbK7wnNJJDKmw1IbWft2Ul5BzrG1Qm8= github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a/go.mod h1:M1qoD/MqPgTZIk0EWKB38wE28ACRfVcn+cU08jyArI0= -github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c h1:Hww8mOyEKTeON4bZn7FrlLismspbPc1teNRUVH7wLQ8= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c h1:eSfnfIuwhxZyULg1NNuZycJcYkjYVGYe7FczwQReM6U= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829 h1:D+CiwcpGTW6pL6bv6KI3KbyEyCKyS+1JWS2h8PNDnGA= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f h1:BVwpUVJDADN2ufcGik7W992pyps0wZ888b/y9GXcLTU= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/common v0.2.0 h1:kUZDBDTdBVBYBj5Tmh2NZLlF60mfjA27rM34b+cVwNU= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1 h1:/K3IL0Z1quvmJ7X0A1AwNEK7CRkVK3YwfOU/QAL4WGg= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= @@ -244,80 +119,26 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/viper v1.3.1 h1:5+8j8FTpnFV4nEImW/ofkzEt8VoOiLXxdYIDsB73T38= github.com/spf13/viper v1.3.1/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.20.2 h1:NAfh7zF0/3/HqtMvJNZ/RFrSlCE6ZTlHmKfhL/Dm1Jk= -go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.21.0 h1:mU6zScU4U1YAFPHEHYk+3JC4SY7JxgkqS10ZOSyksNg= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 h1:mKdxBk7AujPs8kU4m80U72y/zjbZ3UcXC7dClwKbUI0= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6 h1:FP8hkuE6yUEaJnK7O2eTuejKWwW+Rhfj80dQ2JcKxCU= -golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190514140710-3ec191127204 h1:4yG6GqBtw9C+UrLp6s2wtSniayy/Vd/3F7ffLE427XI= -golang.org/x/net v0.0.0-20190514140710-3ec191127204/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190319182350-c85d3e98c914/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a h1:tImsplftrFpALCYumobsd0K86vlAs/eXGFms2txfJfA= -golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190517181255-950ef44c6e07 h1:XC1K3wNjuz44KaI+cj85C9TW85w/46RH7J+DTXNH5Wk= -golang.org/x/oauth2 v0.0.0-20190517181255-950ef44c6e07/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 h1:Ao/3l156eZf2AW5wK8a7/smtodRU+gha3+BeqJ69lRk= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 h1:bjcUS9ztw9kFmmIxJInhon/0Is3p+EHBKNgquIzo1OI= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a h1:1n5lsVfiQW3yfsRGu98756EH1YthsFqr/5mxHduZW2A= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= @@ -327,74 +148,30 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c h1:fqgJT0MGcGpPgpWU7VRdRjuArfcOvC4AoJmILihzhDg= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09 h1:6Cq5LXQ/D2J5E7sYJemWSQApczOzY1rxSp8TWloyxIY= golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190613204242-ed0dc450797f h1:+zypR5600WBcnJgA2nzZAsBlM8cArEGa8dhhiNE4u3w= -golang.org/x/tools v0.0.0-20190613204242-ed0dc450797f/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628034336-212fb13d595e h1:ZlQjfVdpDxeqxRfmO30CdqWWzTvgRCj0MxaUVfxEG1k= -golang.org/x/tools v0.0.0-20190628034336-212fb13d595e/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= -google.golang.org/api v0.3.2 h1:iTp+3yyl/KOtxa/d1/JUE0GGSoR6FuW5udver22iwpw= -google.golang.org/api v0.3.2/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107 h1:xtNn7qFlagY2mQNFHMSRPjT2RkOV4OXM7P5TVy9xATo= -google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.19.1 h1:TrBcJ1yqAl1G++wO39nD/qtgpsW9/1+QGrluyMGEYgM= -google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= k8s.io/api v0.0.0-20190226173710-145d52631d00 h1:xYfyMq0qxTGAg3O9GK23GMbNrBcpnFg9IeA6isDgIXk= k8s.io/api v0.0.0-20190226173710-145d52631d00/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA= k8s.io/apimachinery v0.0.0-20190221084156-01f179d85dbc h1:7z9/6jKWBqkK9GI1RRB0B5fZcmkatLQ/nv8kysch24o= k8s.io/apimachinery v0.0.0-20190221084156-01f179d85dbc/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0= -k8s.io/cli-runtime v0.0.0-20190226180714-082c0831af2b h1:AkeqbZbtHxFlkmXpAf/1DOyl3JLTn25RZxiFcI9QJys= -k8s.io/cli-runtime v0.0.0-20190226180714-082c0831af2b/go.mod h1:qWnH3/b8sp/l7EvlDh7ulDU3UWA4P4N1NFbEEP791tM= k8s.io/cli-runtime v0.0.0-20190325194458-f2b4781c3ae1 h1:yIrGaL3GC1eoxtkSXoNMHKzF1QIbC0TLq07OApgVvc0= k8s.io/cli-runtime v0.0.0-20190325194458-f2b4781c3ae1/go.mod h1:qWnH3/b8sp/l7EvlDh7ulDU3UWA4P4N1NFbEEP791tM= k8s.io/client-go v0.0.0-20190226174127-78295b709ec6 h1:EqyY1rPCSXiJjwNtNuj9MwuCKpbcbYyha4HTZ+EihE4= k8s.io/client-go v0.0.0-20190226174127-78295b709ec6/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= -k8s.io/kube-openapi v0.0.0-20190418160015-6b3d3b2d5666 h1:hlzz2EvLPcefAcG/j0tOZpds4LWSElZzxpZuhxbblbc= -k8s.io/kube-openapi v0.0.0-20190418160015-6b3d3b2d5666/go.mod h1:jqYp7BKXW0Jl+F1dWXBieUmcHKMPpGHGWA0uqfpOZZ4= -k8s.io/kube-openapi v0.0.0-20190510232812-a01b7d5d6c22 h1:f0BTap/vrgs21vVbJ1ySdsNtcivpA1x4ut6Wla9HKKw= -k8s.io/kube-openapi v0.0.0-20190510232812-a01b7d5d6c22/go.mod h1:iU+ZGYsNlvU9XKUSso6SQfKTCCw7lFduMZy26Mgr2Fw= k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208 h1:5sW+fEHvlJI3Ngolx30CmubFulwH28DhKjGf70Xmtco= k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208/go.mod h1:nfDlWeOsu3pUf4yWGL+ERqohP4YsZcBJXWMK+gkzOA4= knative.dev/test-infra v0.0.0-20190404172656-4ce16d390c55 h1:2tpTEN6OydMWVmkKJC3iVNrYbA+iHNL9qjLXe7hocfE= diff --git a/vendor/github.com/golang/protobuf/proto/properties.go b/vendor/github.com/golang/protobuf/proto/properties.go index 79668ff5c5..a4b8c0cd3a 100644 --- a/vendor/github.com/golang/protobuf/proto/properties.go +++ b/vendor/github.com/golang/protobuf/proto/properties.go @@ -38,7 +38,6 @@ package proto import ( "fmt" "log" - "os" "reflect" "sort" "strconv" @@ -194,7 +193,7 @@ func (p *Properties) Parse(s string) { // "bytes,49,opt,name=foo,def=hello!" fields := strings.Split(s, ",") // breaks def=, but handled below. if len(fields) < 2 { - fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s) + log.Printf("proto: tag has too few fields: %q", s) return } @@ -214,7 +213,7 @@ func (p *Properties) Parse(s string) { p.WireType = WireBytes // no numeric converter for non-numeric types default: - fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s) + log.Printf("proto: tag has unknown wire type: %q", s) return } diff --git a/vendor/github.com/json-iterator/go/adapter.go b/vendor/github.com/json-iterator/go/adapter.go index e674d0f397..92d2cc4a3d 100644 --- a/vendor/github.com/json-iterator/go/adapter.go +++ b/vendor/github.com/json-iterator/go/adapter.go @@ -16,7 +16,7 @@ func Unmarshal(data []byte, v interface{}) error { return ConfigDefault.Unmarshal(data, v) } -// UnmarshalFromString convenient method to read from string instead of []byte +// UnmarshalFromString is a convenient method to read from string instead of []byte func UnmarshalFromString(str string, v interface{}) error { return ConfigDefault.UnmarshalFromString(str, v) } diff --git a/vendor/github.com/json-iterator/go/go.mod b/vendor/github.com/json-iterator/go/go.mod new file mode 100644 index 0000000000..e05c42ff58 --- /dev/null +++ b/vendor/github.com/json-iterator/go/go.mod @@ -0,0 +1,11 @@ +module github.com/json-iterator/go + +go 1.12 + +require ( + github.com/davecgh/go-spew v1.1.1 + github.com/google/gofuzz v1.0.0 + github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 + github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 + github.com/stretchr/testify v1.3.0 +) diff --git a/vendor/github.com/json-iterator/go/go.sum b/vendor/github.com/json-iterator/go/go.sum new file mode 100644 index 0000000000..d778b5a14d --- /dev/null +++ b/vendor/github.com/json-iterator/go/go.sum @@ -0,0 +1,14 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/vendor/github.com/json-iterator/go/iter_skip.go b/vendor/github.com/json-iterator/go/iter_skip.go index f58beb9137..e91eefb15b 100644 --- a/vendor/github.com/json-iterator/go/iter_skip.go +++ b/vendor/github.com/json-iterator/go/iter_skip.go @@ -37,17 +37,24 @@ func (iter *Iterator) SkipAndReturnBytes() []byte { return iter.stopCapture() } -type captureBuffer struct { - startedAt int - captured []byte +// SkipAndAppendBytes skips next JSON element and appends its content to +// buffer, returning the result. +func (iter *Iterator) SkipAndAppendBytes(buf []byte) []byte { + iter.startCaptureTo(buf, iter.head) + iter.Skip() + return iter.stopCapture() } -func (iter *Iterator) startCapture(captureStartedAt int) { +func (iter *Iterator) startCaptureTo(buf []byte, captureStartedAt int) { if iter.captured != nil { panic("already in capture mode") } iter.captureStartedAt = captureStartedAt - iter.captured = make([]byte, 0, 32) + iter.captured = buf +} + +func (iter *Iterator) startCapture(captureStartedAt int) { + iter.startCaptureTo(make([]byte, 0, 32), captureStartedAt) } func (iter *Iterator) stopCapture() []byte { @@ -58,13 +65,7 @@ func (iter *Iterator) stopCapture() []byte { remaining := iter.buf[iter.captureStartedAt:iter.head] iter.captureStartedAt = -1 iter.captured = nil - if len(captured) == 0 { - copied := make([]byte, len(remaining)) - copy(copied, remaining) - return copied - } - captured = append(captured, remaining...) - return captured + return append(captured, remaining...) } // Skip skips a json object and positions to relatively the next json object diff --git a/vendor/github.com/json-iterator/go/reflect_native.go b/vendor/github.com/json-iterator/go/reflect_native.go index 9042eb0cb9..f88722d14d 100644 --- a/vendor/github.com/json-iterator/go/reflect_native.go +++ b/vendor/github.com/json-iterator/go/reflect_native.go @@ -432,17 +432,19 @@ func (codec *base64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { } func (codec *base64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - src := *((*[]byte)(ptr)) - if len(src) == 0 { + if codec.sliceType.UnsafeIsNil(ptr) { stream.WriteNil() return } + src := *((*[]byte)(ptr)) encoding := base64.StdEncoding stream.writeByte('"') - size := encoding.EncodedLen(len(src)) - buf := make([]byte, size) - encoding.Encode(buf, src) - stream.buf = append(stream.buf, buf...) + if len(src) != 0 { + size := encoding.EncodedLen(len(src)) + buf := make([]byte, size) + encoding.Encode(buf, src) + stream.buf = append(stream.buf, buf...) + } stream.writeByte('"') } diff --git a/vendor/github.com/json-iterator/go/reflect_struct_decoder.go b/vendor/github.com/json-iterator/go/reflect_struct_decoder.go index 355d2d116b..932641ac46 100644 --- a/vendor/github.com/json-iterator/go/reflect_struct_decoder.go +++ b/vendor/github.com/json-iterator/go/reflect_struct_decoder.go @@ -530,8 +530,8 @@ func (decoder *generalStructDecoder) decodeOneField(ptr unsafe.Pointer, iter *It } } if fieldDecoder == nil { - msg := "found unknown field: " + field if decoder.disallowUnknownFields { + msg := "found unknown field: " + field iter.ReportError("ReadObject", msg) } c := iter.nextToken() diff --git a/vendor/github.com/json-iterator/go/stream_float.go b/vendor/github.com/json-iterator/go/stream_float.go index f318d2c59d..826aa594ac 100644 --- a/vendor/github.com/json-iterator/go/stream_float.go +++ b/vendor/github.com/json-iterator/go/stream_float.go @@ -1,6 +1,7 @@ package jsoniter import ( + "fmt" "math" "strconv" ) @@ -13,6 +14,10 @@ func init() { // WriteFloat32 write float32 to stream func (stream *Stream) WriteFloat32(val float32) { + if math.IsInf(float64(val), 0) || math.IsNaN(float64(val)) { + stream.Error = fmt.Errorf("unsupported value: %f", val) + return + } abs := math.Abs(float64(val)) fmt := byte('f') // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right. @@ -26,6 +31,10 @@ func (stream *Stream) WriteFloat32(val float32) { // WriteFloat32Lossy write float32 to stream with ONLY 6 digits precision although much much faster func (stream *Stream) WriteFloat32Lossy(val float32) { + if math.IsInf(float64(val), 0) || math.IsNaN(float64(val)) { + stream.Error = fmt.Errorf("unsupported value: %f", val) + return + } if val < 0 { stream.writeByte('-') val = -val @@ -54,6 +63,10 @@ func (stream *Stream) WriteFloat32Lossy(val float32) { // WriteFloat64 write float64 to stream func (stream *Stream) WriteFloat64(val float64) { + if math.IsInf(val, 0) || math.IsNaN(val) { + stream.Error = fmt.Errorf("unsupported value: %f", val) + return + } abs := math.Abs(val) fmt := byte('f') // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right. @@ -67,6 +80,10 @@ func (stream *Stream) WriteFloat64(val float64) { // WriteFloat64Lossy write float64 to stream with ONLY 6 digits precision although much much faster func (stream *Stream) WriteFloat64Lossy(val float64) { + if math.IsInf(val, 0) || math.IsNaN(val) { + stream.Error = fmt.Errorf("unsupported value: %f", val) + return + } if val < 0 { stream.writeByte('-') val = -val diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go index c0c80d8930..aeac7d8a51 100644 --- a/vendor/golang.org/x/net/http2/transport.go +++ b/vendor/golang.org/x/net/http2/transport.go @@ -992,7 +992,7 @@ func (cc *ClientConn) roundTrip(req *http.Request) (res *http.Response, gotErrAf req.Method != "HEAD" { // Request gzip only, not deflate. Deflate is ambiguous and // not as universally supported anyway. - // See: http://www.gzip.org/zlib/zlib_faq.html#faq38 + // See: https://zlib.net/zlib_faq.html#faq39 // // Note that we don't request this for HEAD requests, // due to a bug in nginx: diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 4bb86aa0fe..a07ee49ea3 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -994,20 +994,6 @@ func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) { return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq)) } -// SetsockoptSockFprog attaches a classic BPF or an extended BPF program to a -// socket to filter incoming packets. See 'man 7 socket' for usage information. -func SetsockoptSockFprog(fd, level, opt int, fprog *SockFprog) error { - return setsockopt(fd, level, opt, unsafe.Pointer(fprog), unsafe.Sizeof(*fprog)) -} - -func SetsockoptCanRawFilter(fd, level, opt int, filter []CanFilter) error { - var p unsafe.Pointer - if len(filter) > 0 { - p = unsafe.Pointer(&filter[0]) - } - return setsockopt(fd, level, opt, p, uintptr(len(filter)*SizeofCanFilter)) -} - // Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html) // KeyctlInt calls keyctl commands in which each argument is an int. diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 3e9c18e681..d262150cc0 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -405,11 +405,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -439,7 +434,6 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index 14365ff6cf..e492caacda 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -406,11 +406,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -440,7 +435,6 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index 80ad473c61..ad4342156e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -409,11 +409,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -443,7 +438,6 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index 20e78cc1f6..ef76a362d9 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -407,11 +407,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -441,7 +436,6 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index bdeb0cb24f..dbf05903d4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -408,11 +408,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -442,7 +437,6 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index 2d3f591129..1b7e670793 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -407,11 +407,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -441,7 +436,6 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 5fb57ff2a3..57379005b5 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -407,11 +407,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -441,7 +436,6 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index b46b26f6ce..0e88bf47bc 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -408,11 +408,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -442,7 +437,6 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index e14e3c90ab..5ac91b3f7a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -408,11 +408,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -442,7 +437,6 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index 2332e8fd12..1e59b45068 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -408,11 +408,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -442,7 +437,6 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index efec4f8193..508885f11f 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -407,11 +407,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -441,7 +436,6 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index 71cc23f2e1..d315f2c3a7 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -406,11 +406,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -440,7 +435,6 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index 48805ba195..a1a9279c22 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -410,11 +410,6 @@ type TCPInfo struct { Total_retrans uint32 } -type CanFilter struct { - Id uint32 - Mask uint32 -} - const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -444,7 +439,6 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 - SizeofCanFilter = 0x8 ) const ( diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go index 9f946da6fe..4f17a3331f 100644 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -149,7 +149,7 @@ const ( DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS = 0x22b DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS = 0x22c DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS = 0x22d - DOMAIN_ALIAS_RID_MONITORING_USERS = 0x22e + DOMAIN_ALIAS_RID_MONITORING_USERS = 0X22e DOMAIN_ALIAS_RID_LOGGING_USERS = 0x22f DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS = 0x230 DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS = 0x231 diff --git a/vendor/modules.txt b/vendor/modules.txt index 8481a2bbf0..62105cc6bf 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -15,7 +15,7 @@ github.com/gogo/protobuf/proto github.com/gogo/protobuf/sortkeys # github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/golang/glog -# github.com/golang/protobuf v1.3.1 +# github.com/golang/protobuf v1.3.2 github.com/golang/protobuf/proto github.com/golang/protobuf/ptypes/any github.com/golang/protobuf/ptypes @@ -29,7 +29,7 @@ github.com/google/go-cmp/cmp/internal/diff github.com/google/go-cmp/cmp/internal/flags github.com/google/go-cmp/cmp/internal/function github.com/google/go-cmp/cmp/internal/value -# github.com/google/go-containerregistry v0.0.0-20190623150931-ca8b66cb1b79 +# github.com/google/go-containerregistry v0.0.0-20190723205234-74f764b9c575 github.com/google/go-containerregistry/pkg/name # github.com/google/gofuzz v1.0.0 github.com/google/gofuzz @@ -58,7 +58,7 @@ github.com/hashicorp/hcl/json/token github.com/imdario/mergo # github.com/inconshreveable/mousetrap v1.0.0 github.com/inconshreveable/mousetrap -# github.com/json-iterator/go v1.1.6 +# github.com/json-iterator/go v1.1.7 github.com/json-iterator/go # github.com/knative/build v0.7.0 github.com/knative/build/pkg/apis/build/v1alpha1 @@ -120,7 +120,7 @@ github.com/spf13/pflag github.com/spf13/viper # golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 golang.org/x/crypto/ssh/terminal -# golang.org/x/net v0.0.0-20190628185345-da137c7871d7 +# golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 golang.org/x/net/http2 golang.org/x/net/http/httpguts golang.org/x/net/http2/hpack @@ -133,7 +133,7 @@ golang.org/x/oauth2/google golang.org/x/oauth2/internal golang.org/x/oauth2/jws golang.org/x/oauth2/jwt -# golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 +# golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a golang.org/x/sys/unix golang.org/x/sys/windows # golang.org/x/text v0.3.0 @@ -391,7 +391,7 @@ k8s.io/client-go/listers/settings/v1alpha1 k8s.io/client-go/listers/storage/v1 k8s.io/client-go/listers/storage/v1alpha1 k8s.io/client-go/listers/storage/v1beta1 -# k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208 +# k8s.io/kube-openapi v0.0.0-20190722073852-5e22f3d471e6 k8s.io/kube-openapi/pkg/util/proto # knative.dev/test-infra v0.0.0-20190730202142-17f2331e80ad knative.dev/test-infra/scripts From f34b1ceb3a98559bb7142b354818c9fc5c65be4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Wed, 24 Jul 2019 17:47:40 +0200 Subject: [PATCH 03/17] fix(service describe): Integration test fix (revert "show" to "describe") --- test/e2e-smoke-tests.sh | 4 ++-- test/e2e/basic_workflow_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/e2e-smoke-tests.sh b/test/e2e-smoke-tests.sh index 1f87e85d48..457643dacf 100755 --- a/test/e2e-smoke-tests.sh +++ b/test/e2e-smoke-tests.sh @@ -56,8 +56,8 @@ kubectl create ns $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test ./kn service create foo --force --image gcr.io/knative-samples/helloworld-go -e TARGET=foo -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test ./kn revision list -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test ./kn service list -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test -./kn service show hello -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test -./kn service show svc1 -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test +./kn service describe hello -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test +./kn service describe svc1 -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test ./kn route list -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test ./kn service delete hello -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test ./kn service delete foo -n $KN_E2E_SMOKE_TESTS_NAMESPACE || fail_test diff --git a/test/e2e/basic_workflow_test.go b/test/e2e/basic_workflow_test.go index 3bf8b24367..b704528c36 100644 --- a/test/e2e/basic_workflow_test.go +++ b/test/e2e/basic_workflow_test.go @@ -94,7 +94,7 @@ func (test *e2eTest) serviceList(t *testing.T, serviceName string) { } func (test *e2eTest) serviceDescribe(t *testing.T, serviceName string) { - out, err := test.kn.RunWithOpts([]string{"service", "show", serviceName}, runOpts{NoNamespace: false}) + out, err := test.kn.RunWithOpts([]string{"service", "describe", serviceName}, runOpts{NoNamespace: false}) assert.NilError(t, err) assert.Assert(t, util.ContainsAll(out, serviceName, test.kn.namespace, KnDefaultTestImage)) From 9547336996e3ffc32cd6223e6404bdf740a11378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Wed, 24 Jul 2019 18:35:02 +0200 Subject: [PATCH 04/17] fix: go.sum --- go.sum | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/go.sum b/go.sum index 73956d18e8..d4f58b893c 100644 --- a/go.sum +++ b/go.sum @@ -31,22 +31,17 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekf github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-containerregistry v0.0.0-20190623150931-ca8b66cb1b79 h1:iObax0KHGJG3zG66UocaycSspWe9P7OT0SA9dL759sM= -github.com/google/go-containerregistry v0.0.0-20190623150931-ca8b66cb1b79/go.mod h1:yZAFP63pRshzrEYLXLGPmUt0Ay+2zdjmMN1loCnRLUk= github.com/google/go-containerregistry v0.0.0-20190723205234-74f764b9c575 h1:ftd0T3Vm1eHYBeX57PFeXjoLaIHsTZj9qCF4gOHF4pA= github.com/google/go-containerregistry v0.0.0-20190723205234-74f764b9c575/go.mod h1:yZAFP63pRshzrEYLXLGPmUt0Ay+2zdjmMN1loCnRLUk= github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/googleapis/gnostic v0.0.0-20170426233943-68f4ded48ba9/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.3.0 h1:CcQijm0XKekKjP/YCz28LXVSpgguuB+nCxaSjCe09y0= github.com/googleapis/gnostic v0.3.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= @@ -61,8 +56,6 @@ github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= @@ -79,8 +72,6 @@ github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czP github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a h1:+J2gw7Bw77w/fbK7wnNJJDKmw1IbWft2Ul5BzrG1Qm8= github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a/go.mod h1:M1qoD/MqPgTZIk0EWKB38wE28ACRfVcn+cU08jyArI0= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= @@ -124,27 +115,21 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 h1:mKdxBk7AujPs8kU4m80U72y/zjbZ3UcXC7dClwKbUI0= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 h1:Ao/3l156eZf2AW5wK8a7/smtodRU+gha3+BeqJ69lRk= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a h1:1n5lsVfiQW3yfsRGu98756EH1YthsFqr/5mxHduZW2A= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= From 2836e8e3fcafc619d06396638cde62f3c3cc51c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Wed, 24 Jul 2019 18:55:25 +0200 Subject: [PATCH 05/17] fix go.sum --- go.sum | 1 + 1 file changed, 1 insertion(+) diff --git a/go.sum b/go.sum index d4f58b893c..fd54aaa92b 100644 --- a/go.sum +++ b/go.sum @@ -136,6 +136,7 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09 h1:6Cq5LXQ/D2J5E7sYJemWSQApczOzY1rxSp8TWloyxIY= golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= From 19bd44741b9d0ec906fa7ea065466fd2f339e7a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Thu, 25 Jul 2019 09:12:28 +0200 Subject: [PATCH 06/17] feature(service describe): Add printing of resources (requests/limits) + machine readable output with -o --- docs/cmd/kn_service_describe.md | 9 +- pkg/kn/commands/service/service_describe.go | 124 +++++++++++++++----- 2 files changed, 101 insertions(+), 32 deletions(-) diff --git a/docs/cmd/kn_service_describe.md b/docs/cmd/kn_service_describe.md index b0edf79abd..61977cae3d 100644 --- a/docs/cmd/kn_service_describe.md +++ b/docs/cmd/kn_service_describe.md @@ -13,9 +13,12 @@ kn service describe NAME [flags] ### Options ``` - -d, --details Show all details. - -h, --help help for describe - -n, --namespace string List the requested object(s) in given namespace. + --allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true) + -d, --details Show all details. + -h, --help help for describe + -n, --namespace string List the requested object(s) in given namespace. + -o, --output string Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file. + --template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. ``` ### Options inherited from parent commands diff --git a/pkg/kn/commands/service/service_describe.go b/pkg/kn/commands/service/service_describe.go index b16231719f..104fc56985 100644 --- a/pkg/kn/commands/service/service_describe.go +++ b/pkg/kn/commands/service/service_describe.go @@ -26,6 +26,7 @@ import ( "github.com/knative/serving/pkg/apis/autoscaling" "github.com/knative/serving/pkg/apis/serving" + "k8s.io/cli-runtime/pkg/genericclioptions" "github.com/knative/client/pkg/printers" serving_kn_v1alpha1 "github.com/knative/client/pkg/serving/v1alpha1" @@ -53,7 +54,8 @@ var printDetails bool var truncateAt = 100 // View object for collecting revision related information in the context -// of a Service +// of a Service. These are plain data types which can be directly used +// for printing out type revisionDesc struct { name string configuration string @@ -76,6 +78,12 @@ type revisionDesc struct { minScale *int concurrencyTarget *int concurrencyLimit *int64 + + // resource options + requestsMemory string + requestsCpu string + limitsMemory string + limitsCpu string } // [REMOVE COMMENT WHEN MOVING TO 0.7.0] @@ -88,6 +96,10 @@ type revisionDesc struct { // Return a new command for describing a service. func NewServiceDescribeCommand(p *commands.KnParams) *cobra.Command { + + // For machine readable output + machineReadablePrintFlags := genericclioptions.NewPrintFlags("") + command := &cobra.Command{ Use: "describe NAME", Short: "Show details for a given service", @@ -110,15 +122,25 @@ func NewServiceDescribeCommand(p *commands.KnParams) *cobra.Command { return err } - printDetails, err = cmd.Flags().GetBool("details") + service, err := client.GetService(serviceName) if err != nil { return err } - service, err := client.GetService(serviceName) + // Print out machine readable output if requested + if machineReadablePrintFlags.OutputFlagSpecified() { + printer, err := machineReadablePrintFlags.ToPrinter() + if err != nil { + return err + } + return printer.PrintObj(service, cmd.OutOrStdout()) + } + + printDetails, err = cmd.Flags().GetBool("details") if err != nil { return err } + revisionDescs, err := getRevisionDescriptions(client, service, printDetails) return describe(cmd.OutOrStdout(), service, revisionDescs) @@ -127,6 +149,7 @@ func NewServiceDescribeCommand(p *commands.KnParams) *cobra.Command { flags := command.Flags() commands.AddNamespaceFlags(flags, false) flags.BoolP("details", "d", false, "Show all details.") + machineReadablePrintFlags.AddFlags(command) return command } @@ -191,32 +214,13 @@ func writeRevisions(dw printers.PrefixWriter, revisions []*revisionDesc) { // Concurrency specs if given if revisionDesc.concurrencyLimit != nil || revisionDesc.concurrencyTarget != nil { - dw.WriteColsLn(printers.LEVEL_1, "", l("Concurrency")) - if revisionDesc.concurrencyLimit != nil { - dw.WriteColsLn(printers.LEVEL_2, "", "", l("Limit"), strconv.FormatInt(*revisionDesc.concurrencyLimit, 10)) - } - if revisionDesc.concurrencyTarget != nil { - dw.WriteColsLn(printers.LEVEL_2, "", "", l("Target"), strconv.Itoa(*revisionDesc.concurrencyTarget)) - } + writeConcurrencyOptions(dw, revisionDesc) } - } -} -func formatScale(minScale *int, maxScale *int) string { - ret := "0" - if minScale != nil { - ret = strconv.Itoa(*minScale) + // Resources if given + writeResources(dw, "Memory", revisionDesc.requestsMemory, revisionDesc.limitsMemory) + writeResources(dw, "CPU", revisionDesc.requestsCpu, revisionDesc.limitsCpu) } - - ret += " ... " - - if maxScale != nil { - ret += strconv.Itoa(*maxScale) - } else { - ret += "∞" - } - - return ret } // Print out a table with conditions. Use green for 'ok', and red for 'nok' if color is enabled @@ -236,15 +240,40 @@ func writeConditions(dw printers.PrefixWriter, service *v1alpha1.Service) { } } +func writeConcurrencyOptions(dw printers.PrefixWriter, desc *revisionDesc) { + dw.WriteColsLn(printers.LEVEL_1, "", l("Concurrency")) + if desc.concurrencyLimit != nil { + dw.WriteColsLn(printers.LEVEL_2, "", "", l("Limit"), strconv.FormatInt(*desc.concurrencyLimit, 10)) + } + if desc.concurrencyTarget != nil { + dw.WriteColsLn(printers.LEVEL_2, "", "", l("Target"), strconv.Itoa(*desc.concurrencyTarget)) + } +} + // ====================================================================================== // Helper functions -// Format label depending whether color mode is on or not +// Format label (extracted so that color could be added more easily to all labels) func l(label string) string { return label + ":" } -// ====================================================================================== +// Format scale in the format "min ... max" with max = ∞ if not set +func formatScale(minScale *int, maxScale *int) string { + ret := "0" + if minScale != nil { + ret = strconv.Itoa(*minScale) + } + + ret += " ... " + + if maxScale != nil { + ret += strconv.Itoa(*maxScale) + } else { + ret += "∞" + } + return ret +} // Format the revision name along with its generation. Use colors if enabled. func getRevisionNameWithGenerationAndAge(desc *revisionDesc) string { @@ -348,6 +377,24 @@ func writeSliceDesc(dw printers.PrefixWriter, indent int, s []string, label stri dw.WriteColsLn(indent, labelPrefix+label, joined) } +// Write request ... limits or only one of them +func writeResources(dw printers.PrefixWriter, label string, request string, limit string) { + value := "" + if request != "" && limit != "" { + value = request + " ... " + limit + } else if request != "" { + value = request + } else if limit != "" { + value = limit + } + + if value == "" { + return + } + + dw.WriteColsLn(printers.LEVEL_1, "", l(label), value) +} + // Join to key=value pair, comma separated, and truncate if longer than a limit func joinAndTruncate(m map[string]string) string { ret := "" @@ -370,7 +417,7 @@ func formatPercentage(percentage int) string { if percentage == 0 { return " -" } - return fmt.Sprintf("%-3d%%", percentage) + return fmt.Sprintf("%3d%%", percentage) } func age(t time.Time) string { @@ -454,6 +501,7 @@ func newRevisionDesc(revision *v1alpha1.Revision, target *v1alpha1.TrafficTarget addTargetInfo(&revisionDesc, target) addContainerInfo(&revisionDesc, container) + addResourcesInfo(&revisionDesc, container) err = addConcurrencyAndScaleInfo(&revisionDesc, revision) if err != nil { return nil, err @@ -474,6 +522,24 @@ func addContainerInfo(desc *revisionDesc, container *v1.Container) { addPort(desc, container) } +func addResourcesInfo(desc *revisionDesc, container *v1.Container) { + requests := container.Resources.Requests + if !requests.Memory().IsZero() { + desc.requestsMemory = requests.Memory().String() + } + if !requests.Cpu().IsZero() { + desc.requestsCpu = requests.Cpu().String() + } + + limits := container.Resources.Limits + if !limits.Memory().IsZero() { + desc.limitsMemory = limits.Memory().String() + } + if !limits.Cpu().IsZero() { + desc.limitsCpu = limits.Cpu().String() + } +} + func addConcurrencyAndScaleInfo(desc *revisionDesc, revision *v1alpha1.Revision) error { min, err := annotationAsInt(revision, autoscaling.MinScaleAnnotationKey) if err != nil { From 3baf77fb49f1c57b1c42b01deaf350630420dc4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Thu, 25 Jul 2019 17:19:46 +0200 Subject: [PATCH 07/17] chore(service describe): Simplified digest handling --- pkg/kn/commands/service/service_describe.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/kn/commands/service/service_describe.go b/pkg/kn/commands/service/service_describe.go index 104fc56985..ec30bd92b4 100644 --- a/pkg/kn/commands/service/service_describe.go +++ b/pkg/kn/commands/service/service_describe.go @@ -53,6 +53,9 @@ var printDetails bool // Max length When to truncate long strings (when not "all" mode switched on) var truncateAt = 100 +// Matching image digest +var imageDigestRegexp = regexp.MustCompile(`(?i)sha256:([0-9a-f]{64})`) + // View object for collecting revision related information in the context // of a Service. These are plain data types which can be directly used // for printing out @@ -316,8 +319,7 @@ func formatStatus(status corev1.ConditionStatus) string { func getImageDesc(desc *revisionDesc) string { image := desc.image if printDetails && desc.imageDigest != "" { - digest := "(" + shortenDigest(desc.imageDigest) + ")" - return fmt.Sprintf("%s %s", image, digest) + return fmt.Sprintf("%s (%s)", image, shortenDigest(desc.imageDigest)) } return image } @@ -326,8 +328,7 @@ func getImageDesc(desc *revisionDesc) string { // as the digest should to be user consumable. Use the resource via `kn service get` // to get to the full sha func shortenDigest(digest string) string { - digestRegexp := regexp.MustCompile(`(?i)sha256:([0-9a-f]+)`) - match := digestRegexp.FindStringSubmatch(digest) + match := imageDigestRegexp.FindStringSubmatch(digest) if len(match) > 1 { return string(match[1][:12]) } From a88dc0dbe1a289f12bac0e5b9daad8960ff292a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Sun, 28 Jul 2019 11:01:54 +0200 Subject: [PATCH 08/17] chore(service describe): Sort maps by key when printed --- pkg/kn/commands/service/service_describe.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/kn/commands/service/service_describe.go b/pkg/kn/commands/service/service_describe.go index ec30bd92b4..f2d894c949 100644 --- a/pkg/kn/commands/service/service_describe.go +++ b/pkg/kn/commands/service/service_describe.go @@ -336,7 +336,7 @@ func shortenDigest(digest string) string { } // Write a map either compact in a single line (possibly truncated) or, if printDetails is set, -// over multiple line, one line per key-value pair +// over multiple line, one line per key-value pair. The output is sorted by keys. func writeMapDesc(dw printers.PrefixWriter, indent int, m map[string]string, label string, labelPrefix string) { if len(m) == 0 { return @@ -344,8 +344,15 @@ func writeMapDesc(dw printers.PrefixWriter, indent int, m map[string]string, lab if printDetails { l := labelPrefix + label - for key, value := range m { - dw.WriteColsLn(indent, l, key+"="+value) + + var keys []string + for k := range m { + keys = append(keys, k) + } + sort.Strings(keys) + + for _, key := range keys { + dw.WriteColsLn(indent, l, key+"="+m[key]) l = labelPrefix } return From abe30ba95e46efe925b03e84f9a0e7e3ef75c5d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Tue, 6 Aug 2019 16:42:59 +0200 Subject: [PATCH 09/17] chore: Adapt mock framework --- go.sum | 2 ++ pkg/serving/v1alpha1/client_mock.go | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/go.sum b/go.sum index fd54aaa92b..bb0631a86d 100644 --- a/go.sum +++ b/go.sum @@ -160,6 +160,8 @@ k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8 k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208 h1:5sW+fEHvlJI3Ngolx30CmubFulwH28DhKjGf70Xmtco= k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208/go.mod h1:nfDlWeOsu3pUf4yWGL+ERqohP4YsZcBJXWMK+gkzOA4= +k8s.io/kube-openapi v0.0.0-20190722073852-5e22f3d471e6 h1:s9IxTKe9GwDH0S/WaX62nFYr0or32DsTWex9AileL7U= +k8s.io/kube-openapi v0.0.0-20190722073852-5e22f3d471e6/go.mod h1:RZvgC8MSN6DjiMV6oIfEE9pDL9CYXokkfaCKZeHm3nc= knative.dev/test-infra v0.0.0-20190404172656-4ce16d390c55 h1:2tpTEN6OydMWVmkKJC3iVNrYbA+iHNL9qjLXe7hocfE= knative.dev/test-infra v0.0.0-20190404172656-4ce16d390c55/go.mod h1:l77IWBscEV5T4sYb64/9iwRCVY4UXEIqMcAppsblHW4= knative.dev/test-infra v0.0.0-20190509163238-a721698dbe49 h1:TEv7xkUjVofC2lqiSNeYjOYhC3XosGAfr0HG8x/lpC0= diff --git a/pkg/serving/v1alpha1/client_mock.go b/pkg/serving/v1alpha1/client_mock.go index 1b5bc9f46e..dc62549eeb 100644 --- a/pkg/serving/v1alpha1/client_mock.go +++ b/pkg/serving/v1alpha1/client_mock.go @@ -186,6 +186,18 @@ func (c *MockKnClient) ListRoutes(opts ...ListConfig) (*v1alpha1.RouteList, erro return call.result[0].(*v1alpha1.RouteList), errorOrNil(call.result[1]) } +// Get a configuration by name +func (r *Recorder) GetConfiguration(name string, config *v1alpha1.Configuration, err error) { + r.add("GetConfiguration", apiMethodCall{[]interface{}{name}, []interface{}{config, err}}) + +} + +func (c *MockKnClient) GetConfiguration(name string) (*v1alpha1.Configuration, error) { + call := c.getCall("GetConfiguration") + c.verifyArgs(call, name) + return call.result[0].(*v1alpha1.Configuration), errorOrNil(call.result[1]) +} + // Check that every recorded method has been called func (r *Recorder) Validate() { for k, v := range r.recordedCalls { From 7aa5a5994f0205dec98dc719017c9a7cff0211fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Tue, 6 Aug 2019 18:34:34 +0200 Subject: [PATCH 10/17] chore(service describe): Test fixes --- .../service/service_create_mock_test.go | 19 +-- .../commands/service/service_describe_test.go | 139 +++++++++++------- pkg/kn/commands/service/service_test.go | 39 +++++ pkg/serving/v1alpha1/client.go | 10 +- pkg/serving/v1alpha1/client_mock.go | 10 +- 5 files changed, 134 insertions(+), 83 deletions(-) create mode 100644 pkg/kn/commands/service/service_test.go diff --git a/pkg/kn/commands/service/service_create_mock_test.go b/pkg/kn/commands/service/service_create_mock_test.go index d9da9eacf1..aa04714674 100644 --- a/pkg/kn/commands/service/service_create_mock_test.go +++ b/pkg/kn/commands/service/service_create_mock_test.go @@ -15,7 +15,6 @@ package service import ( - "bytes" "testing" "github.com/knative/pkg/apis" @@ -24,7 +23,6 @@ import ( "github.com/knative/serving/pkg/apis/serving/v1alpha1" - "github.com/knative/client/pkg/kn/commands" knclient "github.com/knative/client/pkg/serving/v1alpha1" "github.com/knative/client/pkg/util" @@ -47,7 +45,7 @@ func TestServiceCreateImageMock(t *testing.T) { r.GetService("foo", getServiceWithUrl("foo", "http://foo.example.com"), nil) // Testing: - output, err := executeCommand(client, "create", "foo", "--image", "gcr.io/foo/bar:baz") + output, err := executeServiceCommand(client, "create", "foo", "--image", "gcr.io/foo/bar:baz") assert.NilError(t, err) assert.Assert(t, util.ContainsAll(output, "created", "foo", "http://foo.example.com", "Waiting")) @@ -62,18 +60,3 @@ func getServiceWithUrl(name string, urlName string) *v1alpha1.Service { service.Name = name return &service } - -func executeCommand(client knclient.KnClient, args ...string) (string, error) { - knParams := &commands.KnParams{} - - output := new(bytes.Buffer) - knParams.Output = output - knParams.NewClient = func(namespace string) (knclient.KnClient, error) { - return client, nil - } - cmd := NewServiceCommand(knParams) - cmd.SetArgs(args) - cmd.SetOutput(output) - err := cmd.Execute() - return output.String(), err -} diff --git a/pkg/kn/commands/service/service_describe_test.go b/pkg/kn/commands/service/service_describe_test.go index 326eb2c0d5..b13c82ce91 100644 --- a/pkg/kn/commands/service/service_describe_test.go +++ b/pkg/kn/commands/service/service_describe_test.go @@ -15,86 +15,115 @@ package service import ( - "regexp" - "strings" "testing" duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1" "github.com/knative/serving/pkg/apis/serving/v1alpha1" + "gotest.tools/assert" + "gotest.tools/assert/cmp" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - clienttesting "k8s.io/client-go/testing" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/labels" - "github.com/knative/client/pkg/kn/commands" + api_serving "github.com/knative/serving/pkg/apis/serving" + + knclient "github.com/knative/client/pkg/serving/v1alpha1" ) -func fakeServiceDescribe(args []string, response *v1alpha1.Service) (action clienttesting.Action, output string, err error) { - knParams := &commands.KnParams{} - cmd, fakeServing, buf := commands.CreateTestKnCommand(NewServiceCommand(knParams), knParams) - fakeServing.AddReactor("*", "*", - func(a clienttesting.Action) (bool, runtime.Object, error) { - action = a - return true, response, nil - }) - cmd.SetArgs(args) - err = cmd.Execute() - if err != nil { - return - } - output = buf.String() - return +func TestServiceDescribeBasic(t *testing.T) { + + // New mock client + client := knclient.NewMockKnClient(t) + + // Recording: + r := client.Recorder() + // Check for existing service --> no + expectedService := createnTestService("foo") + + // Get service + r.GetService("foo", &expectedService, nil) + + // Testing: + output, err := executeServiceCommand(client, "describe", "foo") + assert.NilError(t, err) + + validateServiceOutput(t, "foo", output) + + // Validate that all recorded API methods have been called + r.Validate() +} + +func TestServiceDescribeWithDetails(t *testing.T) { + + // New mock client + client := knclient.NewMockKnClient(t) + + // Recording: + r := client.Recorder() + // Check for existing service --> no + expectedService := createnTestService("foo") + r.GetService("foo", &expectedService, nil) + + revList := v1alpha1.RevisionList{} + + // Return the list of all revisions + r.ListRevisions(HasServiceLabelSelector("foo"), &revList, nil) + + // Fetch the revision + // r.GetRevision() + + // Testing: + output, err := executeServiceCommand(client, "describe", "foo", "--details") + assert.NilError(t, err) + + validateServiceOutput(t, "foo", output) + + // Validate that all recorded API methods have been called + r.Validate() } func TestEmptyServiceDescribe(t *testing.T) { - _, _, err := fakeServiceDescribe([]string{"service", "describe"}, &v1alpha1.Service{}) - if err == nil || - !strings.Contains(err.Error(), "no") || - !strings.Contains(err.Error(), "service") || - !strings.Contains(err.Error(), "provided") { - t.Fatalf("expect to fail with missing service name (got: %v)", err) + client := knclient.NewMockKnClient(t) + _, err := executeServiceCommand(client, "service", "describe") + assert.ErrorContains(t, err, "no", "service", "provided") +} + +func validateServiceOutput(t *testing.T, service string, output string) { + assert.Assert(t, cmp.Regexp("Name:\\s+"+service, output)) + assert.Assert(t, cmp.Regexp("Namespace:\\s+default", output)) + assert.Assert(t, cmp.Regexp("Address:\\s+http://"+service+".default.svc.cluster.local", output)) + assert.Assert(t, cmp.Regexp("URL:\\s+"+service+".default.example.com", output)) + assert.Assert(t, cmp.Regexp("Age:", output)) +} + +func HasServiceLabelSelector(service string) func(t *testing.T, a interface{}) { + return func(t *testing.T, a interface{}) { + lc := a.([]knclient.ListConfig) + listConfigCollector := knclient.ListConfigCollector{ + Labels: make(labels.Set), + Fields: make(fields.Set), + } + lc[0](&listConfigCollector) + assert.Equal(t, listConfigCollector.Labels[api_serving.ServiceLabelKey], service) } } -func TestServiceDescribeDefaultOutput(t *testing.T) { +func createnTestService(service string) v1alpha1.Service { expectedService := v1alpha1.Service{ TypeMeta: metav1.TypeMeta{ Kind: "Service", APIVersion: "knative.dev/v1alpha1", }, ObjectMeta: metav1.ObjectMeta{ - Name: "foo", + Name: service, Namespace: "default", }, Status: v1alpha1.ServiceStatus{ RouteStatusFields: v1alpha1.RouteStatusFields{ - DeprecatedDomain: "foo.default.example.com", - Address: &duckv1alpha1.Addressable{Hostname: "foo.default.svc.cluster.local"}, + DeprecatedDomain: service + ".default.example.com", + Address: &duckv1alpha1.Addressable{Hostname: service + ".default.svc.cluster.local"}, }, }, } - action, output, err := fakeServiceDescribe([]string{"service", "describe", "test-foo"}, &expectedService) - if err != nil { - t.Fatal(err) - } - if action == nil { - t.Fatal("No action") - } else if !action.Matches("get", "services") { - t.Fatalf("Bad action %v", action) - } - - assertMatches(t, output, "Name:\\s+foo") - assertMatches(t, output, "Namespace:\\s+default") - assertMatches(t, output, "Address:\\s+http://foo.default.svc.cluster.local") - assertMatches(t, output, "URL:\\s+foo.default.example.com") - assertMatches(t, output, "Age:") -} - -func assertMatches(t *testing.T, value, expr string) { - ok, err := regexp.MatchString(expr, value) - if err != nil { - t.Fatalf("invalid pattern %q. %v", expr, err) - } - if !ok { - t.Errorf("got %s which does not match %s\n", value, expr) - } + return expectedService } diff --git a/pkg/kn/commands/service/service_test.go b/pkg/kn/commands/service/service_test.go new file mode 100644 index 0000000000..09d639e69b --- /dev/null +++ b/pkg/kn/commands/service/service_test.go @@ -0,0 +1,39 @@ +// Copyright © 2019 The Knative Authors +// +// 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 service + +import ( + "bytes" + + "github.com/knative/client/pkg/kn/commands" + knclient "github.com/knative/client/pkg/serving/v1alpha1" +) + +// Helper methods + +func executeServiceCommand(client knclient.KnClient, args ...string) (string, error) { + knParams := &commands.KnParams{} + + output := new(bytes.Buffer) + knParams.Output = output + knParams.NewClient = func(namespace string) (knclient.KnClient, error) { + return client, nil + } + cmd := NewServiceCommand(knParams) + cmd.SetArgs(args) + cmd.SetOutput(output) + err := cmd.Execute() + return output.String(), err +} diff --git a/pkg/serving/v1alpha1/client.go b/pkg/serving/v1alpha1/client.go index cc3b5d53b0..079317ff98 100644 --- a/pkg/serving/v1alpha1/client.go +++ b/pkg/serving/v1alpha1/client.go @@ -73,7 +73,7 @@ type KnClient interface { ListRoutes(opts ...ListConfig) (*v1alpha1.RouteList, error) } -type listConfig struct { +type ListConfigCollector struct { // Labels to filter on Labels labels.Set @@ -82,13 +82,13 @@ type listConfig struct { } // Config function for builder pattern -type ListConfig func(config *listConfig) +type ListConfig func(config *ListConfigCollector) type ListConfigs []ListConfig // add selectors to a list options func (opts ListConfigs) toListOptions() v1.ListOptions { - listConfig := listConfig{labels.Set{}, fields.Set{}} + listConfig := ListConfigCollector{labels.Set{}, fields.Set{}} for _, f := range opts { f(&listConfig) } @@ -104,14 +104,14 @@ func (opts ListConfigs) toListOptions() v1.ListOptions { // Filter list on the provided name func WithName(name string) ListConfig { - return func(lo *listConfig) { + return func(lo *ListConfigCollector) { lo.Fields["metadata.name"] = name } } // Filter on the service name func WithService(service string) ListConfig { - return func(lo *listConfig) { + return func(lo *ListConfigCollector) { lo.Labels[api_serving.ServiceLabelKey] = service } } diff --git a/pkg/serving/v1alpha1/client_mock.go b/pkg/serving/v1alpha1/client_mock.go index dc62549eeb..2523c6770e 100644 --- a/pkg/serving/v1alpha1/client_mock.go +++ b/pkg/serving/v1alpha1/client_mock.go @@ -59,8 +59,8 @@ func (c *MockKnClient) Recorder() *Recorder { } // any() can be used in recording to not check for the argument -func Any() func(t *testing.T, a, b interface{}) { - return func(t *testing.T, a, b interface{}) {} +func Any() func(t *testing.T, a interface{}) { + return func(t *testing.T, a interface{}) {} } // Get Service @@ -242,10 +242,10 @@ func (c *MockKnClient) verifyArgs(call *apiMethodCall, args ...interface{}) { assert.Assert(c.t, len(callArgs) > i, "Internal: Invalid recording: Expected %d args, got %d", len(callArgs), len(args)) fn := reflect.ValueOf(call.args[i]) fnType := fn.Type() - if fnType.Kind() == reflect.Func { - fn.Call([]reflect.Value{reflect.ValueOf(c.t), reflect.ValueOf(call.args[0]), reflect.ValueOf(arg)}) + if fnType.Kind() == reflect.Func && fnType.NumIn() == 2 { + fn.Call([]reflect.Value{reflect.ValueOf(c.t), reflect.ValueOf(arg)}) } else { - assert.DeepEqual(c.t, call.args[0], arg) + assert.DeepEqual(c.t, call.args[i], arg) } } } From 4af24ec4ee211467945a071fd3101f25c7e8abc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Wed, 7 Aug 2019 12:27:08 +0200 Subject: [PATCH 11/17] chore: Added some tests --- docs/cmd/kn_service_describe.md | 2 +- pkg/kn/commands/service/service_describe.go | 4 +- .../commands/service/service_describe_test.go | 82 +++++++++++++------ pkg/serving/v1alpha1/client.go | 10 +-- pkg/serving/v1alpha1/client_mock.go | 45 +++++++++- 5 files changed, 107 insertions(+), 36 deletions(-) diff --git a/docs/cmd/kn_service_describe.md b/docs/cmd/kn_service_describe.md index 61977cae3d..03b9c5ff36 100644 --- a/docs/cmd/kn_service_describe.md +++ b/docs/cmd/kn_service_describe.md @@ -14,11 +14,11 @@ kn service describe NAME [flags] ``` --allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true) - -d, --details Show all details. -h, --help help for describe -n, --namespace string List the requested object(s) in given namespace. -o, --output string Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file. --template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. + -v, --verbose More output. ``` ### Options inherited from parent commands diff --git a/pkg/kn/commands/service/service_describe.go b/pkg/kn/commands/service/service_describe.go index f2d894c949..d5c1f0e0c4 100644 --- a/pkg/kn/commands/service/service_describe.go +++ b/pkg/kn/commands/service/service_describe.go @@ -139,7 +139,7 @@ func NewServiceDescribeCommand(p *commands.KnParams) *cobra.Command { return printer.PrintObj(service, cmd.OutOrStdout()) } - printDetails, err = cmd.Flags().GetBool("details") + printDetails, err = cmd.Flags().GetBool("verbose") if err != nil { return err } @@ -151,7 +151,7 @@ func NewServiceDescribeCommand(p *commands.KnParams) *cobra.Command { } flags := command.Flags() commands.AddNamespaceFlags(flags, false) - flags.BoolP("details", "d", false, "Show all details.") + flags.BoolP("verbose", "v", false, "More output.") machineReadablePrintFlags.AddFlags(command) return command } diff --git a/pkg/kn/commands/service/service_describe_test.go b/pkg/kn/commands/service/service_describe_test.go index b13c82ce91..fc21316036 100644 --- a/pkg/kn/commands/service/service_describe_test.go +++ b/pkg/kn/commands/service/service_describe_test.go @@ -18,16 +18,14 @@ import ( "testing" duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1" + api_serving "github.com/knative/serving/pkg/apis/serving" "github.com/knative/serving/pkg/apis/serving/v1alpha1" "gotest.tools/assert" "gotest.tools/assert/cmp" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" - "k8s.io/apimachinery/pkg/labels" - - api_serving "github.com/knative/serving/pkg/apis/serving" knclient "github.com/knative/client/pkg/serving/v1alpha1" + "github.com/knative/client/pkg/util" ) func TestServiceDescribeBasic(t *testing.T) { @@ -38,7 +36,7 @@ func TestServiceDescribeBasic(t *testing.T) { // Recording: r := client.Recorder() // Check for existing service --> no - expectedService := createnTestService("foo") + expectedService := createTestService("foo") // Get service r.GetService("foo", &expectedService, nil) @@ -53,7 +51,7 @@ func TestServiceDescribeBasic(t *testing.T) { r.Validate() } -func TestServiceDescribeWithDetails(t *testing.T) { +func TestServiceDescribeVerbose(t *testing.T) { // New mock client client := knclient.NewMockKnClient(t) @@ -61,19 +59,28 @@ func TestServiceDescribeWithDetails(t *testing.T) { // Recording: r := client.Recorder() // Check for existing service --> no - expectedService := createnTestService("foo") + expectedService := createTestService("foo") r.GetService("foo", &expectedService, nil) - revList := v1alpha1.RevisionList{} + revList := v1alpha1.RevisionList{ + TypeMeta: metav1.TypeMeta{ + Kind: "RevisionList", + APIVersion: "knative.dev/v1alpha1", + }, + Items: []v1alpha1.Revision{ + createTestRevision("rev1", 1), + createTestRevision("rev2", 2), + }, + } // Return the list of all revisions - r.ListRevisions(HasServiceLabelSelector("foo"), &revList, nil) + r.ListRevisions(knclient.HasLabelSelector(api_serving.ServiceLabelKey, "foo"), &revList, nil) // Fetch the revision // r.GetRevision() // Testing: - output, err := executeServiceCommand(client, "describe", "foo", "--details") + output, err := executeServiceCommand(client, "describe", "foo", "--verbose") assert.NilError(t, err) validateServiceOutput(t, "foo", output) @@ -82,10 +89,29 @@ func TestServiceDescribeWithDetails(t *testing.T) { r.Validate() } -func TestEmptyServiceDescribe(t *testing.T) { +func TestServiceDescribeWithWrongArguments(t *testing.T) { client := knclient.NewMockKnClient(t) - _, err := executeServiceCommand(client, "service", "describe") + _, err := executeServiceCommand(client, "describe") assert.ErrorContains(t, err, "no", "service", "provided") + + _, err = executeServiceCommand(client, "describe", "foo", "bar") + assert.ErrorContains(t, err, "more than one", "service", "provided") +} + +func TestServiceDescribeMachineReadable(t *testing.T) { + client := knclient.NewMockKnClient(t) + + // Recording: + r := client.Recorder() + // Check for existing service --> no + expectedService := createTestService("foo") + r.GetService("foo", &expectedService, nil) + + output, err := executeServiceCommand(client, "describe", "foo", "-o", "yaml") + assert.NilError(t, err) + assert.Assert(t, util.ContainsAll(output, "kind: Service", "spec:", "status:", "metadata:")) + + r.Validate() } func validateServiceOutput(t *testing.T, service string, output string) { @@ -96,20 +122,8 @@ func validateServiceOutput(t *testing.T, service string, output string) { assert.Assert(t, cmp.Regexp("Age:", output)) } -func HasServiceLabelSelector(service string) func(t *testing.T, a interface{}) { - return func(t *testing.T, a interface{}) { - lc := a.([]knclient.ListConfig) - listConfigCollector := knclient.ListConfigCollector{ - Labels: make(labels.Set), - Fields: make(fields.Set), - } - lc[0](&listConfigCollector) - assert.Equal(t, listConfigCollector.Labels[api_serving.ServiceLabelKey], service) - } -} - -func createnTestService(service string) v1alpha1.Service { - expectedService := v1alpha1.Service{ +func createTestService(service string) v1alpha1.Service { + return v1alpha1.Service{ TypeMeta: metav1.TypeMeta{ Kind: "Service", APIVersion: "knative.dev/v1alpha1", @@ -125,5 +139,19 @@ func createnTestService(service string) v1alpha1.Service { }, }, } - return expectedService +} + +func createTestRevision(revision string, gen int64) v1alpha1.Revision { + return v1alpha1.Revision{ + TypeMeta: metav1.TypeMeta{ + Kind: "Revision", + APIVersion: "knative.dev/v1alpha1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: revision, + Namespace: "default", + Generation: gen, + }, + } + } diff --git a/pkg/serving/v1alpha1/client.go b/pkg/serving/v1alpha1/client.go index 079317ff98..58660dff7d 100644 --- a/pkg/serving/v1alpha1/client.go +++ b/pkg/serving/v1alpha1/client.go @@ -73,7 +73,7 @@ type KnClient interface { ListRoutes(opts ...ListConfig) (*v1alpha1.RouteList, error) } -type ListConfigCollector struct { +type listConfigCollector struct { // Labels to filter on Labels labels.Set @@ -82,13 +82,13 @@ type ListConfigCollector struct { } // Config function for builder pattern -type ListConfig func(config *ListConfigCollector) +type ListConfig func(config *listConfigCollector) type ListConfigs []ListConfig // add selectors to a list options func (opts ListConfigs) toListOptions() v1.ListOptions { - listConfig := ListConfigCollector{labels.Set{}, fields.Set{}} + listConfig := listConfigCollector{labels.Set{}, fields.Set{}} for _, f := range opts { f(&listConfig) } @@ -104,14 +104,14 @@ func (opts ListConfigs) toListOptions() v1.ListOptions { // Filter list on the provided name func WithName(name string) ListConfig { - return func(lo *ListConfigCollector) { + return func(lo *listConfigCollector) { lo.Fields["metadata.name"] = name } } // Filter on the service name func WithService(service string) ListConfig { - return func(lo *ListConfigCollector) { + return func(lo *listConfigCollector) { lo.Labels[api_serving.ServiceLabelKey] = service } } diff --git a/pkg/serving/v1alpha1/client_mock.go b/pkg/serving/v1alpha1/client_mock.go index 2523c6770e..bcdaec3001 100644 --- a/pkg/serving/v1alpha1/client_mock.go +++ b/pkg/serving/v1alpha1/client_mock.go @@ -22,6 +22,8 @@ import ( "github.com/knative/serving/pkg/apis/serving/v1alpha1" "gotest.tools/assert" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/labels" ) type Recorder struct { @@ -207,6 +209,47 @@ func (r *Recorder) Validate() { } } +// Return a comparable which can be used for asserting that list methods are called +// with the appropriate label selector +func HasLabelSelector(keyAndValues ...string) func(t *testing.T, a interface{}) { + return func(t *testing.T, a interface{}) { + lc := a.([]ListConfig) + listConfigCollector := listConfigCollector{ + Labels: make(labels.Set), + Fields: make(fields.Set), + } + lc[0](&listConfigCollector) + for i := 0; i < len(keyAndValues); i += 2 { + assert.Equal(t, listConfigCollector.Labels[keyAndValues[i]], keyAndValues[i+1]) + } + } +} + +// Return a comparable which can be used for asserting that list methods are called +// with the appropriate field selectors +func HasFieldSelector(keyAndValues ...string) func(t *testing.T, a interface{}) { + return func(t *testing.T, a interface{}) { + lc := a.([]ListConfig) + listConfigCollector := listConfigCollector{ + Labels: make(labels.Set), + Fields: make(fields.Set), + } + lc[0](&listConfigCollector) + for i := 0; i < len(keyAndValues); i += 2 { + assert.Equal(t, listConfigCollector.Fields[keyAndValues[i]], keyAndValues[i+1]) + } + } +} + +// Return a comparable which can be used for asserting that list methods are called +// with the appropriate label and field selectors +func HasSelector(labelKeysAndValues []string, fieldKeysAndValue []string) func(t *testing.T, a interface{}) { + return func(t *testing.T, a interface{}) { + HasLabelSelector(labelKeysAndValues...)(t, a) + HasFieldSelector(fieldKeysAndValue...)(t, a) + } +} + // Add a recorded api call the list of calls func (r *Recorder) add(name string, call apiMethodCall) { calls, ok := r.recordedCalls[name] @@ -235,7 +278,7 @@ func (c *MockKnClient) getCall(name string) *apiMethodCall { return call } -// Verify given arguments agains recorded arguments +// Verify given arguments against recorded arguments func (c *MockKnClient) verifyArgs(call *apiMethodCall, args ...interface{}) { callArgs := call.args for i, arg := range args { From bb08564cc00b965d997f02c65f4a50fcd6d6a8ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Wed, 7 Aug 2019 16:18:02 +0200 Subject: [PATCH 12/17] more tests --- pkg/kn/commands/service/service_describe.go | 2 +- .../commands/service/service_describe_test.go | 96 +++++++++++++++---- 2 files changed, 81 insertions(+), 17 deletions(-) diff --git a/pkg/kn/commands/service/service_describe.go b/pkg/kn/commands/service/service_describe.go index d5c1f0e0c4..2eb4fabea2 100644 --- a/pkg/kn/commands/service/service_describe.go +++ b/pkg/kn/commands/service/service_describe.go @@ -504,7 +504,7 @@ func newRevisionDesc(revision *v1alpha1.Revision, target *v1alpha1.TrafficTarget creationTimestamp: revision.CreationTimestamp.Time, configurationGeneration: int(generation), - configuration: revision.Labels["serving.knative.dev/configuration"], + configuration: revision.Labels[serving.ConfigurationLabelKey], } addTargetInfo(&revisionDesc, target) diff --git a/pkg/kn/commands/service/service_describe_test.go b/pkg/kn/commands/service/service_describe_test.go index fc21316036..4d3e57a7a6 100644 --- a/pkg/kn/commands/service/service_describe_test.go +++ b/pkg/kn/commands/service/service_describe_test.go @@ -15,13 +15,18 @@ package service import ( + "fmt" "testing" + "github.com/knative/pkg/apis" duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1" + duckv1beta1 "github.com/knative/pkg/apis/duck/v1beta1" api_serving "github.com/knative/serving/pkg/apis/serving" "github.com/knative/serving/pkg/apis/serving/v1alpha1" + "github.com/knative/serving/pkg/apis/serving/v1beta1" "gotest.tools/assert" "gotest.tools/assert/cmp" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" knclient "github.com/knative/client/pkg/serving/v1alpha1" @@ -36,7 +41,7 @@ func TestServiceDescribeBasic(t *testing.T) { // Recording: r := client.Recorder() // Check for existing service --> no - expectedService := createTestService("foo") + expectedService := createTestService("foo", nil, goodConditions()) // Get service r.GetService("foo", &expectedService, nil) @@ -51,6 +56,19 @@ func TestServiceDescribeBasic(t *testing.T) { r.Validate() } +func goodConditions() duckv1beta1.Conditions { + ret := make(duckv1beta1.Conditions, 0) + ret = append(ret, apis.Condition{ + Type: apis.ConditionReady, + Status: v1.ConditionTrue, + }) + ret = append(ret, apis.Condition{ + Type: apis.ConditionSucceeded, + Status: v1.ConditionTrue, + }) + return ret +} + func TestServiceDescribeVerbose(t *testing.T) { // New mock client @@ -59,32 +77,35 @@ func TestServiceDescribeVerbose(t *testing.T) { // Recording: r := client.Recorder() // Check for existing service --> no - expectedService := createTestService("foo") + expectedService := createTestService("foo", []string{"rev1", "rev2"}, goodConditions()) r.GetService("foo", &expectedService, nil) + rev1 := createTestRevision("rev1", 1) + rev2 := createTestRevision("rev2", 2) + revList := v1alpha1.RevisionList{ TypeMeta: metav1.TypeMeta{ Kind: "RevisionList", APIVersion: "knative.dev/v1alpha1", }, Items: []v1alpha1.Revision{ - createTestRevision("rev1", 1), - createTestRevision("rev2", 2), + rev1, rev2, }, } // Return the list of all revisions r.ListRevisions(knclient.HasLabelSelector(api_serving.ServiceLabelKey, "foo"), &revList, nil) - // Fetch the revision - // r.GetRevision() + // Fetch the revisions + r.GetRevision("rev1", &rev1, nil) + r.GetRevision("rev2", &rev2, nil) // Testing: output, err := executeServiceCommand(client, "describe", "foo", "--verbose") assert.NilError(t, err) validateServiceOutput(t, "foo", output) - + assert.Assert(t, util.ContainsAll(output, "[1]", "[2]")) // Validate that all recorded API methods have been called r.Validate() } @@ -104,7 +125,7 @@ func TestServiceDescribeMachineReadable(t *testing.T) { // Recording: r := client.Recorder() // Check for existing service --> no - expectedService := createTestService("foo") + expectedService := createTestService("foo", []string{"rev1", "rev2"}, goodConditions()) r.GetService("foo", &expectedService, nil) output, err := executeServiceCommand(client, "describe", "foo", "-o", "yaml") @@ -122,26 +143,58 @@ func validateServiceOutput(t *testing.T, service string, output string) { assert.Assert(t, cmp.Regexp("Age:", output)) } -func createTestService(service string) v1alpha1.Service { - return v1alpha1.Service{ +func createTestService(name string, revisionNames []string, conditions duckv1beta1.Conditions) v1alpha1.Service { + + labelMap := make(map[string]string) + labelMap["label1"] = "lval1" + labelMap["label2"] = "lval2" + annoMap := make(map[string]string) + annoMap["anno1"] = "aval1" + annoMap["anno2"] = "aval2" + + service := v1alpha1.Service{ TypeMeta: metav1.TypeMeta{ Kind: "Service", APIVersion: "knative.dev/v1alpha1", }, ObjectMeta: metav1.ObjectMeta{ - Name: service, - Namespace: "default", + Name: name, + Namespace: "default", + Labels: labelMap, + Annotations: annoMap, }, Status: v1alpha1.ServiceStatus{ RouteStatusFields: v1alpha1.RouteStatusFields{ - DeprecatedDomain: service + ".default.example.com", - Address: &duckv1alpha1.Addressable{Hostname: service + ".default.svc.cluster.local"}, + DeprecatedDomain: name + ".default.example.com", + Address: &duckv1alpha1.Addressable{Hostname: name + ".default.svc.cluster.local"}, + }, + Status: duckv1beta1.Status{ + Conditions: conditions, }, }, } + if len(revisionNames) > 0 { + trafficTargets := make([]v1alpha1.TrafficTarget, 0) + for _, rname := range revisionNames { + url, _ := apis.ParseURL(fmt.Sprintf("https://%s", rname)) + target := v1alpha1.TrafficTarget{ + TrafficTarget: v1beta1.TrafficTarget{ + RevisionName: rname, + ConfigurationName: name, + Percent: 100 / len(revisionNames), + URL: url, + }, + } + trafficTargets = append(trafficTargets, target) + } + service.Status.Traffic = trafficTargets + } + return service } func createTestRevision(revision string, gen int64) v1alpha1.Revision { + labels := make(map[string]string) + labels[api_serving.ConfigurationGenerationLabelKey] = fmt.Sprintf("%d", gen) return v1alpha1.Revision{ TypeMeta: metav1.TypeMeta{ Kind: "Revision", @@ -150,8 +203,19 @@ func createTestRevision(revision string, gen int64) v1alpha1.Revision { ObjectMeta: metav1.ObjectMeta{ Name: revision, Namespace: "default", - Generation: gen, + Generation: 1, + Labels: labels, + }, + Spec: v1alpha1.RevisionSpec{ + RevisionSpec: v1beta1.RevisionSpec{ + PodSpec: v1beta1.PodSpec{ + Containers: []v1.Container{ + { + Image: "gcr.io/test/image", + }, + }, + }, + }, }, } - } From 10e85c8c044cb47bfaae7048373ec705ba4f6b11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Wed, 7 Aug 2019 18:19:08 +0200 Subject: [PATCH 13/17] test: Moar tests --- pkg/kn/commands/service/service_describe.go | 24 +- .../commands/service/service_describe_test.go | 253 ++++++++++++++++-- 2 files changed, 240 insertions(+), 37 deletions(-) diff --git a/pkg/kn/commands/service/service_describe.go b/pkg/kn/commands/service/service_describe.go index 2eb4fabea2..d5ae2a8086 100644 --- a/pkg/kn/commands/service/service_describe.go +++ b/pkg/kn/commands/service/service_describe.go @@ -44,14 +44,14 @@ import ( ) // Command for printing out a description of a service, meant to be consumed by humans -// It will show information about the serivce itself, but also a summary +// It will show information about the service itself, but also a summary // about the associated revisions. // Whether to print extended information var printDetails bool // Max length When to truncate long strings (when not "all" mode switched on) -var truncateAt = 100 +const truncateAt = 100 // Matching image digest var imageDigestRegexp = regexp.MustCompile(`(?i)sha256:([0-9a-f]{64})`) @@ -342,15 +342,15 @@ func writeMapDesc(dw printers.PrefixWriter, indent int, m map[string]string, lab return } + var keys []string + for k := range m { + keys = append(keys, k) + } + sort.Strings(keys) + if printDetails { l := labelPrefix + label - var keys []string - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - for _, key := range keys { dw.WriteColsLn(indent, l, key+"="+m[key]) l = labelPrefix @@ -358,7 +358,7 @@ func writeMapDesc(dw printers.PrefixWriter, indent int, m map[string]string, lab return } - dw.WriteColsLn(indent, label, joinAndTruncate(m)) + dw.WriteColsLn(indent, label, joinAndTruncate(keys, m)) } // Writer a slice compact (printDetails == false) in one line, or over multiple line @@ -404,10 +404,10 @@ func writeResources(dw printers.PrefixWriter, label string, request string, limi } // Join to key=value pair, comma separated, and truncate if longer than a limit -func joinAndTruncate(m map[string]string) string { +func joinAndTruncate(sortedKeys []string, m map[string]string) string { ret := "" - for key, value := range m { - ret += fmt.Sprintf("%s=%s, ", key, value) + for _, key := range sortedKeys { + ret += fmt.Sprintf("%s=%s, ", key, m[key]) if len(ret) > truncateAt { break } diff --git a/pkg/kn/commands/service/service_describe_test.go b/pkg/kn/commands/service/service_describe_test.go index 4d3e57a7a6..c9f0c79f64 100644 --- a/pkg/kn/commands/service/service_describe_test.go +++ b/pkg/kn/commands/service/service_describe_test.go @@ -16,23 +16,32 @@ package service import ( "fmt" + "strconv" + "strings" "testing" + "time" "github.com/knative/pkg/apis" duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1" duckv1beta1 "github.com/knative/pkg/apis/duck/v1beta1" + "github.com/knative/serving/pkg/apis/autoscaling" api_serving "github.com/knative/serving/pkg/apis/serving" "github.com/knative/serving/pkg/apis/serving/v1alpha1" "github.com/knative/serving/pkg/apis/serving/v1beta1" "gotest.tools/assert" "gotest.tools/assert/cmp" v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" knclient "github.com/knative/client/pkg/serving/v1alpha1" "github.com/knative/client/pkg/util" ) +const ( + imageDigest = "sha256:1234567890123456789012345678901234567890123456789012345678901234" +) + func TestServiceDescribeBasic(t *testing.T) { // New mock client @@ -40,33 +49,151 @@ func TestServiceDescribeBasic(t *testing.T) { // Recording: r := client.Recorder() - // Check for existing service --> no - expectedService := createTestService("foo", nil, goodConditions()) + // Prepare service + expectedService := createTestService("foo", []string{"rev1"}, goodConditions()) - // Get service + // Get service & revision r.GetService("foo", &expectedService, nil) + rev1 := createTestRevision("rev1", 1) + r.GetRevision("rev1", &rev1, nil) // Testing: output, err := executeServiceCommand(client, "describe", "foo") assert.NilError(t, err) validateServiceOutput(t, "foo", output) + assert.Assert(t, util.ContainsAll(output, "Env:", "label1=lval1, label2=lval2\n")) + assert.Assert(t, util.ContainsAll(output, "Annotations:", "anno1=aval1, anno2=aval2, anno3=")) + assert.Assert(t, cmp.Regexp(`(?m)\s*Annotations:.*\.\.\.$`, output)) + assert.Assert(t, util.ContainsAll(output, "Labels:", "label1=lval1, label2=lval2\n")) + assert.Assert(t, util.ContainsAll(output, "[1]")) + // no digest added (added only for details) + assert.Assert(t, !strings.Contains(output, "(123456789012)")) // Validate that all recorded API methods have been called r.Validate() } -func goodConditions() duckv1beta1.Conditions { - ret := make(duckv1beta1.Conditions, 0) - ret = append(ret, apis.Condition{ - Type: apis.ConditionReady, - Status: v1.ConditionTrue, - }) - ret = append(ret, apis.Condition{ - Type: apis.ConditionSucceeded, - Status: v1.ConditionTrue, - }) - return ret +func TestServiceDescribeScaling(t *testing.T) { + + for _, data := range []struct { + minScale, maxScale, limit, target string + scaleOut string + }{ + {"", "", "", "", ""}, + {"", "10", "", "", "0 ... 10"}, + {"10", "", "", "", "10 ... ∞"}, + {"5", "20", "10", "", "5 ... 20"}, + {"", "", "20", "30", ""}, + } { + // New mock client + client := knclient.NewMockKnClient(t) + + // Recording: + r := client.Recorder() + + // Prepare service + expectedService := createTestService("foo", []string{"rev1"}, goodConditions()) + + // Get service & revision + r.GetService("foo", &expectedService, nil) + rev1 := createTestRevision("rev1", 1) + addScaling(&rev1, data.minScale, data.maxScale, data.target, data.limit) + r.GetRevision("rev1", &rev1, nil) + + revList := v1alpha1.RevisionList{ + TypeMeta: metav1.TypeMeta{ + Kind: "RevisionList", + APIVersion: "knative.dev/v1alpha1", + }, + Items: []v1alpha1.Revision{ + rev1, + }, + } + + // Return the list of all revisions + r.ListRevisions(knclient.HasLabelSelector(api_serving.ServiceLabelKey, "foo"), &revList, nil) + + // Testing: + output, err := executeServiceCommand(client, "describe", "foo", "--verbose") + assert.NilError(t, err) + + validateServiceOutput(t, "foo", output) + + if data.limit != "" || data.target != "" { + assert.Assert(t, util.ContainsAll(output, "Concurrency:")) + } else { + assert.Assert(t, !strings.Contains(output, "Concurrency:")) + } + + validateOutputLine(t, output, "Scale", data.scaleOut) + validateOutputLine(t, output, "Limit", data.limit) + validateOutputLine(t, output, "Target", data.target) + + // Validate that all recorded API methods have been called + r.Validate() + } +} + +func validateOutputLine(t *testing.T, output string, label string, value string) { + if value != "" { + assert.Assert(t, cmp.Regexp(fmt.Sprintf("%s:\\s*%s", label, value), output)) + } else { + assert.Assert(t, !strings.Contains(output, label+":")) + } +} + +func TestServiceDescribeResources(t *testing.T) { + + for _, data := range []struct { + reqMem, limitMem, reqCpu, limitCpu string + memoryOut, cpuOut string + }{ + {"", "", "", "", "", ""}, + {"10Mi", "100Mi", "100m", "1", "10Mi ... 100Mi", "100m ... 1"}, + {"", "100Mi", "", "1", "100Mi", "1"}, + {"10Mi", "", "100m", "", "10Mi", "100m"}, + } { + // New mock client + client := knclient.NewMockKnClient(t) + + // Recording: + r := client.Recorder() + + // Prepare service + expectedService := createTestService("foo", []string{"rev1"}, goodConditions()) + + // Get service & revision + r.GetService("foo", &expectedService, nil) + rev1 := createTestRevision("rev1", 1) + addResourceLimits(&rev1.Spec.Containers[0].Resources, data.reqMem, data.limitMem, data.reqCpu, data.limitCpu) + r.GetRevision("rev1", &rev1, nil) + + revList := v1alpha1.RevisionList{ + TypeMeta: metav1.TypeMeta{ + Kind: "RevisionList", + APIVersion: "knative.dev/v1alpha1", + }, + Items: []v1alpha1.Revision{ + rev1, + }, + } + + // Return the list of all revisions + r.ListRevisions(knclient.HasLabelSelector(api_serving.ServiceLabelKey, "foo"), &revList, nil) + + // Testing: + output, err := executeServiceCommand(client, "describe", "foo", "--verbose") + assert.NilError(t, err) + + validateServiceOutput(t, "foo", output) + + validateOutputLine(t, output, "Memory", data.memoryOut) + validateOutputLine(t, output, "CPU", data.cpuOut) + + // Validate that all recorded API methods have been called + r.Validate() + } } func TestServiceDescribeVerbose(t *testing.T) { @@ -76,7 +203,8 @@ func TestServiceDescribeVerbose(t *testing.T) { // Recording: r := client.Recorder() - // Check for existing service --> no + + // Prepare service expectedService := createTestService("foo", []string{"rev1", "rev2"}, goodConditions()) r.GetService("foo", &expectedService, nil) @@ -105,7 +233,13 @@ func TestServiceDescribeVerbose(t *testing.T) { assert.NilError(t, err) validateServiceOutput(t, "foo", output) + + assert.Assert(t, util.ContainsAll(output, "Image", "Name", "(123456789012)", "50%", "gcr.io/test/image", "(0s)")) + assert.Assert(t, util.ContainsAll(output, "Env:", "label1=lval1\n", "label2=lval2\n")) + assert.Assert(t, util.ContainsAll(output, "Annotations:", "anno1=aval1\n", "anno2=aval2\n")) + assert.Assert(t, util.ContainsAll(output, "Labels:", "label1=lval1\n", "label2=lval2\n")) assert.Assert(t, util.ContainsAll(output, "[1]", "[2]")) + // Validate that all recorded API methods have been called r.Validate() } @@ -124,7 +258,8 @@ func TestServiceDescribeMachineReadable(t *testing.T) { // Recording: r := client.Recorder() - // Check for existing service --> no + + // Prepare service expectedService := createTestService("foo", []string{"rev1", "rev2"}, goodConditions()) r.GetService("foo", &expectedService, nil) @@ -140,7 +275,9 @@ func validateServiceOutput(t *testing.T, service string, output string) { assert.Assert(t, cmp.Regexp("Namespace:\\s+default", output)) assert.Assert(t, cmp.Regexp("Address:\\s+http://"+service+".default.svc.cluster.local", output)) assert.Assert(t, cmp.Regexp("URL:\\s+"+service+".default.example.com", output)) - assert.Assert(t, cmp.Regexp("Age:", output)) + + assert.Assert(t, util.ContainsAll(output, "Age:", "Revisions:", "Conditions:", "Labels:", "Annotations:")) + assert.Assert(t, util.ContainsAll(output, "Ready", "RoutesReady", "OK", "TYPE", "AGE", "REASON")) } func createTestService(name string, revisionNames []string, conditions duckv1beta1.Conditions) v1alpha1.Service { @@ -151,6 +288,7 @@ func createTestService(name string, revisionNames []string, conditions duckv1bet annoMap := make(map[string]string) annoMap["anno1"] = "aval1" annoMap["anno2"] = "aval2" + annoMap["anno3"] = "very_long_value_which_should_be_truncated_in_normal_output_if_we_make_it_even_longer" service := v1alpha1.Service{ TypeMeta: metav1.TypeMeta{ @@ -158,10 +296,11 @@ func createTestService(name string, revisionNames []string, conditions duckv1bet APIVersion: "knative.dev/v1alpha1", }, ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: "default", - Labels: labelMap, - Annotations: annoMap, + Name: name, + Namespace: "default", + Labels: labelMap, + Annotations: annoMap, + CreationTimestamp: metav1.Time{Time: time.Now().Add(-30 * time.Second)}, }, Status: v1alpha1.ServiceStatus{ RouteStatusFields: v1alpha1.RouteStatusFields{ @@ -192,19 +331,57 @@ func createTestService(name string, revisionNames []string, conditions duckv1bet return service } +func addScaling(revision *v1alpha1.Revision, minScale, maxScale, concurrencyTarget, concurrenyLimit string) { + annos := make(map[string]string) + if minScale != "" { + annos[autoscaling.MinScaleAnnotationKey] = minScale + } + if maxScale != "" { + annos[autoscaling.MaxScaleAnnotationKey] = maxScale + } + if concurrencyTarget != "" { + annos[autoscaling.TargetAnnotationKey] = concurrencyTarget + } + revision.Annotations = annos + if concurrenyLimit != "" { + l, _ := strconv.Atoi(concurrenyLimit) + revision.Spec.ContainerConcurrency = v1beta1.RevisionContainerConcurrencyType(l) + } +} + +func addResourceLimits(resources *v1.ResourceRequirements, reqMem, limitMem, reqCpu, limitCpu string) { + (*resources).Requests = getResourceListQuantity(reqMem, reqCpu) + (*resources).Limits = getResourceListQuantity(limitMem, limitCpu) +} + +func getResourceListQuantity(mem string, cpu string) v1.ResourceList { + list := v1.ResourceList{} + if mem != "" { + q, _ := resource.ParseQuantity(mem) + list[v1.ResourceMemory] = q + } + if cpu != "" { + q, _ := resource.ParseQuantity(cpu) + list[v1.ResourceCPU] = q + } + return list +} + func createTestRevision(revision string, gen int64) v1alpha1.Revision { labels := make(map[string]string) labels[api_serving.ConfigurationGenerationLabelKey] = fmt.Sprintf("%d", gen) + return v1alpha1.Revision{ TypeMeta: metav1.TypeMeta{ Kind: "Revision", APIVersion: "knative.dev/v1alpha1", }, ObjectMeta: metav1.ObjectMeta{ - Name: revision, - Namespace: "default", - Generation: 1, - Labels: labels, + Name: revision, + Namespace: "default", + Generation: 1, + Labels: labels, + CreationTimestamp: metav1.Time{Time: time.Now()}, }, Spec: v1alpha1.RevisionSpec{ RevisionSpec: v1beta1.RevisionSpec{ @@ -212,10 +389,36 @@ func createTestRevision(revision string, gen int64) v1alpha1.Revision { Containers: []v1.Container{ { Image: "gcr.io/test/image", + Env: []v1.EnvVar{ + {Name: "env1", Value: "eval1"}, + {Name: "env2", Value: "eval2"}, + }, }, }, }, }, }, + Status: v1alpha1.RevisionStatus{ + ImageDigest: imageDigest, + }, } } + +func goodConditions() duckv1beta1.Conditions { + ret := make(duckv1beta1.Conditions, 0) + ret = append(ret, apis.Condition{ + Type: apis.ConditionReady, + Status: v1.ConditionTrue, + LastTransitionTime: apis.VolatileTime{ + Inner: metav1.Time{Time: time.Now()}, + }, + }) + ret = append(ret, apis.Condition{ + Type: v1alpha1.ServiceConditionRoutesReady, + Status: v1.ConditionTrue, + LastTransitionTime: apis.VolatileTime{ + Inner: metav1.Time{Time: time.Now()}, + }, + }) + return ret +} From 0fe9b2c901025badb1bea49718ff09cb7a6aa106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Wed, 7 Aug 2019 18:56:22 +0200 Subject: [PATCH 14/17] chore: Even moar tests --- pkg/serving/v1alpha1/client_mock_test.go | 30 ++++++++++++++++++++ pkg/serving/v1alpha1/client_test.go | 36 ++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/pkg/serving/v1alpha1/client_mock_test.go b/pkg/serving/v1alpha1/client_mock_test.go index d855ec4640..46ed69cb39 100644 --- a/pkg/serving/v1alpha1/client_mock_test.go +++ b/pkg/serving/v1alpha1/client_mock_test.go @@ -18,6 +18,7 @@ import ( "testing" "time" + api_serving "github.com/knative/serving/pkg/apis/serving" "github.com/knative/serving/pkg/apis/serving/v1alpha1" ) @@ -56,3 +57,32 @@ func TestMockKnClient(t *testing.T) { // Validate recorder.Validate() } + +func TestHasLabelSelector(t *testing.T) { + assertFunction := HasLabelSelector(api_serving.ServiceLabelKey, "myservice") + listConfig := []ListConfig{ + WithService("myservice"), + } + assertFunction(t, listConfig) +} + +func TestHasFieldSelector(t *testing.T) { + assertFunction := HasFieldSelector("metadata.name", "myname") + listConfig := []ListConfig{ + WithName("myname"), + } + assertFunction(t, listConfig) +} + +func TestHasSelector(t *testing.T) { + assertFunction := HasSelector( + []string{api_serving.ServiceLabelKey, "myservice"}, + []string{"metadata.name", "myname"}) + listConfig := []ListConfig{ + func(lo *listConfigCollector) { + lo.Labels[api_serving.ServiceLabelKey] = "myservice" + lo.Fields["metadata.name"] = "myname" + }, + } + assertFunction(t, listConfig) +} diff --git a/pkg/serving/v1alpha1/client_test.go b/pkg/serving/v1alpha1/client_test.go index b8cc355f26..c1e67321cb 100644 --- a/pkg/serving/v1alpha1/client_test.go +++ b/pkg/serving/v1alpha1/client_test.go @@ -394,6 +394,42 @@ func TestWaitForService(t *testing.T) { }) } +func TestGetConfiguration(t *testing.T) { + serving, client := setup() + + const ( + configName = "test-config" + notExistingConfigurationName = "no-revision" + ) + + serving.AddReactor("get", "configurations", + func(a client_testing.Action) (bool, runtime.Object, error) { + configuration := &v1alpha1.Configuration{ObjectMeta: metav1.ObjectMeta{Name: configName, Namespace: testNamespace}} + name := a.(client_testing.GetAction).GetName() + // Sanity check + assert.Assert(t, name != "") + assert.Equal(t, testNamespace, a.GetNamespace()) + if name == configName { + return true, configuration, nil + } + return true, nil, errors.NewNotFound(v1alpha1.Resource("configuration"), name) + }) + + t.Run("getting existing configuration returns configuration and no error", func(t *testing.T) { + configuration, err := client.GetConfiguration(configName) + assert.NilError(t, err) + assert.Equal(t, configName, configuration.Name) + validateGroupVersionKind(t, configuration) + }) + + t.Run("trying to get a configuration with a name that does not exist returns an error", func(t *testing.T) { + configuration, err := client.GetConfiguration(notExistingConfigurationName) + assert.Assert(t, configuration == nil) + assert.ErrorContains(t, err, notExistingConfigurationName) + assert.ErrorContains(t, err, "not found") + }) +} + func validateGroupVersionKind(t *testing.T, obj runtime.Object) { gvkExpected, err := serving.GetGroupVersionKind(obj, v1alpha1.SchemeGroupVersion) assert.NilError(t, err) From 75934c820b9bfcd53de6a3693e9da0683f27cca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Wed, 7 Aug 2019 19:03:26 +0200 Subject: [PATCH 15/17] more, more tests --- pkg/kn/commands/service/service_describe_test.go | 5 ++++- pkg/serving/v1alpha1/client_mock_test.go | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/kn/commands/service/service_describe_test.go b/pkg/kn/commands/service/service_describe_test.go index c9f0c79f64..ddf0c54af0 100644 --- a/pkg/kn/commands/service/service_describe_test.go +++ b/pkg/kn/commands/service/service_describe_test.go @@ -276,7 +276,7 @@ func validateServiceOutput(t *testing.T, service string, output string) { assert.Assert(t, cmp.Regexp("Address:\\s+http://"+service+".default.svc.cluster.local", output)) assert.Assert(t, cmp.Regexp("URL:\\s+"+service+".default.example.com", output)) - assert.Assert(t, util.ContainsAll(output, "Age:", "Revisions:", "Conditions:", "Labels:", "Annotations:")) + assert.Assert(t, util.ContainsAll(output, "Age:", "Revisions:", "Conditions:", "Labels:", "Annotations:", "Port:", "8080")) assert.Assert(t, util.ContainsAll(output, "Ready", "RoutesReady", "OK", "TYPE", "AGE", "REASON")) } @@ -393,6 +393,9 @@ func createTestRevision(revision string, gen int64) v1alpha1.Revision { {Name: "env1", Value: "eval1"}, {Name: "env2", Value: "eval2"}, }, + Ports: []v1.ContainerPort{ + {ContainerPort: 8080}, + }, }, }, }, diff --git a/pkg/serving/v1alpha1/client_mock_test.go b/pkg/serving/v1alpha1/client_mock_test.go index 46ed69cb39..157b6f85e7 100644 --- a/pkg/serving/v1alpha1/client_mock_test.go +++ b/pkg/serving/v1alpha1/client_mock_test.go @@ -40,6 +40,7 @@ func TestMockKnClient(t *testing.T) { recorder.DeleteRevision("hello", nil) recorder.GetRoute("hello", nil, nil) recorder.ListRoutes(Any(), nil, nil) + recorder.GetConfiguration("hello", nil, nil) // Call all services client.GetService("hello") @@ -53,6 +54,7 @@ func TestMockKnClient(t *testing.T) { client.DeleteRevision("hello") client.GetRoute("hello") client.ListRoutes(WithName("blub")) + client.GetConfiguration("hello") // Validate recorder.Validate() From b3341d727f6ffe0cfe364be801df402fcd93635f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Wed, 7 Aug 2019 19:26:07 +0200 Subject: [PATCH 16/17] changelog update --- CHANGELOG.adoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 96bbdc019a..6974eae28b 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -30,6 +30,10 @@ | List revisions sorted by configuration generation | https://github.com/knative/client/pull/332[#332] +| 🎁 +| `kn service describe` +| https://github.com/knative/client/pull/252[#252] + |=== ## v0.2.0 (2019-07-10) From 03eaa6dbc5f1c0ea7f739e323adc2bab489ebd6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Hu=C3=9F?= Date: Thu, 8 Aug 2019 11:35:56 +0200 Subject: [PATCH 17/17] fix(service describe): golint fixes --- pkg/kn/commands/service/service_describe.go | 56 +++++++++---------- .../commands/service/service_describe_test.go | 10 ++-- pkg/printers/prefixwriter.go | 8 +-- pkg/serving/v1alpha1/client_mock.go | 9 +-- 4 files changed, 42 insertions(+), 41 deletions(-) diff --git a/pkg/kn/commands/service/service_describe.go b/pkg/kn/commands/service/service_describe.go index d5ae2a8086..0c53d7918f 100644 --- a/pkg/kn/commands/service/service_describe.go +++ b/pkg/kn/commands/service/service_describe.go @@ -68,7 +68,7 @@ type revisionDesc struct { percent int latest *bool - logUrl string + logURL string timeoutSeconds *int64 image string @@ -84,9 +84,9 @@ type revisionDesc struct { // resource options requestsMemory string - requestsCpu string + requestsCPU string limitsMemory string - limitsCpu string + limitsCPU string } // [REMOVE COMMENT WHEN MOVING TO 0.7.0] @@ -97,7 +97,7 @@ type revisionDesc struct { // As this command does not do any writes/updates, it's just a matter of fallbacks. // [/REMOVE COMMENT WHEN MOVING TO 0.7.0] -// Return a new command for describing a service. +// NewServiceDescribeCommand returns a new command for describing a service. func NewServiceDescribeCommand(p *commands.KnParams) *cobra.Command { // For machine readable output @@ -185,34 +185,34 @@ func describe(w io.Writer, service *v1alpha1.Service, revisions []*revisionDesc) // Write out main service information. Use colors for major items. func writeService(dw printers.PrefixWriter, service *v1alpha1.Service) { - dw.WriteColsLn(printers.LEVEL_0, l("Name"), service.Name) - dw.WriteColsLn(printers.LEVEL_0, l("Namespace"), service.Namespace) - dw.WriteColsLn(printers.LEVEL_0, l("URL"), extractURL(service)) + dw.WriteColsLn(printers.Level0, l("Name"), service.Name) + dw.WriteColsLn(printers.Level0, l("Namespace"), service.Namespace) + dw.WriteColsLn(printers.Level0, l("URL"), extractURL(service)) if service.Status.Address != nil { url := service.Status.Address.GetURL() - dw.WriteColsLn(printers.LEVEL_0, l("Address"), url.String()) + dw.WriteColsLn(printers.Level0, l("Address"), url.String()) } - writeMapDesc(dw, printers.LEVEL_0, service.Labels, l("Labels"), "") - writeMapDesc(dw, printers.LEVEL_0, service.Annotations, l("Annotations"), "") - dw.WriteColsLn(printers.LEVEL_0, l("Age"), age(service.CreationTimestamp.Time)) + writeMapDesc(dw, printers.Level0, service.Labels, l("Labels"), "") + writeMapDesc(dw, printers.Level0, service.Annotations, l("Annotations"), "") + dw.WriteColsLn(printers.Level0, l("Age"), age(service.CreationTimestamp.Time)) } // Write out revisions associated with this service. By default only active // target revisions are printed, but with --all also inactive revisions // created by this services are shown func writeRevisions(dw printers.PrefixWriter, revisions []*revisionDesc) { - dw.WriteColsLn(printers.LEVEL_0, l("Revisions")) + dw.WriteColsLn(printers.Level0, l("Revisions")) for _, revisionDesc := range revisions { - dw.WriteColsLn(printers.LEVEL_1, formatPercentage(revisionDesc.percent), l("Name"), getRevisionNameWithGenerationAndAge(revisionDesc)) - dw.WriteColsLn(printers.LEVEL_1, "", l("Image"), getImageDesc(revisionDesc)) + dw.WriteColsLn(printers.Level1, formatPercentage(revisionDesc.percent), l("Name"), getRevisionNameWithGenerationAndAge(revisionDesc)) + dw.WriteColsLn(printers.Level1, "", l("Image"), getImageDesc(revisionDesc)) if revisionDesc.port != nil { - dw.WriteColsLn(printers.LEVEL_1, "", l("Port"), strconv.FormatInt(int64(*revisionDesc.port), 10)) + dw.WriteColsLn(printers.Level1, "", l("Port"), strconv.FormatInt(int64(*revisionDesc.port), 10)) } - writeSliceDesc(dw, printers.LEVEL_1, revisionDesc.env, l("Env"), "\t") + writeSliceDesc(dw, printers.Level1, revisionDesc.env, l("Env"), "\t") // Scale spec if given if revisionDesc.maxScale != nil || revisionDesc.minScale != nil { - dw.WriteColsLn(printers.LEVEL_1, "", l("Scale"), formatScale(revisionDesc.minScale, revisionDesc.maxScale)) + dw.WriteColsLn(printers.Level1, "", l("Scale"), formatScale(revisionDesc.minScale, revisionDesc.maxScale)) } // Concurrency specs if given @@ -222,34 +222,34 @@ func writeRevisions(dw printers.PrefixWriter, revisions []*revisionDesc) { // Resources if given writeResources(dw, "Memory", revisionDesc.requestsMemory, revisionDesc.limitsMemory) - writeResources(dw, "CPU", revisionDesc.requestsCpu, revisionDesc.limitsCpu) + writeResources(dw, "CPU", revisionDesc.requestsCPU, revisionDesc.limitsCPU) } } // Print out a table with conditions. Use green for 'ok', and red for 'nok' if color is enabled func writeConditions(dw printers.PrefixWriter, service *v1alpha1.Service) { - dw.WriteColsLn(printers.LEVEL_0, l("Conditions")) + dw.WriteColsLn(printers.Level0, l("Conditions")) maxLen := getMaxTypeLen(service.Status.Conditions) formatHeader := "%-2s %-" + strconv.Itoa(maxLen) + "s %6s %-s\n" formatRow := "%-2s %-" + strconv.Itoa(maxLen) + "s %6s %-s\n" - dw.Write(printers.LEVEL_1, formatHeader, "OK", "TYPE", "AGE", "REASON") + dw.Write(printers.Level1, formatHeader, "OK", "TYPE", "AGE", "REASON") for _, condition := range service.Status.Conditions { ok := formatStatus(condition.Status) reason := condition.Reason if printDetails && reason != "" { reason = fmt.Sprintf("%s (%s)", reason, condition.Message) } - dw.Write(printers.LEVEL_1, formatRow, ok, formatConditionType(condition), age(condition.LastTransitionTime.Inner.Time), reason) + dw.Write(printers.Level1, formatRow, ok, formatConditionType(condition), age(condition.LastTransitionTime.Inner.Time), reason) } } func writeConcurrencyOptions(dw printers.PrefixWriter, desc *revisionDesc) { - dw.WriteColsLn(printers.LEVEL_1, "", l("Concurrency")) + dw.WriteColsLn(printers.Level1, "", l("Concurrency")) if desc.concurrencyLimit != nil { - dw.WriteColsLn(printers.LEVEL_2, "", "", l("Limit"), strconv.FormatInt(*desc.concurrencyLimit, 10)) + dw.WriteColsLn(printers.Level2, "", "", l("Limit"), strconv.FormatInt(*desc.concurrencyLimit, 10)) } if desc.concurrencyTarget != nil { - dw.WriteColsLn(printers.LEVEL_2, "", "", l("Target"), strconv.Itoa(*desc.concurrencyTarget)) + dw.WriteColsLn(printers.Level2, "", "", l("Target"), strconv.Itoa(*desc.concurrencyTarget)) } } @@ -400,7 +400,7 @@ func writeResources(dw printers.PrefixWriter, label string, request string, limi return } - dw.WriteColsLn(printers.LEVEL_1, "", l(label), value) + dw.WriteColsLn(printers.Level1, "", l(label), value) } // Join to key=value pair, comma separated, and truncate if longer than a limit @@ -498,7 +498,7 @@ func newRevisionDesc(revision *v1alpha1.Revision, target *v1alpha1.TrafficTarget } revisionDesc := revisionDesc{ name: revision.Name, - logUrl: revision.Status.LogURL, + logURL: revision.Status.LogURL, timeoutSeconds: revision.Spec.TimeoutSeconds, imageDigest: revision.Status.ImageDigest, creationTimestamp: revision.CreationTimestamp.Time, @@ -536,7 +536,7 @@ func addResourcesInfo(desc *revisionDesc, container *v1.Container) { desc.requestsMemory = requests.Memory().String() } if !requests.Cpu().IsZero() { - desc.requestsCpu = requests.Cpu().String() + desc.requestsCPU = requests.Cpu().String() } limits := container.Resources.Limits @@ -544,7 +544,7 @@ func addResourcesInfo(desc *revisionDesc, container *v1.Container) { desc.limitsMemory = limits.Memory().String() } if !limits.Cpu().IsZero() { - desc.limitsCpu = limits.Cpu().String() + desc.limitsCPU = limits.Cpu().String() } } diff --git a/pkg/kn/commands/service/service_describe_test.go b/pkg/kn/commands/service/service_describe_test.go index ddf0c54af0..5db553a4dd 100644 --- a/pkg/kn/commands/service/service_describe_test.go +++ b/pkg/kn/commands/service/service_describe_test.go @@ -146,7 +146,7 @@ func validateOutputLine(t *testing.T, output string, label string, value string) func TestServiceDescribeResources(t *testing.T) { for _, data := range []struct { - reqMem, limitMem, reqCpu, limitCpu string + reqMem, limitMem, reqCPU, limitCPU string memoryOut, cpuOut string }{ {"", "", "", "", "", ""}, @@ -166,7 +166,7 @@ func TestServiceDescribeResources(t *testing.T) { // Get service & revision r.GetService("foo", &expectedService, nil) rev1 := createTestRevision("rev1", 1) - addResourceLimits(&rev1.Spec.Containers[0].Resources, data.reqMem, data.limitMem, data.reqCpu, data.limitCpu) + addResourceLimits(&rev1.Spec.Containers[0].Resources, data.reqMem, data.limitMem, data.reqCPU, data.limitCPU) r.GetRevision("rev1", &rev1, nil) revList := v1alpha1.RevisionList{ @@ -349,9 +349,9 @@ func addScaling(revision *v1alpha1.Revision, minScale, maxScale, concurrencyTarg } } -func addResourceLimits(resources *v1.ResourceRequirements, reqMem, limitMem, reqCpu, limitCpu string) { - (*resources).Requests = getResourceListQuantity(reqMem, reqCpu) - (*resources).Limits = getResourceListQuantity(limitMem, limitCpu) +func addResourceLimits(resources *v1.ResourceRequirements, reqMem, limitMem, reqCPU, limitCPU string) { + (*resources).Requests = getResourceListQuantity(reqMem, reqCPU) + (*resources).Limits = getResourceListQuantity(limitMem, limitCPU) } func getResourceListQuantity(mem string, cpu string) v1.ResourceList { diff --git a/pkg/printers/prefixwriter.go b/pkg/printers/prefixwriter.go index a9b06b9b97..fa0c2093c4 100644 --- a/pkg/printers/prefixwriter.go +++ b/pkg/printers/prefixwriter.go @@ -54,10 +54,10 @@ var _ PrefixWriter = &prefixWriter{} // Each level has 2 spaces for PrefixWriter const ( - LEVEL_0 = iota - LEVEL_1 - LEVEL_2 - LEVEL_3 + Level0 = iota + Level1 + Level2 + Level3 ) func (pw *prefixWriter) Write(level int, format string, a ...interface{}) { diff --git a/pkg/serving/v1alpha1/client_mock.go b/pkg/serving/v1alpha1/client_mock.go index bcdaec3001..850278678d 100644 --- a/pkg/serving/v1alpha1/client_mock.go +++ b/pkg/serving/v1alpha1/client_mock.go @@ -188,12 +188,13 @@ func (c *MockKnClient) ListRoutes(opts ...ListConfig) (*v1alpha1.RouteList, erro return call.result[0].(*v1alpha1.RouteList), errorOrNil(call.result[1]) } -// Get a configuration by name +// GetConfiguration records a call to GetConfiguration with possible return values func (r *Recorder) GetConfiguration(name string, config *v1alpha1.Configuration, err error) { r.add("GetConfiguration", apiMethodCall{[]interface{}{name}, []interface{}{config, err}}) } +// GetConfiguration returns a configuration looked up by name func (c *MockKnClient) GetConfiguration(name string) (*v1alpha1.Configuration, error) { call := c.getCall("GetConfiguration") c.verifyArgs(call, name) @@ -209,7 +210,7 @@ func (r *Recorder) Validate() { } } -// Return a comparable which can be used for asserting that list methods are called +// HasLabelSelector returns a comparable which can be used for asserting that list methods are called // with the appropriate label selector func HasLabelSelector(keyAndValues ...string) func(t *testing.T, a interface{}) { return func(t *testing.T, a interface{}) { @@ -225,7 +226,7 @@ func HasLabelSelector(keyAndValues ...string) func(t *testing.T, a interface{}) } } -// Return a comparable which can be used for asserting that list methods are called +// HasFieldSelector returns a comparable which can be used for asserting that list methods are called // with the appropriate field selectors func HasFieldSelector(keyAndValues ...string) func(t *testing.T, a interface{}) { return func(t *testing.T, a interface{}) { @@ -241,7 +242,7 @@ func HasFieldSelector(keyAndValues ...string) func(t *testing.T, a interface{}) } } -// Return a comparable which can be used for asserting that list methods are called +// HasSelector returns a comparable which can be used for asserting that list methods are called // with the appropriate label and field selectors func HasSelector(labelKeysAndValues []string, fieldKeysAndValue []string) func(t *testing.T, a interface{}) { return func(t *testing.T, a interface{}) {