From 8e561d9ae7e7e0c55c7bd4a6a708383188b259cd Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Mon, 19 Dec 2016 23:02:39 -0800 Subject: [PATCH] Add support for loading utf16 files. --- Godeps/LICENSES | 175 ++++++++++++++++++++++++++++++++ pkg/kubectl/resource/BUILD | 2 + pkg/kubectl/resource/visitor.go | 9 +- test/test_owners.csv | 2 + vendor/BUILD | 53 ++++++++++ 5 files changed, 240 insertions(+), 1 deletion(-) diff --git a/Godeps/LICENSES b/Godeps/LICENSES index 4d2ba996a2..21e2dd0ba0 100644 --- a/Godeps/LICENSES +++ b/Godeps/LICENSES @@ -74093,6 +74093,146 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================================ +================================================================================ += vendor/golang.org/x/text/encoding licensed under: = + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + += vendor/golang.org/x/text/LICENSE 5d4950ecb7b26d2c5e4e7b4e0dd74707 - +================================================================================ + + +================================================================================ += vendor/golang.org/x/text/encoding/internal licensed under: = + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + += vendor/golang.org/x/text/LICENSE 5d4950ecb7b26d2c5e4e7b4e0dd74707 - +================================================================================ + + +================================================================================ += vendor/golang.org/x/text/encoding/internal/identifier licensed under: = + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + += vendor/golang.org/x/text/LICENSE 5d4950ecb7b26d2c5e4e7b4e0dd74707 - +================================================================================ + + +================================================================================ += vendor/golang.org/x/text/encoding/unicode licensed under: = + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + += vendor/golang.org/x/text/LICENSE 5d4950ecb7b26d2c5e4e7b4e0dd74707 - +================================================================================ + + ================================================================================ = vendor/golang.org/x/text/internal/tag licensed under: = @@ -74128,6 +74268,41 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================================ +================================================================================ += vendor/golang.org/x/text/internal/utf8internal licensed under: = + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + += vendor/golang.org/x/text/LICENSE 5d4950ecb7b26d2c5e4e7b4e0dd74707 - +================================================================================ + + ================================================================================ = vendor/golang.org/x/text/language licensed under: = diff --git a/pkg/kubectl/resource/BUILD b/pkg/kubectl/resource/BUILD index 79ba1d0e4a..eb18be608b 100644 --- a/pkg/kubectl/resource/BUILD +++ b/pkg/kubectl/resource/BUILD @@ -37,6 +37,8 @@ go_library( "//pkg/util/sets:go_default_library", "//pkg/util/yaml:go_default_library", "//pkg/watch:go_default_library", + "//vendor:golang.org/x/text/encoding/unicode", + "//vendor:golang.org/x/text/transform", ], ) diff --git a/pkg/kubectl/resource/visitor.go b/pkg/kubectl/resource/visitor.go index 42c45a02ec..a765243b70 100644 --- a/pkg/kubectl/resource/visitor.go +++ b/pkg/kubectl/resource/visitor.go @@ -26,6 +26,9 @@ import ( "path/filepath" "time" + "golang.org/x/text/encoding/unicode" + "golang.org/x/text/transform" + "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/meta" @@ -489,7 +492,11 @@ func (v *FileVisitor) Visit(fn VisitorFunc) error { } } defer f.Close() - v.StreamVisitor.Reader = f + + // TODO: Consider adding a flag to force to UTF16, apparently some + // Windows tools don't write the BOM + utf16bom := unicode.BOMOverride(unicode.UTF8.NewDecoder()) + v.StreamVisitor.Reader = transform.NewReader(f, utf16bom) return v.StreamVisitor.Visit(fn) } diff --git a/test/test_owners.csv b/test/test_owners.csv index eec5f60658..d31bf1fa33 100644 --- a/test/test_owners.csv +++ b/test/test_owners.csv @@ -179,6 +179,8 @@ Federation secrets Secret objects should be created and deleted successfully,pmo Federation secrets Secret objects should be deleted from underlying clusters when OrphanDependents is false,nikhiljindal,0 Federation secrets Secret objects should not be deleted from underlying clusters when OrphanDependents is nil,nikhiljindal,0 Federation secrets Secret objects should not be deleted from underlying clusters when OrphanDependents is true,nikhiljindal,0 +Firewall rule should create valid firewall rules for LoadBalancer type service,brendandburns,0 +Firewall rule should have correct firewall rules for e2e cluster,brendandburns,0 GCP Volumes GlusterFS should be mountable,nikhiljindal,0 GCP Volumes NFSv4 should be mountable for NFSv4,nikhiljindal,0 GKE local SSD should write and read from node local SSD,fabioy,0 diff --git a/vendor/BUILD b/vendor/BUILD index a4d61d1dce..fc304a6a52 100644 --- a/vendor/BUILD +++ b/vendor/BUILD @@ -12056,3 +12056,56 @@ go_library( "//pkg/api/v1:go_default_library", ], ) + +go_library( + name = "golang.org/x/text/encoding", + srcs = ["golang.org/x/text/encoding/encoding.go"], + tags = ["automanaged"], + deps = [ + "//vendor:golang.org/x/text/encoding/internal/identifier", + "//vendor:golang.org/x/text/transform", + ], +) + +go_library( + name = "golang.org/x/text/encoding/internal", + srcs = ["golang.org/x/text/encoding/internal/internal.go"], + tags = ["automanaged"], + deps = [ + "//vendor:golang.org/x/text/encoding", + "//vendor:golang.org/x/text/encoding/internal/identifier", + "//vendor:golang.org/x/text/transform", + ], +) + +go_library( + name = "golang.org/x/text/encoding/internal/identifier", + srcs = [ + "golang.org/x/text/encoding/internal/identifier/identifier.go", + "golang.org/x/text/encoding/internal/identifier/mib.go", + ], + tags = ["automanaged"], +) + +go_library( + name = "golang.org/x/text/encoding/unicode", + srcs = [ + "golang.org/x/text/encoding/unicode/override.go", + "golang.org/x/text/encoding/unicode/unicode.go", + ], + tags = ["automanaged"], + deps = [ + "//vendor:golang.org/x/text/encoding", + "//vendor:golang.org/x/text/encoding/internal", + "//vendor:golang.org/x/text/encoding/internal/identifier", + "//vendor:golang.org/x/text/internal/utf8internal", + "//vendor:golang.org/x/text/runes", + "//vendor:golang.org/x/text/transform", + ], +) + +go_library( + name = "golang.org/x/text/internal/utf8internal", + srcs = ["golang.org/x/text/internal/utf8internal/utf8internal.go"], + tags = ["automanaged"], +)