mirror of
https://github.com/kubernetes/sample-controller.git
synced 2025-03-03 15:52:54 +08:00
Merge pull request #72193 from kargakis/owners
Remove myself from OWNERS where I am not active Kubernetes-commit: 544c49ab030a8930f3a6903de232473e0bf4e8e5
This commit is contained in:
commit
9925b3e980
488
Godeps/Godeps.json
generated
488
Godeps/Godeps.json
generated
File diff suppressed because it is too large
Load Diff
1
OWNERS
1
OWNERS
@ -3,7 +3,6 @@ approvers:
|
||||
- munnerz
|
||||
reviewers:
|
||||
- gregory-m
|
||||
- kargakis
|
||||
- sttts
|
||||
- munnerz
|
||||
- nikhita
|
||||
|
2
vendor/k8s.io/api/storage/v1/generated.proto
generated
vendored
2
vendor/k8s.io/api/storage/v1/generated.proto
generated
vendored
@ -178,7 +178,7 @@ message VolumeError {
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.Time time = 1;
|
||||
|
||||
// String detailing the error encountered during Attach or Detach operation.
|
||||
// This string maybe logged, so it should not contain sensitive
|
||||
// This string may be logged, so it should not contain sensitive
|
||||
// information.
|
||||
// +optional
|
||||
optional string message = 2;
|
||||
|
2
vendor/k8s.io/api/storage/v1/types.go
generated
vendored
2
vendor/k8s.io/api/storage/v1/types.go
generated
vendored
@ -204,7 +204,7 @@ type VolumeError struct {
|
||||
Time metav1.Time `json:"time,omitempty" protobuf:"bytes,1,opt,name=time"`
|
||||
|
||||
// String detailing the error encountered during Attach or Detach operation.
|
||||
// This string maybe logged, so it should not contain sensitive
|
||||
// This string may be logged, so it should not contain sensitive
|
||||
// information.
|
||||
// +optional
|
||||
Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"`
|
||||
|
2
vendor/k8s.io/api/storage/v1/types_swagger_doc_generated.go
generated
vendored
2
vendor/k8s.io/api/storage/v1/types_swagger_doc_generated.go
generated
vendored
@ -109,7 +109,7 @@ func (VolumeAttachmentStatus) SwaggerDoc() map[string]string {
|
||||
var map_VolumeError = map[string]string{
|
||||
"": "VolumeError captures an error encountered during a volume operation.",
|
||||
"time": "Time the error was encountered.",
|
||||
"message": "String detailing the error encountered during Attach or Detach operation. This string maybe logged, so it should not contain sensitive information.",
|
||||
"message": "String detailing the error encountered during Attach or Detach operation. This string may be logged, so it should not contain sensitive information.",
|
||||
}
|
||||
|
||||
func (VolumeError) SwaggerDoc() map[string]string {
|
||||
|
2
vendor/k8s.io/api/storage/v1beta1/generated.proto
generated
vendored
2
vendor/k8s.io/api/storage/v1beta1/generated.proto
generated
vendored
@ -178,7 +178,7 @@ message VolumeError {
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.Time time = 1;
|
||||
|
||||
// String detailing the error encountered during Attach or Detach operation.
|
||||
// This string maybe logged, so it should not contain sensitive
|
||||
// This string may be logged, so it should not contain sensitive
|
||||
// information.
|
||||
// +optional
|
||||
optional string message = 2;
|
||||
|
2
vendor/k8s.io/api/storage/v1beta1/types.go
generated
vendored
2
vendor/k8s.io/api/storage/v1beta1/types.go
generated
vendored
@ -204,7 +204,7 @@ type VolumeError struct {
|
||||
Time metav1.Time `json:"time,omitempty" protobuf:"bytes,1,opt,name=time"`
|
||||
|
||||
// String detailing the error encountered during Attach or Detach operation.
|
||||
// This string maybe logged, so it should not contain sensitive
|
||||
// This string may be logged, so it should not contain sensitive
|
||||
// information.
|
||||
// +optional
|
||||
Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"`
|
||||
|
2
vendor/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go
generated
vendored
2
vendor/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go
generated
vendored
@ -109,7 +109,7 @@ func (VolumeAttachmentStatus) SwaggerDoc() map[string]string {
|
||||
var map_VolumeError = map[string]string{
|
||||
"": "VolumeError captures an error encountered during a volume operation.",
|
||||
"time": "Time the error was encountered.",
|
||||
"message": "String detailing the error encountered during Attach or Detach operation. This string maybe logged, so it should not contain sensitive information.",
|
||||
"message": "String detailing the error encountered during Attach or Detach operation. This string may be logged, so it should not contain sensitive information.",
|
||||
}
|
||||
|
||||
func (VolumeError) SwaggerDoc() map[string]string {
|
||||
|
13
vendor/k8s.io/apimachinery/pkg/api/meta/help.go
generated
vendored
13
vendor/k8s.io/apimachinery/pkg/api/meta/help.go
generated
vendored
@ -158,6 +158,19 @@ func ExtractList(obj runtime.Object) ([]runtime.Object, error) {
|
||||
// objectSliceType is the type of a slice of Objects
|
||||
var objectSliceType = reflect.TypeOf([]runtime.Object{})
|
||||
|
||||
// LenList returns the length of this list or 0 if it is not a list.
|
||||
func LenList(list runtime.Object) int {
|
||||
itemsPtr, err := GetItemsPtr(list)
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
items, err := conversion.EnforcePtr(itemsPtr)
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
return items.Len()
|
||||
}
|
||||
|
||||
// SetList sets the given list object's Items member have the elements given in
|
||||
// objects.
|
||||
// Returns an error if list is not a List type (does not have an Items member),
|
||||
|
10
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go
generated
vendored
10
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go
generated
vendored
@ -48,3 +48,13 @@ func (d *Duration) UnmarshalJSON(b []byte) error {
|
||||
func (d Duration) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(d.Duration.String())
|
||||
}
|
||||
|
||||
// OpenAPISchemaType is used by the kube-openapi generator when constructing
|
||||
// the OpenAPI spec of this type.
|
||||
//
|
||||
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
|
||||
func (_ Duration) OpenAPISchemaType() []string { return []string{"string"} }
|
||||
|
||||
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
|
||||
// the OpenAPI spec of this type.
|
||||
func (_ Duration) OpenAPISchemaFormat() string { return "" }
|
||||
|
12
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go
generated
vendored
12
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go
generated
vendored
@ -232,3 +232,15 @@ func HasObjectMetaSystemFieldValues(meta Object) bool {
|
||||
return !meta.GetCreationTimestamp().Time.IsZero() ||
|
||||
len(meta.GetUID()) != 0
|
||||
}
|
||||
|
||||
// ResetObjectMetaForStatus forces the meta fields for a status update to match the meta fields
|
||||
// for a pre-existing object. This is opt-in for new objects with Status subresource.
|
||||
func ResetObjectMetaForStatus(meta, existingMeta Object) {
|
||||
meta.SetDeletionTimestamp(existingMeta.GetDeletionTimestamp())
|
||||
meta.SetGeneration(existingMeta.GetGeneration())
|
||||
meta.SetSelfLink(existingMeta.GetSelfLink())
|
||||
meta.SetLabels(existingMeta.GetLabels())
|
||||
meta.SetAnnotations(existingMeta.GetAnnotations())
|
||||
meta.SetFinalizers(existingMeta.GetFinalizers())
|
||||
meta.SetOwnerReferences(existingMeta.GetOwnerReferences())
|
||||
}
|
||||
|
3
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go
generated
vendored
3
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go
generated
vendored
@ -47,6 +47,9 @@ func NestedFieldNoCopy(obj map[string]interface{}, fields ...string) (interface{
|
||||
var val interface{} = obj
|
||||
|
||||
for i, field := range fields {
|
||||
if val == nil {
|
||||
return nil, false, nil
|
||||
}
|
||||
if m, ok := val.(map[string]interface{}); ok {
|
||||
val, ok = m[field]
|
||||
if !ok {
|
||||
|
2
vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/streaming.go
generated
vendored
2
vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/streaming.go
generated
vendored
@ -64,7 +64,7 @@ func NewDecoder(r io.ReadCloser, d runtime.Decoder) Decoder {
|
||||
reader: r,
|
||||
decoder: d,
|
||||
buf: make([]byte, 1024),
|
||||
maxBytes: 1024 * 1024,
|
||||
maxBytes: 16 * 1024 * 1024,
|
||||
}
|
||||
}
|
||||
|
||||
|
62
vendor/k8s.io/apimachinery/pkg/util/wait/wait.go
generated
vendored
62
vendor/k8s.io/apimachinery/pkg/util/wait/wait.go
generated
vendored
@ -173,10 +173,49 @@ type ConditionFunc func() (done bool, err error)
|
||||
|
||||
// Backoff holds parameters applied to a Backoff function.
|
||||
type Backoff struct {
|
||||
Duration time.Duration // the base duration
|
||||
Factor float64 // Duration is multiplied by factor each iteration
|
||||
Jitter float64 // The amount of jitter applied each iteration
|
||||
Steps int // Exit with error after this many steps
|
||||
// The initial duration.
|
||||
Duration time.Duration
|
||||
// Duration is multiplied by factor each iteration. Must be greater
|
||||
// than or equal to zero.
|
||||
Factor float64
|
||||
// The amount of jitter applied each iteration. Jitter is applied after
|
||||
// cap.
|
||||
Jitter float64
|
||||
// The number of steps before duration stops changing. If zero, initial
|
||||
// duration is always used. Used for exponential backoff in combination
|
||||
// with Factor.
|
||||
Steps int
|
||||
// The returned duration will never be greater than cap *before* jitter
|
||||
// is applied. The actual maximum cap is `cap * (1.0 + jitter)`.
|
||||
Cap time.Duration
|
||||
}
|
||||
|
||||
// Step returns the next interval in the exponential backoff. This method
|
||||
// will mutate the provided backoff.
|
||||
func (b *Backoff) Step() time.Duration {
|
||||
if b.Steps < 1 {
|
||||
if b.Jitter > 0 {
|
||||
return Jitter(b.Duration, b.Jitter)
|
||||
}
|
||||
return b.Duration
|
||||
}
|
||||
b.Steps--
|
||||
|
||||
duration := b.Duration
|
||||
|
||||
// calculate the next step
|
||||
if b.Factor != 0 {
|
||||
b.Duration = time.Duration(float64(b.Duration) * b.Factor)
|
||||
if b.Cap > 0 && b.Duration > b.Cap {
|
||||
b.Duration = b.Cap
|
||||
b.Steps = 0
|
||||
}
|
||||
}
|
||||
|
||||
if b.Jitter > 0 {
|
||||
duration = Jitter(duration, b.Jitter)
|
||||
}
|
||||
return duration
|
||||
}
|
||||
|
||||
// ExponentialBackoff repeats a condition check with exponential backoff.
|
||||
@ -190,19 +229,14 @@ type Backoff struct {
|
||||
// If the condition never returns true, ErrWaitTimeout is returned. All other
|
||||
// errors terminate immediately.
|
||||
func ExponentialBackoff(backoff Backoff, condition ConditionFunc) error {
|
||||
duration := backoff.Duration
|
||||
for i := 0; i < backoff.Steps; i++ {
|
||||
if i != 0 {
|
||||
adjusted := duration
|
||||
if backoff.Jitter > 0.0 {
|
||||
adjusted = Jitter(duration, backoff.Jitter)
|
||||
}
|
||||
time.Sleep(adjusted)
|
||||
duration = time.Duration(float64(duration) * backoff.Factor)
|
||||
}
|
||||
for backoff.Steps > 0 {
|
||||
if ok, err := condition(); err != nil || ok {
|
||||
return err
|
||||
}
|
||||
if backoff.Steps == 1 {
|
||||
break
|
||||
}
|
||||
time.Sleep(backoff.Step())
|
||||
}
|
||||
return ErrWaitTimeout
|
||||
}
|
||||
|
8
vendor/k8s.io/client-go/discovery/discovery_client.go
generated
vendored
8
vendor/k8s.io/client-go/discovery/discovery_client.go
generated
vendored
@ -26,7 +26,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/googleapis/gnostic/OpenAPIv2"
|
||||
openapi_v2 "github.com/googleapis/gnostic/OpenAPIv2"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@ -60,6 +60,9 @@ type DiscoveryInterface interface {
|
||||
}
|
||||
|
||||
// CachedDiscoveryInterface is a DiscoveryInterface with cache invalidation and freshness.
|
||||
// Note that If the ServerResourcesForGroupVersion method returns a cache miss
|
||||
// error, the user needs to explicitly call Invalidate to clear the cache,
|
||||
// otherwise the same cache miss error will be returned next time.
|
||||
type CachedDiscoveryInterface interface {
|
||||
DiscoveryInterface
|
||||
// Fresh is supposed to tell the caller whether or not to retry if the cache
|
||||
@ -68,7 +71,8 @@ type CachedDiscoveryInterface interface {
|
||||
// TODO: this needs to be revisited, this interface can't be locked properly
|
||||
// and doesn't make a lot of sense.
|
||||
Fresh() bool
|
||||
// Invalidate enforces that no cached data is used in the future that is older than the current time.
|
||||
// Invalidate enforces that no cached data that is older than the current time
|
||||
// is used.
|
||||
Invalidate()
|
||||
}
|
||||
|
||||
|
26
vendor/k8s.io/client-go/rest/config.go
generated
vendored
26
vendor/k8s.io/client-go/rest/config.go
generated
vendored
@ -70,6 +70,11 @@ type Config struct {
|
||||
// TODO: demonstrate an OAuth2 compatible client.
|
||||
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 ImpersonationConfig
|
||||
|
||||
@ -322,9 +327,8 @@ func InClusterConfig() (*Config, error) {
|
||||
return nil, ErrNotInCluster
|
||||
}
|
||||
|
||||
ts := NewCachedFileTokenSource(tokenFile)
|
||||
|
||||
if _, err := ts.Token(); err != nil {
|
||||
token, err := ioutil.ReadFile(tokenFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -340,7 +344,8 @@ func InClusterConfig() (*Config, error) {
|
||||
// TODO: switch to using cluster DNS.
|
||||
Host: "https://" + net.JoinHostPort(host, port),
|
||||
TLSClientConfig: tlsClientConfig,
|
||||
WrapTransport: TokenSourceWrapTransport(ts),
|
||||
BearerToken: string(token),
|
||||
BearerTokenFile: tokenFile,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -430,12 +435,13 @@ func AnonymousClientConfig(config *Config) *Config {
|
||||
// CopyConfig returns a copy of the given config
|
||||
func CopyConfig(config *Config) *Config {
|
||||
return &Config{
|
||||
Host: config.Host,
|
||||
APIPath: config.APIPath,
|
||||
ContentConfig: config.ContentConfig,
|
||||
Username: config.Username,
|
||||
Password: config.Password,
|
||||
BearerToken: config.BearerToken,
|
||||
Host: config.Host,
|
||||
APIPath: config.APIPath,
|
||||
ContentConfig: config.ContentConfig,
|
||||
Username: config.Username,
|
||||
Password: config.Password,
|
||||
BearerToken: config.BearerToken,
|
||||
BearerTokenFile: config.BearerTokenFile,
|
||||
Impersonate: ImpersonationConfig{
|
||||
Groups: config.Impersonate.Groups,
|
||||
Extra: config.Impersonate.Extra,
|
||||
|
3
vendor/k8s.io/client-go/rest/request.go
generated
vendored
3
vendor/k8s.io/client-go/rest/request.go
generated
vendored
@ -1195,7 +1195,6 @@ func IsValidPathSegmentPrefix(name string) []string {
|
||||
func ValidatePathSegmentName(name string, prefix bool) []string {
|
||||
if prefix {
|
||||
return IsValidPathSegmentPrefix(name)
|
||||
} else {
|
||||
return IsValidPathSegmentName(name)
|
||||
}
|
||||
return IsValidPathSegmentName(name)
|
||||
}
|
||||
|
6
vendor/k8s.io/client-go/testing/fixture.go
generated
vendored
6
vendor/k8s.io/client-go/testing/fixture.go
generated
vendored
@ -339,8 +339,10 @@ func (t *tracker) getWatches(gvr schema.GroupVersionResource, ns string) []*watc
|
||||
if w := t.watchers[gvr][ns]; w != nil {
|
||||
watches = append(watches, w...)
|
||||
}
|
||||
if w := t.watchers[gvr][""]; w != nil {
|
||||
watches = append(watches, w...)
|
||||
if ns != metav1.NamespaceAll {
|
||||
if w := t.watchers[gvr][metav1.NamespaceAll]; w != nil {
|
||||
watches = append(watches, w...)
|
||||
}
|
||||
}
|
||||
}
|
||||
return watches
|
||||
|
1
vendor/k8s.io/client-go/tools/cache/OWNERS
generated
vendored
1
vendor/k8s.io/client-go/tools/cache/OWNERS
generated
vendored
@ -22,7 +22,6 @@ reviewers:
|
||||
- erictune
|
||||
- davidopp
|
||||
- pmorie
|
||||
- kargakis
|
||||
- janetkuo
|
||||
- justinsb
|
||||
- eparis
|
||||
|
7
vendor/k8s.io/client-go/tools/clientcmd/client_config.go
generated
vendored
7
vendor/k8s.io/client-go/tools/clientcmd/client_config.go
generated
vendored
@ -229,11 +229,12 @@ func (config *DirectClientConfig) getUserIdentificationPartialConfig(configAuthI
|
||||
if len(configAuthInfo.Token) > 0 {
|
||||
mergedConfig.BearerToken = configAuthInfo.Token
|
||||
} else if len(configAuthInfo.TokenFile) > 0 {
|
||||
ts := restclient.NewCachedFileTokenSource(configAuthInfo.TokenFile)
|
||||
if _, err := ts.Token(); err != nil {
|
||||
tokenBytes, err := ioutil.ReadFile(configAuthInfo.TokenFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mergedConfig.WrapTransport = restclient.TokenSourceWrapTransport(ts)
|
||||
mergedConfig.BearerToken = string(tokenBytes)
|
||||
mergedConfig.BearerTokenFile = configAuthInfo.TokenFile
|
||||
}
|
||||
if len(configAuthInfo.Impersonate) > 0 {
|
||||
mergedConfig.Impersonate = restclient.ImpersonationConfig{
|
||||
|
7
vendor/k8s.io/client-go/transport/config.go
generated
vendored
7
vendor/k8s.io/client-go/transport/config.go
generated
vendored
@ -39,6 +39,11 @@ type Config struct {
|
||||
// Bearer token for authentication
|
||||
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 ImpersonationConfig
|
||||
|
||||
@ -80,7 +85,7 @@ func (c *Config) HasBasicAuth() bool {
|
||||
|
||||
// HasTokenAuth returns whether the configuration has token authentication or not.
|
||||
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.
|
||||
|
39
vendor/k8s.io/client-go/transport/round_trippers.go
generated
vendored
39
vendor/k8s.io/client-go/transport/round_trippers.go
generated
vendored
@ -22,6 +22,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
"k8s.io/klog"
|
||||
|
||||
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():
|
||||
return nil, fmt.Errorf("username/password or bearer token may be set, but not both")
|
||||
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():
|
||||
rt = NewBasicAuthRoundTripper(config.Username, config.Password, rt)
|
||||
}
|
||||
@ -265,13 +270,35 @@ func (rt *impersonatingRoundTripper) WrappedRoundTripper() http.RoundTripper { r
|
||||
|
||||
type bearerAuthRoundTripper struct {
|
||||
bearer string
|
||||
source oauth2.TokenSource
|
||||
rt http.RoundTripper
|
||||
}
|
||||
|
||||
// NewBearerAuthRoundTripper adds the provided bearer token to a request
|
||||
// unless the authorization header has already been set.
|
||||
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) {
|
||||
@ -280,7 +307,13 @@ func (rt *bearerAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response,
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package rest
|
||||
package transport
|
||||
|
||||
import (
|
||||
"fmt"
|
2
vendor/k8s.io/client-go/util/workqueue/default_rate_limiters.go
generated
vendored
2
vendor/k8s.io/client-go/util/workqueue/default_rate_limiters.go
generated
vendored
@ -35,7 +35,7 @@ type RateLimiter interface {
|
||||
}
|
||||
|
||||
// DefaultControllerRateLimiter is a no-arg constructor for a default rate limiter for a workqueue. It has
|
||||
// both overall and per-item rate limitting. The overall is a token bucket and the per-item is exponential
|
||||
// both overall and per-item rate limiting. The overall is a token bucket and the per-item is exponential
|
||||
func DefaultControllerRateLimiter() RateLimiter {
|
||||
return NewMaxOfRateLimiter(
|
||||
NewItemExponentialFailureRateLimiter(5*time.Millisecond, 1000*time.Second),
|
||||
|
27
vendor/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go
generated
vendored
27
vendor/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go
generated
vendored
@ -27,6 +27,7 @@ import (
|
||||
"k8s.io/code-generator/cmd/client-gen/generators/util"
|
||||
"k8s.io/code-generator/cmd/client-gen/path"
|
||||
clientgentypes "k8s.io/code-generator/cmd/client-gen/types"
|
||||
codegennamer "k8s.io/code-generator/pkg/namer"
|
||||
"k8s.io/gengo/args"
|
||||
"k8s.io/gengo/generator"
|
||||
"k8s.io/gengo/namer"
|
||||
@ -101,7 +102,7 @@ func NameSystems() namer.NameSystems {
|
||||
"publicPlural": publicPluralNamer,
|
||||
"privatePlural": privatePluralNamer,
|
||||
"allLowercasePlural": lowercaseNamer,
|
||||
"resource": NewTagOverrideNamer("resourceName", lowercaseNamer),
|
||||
"resource": codegennamer.NewTagOverrideNamer("resourceName", lowercaseNamer),
|
||||
}
|
||||
}
|
||||
|
||||
@ -400,27 +401,3 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
|
||||
return generator.Packages(packageList)
|
||||
}
|
||||
|
||||
// tagOverrideNamer is a namer which pulls names from a given tag, if specified,
|
||||
// and otherwise falls back to a different namer.
|
||||
type tagOverrideNamer struct {
|
||||
tagName string
|
||||
fallback namer.Namer
|
||||
}
|
||||
|
||||
func (n *tagOverrideNamer) Name(t *types.Type) string {
|
||||
if nameOverride := extractTag(n.tagName, append(t.SecondClosestCommentLines, t.CommentLines...)); nameOverride != "" {
|
||||
return nameOverride
|
||||
}
|
||||
|
||||
return n.fallback.Name(t)
|
||||
}
|
||||
|
||||
// NewTagOverrideNamer creates a namer.Namer which uses the contents of the given tag as
|
||||
// the name, or falls back to another Namer if the tag is not present.
|
||||
func NewTagOverrideNamer(tagName string, fallback namer.Namer) namer.Namer {
|
||||
return &tagOverrideNamer{
|
||||
tagName: tagName,
|
||||
fallback: fallback,
|
||||
}
|
||||
}
|
||||
|
4
vendor/k8s.io/code-generator/cmd/informer-gen/generators/generic.go
generated
vendored
4
vendor/k8s.io/code-generator/cmd/informer-gen/generators/generic.go
generated
vendored
@ -22,6 +22,7 @@ import (
|
||||
"strings"
|
||||
|
||||
clientgentypes "k8s.io/code-generator/cmd/client-gen/types"
|
||||
codegennamer "k8s.io/code-generator/pkg/namer"
|
||||
"k8s.io/gengo/generator"
|
||||
"k8s.io/gengo/namer"
|
||||
"k8s.io/gengo/types"
|
||||
@ -56,6 +57,7 @@ func (g *genericGenerator) Namers(c *generator.Context) namer.NameSystems {
|
||||
"raw": namer.NewRawNamer(g.outputPackage, g.imports),
|
||||
"allLowercasePlural": namer.NewAllLowercasePluralNamer(pluralExceptions),
|
||||
"publicPlural": namer.NewPublicPluralNamer(pluralExceptions),
|
||||
"resource": codegennamer.NewTagOverrideNamer("resourceName", namer.NewAllLowercasePluralNamer(pluralExceptions)),
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,7 +170,7 @@ func (f *sharedInformerFactory) ForResource(resource {{.schemaGroupVersionResour
|
||||
{{range $version := .Versions -}}
|
||||
// Group={{$group.Name}}, Version={{.Name}}
|
||||
{{range .Resources -}}
|
||||
case {{index $.schemeGVs $version|raw}}.WithResource("{{.|allLowercasePlural}}"):
|
||||
case {{index $.schemeGVs $version|raw}}.WithResource("{{.|resource}}"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.{{$GroupGoName}}().{{$version.GoName}}().{{.|publicPlural}}().Informer()}, nil
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
@ -14,12 +14,38 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package generators
|
||||
package namer
|
||||
|
||||
import (
|
||||
"k8s.io/gengo/namer"
|
||||
"k8s.io/gengo/types"
|
||||
)
|
||||
|
||||
// TagOverrideNamer is a namer which pulls names from a given tag, if specified,
|
||||
// and otherwise falls back to a different namer.
|
||||
type TagOverrideNamer struct {
|
||||
tagName string
|
||||
fallback namer.Namer
|
||||
}
|
||||
|
||||
// Name returns the tag value if it exists. It no tag was found the fallback namer will be used
|
||||
func (n *TagOverrideNamer) Name(t *types.Type) string {
|
||||
if nameOverride := extractTag(n.tagName, append(t.SecondClosestCommentLines, t.CommentLines...)); nameOverride != "" {
|
||||
return nameOverride
|
||||
}
|
||||
|
||||
return n.fallback.Name(t)
|
||||
}
|
||||
|
||||
// NewTagOverrideNamer creates a namer.Namer which uses the contents of the given tag as
|
||||
// the name, or falls back to another Namer if the tag is not present.
|
||||
func NewTagOverrideNamer(tagName string, fallback namer.Namer) namer.Namer {
|
||||
return &TagOverrideNamer{
|
||||
tagName: tagName,
|
||||
fallback: fallback,
|
||||
}
|
||||
}
|
||||
|
||||
// extractTag gets the comment-tags for the key. If the tag did not exist, it
|
||||
// returns the empty string.
|
||||
func extractTag(key string, lines []string) string {
|
Loading…
Reference in New Issue
Block a user