mirror of
https://github.com/kubernetes/sample-controller.git
synced 2025-04-25 06:12:31 +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
|
- munnerz
|
||||||
reviewers:
|
reviewers:
|
||||||
- gregory-m
|
- gregory-m
|
||||||
- kargakis
|
|
||||||
- sttts
|
- sttts
|
||||||
- munnerz
|
- munnerz
|
||||||
- nikhita
|
- 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;
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.Time time = 1;
|
||||||
|
|
||||||
// String detailing the error encountered during Attach or Detach operation.
|
// 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.
|
// information.
|
||||||
// +optional
|
// +optional
|
||||||
optional string message = 2;
|
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"`
|
Time metav1.Time `json:"time,omitempty" protobuf:"bytes,1,opt,name=time"`
|
||||||
|
|
||||||
// String detailing the error encountered during Attach or Detach operation.
|
// 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.
|
// information.
|
||||||
// +optional
|
// +optional
|
||||||
Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"`
|
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{
|
var map_VolumeError = map[string]string{
|
||||||
"": "VolumeError captures an error encountered during a volume operation.",
|
"": "VolumeError captures an error encountered during a volume operation.",
|
||||||
"time": "Time the error was encountered.",
|
"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 {
|
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;
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.Time time = 1;
|
||||||
|
|
||||||
// String detailing the error encountered during Attach or Detach operation.
|
// 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.
|
// information.
|
||||||
// +optional
|
// +optional
|
||||||
optional string message = 2;
|
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"`
|
Time metav1.Time `json:"time,omitempty" protobuf:"bytes,1,opt,name=time"`
|
||||||
|
|
||||||
// String detailing the error encountered during Attach or Detach operation.
|
// 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.
|
// information.
|
||||||
// +optional
|
// +optional
|
||||||
Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"`
|
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{
|
var map_VolumeError = map[string]string{
|
||||||
"": "VolumeError captures an error encountered during a volume operation.",
|
"": "VolumeError captures an error encountered during a volume operation.",
|
||||||
"time": "Time the error was encountered.",
|
"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 {
|
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
|
// objectSliceType is the type of a slice of Objects
|
||||||
var objectSliceType = reflect.TypeOf([]runtime.Object{})
|
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
|
// SetList sets the given list object's Items member have the elements given in
|
||||||
// objects.
|
// objects.
|
||||||
// Returns an error if list is not a List type (does not have an Items member),
|
// 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) {
|
func (d Duration) MarshalJSON() ([]byte, error) {
|
||||||
return json.Marshal(d.Duration.String())
|
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() ||
|
return !meta.GetCreationTimestamp().Time.IsZero() ||
|
||||||
len(meta.GetUID()) != 0
|
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
|
var val interface{} = obj
|
||||||
|
|
||||||
for i, field := range fields {
|
for i, field := range fields {
|
||||||
|
if val == nil {
|
||||||
|
return nil, false, nil
|
||||||
|
}
|
||||||
if m, ok := val.(map[string]interface{}); ok {
|
if m, ok := val.(map[string]interface{}); ok {
|
||||||
val, ok = m[field]
|
val, ok = m[field]
|
||||||
if !ok {
|
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,
|
reader: r,
|
||||||
decoder: d,
|
decoder: d,
|
||||||
buf: make([]byte, 1024),
|
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.
|
// Backoff holds parameters applied to a Backoff function.
|
||||||
type Backoff struct {
|
type Backoff struct {
|
||||||
Duration time.Duration // the base duration
|
// The initial duration.
|
||||||
Factor float64 // Duration is multiplied by factor each iteration
|
Duration time.Duration
|
||||||
Jitter float64 // The amount of jitter applied each iteration
|
// Duration is multiplied by factor each iteration. Must be greater
|
||||||
Steps int // Exit with error after this many steps
|
// 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.
|
// 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
|
// If the condition never returns true, ErrWaitTimeout is returned. All other
|
||||||
// errors terminate immediately.
|
// errors terminate immediately.
|
||||||
func ExponentialBackoff(backoff Backoff, condition ConditionFunc) error {
|
func ExponentialBackoff(backoff Backoff, condition ConditionFunc) error {
|
||||||
duration := backoff.Duration
|
for backoff.Steps > 0 {
|
||||||
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)
|
|
||||||
}
|
|
||||||
if ok, err := condition(); err != nil || ok {
|
if ok, err := condition(); err != nil || ok {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if backoff.Steps == 1 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
time.Sleep(backoff.Step())
|
||||||
}
|
}
|
||||||
return ErrWaitTimeout
|
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"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/googleapis/gnostic/OpenAPIv2"
|
openapi_v2 "github.com/googleapis/gnostic/OpenAPIv2"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@ -60,6 +60,9 @@ type DiscoveryInterface interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CachedDiscoveryInterface is a DiscoveryInterface with cache invalidation and freshness.
|
// 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 {
|
type CachedDiscoveryInterface interface {
|
||||||
DiscoveryInterface
|
DiscoveryInterface
|
||||||
// Fresh is supposed to tell the caller whether or not to retry if the cache
|
// 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
|
// TODO: this needs to be revisited, this interface can't be locked properly
|
||||||
// and doesn't make a lot of sense.
|
// and doesn't make a lot of sense.
|
||||||
Fresh() bool
|
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()
|
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.
|
// 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
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,12 +435,13 @@ func AnonymousClientConfig(config *Config) *Config {
|
|||||||
// CopyConfig returns a copy of the given config
|
// CopyConfig returns a copy of the given config
|
||||||
func CopyConfig(config *Config) *Config {
|
func CopyConfig(config *Config) *Config {
|
||||||
return &Config{
|
return &Config{
|
||||||
Host: config.Host,
|
Host: config.Host,
|
||||||
APIPath: config.APIPath,
|
APIPath: config.APIPath,
|
||||||
ContentConfig: config.ContentConfig,
|
ContentConfig: config.ContentConfig,
|
||||||
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,
|
||||||
|
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 {
|
func ValidatePathSegmentName(name string, prefix bool) []string {
|
||||||
if prefix {
|
if prefix {
|
||||||
return IsValidPathSegmentPrefix(name)
|
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 {
|
if w := t.watchers[gvr][ns]; w != nil {
|
||||||
watches = append(watches, w...)
|
watches = append(watches, w...)
|
||||||
}
|
}
|
||||||
if w := t.watchers[gvr][""]; w != nil {
|
if ns != metav1.NamespaceAll {
|
||||||
watches = append(watches, w...)
|
if w := t.watchers[gvr][metav1.NamespaceAll]; w != nil {
|
||||||
|
watches = append(watches, w...)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return watches
|
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
|
- erictune
|
||||||
- davidopp
|
- davidopp
|
||||||
- pmorie
|
- pmorie
|
||||||
- kargakis
|
|
||||||
- janetkuo
|
- janetkuo
|
||||||
- justinsb
|
- justinsb
|
||||||
- eparis
|
- 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 {
|
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{
|
||||||
|
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
|
// 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.
|
||||||
|
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"
|
"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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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"
|
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
|
// 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 {
|
func DefaultControllerRateLimiter() RateLimiter {
|
||||||
return NewMaxOfRateLimiter(
|
return NewMaxOfRateLimiter(
|
||||||
NewItemExponentialFailureRateLimiter(5*time.Millisecond, 1000*time.Second),
|
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/generators/util"
|
||||||
"k8s.io/code-generator/cmd/client-gen/path"
|
"k8s.io/code-generator/cmd/client-gen/path"
|
||||||
clientgentypes "k8s.io/code-generator/cmd/client-gen/types"
|
clientgentypes "k8s.io/code-generator/cmd/client-gen/types"
|
||||||
|
codegennamer "k8s.io/code-generator/pkg/namer"
|
||||||
"k8s.io/gengo/args"
|
"k8s.io/gengo/args"
|
||||||
"k8s.io/gengo/generator"
|
"k8s.io/gengo/generator"
|
||||||
"k8s.io/gengo/namer"
|
"k8s.io/gengo/namer"
|
||||||
@ -101,7 +102,7 @@ func NameSystems() namer.NameSystems {
|
|||||||
"publicPlural": publicPluralNamer,
|
"publicPlural": publicPluralNamer,
|
||||||
"privatePlural": privatePluralNamer,
|
"privatePlural": privatePluralNamer,
|
||||||
"allLowercasePlural": lowercaseNamer,
|
"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)
|
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"
|
"strings"
|
||||||
|
|
||||||
clientgentypes "k8s.io/code-generator/cmd/client-gen/types"
|
clientgentypes "k8s.io/code-generator/cmd/client-gen/types"
|
||||||
|
codegennamer "k8s.io/code-generator/pkg/namer"
|
||||||
"k8s.io/gengo/generator"
|
"k8s.io/gengo/generator"
|
||||||
"k8s.io/gengo/namer"
|
"k8s.io/gengo/namer"
|
||||||
"k8s.io/gengo/types"
|
"k8s.io/gengo/types"
|
||||||
@ -56,6 +57,7 @@ func (g *genericGenerator) Namers(c *generator.Context) namer.NameSystems {
|
|||||||
"raw": namer.NewRawNamer(g.outputPackage, g.imports),
|
"raw": namer.NewRawNamer(g.outputPackage, g.imports),
|
||||||
"allLowercasePlural": namer.NewAllLowercasePluralNamer(pluralExceptions),
|
"allLowercasePlural": namer.NewAllLowercasePluralNamer(pluralExceptions),
|
||||||
"publicPlural": namer.NewPublicPluralNamer(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 -}}
|
{{range $version := .Versions -}}
|
||||||
// Group={{$group.Name}}, Version={{.Name}}
|
// Group={{$group.Name}}, Version={{.Name}}
|
||||||
{{range .Resources -}}
|
{{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
|
return &genericInformer{resource: resource.GroupResource(), informer: f.{{$GroupGoName}}().{{$version.GoName}}().{{.|publicPlural}}().Informer()}, nil
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -14,12 +14,38 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package generators
|
package namer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"k8s.io/gengo/namer"
|
||||||
"k8s.io/gengo/types"
|
"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
|
// extractTag gets the comment-tags for the key. If the tag did not exist, it
|
||||||
// returns the empty string.
|
// returns the empty string.
|
||||||
func extractTag(key string, lines []string) string {
|
func extractTag(key string, lines []string) string {
|
Loading…
x
Reference in New Issue
Block a user