Merge pull request #145 from humblec/csi-v1.0

Update kube dependencies to v1.13.2 from v1.13.0
This commit is contained in:
Huamin Chen 2019-01-27 10:06:27 -05:00 committed by GitHub
commit b968025037
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 191 additions and 107 deletions

138
Gopkg.lock generated
View File

@ -2,27 +2,34 @@
[[projects]] [[projects]]
digest = "1:94ffc0947c337d618b6ff5ed9abaddc1217b090c1b3a1ae4739b35b7b25851d5"
name = "github.com/container-storage-interface/spec" name = "github.com/container-storage-interface/spec"
packages = ["lib/go/csi"] packages = ["lib/go/csi"]
pruneopts = "NUT"
revision = "ed0bb0e1557548aa028307f48728767cfe8f6345" revision = "ed0bb0e1557548aa028307f48728767cfe8f6345"
version = "v1.0.0" version = "v1.0.0"
[[projects]] [[projects]]
digest = "1:abea725bcf0210887f5da19d804fffa1dd45a42a56bdf5f02322345e3fee4f0d"
name = "github.com/gogo/protobuf" name = "github.com/gogo/protobuf"
packages = [ packages = [
"proto", "proto",
"sortkeys" "sortkeys",
] ]
pruneopts = "NUT"
revision = "4cbf7e384e768b4e01799441fdf2a706a5635ae7" revision = "4cbf7e384e768b4e01799441fdf2a706a5635ae7"
version = "v1.2.0" version = "v1.2.0"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:e2b86e41f3d669fc36b50d31d32d22c8ac656c75aa5ea89717ce7177e134ff2a"
name = "github.com/golang/glog" name = "github.com/golang/glog"
packages = ["."] packages = ["."]
pruneopts = "NUT"
revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998" revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998"
[[projects]] [[projects]]
digest = "1:bff0ce7c8e3d6357fa5a8549bbe4bdb620bddc13c11ae569aa7248ea92e2139f"
name = "github.com/golang/protobuf" name = "github.com/golang/protobuf"
packages = [ packages = [
"descriptor", "descriptor",
@ -32,122 +39,158 @@
"ptypes/any", "ptypes/any",
"ptypes/duration", "ptypes/duration",
"ptypes/timestamp", "ptypes/timestamp",
"ptypes/wrappers" "ptypes/wrappers",
] ]
pruneopts = "NUT"
revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5" revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
version = "v1.2.0" version = "v1.2.0"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:05f95ffdfcf651bdb0f05b40b69e7f5663047f8da75c72d58728acb59b5cc107"
name = "github.com/google/btree" name = "github.com/google/btree"
packages = ["."] packages = ["."]
pruneopts = "NUT"
revision = "4030bb1f1f0c35b30ca7009e9ebd06849dd45306" revision = "4030bb1f1f0c35b30ca7009e9ebd06849dd45306"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:52c5834e2bebac9030c97cc0798ac11c3aa8a39f098aeb419f142533da6cd3cc"
name = "github.com/google/gofuzz" name = "github.com/google/gofuzz"
packages = ["."] packages = ["."]
pruneopts = "NUT"
revision = "24818f796faf91cd76ec7bddd72458fbced7a6c1" revision = "24818f796faf91cd76ec7bddd72458fbced7a6c1"
[[projects]] [[projects]]
digest = "1:56a1f3949ebb7fa22fa6b4e4ac0fe0f77cc4faee5b57413e6fa9199a8458faf1"
name = "github.com/google/uuid" name = "github.com/google/uuid"
packages = ["."] packages = ["."]
pruneopts = "NUT"
revision = "9b3b1e0f5f99ae461456d768e7d301a7acdaa2d8" revision = "9b3b1e0f5f99ae461456d768e7d301a7acdaa2d8"
version = "v1.1.0" version = "v1.1.0"
[[projects]] [[projects]]
digest = "1:06a7dadb7b760767341ffb6c8d377238d68a1226f2b21b5d497d2e3f6ecf6b4e"
name = "github.com/googleapis/gnostic" name = "github.com/googleapis/gnostic"
packages = [ packages = [
"OpenAPIv2", "OpenAPIv2",
"compiler", "compiler",
"extensions" "extensions",
] ]
pruneopts = "NUT"
revision = "7c663266750e7d82587642f65e60bc4083f1f84e" revision = "7c663266750e7d82587642f65e60bc4083f1f84e"
version = "v0.2.0" version = "v0.2.0"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:7fdf3223c7372d1ced0b98bf53457c5e89d89aecbad9a77ba9fcc6e01f9e5621"
name = "github.com/gregjones/httpcache" name = "github.com/gregjones/httpcache"
packages = [ packages = [
".", ".",
"diskcache" "diskcache",
] ]
pruneopts = "NUT"
revision = "c63ab54fda8f77302f8d414e19933f2b6026a089" revision = "c63ab54fda8f77302f8d414e19933f2b6026a089"
[[projects]] [[projects]]
digest = "1:9a52adf44086cead3b384e5d0dbf7a1c1cce65e67552ee3383a8561c42a18cd3"
name = "github.com/imdario/mergo" name = "github.com/imdario/mergo"
packages = ["."] packages = ["."]
pruneopts = "NUT"
revision = "9f23e2d6bd2a77f959b2bf6acdbefd708a83a4a4" revision = "9f23e2d6bd2a77f959b2bf6acdbefd708a83a4a4"
version = "v0.3.6" version = "v0.3.6"
[[projects]] [[projects]]
digest = "1:8e36686e8b139f8fe240c1d5cf3a145bc675c22ff8e707857cdd3ae17b00d728"
name = "github.com/json-iterator/go" name = "github.com/json-iterator/go"
packages = ["."] packages = ["."]
pruneopts = "NUT"
revision = "1624edc4454b8682399def8740d46db5e4362ba4" revision = "1624edc4454b8682399def8740d46db5e4362ba4"
version = "v1.1.5" version = "v1.1.5"
[[projects]] [[projects]]
digest = "1:2b060bb1a39127e592baf9ab62ec1e94100dc22107f915183f3cd1f6d1cd579a"
name = "github.com/kubernetes-csi/csi-lib-utils" name = "github.com/kubernetes-csi/csi-lib-utils"
packages = ["protosanitizer"] packages = ["protosanitizer"]
pruneopts = "NUT"
revision = "5853414e1d4771302e0df10d1870c444c2135799" revision = "5853414e1d4771302e0df10d1870c444c2135799"
version = "v0.2.0" version = "v0.2.0"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:0bde3fb932a1aa4e12bc43ef91157fcda27dd0fc5d9f309647544ceaec075f48"
name = "github.com/kubernetes-csi/drivers" name = "github.com/kubernetes-csi/drivers"
packages = ["pkg/csi-common"] packages = ["pkg/csi-common"]
pruneopts = "NUT"
revision = "05e1ea84df03b90296869812fa42f4244bd5ab53" revision = "05e1ea84df03b90296869812fa42f4244bd5ab53"
[[projects]] [[projects]]
digest = "1:2f42fa12d6911c7b7659738758631bec870b7e9b4c6be5444f963cdcfccc191f"
name = "github.com/modern-go/concurrent" name = "github.com/modern-go/concurrent"
packages = ["."] packages = ["."]
pruneopts = "NUT"
revision = "bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94" revision = "bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94"
version = "1.0.3" version = "1.0.3"
[[projects]] [[projects]]
digest = "1:c6aca19413b13dc59c220ad7430329e2ec454cc310bc6d8de2c7e2b93c18a0f6"
name = "github.com/modern-go/reflect2" name = "github.com/modern-go/reflect2"
packages = ["."] packages = ["."]
pruneopts = "NUT"
revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd" revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd"
version = "1.0.1" version = "1.0.1"
[[projects]] [[projects]]
digest = "1:93b1d84c5fa6d1ea52f4114c37714cddd84d5b78f151b62bb101128dd51399bf"
name = "github.com/pborman/uuid" name = "github.com/pborman/uuid"
packages = ["."] packages = ["."]
pruneopts = "NUT"
revision = "adf5a7427709b9deb95d29d3fa8a2bf9cfd388f1" revision = "adf5a7427709b9deb95d29d3fa8a2bf9cfd388f1"
version = "v1.2" version = "v1.2"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:3bf17a6e6eaa6ad24152148a631d18662f7212e21637c2699bff3369b7f00fa2"
name = "github.com/petar/GoLLRB" name = "github.com/petar/GoLLRB"
packages = ["llrb"] packages = ["llrb"]
pruneopts = "NUT"
revision = "53be0d36a84c2a886ca057d34b6aa4468df9ccb4" revision = "53be0d36a84c2a886ca057d34b6aa4468df9ccb4"
[[projects]] [[projects]]
digest = "1:6c6d91dc326ed6778783cff869c49fb2f61303cdd2ebbcf90abe53505793f3b6"
name = "github.com/peterbourgon/diskv" name = "github.com/peterbourgon/diskv"
packages = ["."] packages = ["."]
pruneopts = "NUT"
revision = "5f041e8faa004a95c88a202771f4cc3e991971e6" revision = "5f041e8faa004a95c88a202771f4cc3e991971e6"
version = "v2.0.1" version = "v2.0.1"
[[projects]] [[projects]]
digest = "1:14715f705ff5dfe0ffd6571d7d201dd8e921030f8070321a79380d8ca4ec1a24"
name = "github.com/pkg/errors" name = "github.com/pkg/errors"
packages = ["."] packages = ["."]
pruneopts = "NUT"
revision = "ba968bfe8b2f7e042a574c888954fccecfa385b4" revision = "ba968bfe8b2f7e042a574c888954fccecfa385b4"
version = "v0.8.1" version = "v0.8.1"
[[projects]] [[projects]]
digest = "1:9d8420bbf131d1618bde6530af37c3799340d3762cc47210c1d9532a4c3a2779"
name = "github.com/spf13/pflag" name = "github.com/spf13/pflag"
packages = ["."] packages = ["."]
pruneopts = "NUT"
revision = "298182f68c66c05229eb03ac171abe6e309ee79a" revision = "298182f68c66c05229eb03ac171abe6e309ee79a"
version = "v1.0.3" version = "v1.0.3"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:38f553aff0273ad6f367cb0a0f8b6eecbaef8dc6cb8b50e57b6a81c1d5b1e332"
name = "golang.org/x/crypto" name = "golang.org/x/crypto"
packages = ["ssh/terminal"] packages = ["ssh/terminal"]
pruneopts = "NUT"
revision = "ff983b9c42bc9fbf91556e191cc8efb585c16908" revision = "ff983b9c42bc9fbf91556e191cc8efb585c16908"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:d4e37d487310720926343302a747f3f9e8f020e5fe961190c57ce437159a6e63"
name = "golang.org/x/net" name = "golang.org/x/net"
packages = [ packages = [
"context", "context",
@ -157,29 +200,35 @@
"http2/hpack", "http2/hpack",
"idna", "idna",
"internal/timeseries", "internal/timeseries",
"trace" "trace",
] ]
pruneopts = "NUT"
revision = "915654e7eabcea33ae277abbecf52f0d8b7a9fdc" revision = "915654e7eabcea33ae277abbecf52f0d8b7a9fdc"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:293b8e3359faf71cc5f85f3c144115ca6540396f4e1ff0fa30cd014c04258c30"
name = "golang.org/x/oauth2" name = "golang.org/x/oauth2"
packages = [ packages = [
".", ".",
"internal" "internal",
] ]
pruneopts = "NUT"
revision = "36a7019397c4c86cf59eeab3bc0d188bac444277" revision = "36a7019397c4c86cf59eeab3bc0d188bac444277"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:0f0298002380ddbc31230516fc1dc354ff466e607823e9122d69cce79310bdc9"
name = "golang.org/x/sys" name = "golang.org/x/sys"
packages = [ packages = [
"unix", "unix",
"windows" "windows",
] ]
pruneopts = "NUT"
revision = "a457fd036447854c0c02e89ea439481bdcf941a2" revision = "a457fd036447854c0c02e89ea439481bdcf941a2"
[[projects]] [[projects]]
digest = "1:e7071ed636b5422cc51c0e3a6cebc229d6c9fffc528814b519a980641422d619"
name = "golang.org/x/text" name = "golang.org/x/text"
packages = [ packages = [
"collate", "collate",
@ -195,18 +244,22 @@
"unicode/bidi", "unicode/bidi",
"unicode/cldr", "unicode/cldr",
"unicode/norm", "unicode/norm",
"unicode/rangetable" "unicode/rangetable",
] ]
pruneopts = "NUT"
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
version = "v0.3.0" version = "v0.3.0"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:9fdc2b55e8e0fafe4b41884091e51e77344f7dc511c5acedcfd98200003bff90"
name = "golang.org/x/time" name = "golang.org/x/time"
packages = ["rate"] packages = ["rate"]
pruneopts = "NUT"
revision = "85acf8d2951cb2a3bde7632f9ff273ef0379bcbd" revision = "85acf8d2951cb2a3bde7632f9ff273ef0379bcbd"
[[projects]] [[projects]]
digest = "1:34c10243da5972105edd1b4b883e2bd918fbb3f73fbe14d6af6929e547173494"
name = "google.golang.org/appengine" name = "google.golang.org/appengine"
packages = [ packages = [
"internal", "internal",
@ -215,18 +268,22 @@
"internal/log", "internal/log",
"internal/remote_api", "internal/remote_api",
"internal/urlfetch", "internal/urlfetch",
"urlfetch" "urlfetch",
] ]
pruneopts = "NUT"
revision = "e9657d882bb81064595ca3b56cbe2546bbabf7b1" revision = "e9657d882bb81064595ca3b56cbe2546bbabf7b1"
version = "v1.4.0" version = "v1.4.0"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:077c1c599507b3b3e9156d17d36e1e61928ee9b53a5b420f10f28ebd4a0b275c"
name = "google.golang.org/genproto" name = "google.golang.org/genproto"
packages = ["googleapis/rpc/status"] packages = ["googleapis/rpc/status"]
pruneopts = "NUT"
revision = "db91494dd46c1fdcbbde05e5ff5eb56df8f7d79a" revision = "db91494dd46c1fdcbbde05e5ff5eb56df8f7d79a"
[[projects]] [[projects]]
digest = "1:638e6e596d67d0a0c8aeb76ebdcf73561b701ea43f21963b1db231d96ed7db68"
name = "google.golang.org/grpc" name = "google.golang.org/grpc"
packages = [ packages = [
".", ".",
@ -259,24 +316,30 @@
"resolver/passthrough", "resolver/passthrough",
"stats", "stats",
"status", "status",
"tap" "tap",
] ]
pruneopts = "NUT"
revision = "df014850f6dee74ba2fc94874043a9f3f75fbfd8" revision = "df014850f6dee74ba2fc94874043a9f3f75fbfd8"
version = "v1.17.0" version = "v1.17.0"
[[projects]] [[projects]]
digest = "1:2d1fbdc6777e5408cabeb02bf336305e724b925ff4546ded0fa8715a7267922a"
name = "gopkg.in/inf.v0" name = "gopkg.in/inf.v0"
packages = ["."] packages = ["."]
pruneopts = "NUT"
revision = "d2d2541c53f18d2a059457998ce2876cc8e67cbf" revision = "d2d2541c53f18d2a059457998ce2876cc8e67cbf"
version = "v0.9.1" version = "v0.9.1"
[[projects]] [[projects]]
digest = "1:18108594151654e9e696b27b181b953f9a90b16bf14d253dd1b397b025a1487f"
name = "gopkg.in/yaml.v2" name = "gopkg.in/yaml.v2"
packages = ["."] packages = ["."]
pruneopts = "NUT"
revision = "51d6538a90f86fe93ac480b35f37b2be17fef232" revision = "51d6538a90f86fe93ac480b35f37b2be17fef232"
version = "v2.2.2" version = "v2.2.2"
[[projects]] [[projects]]
digest = "1:c453ddc26bdab1e4267683a588ad9046e48d803a73f124fe2927adbab6ff02a5"
name = "k8s.io/api" name = "k8s.io/api"
packages = [ packages = [
"admissionregistration/v1alpha1", "admissionregistration/v1alpha1",
@ -310,12 +373,14 @@
"settings/v1alpha1", "settings/v1alpha1",
"storage/v1", "storage/v1",
"storage/v1alpha1", "storage/v1alpha1",
"storage/v1beta1" "storage/v1beta1",
] ]
revision = "89a74a8d264df0e993299876a8cde88379b940ee" pruneopts = "NUT"
version = "kubernetes-1.13.0" revision = "67edc246be36579e46a89e29a2f165d47e012109"
version = "kubernetes-1.13.2"
[[projects]] [[projects]]
digest = "1:a2da0cbc8dfda27eeffa54b53195e607497c6cac737d17f45a667963aeae5f02"
name = "k8s.io/apimachinery" name = "k8s.io/apimachinery"
packages = [ packages = [
"pkg/api/errors", "pkg/api/errors",
@ -353,12 +418,14 @@
"pkg/util/yaml", "pkg/util/yaml",
"pkg/version", "pkg/version",
"pkg/watch", "pkg/watch",
"third_party/forked/golang/reflect" "third_party/forked/golang/reflect",
] ]
pruneopts = "NUT"
revision = "2b1284ed4c93a43499e781493253e2ac5959c4fd" revision = "2b1284ed4c93a43499e781493253e2ac5959c4fd"
version = "kubernetes-1.13.0" version = "kubernetes-1.13.2"
[[projects]] [[projects]]
digest = "1:638623327cb201b425a328d0bddb3379b05eb05ef4cab589380f0be07ac1dc17"
name = "k8s.io/client-go" name = "k8s.io/client-go"
packages = [ packages = [
"discovery", "discovery",
@ -415,44 +482,75 @@
"util/connrotation", "util/connrotation",
"util/flowcontrol", "util/flowcontrol",
"util/homedir", "util/homedir",
"util/integer" "util/integer",
] ]
revision = "e64494209f554a6723674bd494d69445fb76a1d4" pruneopts = "NUT"
version = "kubernetes-1.13.0" revision = "6bf63545bd0257ed9e701ad95307ffa51b4407c0"
version = "kubernetes-1.13.2"
[[projects]] [[projects]]
digest = "1:9cc257b3c9ff6a0158c9c661ab6eebda1fe8a4a4453cd5c4044dc9a2ebfb992b"
name = "k8s.io/klog" name = "k8s.io/klog"
packages = ["."] packages = ["."]
pruneopts = "NUT"
revision = "a5bc97fbc634d635061f3146511332c7e313a55a" revision = "a5bc97fbc634d635061f3146511332c7e313a55a"
version = "v0.1.0" version = "v0.1.0"
[[projects]] [[projects]]
digest = "1:cf54450b967dcae4f270dfa44395b01175e5358bbd79fe8a6073b13f220f1c2e"
name = "k8s.io/kubernetes" name = "k8s.io/kubernetes"
packages = [ packages = [
"pkg/util/file", "pkg/util/file",
"pkg/util/io", "pkg/util/io",
"pkg/util/keymutex", "pkg/util/keymutex",
"pkg/util/mount", "pkg/util/mount",
"pkg/util/nsenter" "pkg/util/nsenter",
] ]
pruneopts = "NUT"
revision = "cff46ab41ff0bb44d8584413b598ad8360ec1def" revision = "cff46ab41ff0bb44d8584413b598ad8360ec1def"
version = "v1.13.2" version = "v1.13.2"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:381323c2fe2e890a3dd3b5d6dc6f2199068408cca89b24f6b7ca1c60f32644a5"
name = "k8s.io/utils" name = "k8s.io/utils"
packages = ["exec"] packages = ["exec"]
pruneopts = "NUT"
revision = "8a16e7dd8fb6d97d1331b0c79a16722f934b00b1" revision = "8a16e7dd8fb6d97d1331b0c79a16722f934b00b1"
[[projects]] [[projects]]
digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c"
name = "sigs.k8s.io/yaml" name = "sigs.k8s.io/yaml"
packages = ["."] packages = ["."]
pruneopts = "NUT"
revision = "fd68e9863619f6ec2fdd8625fe1f02e7c877e480" revision = "fd68e9863619f6ec2fdd8625fe1f02e7c877e480"
version = "v1.1.0" version = "v1.1.0"
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 analyzer-version = 1
inputs-digest = "1f4b8deb03e79a1ae0419d794d2bc213a5c4298cb4cf213f8ef5f6ff8a025c95" input-imports = [
"github.com/container-storage-interface/spec/lib/go/csi",
"github.com/golang/glog",
"github.com/golang/protobuf/ptypes/timestamp",
"github.com/kubernetes-csi/drivers/pkg/csi-common",
"github.com/pborman/uuid",
"github.com/pkg/errors",
"golang.org/x/net/context",
"google.golang.org/grpc/codes",
"google.golang.org/grpc/status",
"k8s.io/api/core/v1",
"k8s.io/apimachinery/pkg/api/errors",
"k8s.io/apimachinery/pkg/apis/meta/v1",
"k8s.io/apimachinery/pkg/util/sets",
"k8s.io/apimachinery/pkg/util/wait",
"k8s.io/client-go/kubernetes",
"k8s.io/client-go/rest",
"k8s.io/client-go/tools/clientcmd",
"k8s.io/kubernetes/pkg/util/keymutex",
"k8s.io/kubernetes/pkg/util/mount",
"k8s.io/kubernetes/pkg/util/nsenter",
"k8s.io/utils/exec",
]
solver-name = "gps-cdcl" solver-name = "gps-cdcl"
solver-version = 1 solver-version = 1

View File

@ -19,15 +19,15 @@
version = "1.10.0" version = "1.10.0"
[[constraint]] [[constraint]]
version = "kubernetes-1.13.0" version = "kubernetes-1.13.2"
name = "k8s.io/apimachinery" name = "k8s.io/apimachinery"
[[constraint]] [[constraint]]
name = "k8s.io/kubernetes" name = "k8s.io/kubernetes"
version = "v1.13.0" version = "v1.13.2"
[[override]] [[override]]
version = "kubernetes-1.13.0" version = "kubernetes-1.13.2"
name = "k8s.io/api" name = "k8s.io/api"
[[override]] [[override]]
@ -36,7 +36,7 @@
[[constraint]] [[constraint]]
name = "k8s.io/client-go" name = "k8s.io/client-go"
version = "kubernetes-1.13.0" version = "kubernetes-1.13.2"
[prune] [prune]
go-tests = true go-tests = true

View File

@ -70,6 +70,11 @@ type Config struct {
// TODO: demonstrate an OAuth2 compatible client. // TODO: demonstrate an OAuth2 compatible client.
BearerToken string BearerToken string
// Path to a file containing a BearerToken.
// If set, the contents are periodically read.
// The last successfully read value takes precedence over BearerToken.
BearerTokenFile string
// Impersonate is the configuration that RESTClient will use for impersonation. // Impersonate is the configuration that RESTClient will use for impersonation.
Impersonate ImpersonationConfig Impersonate ImpersonationConfig
@ -322,9 +327,8 @@ func InClusterConfig() (*Config, error) {
return nil, ErrNotInCluster return nil, ErrNotInCluster
} }
ts := NewCachedFileTokenSource(tokenFile) token, err := ioutil.ReadFile(tokenFile)
if err != nil {
if _, err := ts.Token(); err != nil {
return nil, err return nil, err
} }
@ -340,7 +344,8 @@ func InClusterConfig() (*Config, error) {
// TODO: switch to using cluster DNS. // TODO: switch to using cluster DNS.
Host: "https://" + net.JoinHostPort(host, port), Host: "https://" + net.JoinHostPort(host, port),
TLSClientConfig: tlsClientConfig, TLSClientConfig: tlsClientConfig,
WrapTransport: TokenSourceWrapTransport(ts), BearerToken: string(token),
BearerTokenFile: tokenFile,
}, nil }, nil
} }
@ -436,6 +441,7 @@ func CopyConfig(config *Config) *Config {
Username: config.Username, Username: config.Username,
Password: config.Password, Password: config.Password,
BearerToken: config.BearerToken, BearerToken: config.BearerToken,
BearerTokenFile: config.BearerTokenFile,
Impersonate: ImpersonationConfig{ Impersonate: ImpersonationConfig{
Groups: config.Impersonate.Groups, Groups: config.Impersonate.Groups,
Extra: config.Impersonate.Extra, Extra: config.Impersonate.Extra,

View File

@ -229,11 +229,12 @@ func (config *DirectClientConfig) getUserIdentificationPartialConfig(configAuthI
if len(configAuthInfo.Token) > 0 { if len(configAuthInfo.Token) > 0 {
mergedConfig.BearerToken = configAuthInfo.Token mergedConfig.BearerToken = configAuthInfo.Token
} else if len(configAuthInfo.TokenFile) > 0 { } else if len(configAuthInfo.TokenFile) > 0 {
ts := restclient.NewCachedFileTokenSource(configAuthInfo.TokenFile) tokenBytes, err := ioutil.ReadFile(configAuthInfo.TokenFile)
if _, err := ts.Token(); err != nil { if err != nil {
return nil, err return nil, err
} }
mergedConfig.WrapTransport = restclient.TokenSourceWrapTransport(ts) mergedConfig.BearerToken = string(tokenBytes)
mergedConfig.BearerTokenFile = configAuthInfo.TokenFile
} }
if len(configAuthInfo.Impersonate) > 0 { if len(configAuthInfo.Impersonate) > 0 {
mergedConfig.Impersonate = restclient.ImpersonationConfig{ mergedConfig.Impersonate = restclient.ImpersonationConfig{

View File

@ -39,6 +39,11 @@ type Config struct {
// Bearer token for authentication // Bearer token for authentication
BearerToken string BearerToken string
// Path to a file containing a BearerToken.
// If set, the contents are periodically read.
// The last successfully read value takes precedence over BearerToken.
BearerTokenFile string
// Impersonate is the config that this Config will impersonate using // Impersonate is the config that this Config will impersonate using
Impersonate ImpersonationConfig Impersonate ImpersonationConfig
@ -80,7 +85,7 @@ func (c *Config) HasBasicAuth() bool {
// HasTokenAuth returns whether the configuration has token authentication or not. // HasTokenAuth returns whether the configuration has token authentication or not.
func (c *Config) HasTokenAuth() bool { func (c *Config) HasTokenAuth() bool {
return len(c.BearerToken) != 0 return len(c.BearerToken) != 0 || len(c.BearerTokenFile) != 0
} }
// HasCertAuth returns whether the configuration has certificate authentication or not. // HasCertAuth returns whether the configuration has certificate authentication or not.

View File

@ -22,6 +22,7 @@ import (
"strings" "strings"
"time" "time"
"golang.org/x/oauth2"
"k8s.io/klog" "k8s.io/klog"
utilnet "k8s.io/apimachinery/pkg/util/net" utilnet "k8s.io/apimachinery/pkg/util/net"
@ -44,7 +45,11 @@ func HTTPWrappersForConfig(config *Config, rt http.RoundTripper) (http.RoundTrip
case config.HasBasicAuth() && config.HasTokenAuth(): case config.HasBasicAuth() && config.HasTokenAuth():
return nil, fmt.Errorf("username/password or bearer token may be set, but not both") return nil, fmt.Errorf("username/password or bearer token may be set, but not both")
case config.HasTokenAuth(): case config.HasTokenAuth():
rt = NewBearerAuthRoundTripper(config.BearerToken, rt) var err error
rt, err = NewBearerAuthWithRefreshRoundTripper(config.BearerToken, config.BearerTokenFile, rt)
if err != nil {
return nil, err
}
case config.HasBasicAuth(): case config.HasBasicAuth():
rt = NewBasicAuthRoundTripper(config.Username, config.Password, rt) rt = NewBasicAuthRoundTripper(config.Username, config.Password, rt)
} }
@ -265,13 +270,35 @@ func (rt *impersonatingRoundTripper) WrappedRoundTripper() http.RoundTripper { r
type bearerAuthRoundTripper struct { type bearerAuthRoundTripper struct {
bearer string bearer string
source oauth2.TokenSource
rt http.RoundTripper rt http.RoundTripper
} }
// NewBearerAuthRoundTripper adds the provided bearer token to a request // NewBearerAuthRoundTripper adds the provided bearer token to a request
// unless the authorization header has already been set. // unless the authorization header has already been set.
func NewBearerAuthRoundTripper(bearer string, rt http.RoundTripper) http.RoundTripper { func NewBearerAuthRoundTripper(bearer string, rt http.RoundTripper) http.RoundTripper {
return &bearerAuthRoundTripper{bearer, rt} return &bearerAuthRoundTripper{bearer, nil, rt}
}
// NewBearerAuthRoundTripper adds the provided bearer token to a request
// unless the authorization header has already been set.
// If tokenFile is non-empty, it is periodically read,
// and the last successfully read content is used as the bearer token.
// If tokenFile is non-empty and bearer is empty, the tokenFile is read
// immediately to populate the initial bearer token.
func NewBearerAuthWithRefreshRoundTripper(bearer string, tokenFile string, rt http.RoundTripper) (http.RoundTripper, error) {
if len(tokenFile) == 0 {
return &bearerAuthRoundTripper{bearer, nil, rt}, nil
}
source := NewCachedFileTokenSource(tokenFile)
if len(bearer) == 0 {
token, err := source.Token()
if err != nil {
return nil, err
}
bearer = token.AccessToken
}
return &bearerAuthRoundTripper{bearer, source, rt}, nil
} }
func (rt *bearerAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { func (rt *bearerAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
@ -280,7 +307,13 @@ func (rt *bearerAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response,
} }
req = utilnet.CloneRequest(req) req = utilnet.CloneRequest(req)
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", rt.bearer)) token := rt.bearer
if rt.source != nil {
if refreshedToken, err := rt.source.Token(); err == nil {
token = refreshedToken.AccessToken
}
}
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token))
return rt.rt.RoundTrip(req) return rt.rt.RoundTrip(req)
} }

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package rest package transport
import ( import (
"fmt" "fmt"
@ -47,14 +47,14 @@ func TokenSourceWrapTransport(ts oauth2.TokenSource) func(http.RoundTripper) htt
func NewCachedFileTokenSource(path string) oauth2.TokenSource { func NewCachedFileTokenSource(path string) oauth2.TokenSource {
return &cachingTokenSource{ return &cachingTokenSource{
now: time.Now, now: time.Now,
leeway: 1 * time.Minute, leeway: 10 * time.Second,
base: &fileTokenSource{ base: &fileTokenSource{
path: path, path: path,
// This period was picked because it is half of the minimum validity // This period was picked because it is half of the duration between when the kubelet
// duration for a token provisioned by they TokenRequest API. This is // refreshes a projected service account token and when the original token expires.
// unsophisticated and should induce rotation at a frequency that should // Default token lifetime is 10 minutes, and the kubelet starts refreshing at 80% of lifetime.
// work with the token volume source. // This should induce re-reading at a frequency that works with the token volume source.
period: 5 * time.Minute, period: time.Minute,
}, },
} }
} }

View File

@ -1,59 +0,0 @@
package main
import (
"strings"
)
// LicenseFilePrefix is a list of filename prefixes that indicate it
// might contain a software license
var LicenseFilePrefix = []string{
"licence", // UK spelling
"license", // US spelling
"copying",
"unlicense",
"copyright",
"copyleft",
"authors",
"contributors",
}
// LegalFileSubstring are substrings that indicate the file is likely
// to contain some type of legal declaration. "legal" is often used
// that it might moved to LicenseFilePrefix
var LegalFileSubstring = []string{
"legal",
"notice",
"disclaimer",
"patent",
"third-party",
"thirdparty",
}
// IsLicenseFile returns true if the filename might be contain a
// software license
func IsLicenseFile(filename string) bool {
lowerfile := strings.ToLower(filename)
for _, prefix := range LicenseFilePrefix {
if strings.HasPrefix(lowerfile, prefix) {
return true
}
}
return false
}
// IsLegalFile returns true if the file is likely to contain some type
// of of legal declaration or licensing information
func IsLegalFile(filename string) bool {
lowerfile := strings.ToLower(filename)
for _, prefix := range LicenseFilePrefix {
if strings.HasPrefix(lowerfile, prefix) {
return true
}
}
for _, substring := range LegalFileSubstring {
if strings.Contains(lowerfile, substring) {
return true
}
}
return false
}