mirror of
https://github.com/kubernetes/sample-controller.git
synced 2026-05-01 00:00:03 +08:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 642643714d | |||
| 9593044ffe | |||
| a5274af388 | |||
| cd99871cca | |||
| 945b0edca8 | |||
| 4ad346dca1 | |||
| 8ddebc5d89 | |||
| bf7334cd9d | |||
| 28705fc220 | |||
| 794c636ab1 | |||
| 58e97b0bc2 | |||
| b9d013a749 | |||
| 48776fd1f2 | |||
| 0b7a8b29d6 | |||
| cbb9197ba2 | |||
| b8ae83903e | |||
| d36cff0c2c | |||
| 0b5e85fef2 |
Generated
+260
-260
File diff suppressed because it is too large
Load Diff
+14
-14
@@ -20,7 +20,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
@@ -37,6 +36,7 @@ import (
|
|||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
"k8s.io/client-go/tools/record"
|
"k8s.io/client-go/tools/record"
|
||||||
"k8s.io/client-go/util/workqueue"
|
"k8s.io/client-go/util/workqueue"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
samplev1alpha1 "k8s.io/sample-controller/pkg/apis/samplecontroller/v1alpha1"
|
samplev1alpha1 "k8s.io/sample-controller/pkg/apis/samplecontroller/v1alpha1"
|
||||||
clientset "k8s.io/sample-controller/pkg/client/clientset/versioned"
|
clientset "k8s.io/sample-controller/pkg/client/clientset/versioned"
|
||||||
@@ -96,9 +96,9 @@ func NewController(
|
|||||||
// Add sample-controller types to the default Kubernetes Scheme so Events can be
|
// Add sample-controller types to the default Kubernetes Scheme so Events can be
|
||||||
// logged for sample-controller types.
|
// logged for sample-controller types.
|
||||||
utilruntime.Must(samplescheme.AddToScheme(scheme.Scheme))
|
utilruntime.Must(samplescheme.AddToScheme(scheme.Scheme))
|
||||||
glog.V(4).Info("Creating event broadcaster")
|
klog.V(4).Info("Creating event broadcaster")
|
||||||
eventBroadcaster := record.NewBroadcaster()
|
eventBroadcaster := record.NewBroadcaster()
|
||||||
eventBroadcaster.StartLogging(glog.Infof)
|
eventBroadcaster.StartLogging(klog.Infof)
|
||||||
eventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: kubeclientset.CoreV1().Events("")})
|
eventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: kubeclientset.CoreV1().Events("")})
|
||||||
recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: controllerAgentName})
|
recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: controllerAgentName})
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ func NewController(
|
|||||||
recorder: recorder,
|
recorder: recorder,
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.Info("Setting up event handlers")
|
klog.Info("Setting up event handlers")
|
||||||
// Set up an event handler for when Foo resources change
|
// Set up an event handler for when Foo resources change
|
||||||
fooInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
|
fooInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||||
AddFunc: controller.enqueueFoo,
|
AddFunc: controller.enqueueFoo,
|
||||||
@@ -154,23 +154,23 @@ func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error {
|
|||||||
defer c.workqueue.ShutDown()
|
defer c.workqueue.ShutDown()
|
||||||
|
|
||||||
// Start the informer factories to begin populating the informer caches
|
// Start the informer factories to begin populating the informer caches
|
||||||
glog.Info("Starting Foo controller")
|
klog.Info("Starting Foo controller")
|
||||||
|
|
||||||
// Wait for the caches to be synced before starting workers
|
// Wait for the caches to be synced before starting workers
|
||||||
glog.Info("Waiting for informer caches to sync")
|
klog.Info("Waiting for informer caches to sync")
|
||||||
if ok := cache.WaitForCacheSync(stopCh, c.deploymentsSynced, c.foosSynced); !ok {
|
if ok := cache.WaitForCacheSync(stopCh, c.deploymentsSynced, c.foosSynced); !ok {
|
||||||
return fmt.Errorf("failed to wait for caches to sync")
|
return fmt.Errorf("failed to wait for caches to sync")
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.Info("Starting workers")
|
klog.Info("Starting workers")
|
||||||
// Launch two workers to process Foo resources
|
// Launch two workers to process Foo resources
|
||||||
for i := 0; i < threadiness; i++ {
|
for i := 0; i < threadiness; i++ {
|
||||||
go wait.Until(c.runWorker, time.Second, stopCh)
|
go wait.Until(c.runWorker, time.Second, stopCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.Info("Started workers")
|
klog.Info("Started workers")
|
||||||
<-stopCh
|
<-stopCh
|
||||||
glog.Info("Shutting down workers")
|
klog.Info("Shutting down workers")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -226,7 +226,7 @@ func (c *Controller) processNextWorkItem() bool {
|
|||||||
// Finally, if no error occurs we Forget this item so it does not
|
// Finally, if no error occurs we Forget this item so it does not
|
||||||
// get queued again until another change happens.
|
// get queued again until another change happens.
|
||||||
c.workqueue.Forget(obj)
|
c.workqueue.Forget(obj)
|
||||||
glog.Infof("Successfully synced '%s'", key)
|
klog.Infof("Successfully synced '%s'", key)
|
||||||
return nil
|
return nil
|
||||||
}(obj)
|
}(obj)
|
||||||
|
|
||||||
@@ -297,7 +297,7 @@ func (c *Controller) syncHandler(key string) error {
|
|||||||
// number does not equal the current desired replicas on the Deployment, we
|
// number does not equal the current desired replicas on the Deployment, we
|
||||||
// should update the Deployment resource.
|
// should update the Deployment resource.
|
||||||
if foo.Spec.Replicas != nil && *foo.Spec.Replicas != *deployment.Spec.Replicas {
|
if foo.Spec.Replicas != nil && *foo.Spec.Replicas != *deployment.Spec.Replicas {
|
||||||
glog.V(4).Infof("Foo %s replicas: %d, deployment replicas: %d", name, *foo.Spec.Replicas, *deployment.Spec.Replicas)
|
klog.V(4).Infof("Foo %s replicas: %d, deployment replicas: %d", name, *foo.Spec.Replicas, *deployment.Spec.Replicas)
|
||||||
deployment, err = c.kubeclientset.AppsV1().Deployments(foo.Namespace).Update(newDeployment(foo))
|
deployment, err = c.kubeclientset.AppsV1().Deployments(foo.Namespace).Update(newDeployment(foo))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,9 +365,9 @@ func (c *Controller) handleObject(obj interface{}) {
|
|||||||
runtime.HandleError(fmt.Errorf("error decoding object tombstone, invalid type"))
|
runtime.HandleError(fmt.Errorf("error decoding object tombstone, invalid type"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
glog.V(4).Infof("Recovered deleted object '%s' from tombstone", object.GetName())
|
klog.V(4).Infof("Recovered deleted object '%s' from tombstone", object.GetName())
|
||||||
}
|
}
|
||||||
glog.V(4).Infof("Processing object: %s", object.GetName())
|
klog.V(4).Infof("Processing object: %s", object.GetName())
|
||||||
if ownerRef := metav1.GetControllerOf(object); ownerRef != nil {
|
if ownerRef := metav1.GetControllerOf(object); ownerRef != nil {
|
||||||
// If this object is not owned by a Foo, we should not do anything more
|
// If this object is not owned by a Foo, we should not do anything more
|
||||||
// with it.
|
// with it.
|
||||||
@@ -377,7 +377,7 @@ func (c *Controller) handleObject(obj interface{}) {
|
|||||||
|
|
||||||
foo, err := c.foosLister.Foos(object.GetNamespace()).Get(ownerRef.Name)
|
foo, err := c.foosLister.Foos(object.GetNamespace()).Get(ownerRef.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.V(4).Infof("ignoring orphaned object '%s' of foo '%s'", object.GetSelfLink(), ownerRef.Name)
|
klog.V(4).Infof("ignoring orphaned object '%s' of foo '%s'", object.GetSelfLink(), ownerRef.Name)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
kubeinformers "k8s.io/client-go/informers"
|
kubeinformers "k8s.io/client-go/informers"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
|
"k8s.io/klog"
|
||||||
// Uncomment the following line to load the gcp plugin (only required to authenticate against GKE clusters).
|
// Uncomment the following line to load the gcp plugin (only required to authenticate against GKE clusters).
|
||||||
// _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
|
// _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
|
||||||
|
|
||||||
@@ -45,17 +45,17 @@ func main() {
|
|||||||
|
|
||||||
cfg, err := clientcmd.BuildConfigFromFlags(masterURL, kubeconfig)
|
cfg, err := clientcmd.BuildConfigFromFlags(masterURL, kubeconfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Error building kubeconfig: %s", err.Error())
|
klog.Fatalf("Error building kubeconfig: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
kubeClient, err := kubernetes.NewForConfig(cfg)
|
kubeClient, err := kubernetes.NewForConfig(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Error building kubernetes clientset: %s", err.Error())
|
klog.Fatalf("Error building kubernetes clientset: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
exampleClient, err := clientset.NewForConfig(cfg)
|
exampleClient, err := clientset.NewForConfig(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Error building example clientset: %s", err.Error())
|
klog.Fatalf("Error building example clientset: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
kubeInformerFactory := kubeinformers.NewSharedInformerFactory(kubeClient, time.Second*30)
|
kubeInformerFactory := kubeinformers.NewSharedInformerFactory(kubeClient, time.Second*30)
|
||||||
@@ -71,7 +71,7 @@ func main() {
|
|||||||
exampleInformerFactory.Start(stopCh)
|
exampleInformerFactory.Start(stopCh)
|
||||||
|
|
||||||
if err = controller.Run(2, stopCh); err != nil {
|
if err = controller.Run(2, stopCh); err != nil {
|
||||||
glog.Fatalf("Error running controller: %s", err.Error())
|
klog.Fatalf("Error running controller: %s", err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ limitations under the License.
|
|||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
@@ -76,11 +78,16 @@ func (c *foos) Get(name string, options v1.GetOptions) (result *v1alpha1.Foo, er
|
|||||||
|
|
||||||
// List takes label and field selectors, and returns the list of Foos that match those selectors.
|
// List takes label and field selectors, and returns the list of Foos that match those selectors.
|
||||||
func (c *foos) List(opts v1.ListOptions) (result *v1alpha1.FooList, err error) {
|
func (c *foos) List(opts v1.ListOptions) (result *v1alpha1.FooList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
result = &v1alpha1.FooList{}
|
result = &v1alpha1.FooList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("foos").
|
Resource("foos").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Do().
|
Do().
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
@@ -88,11 +95,16 @@ func (c *foos) List(opts v1.ListOptions) (result *v1alpha1.FooList, err error) {
|
|||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested foos.
|
// Watch returns a watch.Interface that watches the requested foos.
|
||||||
func (c *foos) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
func (c *foos) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
opts.Watch = true
|
opts.Watch = true
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("foos").
|
Resource("foos").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,10 +162,15 @@ func (c *foos) Delete(name string, options *v1.DeleteOptions) error {
|
|||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *foos) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
func (c *foos) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("foos").
|
Resource("foos").
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do().
|
Do().
|
||||||
Error()
|
Error()
|
||||||
|
|||||||
+13
@@ -25,6 +25,19 @@ go get -u github.com/evanphx/json-patch
|
|||||||
* [Comparing JSON documents](#comparing-json-documents)
|
* [Comparing JSON documents](#comparing-json-documents)
|
||||||
* [Combine merge patches](#combine-merge-patches)
|
* [Combine merge patches](#combine-merge-patches)
|
||||||
|
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
|
||||||
|
* There is a global configuration variable `jsonpatch.SupportNegativeIndices`.
|
||||||
|
This defaults to `true` and enables the non-standard practice of allowing
|
||||||
|
negative indices to mean indices starting at the end of an array. This
|
||||||
|
functionality can be disabled by setting `jsonpatch.SupportNegativeIndices =
|
||||||
|
false`.
|
||||||
|
|
||||||
|
* There is a global configuration variable `jsonpatch.AccumulatedCopySizeLimit`,
|
||||||
|
which limits the total size increase in bytes caused by "copy" operations in a
|
||||||
|
patch. It defaults to 0, which means there is no limit.
|
||||||
|
|
||||||
## Create and apply a merge patch
|
## Create and apply a merge patch
|
||||||
Given both an original JSON document and a modified JSON document, you can create
|
Given both an original JSON document and a modified JSON document, you can create
|
||||||
a [Merge Patch](https://tools.ietf.org/html/rfc7396) document.
|
a [Merge Patch](https://tools.ietf.org/html/rfc7396) document.
|
||||||
|
|||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
package jsonpatch
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
// AccumulatedCopySizeError is an error type returned when the accumulated size
|
||||||
|
// increase caused by copy operations in a patch operation has exceeded the
|
||||||
|
// limit.
|
||||||
|
type AccumulatedCopySizeError struct {
|
||||||
|
limit int64
|
||||||
|
accumulated int64
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewAccumulatedCopySizeError returns an AccumulatedCopySizeError.
|
||||||
|
func NewAccumulatedCopySizeError(l, a int64) *AccumulatedCopySizeError {
|
||||||
|
return &AccumulatedCopySizeError{limit: l, accumulated: a}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error implements the error interface.
|
||||||
|
func (a *AccumulatedCopySizeError) Error() string {
|
||||||
|
return fmt.Sprintf("Unable to complete the copy, the accumulated size increase of copy is %d, exceeding the limit %d", a.accumulated, a.limit)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ArraySizeError is an error type returned when the array size has exceeded
|
||||||
|
// the limit.
|
||||||
|
type ArraySizeError struct {
|
||||||
|
limit int
|
||||||
|
size int
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewArraySizeError returns an ArraySizeError.
|
||||||
|
func NewArraySizeError(l, s int) *ArraySizeError {
|
||||||
|
return &ArraySizeError{limit: l, size: s}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error implements the error interface.
|
||||||
|
func (a *ArraySizeError) Error() string {
|
||||||
|
return fmt.Sprintf("Unable to create array of size %d, limit is %d", a.size, a.limit)
|
||||||
|
}
|
||||||
+66
-36
@@ -14,6 +14,16 @@ const (
|
|||||||
eAry
|
eAry
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// SupportNegativeIndices decides whether to support non-standard practice of
|
||||||
|
// allowing negative indices to mean indices starting at the end of an array.
|
||||||
|
// Default to true.
|
||||||
|
SupportNegativeIndices bool = true
|
||||||
|
// AccumulatedCopySizeLimit limits the total size increase in bytes caused by
|
||||||
|
// "copy" operations in a patch.
|
||||||
|
AccumulatedCopySizeLimit int64 = 0
|
||||||
|
)
|
||||||
|
|
||||||
type lazyNode struct {
|
type lazyNode struct {
|
||||||
raw *json.RawMessage
|
raw *json.RawMessage
|
||||||
doc partialDoc
|
doc partialDoc
|
||||||
@@ -61,6 +71,20 @@ func (n *lazyNode) UnmarshalJSON(data []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func deepCopy(src *lazyNode) (*lazyNode, int, error) {
|
||||||
|
if src == nil {
|
||||||
|
return nil, 0, nil
|
||||||
|
}
|
||||||
|
a, err := src.MarshalJSON()
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
sz := len(a)
|
||||||
|
ra := make(json.RawMessage, sz)
|
||||||
|
copy(ra, a)
|
||||||
|
return newLazyNode(&ra), sz, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (n *lazyNode) intoDoc() (*partialDoc, error) {
|
func (n *lazyNode) intoDoc() (*partialDoc, error) {
|
||||||
if n.which == eDoc {
|
if n.which == eDoc {
|
||||||
return &n.doc, nil
|
return &n.doc, nil
|
||||||
@@ -342,35 +366,14 @@ func (d *partialDoc) remove(key string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set should only be used to implement the "replace" operation, so "key" must
|
||||||
|
// be an already existing index in "d".
|
||||||
func (d *partialArray) set(key string, val *lazyNode) error {
|
func (d *partialArray) set(key string, val *lazyNode) error {
|
||||||
if key == "-" {
|
|
||||||
*d = append(*d, val)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
idx, err := strconv.Atoi(key)
|
idx, err := strconv.Atoi(key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
(*d)[idx] = val
|
||||||
sz := len(*d)
|
|
||||||
if idx+1 > sz {
|
|
||||||
sz = idx + 1
|
|
||||||
}
|
|
||||||
|
|
||||||
ary := make([]*lazyNode, sz)
|
|
||||||
|
|
||||||
cur := *d
|
|
||||||
|
|
||||||
copy(ary, cur)
|
|
||||||
|
|
||||||
if idx >= len(ary) {
|
|
||||||
return fmt.Errorf("Unable to access invalid index: %d", idx)
|
|
||||||
}
|
|
||||||
|
|
||||||
ary[idx] = val
|
|
||||||
|
|
||||||
*d = ary
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,17 +388,26 @@ func (d *partialArray) add(key string, val *lazyNode) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
ary := make([]*lazyNode, len(*d)+1)
|
sz := len(*d) + 1
|
||||||
|
|
||||||
|
ary := make([]*lazyNode, sz)
|
||||||
|
|
||||||
cur := *d
|
cur := *d
|
||||||
|
|
||||||
if idx < -len(ary) || idx >= len(ary) {
|
if idx >= len(ary) {
|
||||||
return fmt.Errorf("Unable to access invalid index: %d", idx)
|
return fmt.Errorf("Unable to access invalid index: %d", idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
if idx < 0 {
|
if SupportNegativeIndices {
|
||||||
idx += len(ary)
|
if idx < -len(ary) {
|
||||||
|
return fmt.Errorf("Unable to access invalid index: %d", idx)
|
||||||
|
}
|
||||||
|
|
||||||
|
if idx < 0 {
|
||||||
|
idx += len(ary)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
copy(ary[0:idx], cur[0:idx])
|
copy(ary[0:idx], cur[0:idx])
|
||||||
ary[idx] = val
|
ary[idx] = val
|
||||||
copy(ary[idx+1:], cur[idx:])
|
copy(ary[idx+1:], cur[idx:])
|
||||||
@@ -426,11 +438,18 @@ func (d *partialArray) remove(key string) error {
|
|||||||
|
|
||||||
cur := *d
|
cur := *d
|
||||||
|
|
||||||
if idx < -len(cur) || idx >= len(cur) {
|
if idx >= len(cur) {
|
||||||
return fmt.Errorf("Unable to remove invalid index: %d", idx)
|
return fmt.Errorf("Unable to access invalid index: %d", idx)
|
||||||
}
|
}
|
||||||
if idx < 0 {
|
|
||||||
idx += len(cur)
|
if SupportNegativeIndices {
|
||||||
|
if idx < -len(cur) {
|
||||||
|
return fmt.Errorf("Unable to access invalid index: %d", idx)
|
||||||
|
}
|
||||||
|
|
||||||
|
if idx < 0 {
|
||||||
|
idx += len(cur)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ary := make([]*lazyNode, len(cur)-1)
|
ary := make([]*lazyNode, len(cur)-1)
|
||||||
@@ -511,7 +530,7 @@ func (p Patch) move(doc *container, op operation) error {
|
|||||||
return fmt.Errorf("jsonpatch move operation does not apply: doc is missing destination path: %s", path)
|
return fmt.Errorf("jsonpatch move operation does not apply: doc is missing destination path: %s", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
return con.set(key, val)
|
return con.add(key, val)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p Patch) test(doc *container, op operation) error {
|
func (p Patch) test(doc *container, op operation) error {
|
||||||
@@ -545,7 +564,7 @@ func (p Patch) test(doc *container, op operation) error {
|
|||||||
return fmt.Errorf("Testing value %s failed", path)
|
return fmt.Errorf("Testing value %s failed", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p Patch) copy(doc *container, op operation) error {
|
func (p Patch) copy(doc *container, op operation, accumulatedCopySize *int64) error {
|
||||||
from := op.from()
|
from := op.from()
|
||||||
|
|
||||||
con, key := findObject(doc, from)
|
con, key := findObject(doc, from)
|
||||||
@@ -567,7 +586,16 @@ func (p Patch) copy(doc *container, op operation) error {
|
|||||||
return fmt.Errorf("jsonpatch copy operation does not apply: doc is missing destination path: %s", path)
|
return fmt.Errorf("jsonpatch copy operation does not apply: doc is missing destination path: %s", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
return con.set(key, val)
|
valCopy, sz, err := deepCopy(val)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
(*accumulatedCopySize) += int64(sz)
|
||||||
|
if AccumulatedCopySizeLimit > 0 && *accumulatedCopySize > AccumulatedCopySizeLimit {
|
||||||
|
return NewAccumulatedCopySizeError(AccumulatedCopySizeLimit, *accumulatedCopySize)
|
||||||
|
}
|
||||||
|
|
||||||
|
return con.add(key, valCopy)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Equal indicates if 2 JSON documents have the same structural equality.
|
// Equal indicates if 2 JSON documents have the same structural equality.
|
||||||
@@ -620,6 +648,8 @@ func (p Patch) ApplyIndent(doc []byte, indent string) ([]byte, error) {
|
|||||||
|
|
||||||
err = nil
|
err = nil
|
||||||
|
|
||||||
|
var accumulatedCopySize int64
|
||||||
|
|
||||||
for _, op := range p {
|
for _, op := range p {
|
||||||
switch op.kind() {
|
switch op.kind() {
|
||||||
case "add":
|
case "add":
|
||||||
@@ -633,7 +663,7 @@ func (p Patch) ApplyIndent(doc []byte, indent string) ([]byte, error) {
|
|||||||
case "test":
|
case "test":
|
||||||
err = p.test(&pd, op)
|
err = p.test(&pd, op)
|
||||||
case "copy":
|
case "copy":
|
||||||
err = p.copy(&pd, op)
|
err = p.copy(&pd, op, &accumulatedCopySize)
|
||||||
default:
|
default:
|
||||||
err = fmt.Errorf("Unexpected kind: %s", op.kind())
|
err = fmt.Errorf("Unexpected kind: %s", op.kind())
|
||||||
}
|
}
|
||||||
|
|||||||
-8
@@ -1,8 +0,0 @@
|
|||||||
language: go
|
|
||||||
go:
|
|
||||||
- "1.3"
|
|
||||||
- "1.4"
|
|
||||||
- "1.10"
|
|
||||||
script:
|
|
||||||
- go test
|
|
||||||
- go build
|
|
||||||
+3
-9
@@ -1,12 +1,6 @@
|
|||||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||||
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
name = "github.com/json-iterator/go"
|
|
||||||
packages = ["."]
|
|
||||||
revision = "ca39e5af3ece67bbcda3d0f4f56a8e24d9f2dad4"
|
|
||||||
version = "1.1.3"
|
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/modern-go/concurrent"
|
name = "github.com/modern-go/concurrent"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
@@ -16,12 +10,12 @@
|
|||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/modern-go/reflect2"
|
name = "github.com/modern-go/reflect2"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
revision = "1df9eeb2bb81f327b96228865c5687bc2194af3f"
|
revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
|
|
||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
analyzer-version = 1
|
analyzer-version = 1
|
||||||
inputs-digest = "56a0b9e9e61d2bc8af5e1b68537401b7f4d60805eda3d107058f3171aa5cf793"
|
inputs-digest = "ea54a775e5a354cb015502d2e7aa4b74230fc77e894f34a838b268c25ec8eeb8"
|
||||||
solver-name = "gps-cdcl"
|
solver-name = "gps-cdcl"
|
||||||
solver-version = 1
|
solver-version = 1
|
||||||
|
|||||||
+1
-1
@@ -23,4 +23,4 @@ ignored = ["github.com/davecgh/go-spew*","github.com/google/gofuzz*","github.com
|
|||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/modern-go/reflect2"
|
name = "github.com/modern-go/reflect2"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
|
|||||||
+2
@@ -5,6 +5,8 @@
|
|||||||
// Package context defines the Context type, which carries deadlines,
|
// Package context defines the Context type, which carries deadlines,
|
||||||
// cancelation signals, and other request-scoped values across API boundaries
|
// cancelation signals, and other request-scoped values across API boundaries
|
||||||
// and between processes.
|
// and between processes.
|
||||||
|
// As of Go 1.7 this package is available in the standard library under the
|
||||||
|
// name context. https://golang.org/pkg/context.
|
||||||
//
|
//
|
||||||
// Incoming requests to a server should create a Context, and outgoing calls to
|
// Incoming requests to a server should create a Context, and outgoing calls to
|
||||||
// servers should accept a Context. The chain of function calls between must
|
// servers should accept a Context. The chain of function calls between must
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
package http2
|
package http2
|
||||||
|
|
||||||
// A list of the possible cipher suite ids. Taken from
|
// A list of the possible cipher suite ids. Taken from
|
||||||
// http://www.iana.org/assignments/tls-parameters/tls-parameters.txt
|
// https://www.iana.org/assignments/tls-parameters/tls-parameters.txt
|
||||||
|
|
||||||
const (
|
const (
|
||||||
cipher_TLS_NULL_WITH_NULL_NULL uint16 = 0x0000
|
cipher_TLS_NULL_WITH_NULL_NULL uint16 = 0x0000
|
||||||
|
|||||||
+1
-1
@@ -73,7 +73,7 @@ type noDialH2RoundTripper struct{ t *Transport }
|
|||||||
|
|
||||||
func (rt noDialH2RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
func (rt noDialH2RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
res, err := rt.t.RoundTrip(req)
|
res, err := rt.t.RoundTrip(req)
|
||||||
if err == ErrNoCachedConn {
|
if isNoCachedConnError(err) {
|
||||||
return nil, http.ErrSkipAltProtocol
|
return nil, http.ErrSkipAltProtocol
|
||||||
}
|
}
|
||||||
return res, err
|
return res, err
|
||||||
|
|||||||
+58
-27
@@ -220,12 +220,15 @@ func ConfigureServer(s *http.Server, conf *Server) error {
|
|||||||
} else if s.TLSConfig.CipherSuites != nil {
|
} else if s.TLSConfig.CipherSuites != nil {
|
||||||
// If they already provided a CipherSuite list, return
|
// If they already provided a CipherSuite list, return
|
||||||
// an error if it has a bad order or is missing
|
// an error if it has a bad order or is missing
|
||||||
// ECDHE_RSA_WITH_AES_128_GCM_SHA256.
|
// ECDHE_RSA_WITH_AES_128_GCM_SHA256 or ECDHE_ECDSA_WITH_AES_128_GCM_SHA256.
|
||||||
const requiredCipher = tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
|
|
||||||
haveRequired := false
|
haveRequired := false
|
||||||
sawBad := false
|
sawBad := false
|
||||||
for i, cs := range s.TLSConfig.CipherSuites {
|
for i, cs := range s.TLSConfig.CipherSuites {
|
||||||
if cs == requiredCipher {
|
switch cs {
|
||||||
|
case tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
|
||||||
|
// Alternative MTI cipher to not discourage ECDSA-only servers.
|
||||||
|
// See http://golang.org/cl/30721 for further information.
|
||||||
|
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:
|
||||||
haveRequired = true
|
haveRequired = true
|
||||||
}
|
}
|
||||||
if isBadCipher(cs) {
|
if isBadCipher(cs) {
|
||||||
@@ -235,7 +238,7 @@ func ConfigureServer(s *http.Server, conf *Server) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !haveRequired {
|
if !haveRequired {
|
||||||
return fmt.Errorf("http2: TLSConfig.CipherSuites is missing HTTP/2-required TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256")
|
return fmt.Errorf("http2: TLSConfig.CipherSuites is missing an HTTP/2-required AES_128_GCM_SHA256 cipher.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -649,7 +652,7 @@ func (sc *serverConn) condlogf(err error, format string, args ...interface{}) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err == io.EOF || err == io.ErrUnexpectedEOF || isClosedConnError(err) {
|
if err == io.EOF || err == io.ErrUnexpectedEOF || isClosedConnError(err) || err == errPrefaceTimeout {
|
||||||
// Boring, expected errors.
|
// Boring, expected errors.
|
||||||
sc.vlogf(format, args...)
|
sc.vlogf(format, args...)
|
||||||
} else {
|
} else {
|
||||||
@@ -853,8 +856,13 @@ func (sc *serverConn) serve() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if sc.inGoAway && sc.curOpenStreams() == 0 && !sc.needToSendGoAway && !sc.writingFrame {
|
// Start the shutdown timer after sending a GOAWAY. When sending GOAWAY
|
||||||
return
|
// with no error code (graceful shutdown), don't start the timer until
|
||||||
|
// all open streams have been completed.
|
||||||
|
sentGoAway := sc.inGoAway && !sc.needToSendGoAway && !sc.writingFrame
|
||||||
|
gracefulShutdownComplete := sc.goAwayCode == ErrCodeNo && sc.curOpenStreams() == 0
|
||||||
|
if sentGoAway && sc.shutdownTimer == nil && (sc.goAwayCode != ErrCodeNo || gracefulShutdownComplete) {
|
||||||
|
sc.shutDownIn(goAwayTimeout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -889,8 +897,11 @@ func (sc *serverConn) sendServeMsg(msg interface{}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// readPreface reads the ClientPreface greeting from the peer
|
var errPrefaceTimeout = errors.New("timeout waiting for client preface")
|
||||||
// or returns an error on timeout or an invalid greeting.
|
|
||||||
|
// readPreface reads the ClientPreface greeting from the peer or
|
||||||
|
// returns errPrefaceTimeout on timeout, or an error if the greeting
|
||||||
|
// is invalid.
|
||||||
func (sc *serverConn) readPreface() error {
|
func (sc *serverConn) readPreface() error {
|
||||||
errc := make(chan error, 1)
|
errc := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
@@ -908,7 +919,7 @@ func (sc *serverConn) readPreface() error {
|
|||||||
defer timer.Stop()
|
defer timer.Stop()
|
||||||
select {
|
select {
|
||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
return errors.New("timeout waiting for client preface")
|
return errPrefaceTimeout
|
||||||
case err := <-errc:
|
case err := <-errc:
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if VerboseLogs {
|
if VerboseLogs {
|
||||||
@@ -1218,30 +1229,31 @@ func (sc *serverConn) startGracefulShutdown() {
|
|||||||
sc.shutdownOnce.Do(func() { sc.sendServeMsg(gracefulShutdownMsg) })
|
sc.shutdownOnce.Do(func() { sc.sendServeMsg(gracefulShutdownMsg) })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// After sending GOAWAY, the connection will close after goAwayTimeout.
|
||||||
|
// If we close the connection immediately after sending GOAWAY, there may
|
||||||
|
// be unsent data in our kernel receive buffer, which will cause the kernel
|
||||||
|
// to send a TCP RST on close() instead of a FIN. This RST will abort the
|
||||||
|
// connection immediately, whether or not the client had received the GOAWAY.
|
||||||
|
//
|
||||||
|
// Ideally we should delay for at least 1 RTT + epsilon so the client has
|
||||||
|
// a chance to read the GOAWAY and stop sending messages. Measuring RTT
|
||||||
|
// is hard, so we approximate with 1 second. See golang.org/issue/18701.
|
||||||
|
//
|
||||||
|
// This is a var so it can be shorter in tests, where all requests uses the
|
||||||
|
// loopback interface making the expected RTT very small.
|
||||||
|
//
|
||||||
|
// TODO: configurable?
|
||||||
|
var goAwayTimeout = 1 * time.Second
|
||||||
|
|
||||||
func (sc *serverConn) startGracefulShutdownInternal() {
|
func (sc *serverConn) startGracefulShutdownInternal() {
|
||||||
sc.goAwayIn(ErrCodeNo, 0)
|
sc.goAway(ErrCodeNo)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sc *serverConn) goAway(code ErrCode) {
|
func (sc *serverConn) goAway(code ErrCode) {
|
||||||
sc.serveG.check()
|
|
||||||
var forceCloseIn time.Duration
|
|
||||||
if code != ErrCodeNo {
|
|
||||||
forceCloseIn = 250 * time.Millisecond
|
|
||||||
} else {
|
|
||||||
// TODO: configurable
|
|
||||||
forceCloseIn = 1 * time.Second
|
|
||||||
}
|
|
||||||
sc.goAwayIn(code, forceCloseIn)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sc *serverConn) goAwayIn(code ErrCode, forceCloseIn time.Duration) {
|
|
||||||
sc.serveG.check()
|
sc.serveG.check()
|
||||||
if sc.inGoAway {
|
if sc.inGoAway {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if forceCloseIn != 0 {
|
|
||||||
sc.shutDownIn(forceCloseIn)
|
|
||||||
}
|
|
||||||
sc.inGoAway = true
|
sc.inGoAway = true
|
||||||
sc.needToSendGoAway = true
|
sc.needToSendGoAway = true
|
||||||
sc.goAwayCode = code
|
sc.goAwayCode = code
|
||||||
@@ -2310,7 +2322,7 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) {
|
|||||||
clen = strconv.Itoa(len(p))
|
clen = strconv.Itoa(len(p))
|
||||||
}
|
}
|
||||||
_, hasContentType := rws.snapHeader["Content-Type"]
|
_, hasContentType := rws.snapHeader["Content-Type"]
|
||||||
if !hasContentType && bodyAllowedForStatus(rws.status) {
|
if !hasContentType && bodyAllowedForStatus(rws.status) && len(p) > 0 {
|
||||||
ctype = http.DetectContentType(p)
|
ctype = http.DetectContentType(p)
|
||||||
}
|
}
|
||||||
var date string
|
var date string
|
||||||
@@ -2478,6 +2490,24 @@ func (w *responseWriter) Header() http.Header {
|
|||||||
return rws.handlerHeader
|
return rws.handlerHeader
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// checkWriteHeaderCode is a copy of net/http's checkWriteHeaderCode.
|
||||||
|
func checkWriteHeaderCode(code int) {
|
||||||
|
// Issue 22880: require valid WriteHeader status codes.
|
||||||
|
// For now we only enforce that it's three digits.
|
||||||
|
// In the future we might block things over 599 (600 and above aren't defined
|
||||||
|
// at http://httpwg.org/specs/rfc7231.html#status.codes)
|
||||||
|
// and we might block under 200 (once we have more mature 1xx support).
|
||||||
|
// But for now any three digits.
|
||||||
|
//
|
||||||
|
// We used to send "HTTP/1.1 000 0" on the wire in responses but there's
|
||||||
|
// no equivalent bogus thing we can realistically send in HTTP/2,
|
||||||
|
// so we'll consistently panic instead and help people find their bugs
|
||||||
|
// early. (We can't return an error from WriteHeader even if we wanted to.)
|
||||||
|
if code < 100 || code > 999 {
|
||||||
|
panic(fmt.Sprintf("invalid WriteHeader code %v", code))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (w *responseWriter) WriteHeader(code int) {
|
func (w *responseWriter) WriteHeader(code int) {
|
||||||
rws := w.rws
|
rws := w.rws
|
||||||
if rws == nil {
|
if rws == nil {
|
||||||
@@ -2488,6 +2518,7 @@ func (w *responseWriter) WriteHeader(code int) {
|
|||||||
|
|
||||||
func (rws *responseWriterState) writeHeader(code int) {
|
func (rws *responseWriterState) writeHeader(code int) {
|
||||||
if !rws.wroteHeader {
|
if !rws.wroteHeader {
|
||||||
|
checkWriteHeaderCode(code)
|
||||||
rws.wroteHeader = true
|
rws.wroteHeader = true
|
||||||
rws.status = code
|
rws.status = code
|
||||||
if len(rws.handlerHeader) > 0 {
|
if len(rws.handlerHeader) > 0 {
|
||||||
|
|||||||
+217
-135
@@ -87,7 +87,7 @@ type Transport struct {
|
|||||||
|
|
||||||
// MaxHeaderListSize is the http2 SETTINGS_MAX_HEADER_LIST_SIZE to
|
// MaxHeaderListSize is the http2 SETTINGS_MAX_HEADER_LIST_SIZE to
|
||||||
// send in the initial settings frame. It is how many bytes
|
// send in the initial settings frame. It is how many bytes
|
||||||
// of response headers are allow. Unlike the http2 spec, zero here
|
// of response headers are allowed. Unlike the http2 spec, zero here
|
||||||
// means to use a default limit (currently 10MB). If you actually
|
// means to use a default limit (currently 10MB). If you actually
|
||||||
// want to advertise an ulimited value to the peer, Transport
|
// want to advertise an ulimited value to the peer, Transport
|
||||||
// interprets the highest possible value here (0xffffffff or 1<<32-1)
|
// interprets the highest possible value here (0xffffffff or 1<<32-1)
|
||||||
@@ -172,9 +172,10 @@ type ClientConn struct {
|
|||||||
fr *Framer
|
fr *Framer
|
||||||
lastActive time.Time
|
lastActive time.Time
|
||||||
// Settings from peer: (also guarded by mu)
|
// Settings from peer: (also guarded by mu)
|
||||||
maxFrameSize uint32
|
maxFrameSize uint32
|
||||||
maxConcurrentStreams uint32
|
maxConcurrentStreams uint32
|
||||||
initialWindowSize uint32
|
peerMaxHeaderListSize uint64
|
||||||
|
initialWindowSize uint32
|
||||||
|
|
||||||
hbuf bytes.Buffer // HPACK encoder writes into this
|
hbuf bytes.Buffer // HPACK encoder writes into this
|
||||||
henc *hpack.Encoder
|
henc *hpack.Encoder
|
||||||
@@ -273,6 +274,13 @@ func (cs *clientStream) checkResetOrDone() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (cs *clientStream) getStartedWrite() bool {
|
||||||
|
cc := cs.cc
|
||||||
|
cc.mu.Lock()
|
||||||
|
defer cc.mu.Unlock()
|
||||||
|
return cs.startedWrite
|
||||||
|
}
|
||||||
|
|
||||||
func (cs *clientStream) abortRequestBodyWrite(err error) {
|
func (cs *clientStream) abortRequestBodyWrite(err error) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
panic("nil error")
|
panic("nil error")
|
||||||
@@ -298,7 +306,26 @@ func (sew stickyErrWriter) Write(p []byte) (n int, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var ErrNoCachedConn = errors.New("http2: no cached connection was available")
|
// noCachedConnError is the concrete type of ErrNoCachedConn, which
|
||||||
|
// needs to be detected by net/http regardless of whether it's its
|
||||||
|
// bundled version (in h2_bundle.go with a rewritten type name) or
|
||||||
|
// from a user's x/net/http2. As such, as it has a unique method name
|
||||||
|
// (IsHTTP2NoCachedConnError) that net/http sniffs for via func
|
||||||
|
// isNoCachedConnError.
|
||||||
|
type noCachedConnError struct{}
|
||||||
|
|
||||||
|
func (noCachedConnError) IsHTTP2NoCachedConnError() {}
|
||||||
|
func (noCachedConnError) Error() string { return "http2: no cached connection was available" }
|
||||||
|
|
||||||
|
// isNoCachedConnError reports whether err is of type noCachedConnError
|
||||||
|
// or its equivalent renamed type in net/http2's h2_bundle.go. Both types
|
||||||
|
// may coexist in the same running program.
|
||||||
|
func isNoCachedConnError(err error) bool {
|
||||||
|
_, ok := err.(interface{ IsHTTP2NoCachedConnError() })
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
var ErrNoCachedConn error = noCachedConnError{}
|
||||||
|
|
||||||
// RoundTripOpt are options for the Transport.RoundTripOpt method.
|
// RoundTripOpt are options for the Transport.RoundTripOpt method.
|
||||||
type RoundTripOpt struct {
|
type RoundTripOpt struct {
|
||||||
@@ -348,14 +375,9 @@ func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Res
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
traceGotConn(req, cc)
|
traceGotConn(req, cc)
|
||||||
res, err := cc.RoundTrip(req)
|
res, gotErrAfterReqBodyWrite, err := cc.roundTrip(req)
|
||||||
if err != nil && retry <= 6 {
|
if err != nil && retry <= 6 {
|
||||||
afterBodyWrite := false
|
if req, err = shouldRetryRequest(req, err, gotErrAfterReqBodyWrite); err == nil {
|
||||||
if e, ok := err.(afterReqBodyWriteError); ok {
|
|
||||||
err = e
|
|
||||||
afterBodyWrite = true
|
|
||||||
}
|
|
||||||
if req, err = shouldRetryRequest(req, err, afterBodyWrite); err == nil {
|
|
||||||
// After the first retry, do exponential backoff with 10% jitter.
|
// After the first retry, do exponential backoff with 10% jitter.
|
||||||
if retry == 0 {
|
if retry == 0 {
|
||||||
continue
|
continue
|
||||||
@@ -393,16 +415,6 @@ var (
|
|||||||
errClientConnGotGoAway = errors.New("http2: Transport received Server's graceful shutdown GOAWAY")
|
errClientConnGotGoAway = errors.New("http2: Transport received Server's graceful shutdown GOAWAY")
|
||||||
)
|
)
|
||||||
|
|
||||||
// afterReqBodyWriteError is a wrapper around errors returned by ClientConn.RoundTrip.
|
|
||||||
// It is used to signal that err happened after part of Request.Body was sent to the server.
|
|
||||||
type afterReqBodyWriteError struct {
|
|
||||||
err error
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e afterReqBodyWriteError) Error() string {
|
|
||||||
return e.err.Error() + "; some request body already written"
|
|
||||||
}
|
|
||||||
|
|
||||||
// shouldRetryRequest is called by RoundTrip when a request fails to get
|
// shouldRetryRequest is called by RoundTrip when a request fails to get
|
||||||
// response headers. It is always called with a non-nil error.
|
// response headers. It is always called with a non-nil error.
|
||||||
// It returns either a request to retry (either the same request, or a
|
// It returns either a request to retry (either the same request, or a
|
||||||
@@ -519,17 +531,18 @@ func (t *Transport) NewClientConn(c net.Conn) (*ClientConn, error) {
|
|||||||
|
|
||||||
func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, error) {
|
func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, error) {
|
||||||
cc := &ClientConn{
|
cc := &ClientConn{
|
||||||
t: t,
|
t: t,
|
||||||
tconn: c,
|
tconn: c,
|
||||||
readerDone: make(chan struct{}),
|
readerDone: make(chan struct{}),
|
||||||
nextStreamID: 1,
|
nextStreamID: 1,
|
||||||
maxFrameSize: 16 << 10, // spec default
|
maxFrameSize: 16 << 10, // spec default
|
||||||
initialWindowSize: 65535, // spec default
|
initialWindowSize: 65535, // spec default
|
||||||
maxConcurrentStreams: 1000, // "infinite", per spec. 1000 seems good enough.
|
maxConcurrentStreams: 1000, // "infinite", per spec. 1000 seems good enough.
|
||||||
streams: make(map[uint32]*clientStream),
|
peerMaxHeaderListSize: 0xffffffffffffffff, // "infinite", per spec. Use 2^64-1 instead.
|
||||||
singleUse: singleUse,
|
streams: make(map[uint32]*clientStream),
|
||||||
wantSettingsAck: true,
|
singleUse: singleUse,
|
||||||
pings: make(map[[8]byte]chan struct{}),
|
wantSettingsAck: true,
|
||||||
|
pings: make(map[[8]byte]chan struct{}),
|
||||||
}
|
}
|
||||||
if d := t.idleConnTimeout(); d != 0 {
|
if d := t.idleConnTimeout(); d != 0 {
|
||||||
cc.idleTimeout = d
|
cc.idleTimeout = d
|
||||||
@@ -750,8 +763,13 @@ func actualContentLength(req *http.Request) int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
|
resp, _, err := cc.roundTrip(req)
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cc *ClientConn) roundTrip(req *http.Request) (res *http.Response, gotErrAfterReqBodyWrite bool, err error) {
|
||||||
if err := checkConnHeaders(req); err != nil {
|
if err := checkConnHeaders(req); err != nil {
|
||||||
return nil, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
if cc.idleTimer != nil {
|
if cc.idleTimer != nil {
|
||||||
cc.idleTimer.Stop()
|
cc.idleTimer.Stop()
|
||||||
@@ -759,14 +777,14 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||||||
|
|
||||||
trailers, err := commaSeparatedTrailers(req)
|
trailers, err := commaSeparatedTrailers(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
hasTrailers := trailers != ""
|
hasTrailers := trailers != ""
|
||||||
|
|
||||||
cc.mu.Lock()
|
cc.mu.Lock()
|
||||||
if err := cc.awaitOpenSlotForRequest(req); err != nil {
|
if err := cc.awaitOpenSlotForRequest(req); err != nil {
|
||||||
cc.mu.Unlock()
|
cc.mu.Unlock()
|
||||||
return nil, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
body := req.Body
|
body := req.Body
|
||||||
@@ -800,7 +818,7 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||||||
hdrs, err := cc.encodeHeaders(req, requestedGzip, trailers, contentLen)
|
hdrs, err := cc.encodeHeaders(req, requestedGzip, trailers, contentLen)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cc.mu.Unlock()
|
cc.mu.Unlock()
|
||||||
return nil, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
cs := cc.newStream()
|
cs := cc.newStream()
|
||||||
@@ -812,7 +830,7 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||||||
|
|
||||||
cc.wmu.Lock()
|
cc.wmu.Lock()
|
||||||
endStream := !hasBody && !hasTrailers
|
endStream := !hasBody && !hasTrailers
|
||||||
werr := cc.writeHeaders(cs.ID, endStream, hdrs)
|
werr := cc.writeHeaders(cs.ID, endStream, int(cc.maxFrameSize), hdrs)
|
||||||
cc.wmu.Unlock()
|
cc.wmu.Unlock()
|
||||||
traceWroteHeaders(cs.trace)
|
traceWroteHeaders(cs.trace)
|
||||||
cc.mu.Unlock()
|
cc.mu.Unlock()
|
||||||
@@ -826,7 +844,7 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||||||
// Don't bother sending a RST_STREAM (our write already failed;
|
// Don't bother sending a RST_STREAM (our write already failed;
|
||||||
// no need to keep writing)
|
// no need to keep writing)
|
||||||
traceWroteRequest(cs.trace, werr)
|
traceWroteRequest(cs.trace, werr)
|
||||||
return nil, werr
|
return nil, false, werr
|
||||||
}
|
}
|
||||||
|
|
||||||
var respHeaderTimer <-chan time.Time
|
var respHeaderTimer <-chan time.Time
|
||||||
@@ -845,7 +863,7 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||||||
bodyWritten := false
|
bodyWritten := false
|
||||||
ctx := reqContext(req)
|
ctx := reqContext(req)
|
||||||
|
|
||||||
handleReadLoopResponse := func(re resAndError) (*http.Response, error) {
|
handleReadLoopResponse := func(re resAndError) (*http.Response, bool, error) {
|
||||||
res := re.res
|
res := re.res
|
||||||
if re.err != nil || res.StatusCode > 299 {
|
if re.err != nil || res.StatusCode > 299 {
|
||||||
// On error or status code 3xx, 4xx, 5xx, etc abort any
|
// On error or status code 3xx, 4xx, 5xx, etc abort any
|
||||||
@@ -861,18 +879,12 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||||||
cs.abortRequestBodyWrite(errStopReqBodyWrite)
|
cs.abortRequestBodyWrite(errStopReqBodyWrite)
|
||||||
}
|
}
|
||||||
if re.err != nil {
|
if re.err != nil {
|
||||||
cc.mu.Lock()
|
|
||||||
afterBodyWrite := cs.startedWrite
|
|
||||||
cc.mu.Unlock()
|
|
||||||
cc.forgetStreamID(cs.ID)
|
cc.forgetStreamID(cs.ID)
|
||||||
if afterBodyWrite {
|
return nil, cs.getStartedWrite(), re.err
|
||||||
return nil, afterReqBodyWriteError{re.err}
|
|
||||||
}
|
|
||||||
return nil, re.err
|
|
||||||
}
|
}
|
||||||
res.Request = req
|
res.Request = req
|
||||||
res.TLS = cc.tlsState
|
res.TLS = cc.tlsState
|
||||||
return res, nil
|
return res, false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
@@ -887,7 +899,7 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||||||
cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel)
|
cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel)
|
||||||
}
|
}
|
||||||
cc.forgetStreamID(cs.ID)
|
cc.forgetStreamID(cs.ID)
|
||||||
return nil, errTimeout
|
return nil, cs.getStartedWrite(), errTimeout
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
if !hasBody || bodyWritten {
|
if !hasBody || bodyWritten {
|
||||||
cc.writeStreamReset(cs.ID, ErrCodeCancel, nil)
|
cc.writeStreamReset(cs.ID, ErrCodeCancel, nil)
|
||||||
@@ -896,7 +908,7 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||||||
cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel)
|
cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel)
|
||||||
}
|
}
|
||||||
cc.forgetStreamID(cs.ID)
|
cc.forgetStreamID(cs.ID)
|
||||||
return nil, ctx.Err()
|
return nil, cs.getStartedWrite(), ctx.Err()
|
||||||
case <-req.Cancel:
|
case <-req.Cancel:
|
||||||
if !hasBody || bodyWritten {
|
if !hasBody || bodyWritten {
|
||||||
cc.writeStreamReset(cs.ID, ErrCodeCancel, nil)
|
cc.writeStreamReset(cs.ID, ErrCodeCancel, nil)
|
||||||
@@ -905,12 +917,12 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||||||
cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel)
|
cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel)
|
||||||
}
|
}
|
||||||
cc.forgetStreamID(cs.ID)
|
cc.forgetStreamID(cs.ID)
|
||||||
return nil, errRequestCanceled
|
return nil, cs.getStartedWrite(), errRequestCanceled
|
||||||
case <-cs.peerReset:
|
case <-cs.peerReset:
|
||||||
// processResetStream already removed the
|
// processResetStream already removed the
|
||||||
// stream from the streams map; no need for
|
// stream from the streams map; no need for
|
||||||
// forgetStreamID.
|
// forgetStreamID.
|
||||||
return nil, cs.resetErr
|
return nil, cs.getStartedWrite(), cs.resetErr
|
||||||
case err := <-bodyWriter.resc:
|
case err := <-bodyWriter.resc:
|
||||||
// Prefer the read loop's response, if available. Issue 16102.
|
// Prefer the read loop's response, if available. Issue 16102.
|
||||||
select {
|
select {
|
||||||
@@ -919,7 +931,7 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, cs.getStartedWrite(), err
|
||||||
}
|
}
|
||||||
bodyWritten = true
|
bodyWritten = true
|
||||||
if d := cc.responseHeaderTimeout(); d != 0 {
|
if d := cc.responseHeaderTimeout(); d != 0 {
|
||||||
@@ -971,13 +983,12 @@ func (cc *ClientConn) awaitOpenSlotForRequest(req *http.Request) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// requires cc.wmu be held
|
// requires cc.wmu be held
|
||||||
func (cc *ClientConn) writeHeaders(streamID uint32, endStream bool, hdrs []byte) error {
|
func (cc *ClientConn) writeHeaders(streamID uint32, endStream bool, maxFrameSize int, hdrs []byte) error {
|
||||||
first := true // first frame written (HEADERS is first, then CONTINUATION)
|
first := true // first frame written (HEADERS is first, then CONTINUATION)
|
||||||
frameSize := int(cc.maxFrameSize)
|
|
||||||
for len(hdrs) > 0 && cc.werr == nil {
|
for len(hdrs) > 0 && cc.werr == nil {
|
||||||
chunk := hdrs
|
chunk := hdrs
|
||||||
if len(chunk) > frameSize {
|
if len(chunk) > maxFrameSize {
|
||||||
chunk = chunk[:frameSize]
|
chunk = chunk[:maxFrameSize]
|
||||||
}
|
}
|
||||||
hdrs = hdrs[len(chunk):]
|
hdrs = hdrs[len(chunk):]
|
||||||
endHeaders := len(hdrs) == 0
|
endHeaders := len(hdrs) == 0
|
||||||
@@ -1085,17 +1096,26 @@ func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) (
|
|||||||
var trls []byte
|
var trls []byte
|
||||||
if hasTrailers {
|
if hasTrailers {
|
||||||
cc.mu.Lock()
|
cc.mu.Lock()
|
||||||
defer cc.mu.Unlock()
|
trls, err = cc.encodeTrailers(req)
|
||||||
trls = cc.encodeTrailers(req)
|
cc.mu.Unlock()
|
||||||
|
if err != nil {
|
||||||
|
cc.writeStreamReset(cs.ID, ErrCodeInternal, err)
|
||||||
|
cc.forgetStreamID(cs.ID)
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc.mu.Lock()
|
||||||
|
maxFrameSize := int(cc.maxFrameSize)
|
||||||
|
cc.mu.Unlock()
|
||||||
|
|
||||||
cc.wmu.Lock()
|
cc.wmu.Lock()
|
||||||
defer cc.wmu.Unlock()
|
defer cc.wmu.Unlock()
|
||||||
|
|
||||||
// Two ways to send END_STREAM: either with trailers, or
|
// Two ways to send END_STREAM: either with trailers, or
|
||||||
// with an empty DATA frame.
|
// with an empty DATA frame.
|
||||||
if len(trls) > 0 {
|
if len(trls) > 0 {
|
||||||
err = cc.writeHeaders(cs.ID, true, trls)
|
err = cc.writeHeaders(cs.ID, true, maxFrameSize, trls)
|
||||||
} else {
|
} else {
|
||||||
err = cc.fr.WriteData(cs.ID, true, nil)
|
err = cc.fr.WriteData(cs.ID, true, nil)
|
||||||
}
|
}
|
||||||
@@ -1189,62 +1209,86 @@ func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trail
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 8.1.2.3 Request Pseudo-Header Fields
|
enumerateHeaders := func(f func(name, value string)) {
|
||||||
// The :path pseudo-header field includes the path and query parts of the
|
// 8.1.2.3 Request Pseudo-Header Fields
|
||||||
// target URI (the path-absolute production and optionally a '?' character
|
// The :path pseudo-header field includes the path and query parts of the
|
||||||
// followed by the query production (see Sections 3.3 and 3.4 of
|
// target URI (the path-absolute production and optionally a '?' character
|
||||||
// [RFC3986]).
|
// followed by the query production (see Sections 3.3 and 3.4 of
|
||||||
cc.writeHeader(":authority", host)
|
// [RFC3986]).
|
||||||
cc.writeHeader(":method", req.Method)
|
f(":authority", host)
|
||||||
if req.Method != "CONNECT" {
|
f(":method", req.Method)
|
||||||
cc.writeHeader(":path", path)
|
if req.Method != "CONNECT" {
|
||||||
cc.writeHeader(":scheme", req.URL.Scheme)
|
f(":path", path)
|
||||||
}
|
f(":scheme", req.URL.Scheme)
|
||||||
if trailers != "" {
|
}
|
||||||
cc.writeHeader("trailer", trailers)
|
if trailers != "" {
|
||||||
|
f("trailer", trailers)
|
||||||
|
}
|
||||||
|
|
||||||
|
var didUA bool
|
||||||
|
for k, vv := range req.Header {
|
||||||
|
if strings.EqualFold(k, "host") || strings.EqualFold(k, "content-length") {
|
||||||
|
// Host is :authority, already sent.
|
||||||
|
// Content-Length is automatic, set below.
|
||||||
|
continue
|
||||||
|
} else if strings.EqualFold(k, "connection") || strings.EqualFold(k, "proxy-connection") ||
|
||||||
|
strings.EqualFold(k, "transfer-encoding") || strings.EqualFold(k, "upgrade") ||
|
||||||
|
strings.EqualFold(k, "keep-alive") {
|
||||||
|
// Per 8.1.2.2 Connection-Specific Header
|
||||||
|
// Fields, don't send connection-specific
|
||||||
|
// fields. We have already checked if any
|
||||||
|
// are error-worthy so just ignore the rest.
|
||||||
|
continue
|
||||||
|
} else if strings.EqualFold(k, "user-agent") {
|
||||||
|
// Match Go's http1 behavior: at most one
|
||||||
|
// User-Agent. If set to nil or empty string,
|
||||||
|
// then omit it. Otherwise if not mentioned,
|
||||||
|
// include the default (below).
|
||||||
|
didUA = true
|
||||||
|
if len(vv) < 1 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
vv = vv[:1]
|
||||||
|
if vv[0] == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range vv {
|
||||||
|
f(k, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if shouldSendReqContentLength(req.Method, contentLength) {
|
||||||
|
f("content-length", strconv.FormatInt(contentLength, 10))
|
||||||
|
}
|
||||||
|
if addGzipHeader {
|
||||||
|
f("accept-encoding", "gzip")
|
||||||
|
}
|
||||||
|
if !didUA {
|
||||||
|
f("user-agent", defaultUserAgent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var didUA bool
|
// Do a first pass over the headers counting bytes to ensure
|
||||||
for k, vv := range req.Header {
|
// we don't exceed cc.peerMaxHeaderListSize. This is done as a
|
||||||
lowKey := strings.ToLower(k)
|
// separate pass before encoding the headers to prevent
|
||||||
switch lowKey {
|
// modifying the hpack state.
|
||||||
case "host", "content-length":
|
hlSize := uint64(0)
|
||||||
// Host is :authority, already sent.
|
enumerateHeaders(func(name, value string) {
|
||||||
// Content-Length is automatic, set below.
|
hf := hpack.HeaderField{Name: name, Value: value}
|
||||||
continue
|
hlSize += uint64(hf.Size())
|
||||||
case "connection", "proxy-connection", "transfer-encoding", "upgrade", "keep-alive":
|
})
|
||||||
// Per 8.1.2.2 Connection-Specific Header
|
|
||||||
// Fields, don't send connection-specific
|
if hlSize > cc.peerMaxHeaderListSize {
|
||||||
// fields. We have already checked if any
|
return nil, errRequestHeaderListSize
|
||||||
// are error-worthy so just ignore the rest.
|
|
||||||
continue
|
|
||||||
case "user-agent":
|
|
||||||
// Match Go's http1 behavior: at most one
|
|
||||||
// User-Agent. If set to nil or empty string,
|
|
||||||
// then omit it. Otherwise if not mentioned,
|
|
||||||
// include the default (below).
|
|
||||||
didUA = true
|
|
||||||
if len(vv) < 1 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
vv = vv[:1]
|
|
||||||
if vv[0] == "" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, v := range vv {
|
|
||||||
cc.writeHeader(lowKey, v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if shouldSendReqContentLength(req.Method, contentLength) {
|
|
||||||
cc.writeHeader("content-length", strconv.FormatInt(contentLength, 10))
|
|
||||||
}
|
|
||||||
if addGzipHeader {
|
|
||||||
cc.writeHeader("accept-encoding", "gzip")
|
|
||||||
}
|
|
||||||
if !didUA {
|
|
||||||
cc.writeHeader("user-agent", defaultUserAgent)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Header list size is ok. Write the headers.
|
||||||
|
enumerateHeaders(func(name, value string) {
|
||||||
|
cc.writeHeader(strings.ToLower(name), value)
|
||||||
|
})
|
||||||
|
|
||||||
return cc.hbuf.Bytes(), nil
|
return cc.hbuf.Bytes(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1271,17 +1315,29 @@ func shouldSendReqContentLength(method string, contentLength int64) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// requires cc.mu be held.
|
// requires cc.mu be held.
|
||||||
func (cc *ClientConn) encodeTrailers(req *http.Request) []byte {
|
func (cc *ClientConn) encodeTrailers(req *http.Request) ([]byte, error) {
|
||||||
cc.hbuf.Reset()
|
cc.hbuf.Reset()
|
||||||
|
|
||||||
|
hlSize := uint64(0)
|
||||||
for k, vv := range req.Trailer {
|
for k, vv := range req.Trailer {
|
||||||
// Transfer-Encoding, etc.. have already been filter at the
|
for _, v := range vv {
|
||||||
|
hf := hpack.HeaderField{Name: k, Value: v}
|
||||||
|
hlSize += uint64(hf.Size())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if hlSize > cc.peerMaxHeaderListSize {
|
||||||
|
return nil, errRequestHeaderListSize
|
||||||
|
}
|
||||||
|
|
||||||
|
for k, vv := range req.Trailer {
|
||||||
|
// Transfer-Encoding, etc.. have already been filtered at the
|
||||||
// start of RoundTrip
|
// start of RoundTrip
|
||||||
lowKey := strings.ToLower(k)
|
lowKey := strings.ToLower(k)
|
||||||
for _, v := range vv {
|
for _, v := range vv {
|
||||||
cc.writeHeader(lowKey, v)
|
cc.writeHeader(lowKey, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cc.hbuf.Bytes()
|
return cc.hbuf.Bytes(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cc *ClientConn) writeHeader(name, value string) {
|
func (cc *ClientConn) writeHeader(name, value string) {
|
||||||
@@ -1339,17 +1395,12 @@ func (cc *ClientConn) streamByID(id uint32, andRemove bool) *clientStream {
|
|||||||
// clientConnReadLoop is the state owned by the clientConn's frame-reading readLoop.
|
// clientConnReadLoop is the state owned by the clientConn's frame-reading readLoop.
|
||||||
type clientConnReadLoop struct {
|
type clientConnReadLoop struct {
|
||||||
cc *ClientConn
|
cc *ClientConn
|
||||||
activeRes map[uint32]*clientStream // keyed by streamID
|
|
||||||
closeWhenIdle bool
|
closeWhenIdle bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// readLoop runs in its own goroutine and reads and dispatches frames.
|
// readLoop runs in its own goroutine and reads and dispatches frames.
|
||||||
func (cc *ClientConn) readLoop() {
|
func (cc *ClientConn) readLoop() {
|
||||||
rl := &clientConnReadLoop{
|
rl := &clientConnReadLoop{cc: cc}
|
||||||
cc: cc,
|
|
||||||
activeRes: make(map[uint32]*clientStream),
|
|
||||||
}
|
|
||||||
|
|
||||||
defer rl.cleanup()
|
defer rl.cleanup()
|
||||||
cc.readerErr = rl.run()
|
cc.readerErr = rl.run()
|
||||||
if ce, ok := cc.readerErr.(ConnectionError); ok {
|
if ce, ok := cc.readerErr.(ConnectionError); ok {
|
||||||
@@ -1404,10 +1455,8 @@ func (rl *clientConnReadLoop) cleanup() {
|
|||||||
} else if err == io.EOF {
|
} else if err == io.EOF {
|
||||||
err = io.ErrUnexpectedEOF
|
err = io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
for _, cs := range rl.activeRes {
|
|
||||||
cs.bufPipe.CloseWithError(err)
|
|
||||||
}
|
|
||||||
for _, cs := range cc.streams {
|
for _, cs := range cc.streams {
|
||||||
|
cs.bufPipe.CloseWithError(err) // no-op if already closed
|
||||||
select {
|
select {
|
||||||
case cs.resc <- resAndError{err: err}:
|
case cs.resc <- resAndError{err: err}:
|
||||||
default:
|
default:
|
||||||
@@ -1485,7 +1534,7 @@ func (rl *clientConnReadLoop) run() error {
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if rl.closeWhenIdle && gotReply && maybeIdle && len(rl.activeRes) == 0 {
|
if rl.closeWhenIdle && gotReply && maybeIdle {
|
||||||
cc.closeIfIdle()
|
cc.closeIfIdle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1493,13 +1542,31 @@ func (rl *clientConnReadLoop) run() error {
|
|||||||
|
|
||||||
func (rl *clientConnReadLoop) processHeaders(f *MetaHeadersFrame) error {
|
func (rl *clientConnReadLoop) processHeaders(f *MetaHeadersFrame) error {
|
||||||
cc := rl.cc
|
cc := rl.cc
|
||||||
cs := cc.streamByID(f.StreamID, f.StreamEnded())
|
cs := cc.streamByID(f.StreamID, false)
|
||||||
if cs == nil {
|
if cs == nil {
|
||||||
// We'd get here if we canceled a request while the
|
// We'd get here if we canceled a request while the
|
||||||
// server had its response still in flight. So if this
|
// server had its response still in flight. So if this
|
||||||
// was just something we canceled, ignore it.
|
// was just something we canceled, ignore it.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if f.StreamEnded() {
|
||||||
|
// Issue 20521: If the stream has ended, streamByID() causes
|
||||||
|
// clientStream.done to be closed, which causes the request's bodyWriter
|
||||||
|
// to be closed with an errStreamClosed, which may be received by
|
||||||
|
// clientConn.RoundTrip before the result of processing these headers.
|
||||||
|
// Deferring stream closure allows the header processing to occur first.
|
||||||
|
// clientConn.RoundTrip may still receive the bodyWriter error first, but
|
||||||
|
// the fix for issue 16102 prioritises any response.
|
||||||
|
//
|
||||||
|
// Issue 22413: If there is no request body, we should close the
|
||||||
|
// stream before writing to cs.resc so that the stream is closed
|
||||||
|
// immediately once RoundTrip returns.
|
||||||
|
if cs.req.Body != nil {
|
||||||
|
defer cc.forgetStreamID(f.StreamID)
|
||||||
|
} else {
|
||||||
|
cc.forgetStreamID(f.StreamID)
|
||||||
|
}
|
||||||
|
}
|
||||||
if !cs.firstByte {
|
if !cs.firstByte {
|
||||||
if cs.trace != nil {
|
if cs.trace != nil {
|
||||||
// TODO(bradfitz): move first response byte earlier,
|
// TODO(bradfitz): move first response byte earlier,
|
||||||
@@ -1523,6 +1590,7 @@ func (rl *clientConnReadLoop) processHeaders(f *MetaHeadersFrame) error {
|
|||||||
}
|
}
|
||||||
// Any other error type is a stream error.
|
// Any other error type is a stream error.
|
||||||
cs.cc.writeStreamReset(f.StreamID, ErrCodeProtocol, err)
|
cs.cc.writeStreamReset(f.StreamID, ErrCodeProtocol, err)
|
||||||
|
cc.forgetStreamID(cs.ID)
|
||||||
cs.resc <- resAndError{err: err}
|
cs.resc <- resAndError{err: err}
|
||||||
return nil // return nil from process* funcs to keep conn alive
|
return nil // return nil from process* funcs to keep conn alive
|
||||||
}
|
}
|
||||||
@@ -1530,9 +1598,6 @@ func (rl *clientConnReadLoop) processHeaders(f *MetaHeadersFrame) error {
|
|||||||
// (nil, nil) special case. See handleResponse docs.
|
// (nil, nil) special case. See handleResponse docs.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if res.Body != noBody {
|
|
||||||
rl.activeRes[cs.ID] = cs
|
|
||||||
}
|
|
||||||
cs.resTrailer = &res.Trailer
|
cs.resTrailer = &res.Trailer
|
||||||
cs.resc <- resAndError{res: res}
|
cs.resc <- resAndError{res: res}
|
||||||
return nil
|
return nil
|
||||||
@@ -1552,11 +1617,11 @@ func (rl *clientConnReadLoop) handleResponse(cs *clientStream, f *MetaHeadersFra
|
|||||||
|
|
||||||
status := f.PseudoValue("status")
|
status := f.PseudoValue("status")
|
||||||
if status == "" {
|
if status == "" {
|
||||||
return nil, errors.New("missing status pseudo header")
|
return nil, errors.New("malformed response from server: missing status pseudo header")
|
||||||
}
|
}
|
||||||
statusCode, err := strconv.Atoi(status)
|
statusCode, err := strconv.Atoi(status)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.New("malformed non-numeric status pseudo header")
|
return nil, errors.New("malformed response from server: malformed non-numeric status pseudo header")
|
||||||
}
|
}
|
||||||
|
|
||||||
if statusCode == 100 {
|
if statusCode == 100 {
|
||||||
@@ -1789,7 +1854,23 @@ func (rl *clientConnReadLoop) processData(f *DataFrame) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if !cs.firstByte {
|
||||||
|
cc.logf("protocol error: received DATA before a HEADERS frame")
|
||||||
|
rl.endStreamError(cs, StreamError{
|
||||||
|
StreamID: f.StreamID,
|
||||||
|
Code: ErrCodeProtocol,
|
||||||
|
})
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if f.Length > 0 {
|
if f.Length > 0 {
|
||||||
|
if cs.req.Method == "HEAD" && len(data) > 0 {
|
||||||
|
cc.logf("protocol error: received DATA on a HEAD request")
|
||||||
|
rl.endStreamError(cs, StreamError{
|
||||||
|
StreamID: f.StreamID,
|
||||||
|
Code: ErrCodeProtocol,
|
||||||
|
})
|
||||||
|
return nil
|
||||||
|
}
|
||||||
// Check connection-level flow control.
|
// Check connection-level flow control.
|
||||||
cc.mu.Lock()
|
cc.mu.Lock()
|
||||||
if cs.inflow.available() >= int32(f.Length) {
|
if cs.inflow.available() >= int32(f.Length) {
|
||||||
@@ -1851,11 +1932,10 @@ func (rl *clientConnReadLoop) endStreamError(cs *clientStream, err error) {
|
|||||||
err = io.EOF
|
err = io.EOF
|
||||||
code = cs.copyTrailers
|
code = cs.copyTrailers
|
||||||
}
|
}
|
||||||
cs.bufPipe.closeWithErrorAndCode(err, code)
|
|
||||||
delete(rl.activeRes, cs.ID)
|
|
||||||
if isConnectionCloseRequest(cs.req) {
|
if isConnectionCloseRequest(cs.req) {
|
||||||
rl.closeWhenIdle = true
|
rl.closeWhenIdle = true
|
||||||
}
|
}
|
||||||
|
cs.bufPipe.closeWithErrorAndCode(err, code)
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case cs.resc <- resAndError{err: err}:
|
case cs.resc <- resAndError{err: err}:
|
||||||
@@ -1903,6 +1983,8 @@ func (rl *clientConnReadLoop) processSettings(f *SettingsFrame) error {
|
|||||||
cc.maxFrameSize = s.Val
|
cc.maxFrameSize = s.Val
|
||||||
case SettingMaxConcurrentStreams:
|
case SettingMaxConcurrentStreams:
|
||||||
cc.maxConcurrentStreams = s.Val
|
cc.maxConcurrentStreams = s.Val
|
||||||
|
case SettingMaxHeaderListSize:
|
||||||
|
cc.peerMaxHeaderListSize = uint64(s.Val)
|
||||||
case SettingInitialWindowSize:
|
case SettingInitialWindowSize:
|
||||||
// Values above the maximum flow-control
|
// Values above the maximum flow-control
|
||||||
// window size of 2^31-1 MUST be treated as a
|
// window size of 2^31-1 MUST be treated as a
|
||||||
@@ -1980,7 +2062,6 @@ func (rl *clientConnReadLoop) processResetStream(f *RSTStreamFrame) error {
|
|||||||
cs.bufPipe.CloseWithError(err)
|
cs.bufPipe.CloseWithError(err)
|
||||||
cs.cc.cond.Broadcast() // wake up checkResetOrDone via clientStream.awaitFlowControl
|
cs.cc.cond.Broadcast() // wake up checkResetOrDone via clientStream.awaitFlowControl
|
||||||
}
|
}
|
||||||
delete(rl.activeRes, cs.ID)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2069,6 +2150,7 @@ func (cc *ClientConn) writeStreamReset(streamID uint32, code ErrCode, err error)
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
errResponseHeaderListSize = errors.New("http2: response header list larger than advertised limit")
|
errResponseHeaderListSize = errors.New("http2: response header list larger than advertised limit")
|
||||||
|
errRequestHeaderListSize = errors.New("http2: request header list larger than peer's advertised limit")
|
||||||
errPseudoTrailers = errors.New("http2: invalid pseudo header in trailers")
|
errPseudoTrailers = errors.New("http2: invalid pseudo header in trailers")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+1
-6
@@ -10,7 +10,6 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
|
||||||
|
|
||||||
"golang.org/x/net/http2/hpack"
|
"golang.org/x/net/http2/hpack"
|
||||||
"golang.org/x/net/lex/httplex"
|
"golang.org/x/net/lex/httplex"
|
||||||
@@ -90,11 +89,7 @@ type writeGoAway struct {
|
|||||||
|
|
||||||
func (p *writeGoAway) writeFrame(ctx writeContext) error {
|
func (p *writeGoAway) writeFrame(ctx writeContext) error {
|
||||||
err := ctx.Framer().WriteGoAway(p.maxStreamID, p.code, nil)
|
err := ctx.Framer().WriteGoAway(p.maxStreamID, p.code, nil)
|
||||||
if p.code != 0 {
|
ctx.Flush() // ignore error: we're hanging up on them anyway
|
||||||
ctx.Flush() // ignore error: we're hanging up on them anyway
|
|
||||||
time.Sleep(50 * time.Millisecond)
|
|
||||||
ctx.CloseConn()
|
|
||||||
}
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+89
-37
@@ -21,6 +21,7 @@ import (
|
|||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
"golang.org/x/text/secure/bidirule"
|
"golang.org/x/text/secure/bidirule"
|
||||||
|
"golang.org/x/text/unicode/bidi"
|
||||||
"golang.org/x/text/unicode/norm"
|
"golang.org/x/text/unicode/norm"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ func VerifyDNSLength(verify bool) Option {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RemoveLeadingDots removes leading label separators. Leading runes that map to
|
// RemoveLeadingDots removes leading label separators. Leading runes that map to
|
||||||
// dots, such as U+3002, are removed as well.
|
// dots, such as U+3002 IDEOGRAPHIC FULL STOP, are removed as well.
|
||||||
//
|
//
|
||||||
// This is the behavior suggested by the UTS #46 and is adopted by some
|
// This is the behavior suggested by the UTS #46 and is adopted by some
|
||||||
// browsers.
|
// browsers.
|
||||||
@@ -92,7 +93,7 @@ func ValidateLabels(enable bool) Option {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// StrictDomainName limits the set of permissable ASCII characters to those
|
// StrictDomainName limits the set of permissible ASCII characters to those
|
||||||
// allowed in domain names as defined in RFC 1034 (A-Z, a-z, 0-9 and the
|
// allowed in domain names as defined in RFC 1034 (A-Z, a-z, 0-9 and the
|
||||||
// hyphen). This is set by default for MapForLookup and ValidateForRegistration.
|
// hyphen). This is set by default for MapForLookup and ValidateForRegistration.
|
||||||
//
|
//
|
||||||
@@ -142,7 +143,6 @@ func MapForLookup() Option {
|
|||||||
o.mapping = validateAndMap
|
o.mapping = validateAndMap
|
||||||
StrictDomainName(true)(o)
|
StrictDomainName(true)(o)
|
||||||
ValidateLabels(true)(o)
|
ValidateLabels(true)(o)
|
||||||
RemoveLeadingDots(true)(o)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,14 +160,14 @@ type options struct {
|
|||||||
|
|
||||||
// mapping implements a validation and mapping step as defined in RFC 5895
|
// mapping implements a validation and mapping step as defined in RFC 5895
|
||||||
// or UTS 46, tailored to, for example, domain registration or lookup.
|
// or UTS 46, tailored to, for example, domain registration or lookup.
|
||||||
mapping func(p *Profile, s string) (string, error)
|
mapping func(p *Profile, s string) (mapped string, isBidi bool, err error)
|
||||||
|
|
||||||
// bidirule, if specified, checks whether s conforms to the Bidi Rule
|
// bidirule, if specified, checks whether s conforms to the Bidi Rule
|
||||||
// defined in RFC 5893.
|
// defined in RFC 5893.
|
||||||
bidirule func(s string) bool
|
bidirule func(s string) bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// A Profile defines the configuration of a IDNA mapper.
|
// A Profile defines the configuration of an IDNA mapper.
|
||||||
type Profile struct {
|
type Profile struct {
|
||||||
options
|
options
|
||||||
}
|
}
|
||||||
@@ -251,23 +251,21 @@ var (
|
|||||||
|
|
||||||
punycode = &Profile{}
|
punycode = &Profile{}
|
||||||
lookup = &Profile{options{
|
lookup = &Profile{options{
|
||||||
transitional: true,
|
transitional: true,
|
||||||
useSTD3Rules: true,
|
useSTD3Rules: true,
|
||||||
validateLabels: true,
|
validateLabels: true,
|
||||||
removeLeadingDots: true,
|
trie: trie,
|
||||||
trie: trie,
|
fromPuny: validateFromPunycode,
|
||||||
fromPuny: validateFromPunycode,
|
mapping: validateAndMap,
|
||||||
mapping: validateAndMap,
|
bidirule: bidirule.ValidString,
|
||||||
bidirule: bidirule.ValidString,
|
|
||||||
}}
|
}}
|
||||||
display = &Profile{options{
|
display = &Profile{options{
|
||||||
useSTD3Rules: true,
|
useSTD3Rules: true,
|
||||||
validateLabels: true,
|
validateLabels: true,
|
||||||
removeLeadingDots: true,
|
trie: trie,
|
||||||
trie: trie,
|
fromPuny: validateFromPunycode,
|
||||||
fromPuny: validateFromPunycode,
|
mapping: validateAndMap,
|
||||||
mapping: validateAndMap,
|
bidirule: bidirule.ValidString,
|
||||||
bidirule: bidirule.ValidString,
|
|
||||||
}}
|
}}
|
||||||
registration = &Profile{options{
|
registration = &Profile{options{
|
||||||
useSTD3Rules: true,
|
useSTD3Rules: true,
|
||||||
@@ -302,14 +300,16 @@ func (e runeError) Error() string {
|
|||||||
// see http://www.unicode.org/reports/tr46.
|
// see http://www.unicode.org/reports/tr46.
|
||||||
func (p *Profile) process(s string, toASCII bool) (string, error) {
|
func (p *Profile) process(s string, toASCII bool) (string, error) {
|
||||||
var err error
|
var err error
|
||||||
|
var isBidi bool
|
||||||
if p.mapping != nil {
|
if p.mapping != nil {
|
||||||
s, err = p.mapping(p, s)
|
s, isBidi, err = p.mapping(p, s)
|
||||||
}
|
}
|
||||||
// Remove leading empty labels.
|
// Remove leading empty labels.
|
||||||
if p.removeLeadingDots {
|
if p.removeLeadingDots {
|
||||||
for ; len(s) > 0 && s[0] == '.'; s = s[1:] {
|
for ; len(s) > 0 && s[0] == '.'; s = s[1:] {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// TODO: allow for a quick check of the tables data.
|
||||||
// It seems like we should only create this error on ToASCII, but the
|
// It seems like we should only create this error on ToASCII, but the
|
||||||
// UTS 46 conformance tests suggests we should always check this.
|
// UTS 46 conformance tests suggests we should always check this.
|
||||||
if err == nil && p.verifyDNSLength && s == "" {
|
if err == nil && p.verifyDNSLength && s == "" {
|
||||||
@@ -335,6 +335,7 @@ func (p *Profile) process(s string, toASCII bool) (string, error) {
|
|||||||
// Spec says keep the old label.
|
// Spec says keep the old label.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
isBidi = isBidi || bidirule.DirectionString(u) != bidi.LeftToRight
|
||||||
labels.set(u)
|
labels.set(u)
|
||||||
if err == nil && p.validateLabels {
|
if err == nil && p.validateLabels {
|
||||||
err = p.fromPuny(p, u)
|
err = p.fromPuny(p, u)
|
||||||
@@ -349,6 +350,14 @@ func (p *Profile) process(s string, toASCII bool) (string, error) {
|
|||||||
err = p.validateLabel(label)
|
err = p.validateLabel(label)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if isBidi && p.bidirule != nil && err == nil {
|
||||||
|
for labels.reset(); !labels.done(); labels.next() {
|
||||||
|
if !p.bidirule(labels.label()) {
|
||||||
|
err = &labelError{s, "B"}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if toASCII {
|
if toASCII {
|
||||||
for labels.reset(); !labels.done(); labels.next() {
|
for labels.reset(); !labels.done(); labels.next() {
|
||||||
label := labels.label()
|
label := labels.label()
|
||||||
@@ -380,16 +389,26 @@ func (p *Profile) process(s string, toASCII bool) (string, error) {
|
|||||||
return s, err
|
return s, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func normalize(p *Profile, s string) (string, error) {
|
func normalize(p *Profile, s string) (mapped string, isBidi bool, err error) {
|
||||||
return norm.NFC.String(s), nil
|
// TODO: consider first doing a quick check to see if any of these checks
|
||||||
|
// need to be done. This will make it slower in the general case, but
|
||||||
|
// faster in the common case.
|
||||||
|
mapped = norm.NFC.String(s)
|
||||||
|
isBidi = bidirule.DirectionString(mapped) == bidi.RightToLeft
|
||||||
|
return mapped, isBidi, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateRegistration(p *Profile, s string) (string, error) {
|
func validateRegistration(p *Profile, s string) (idem string, bidi bool, err error) {
|
||||||
|
// TODO: filter need for normalization in loop below.
|
||||||
if !norm.NFC.IsNormalString(s) {
|
if !norm.NFC.IsNormalString(s) {
|
||||||
return s, &labelError{s, "V1"}
|
return s, false, &labelError{s, "V1"}
|
||||||
}
|
}
|
||||||
for i := 0; i < len(s); {
|
for i := 0; i < len(s); {
|
||||||
v, sz := trie.lookupString(s[i:])
|
v, sz := trie.lookupString(s[i:])
|
||||||
|
if sz == 0 {
|
||||||
|
return s, bidi, runeError(utf8.RuneError)
|
||||||
|
}
|
||||||
|
bidi = bidi || info(v).isBidi(s[i:])
|
||||||
// Copy bytes not copied so far.
|
// Copy bytes not copied so far.
|
||||||
switch p.simplify(info(v).category()) {
|
switch p.simplify(info(v).category()) {
|
||||||
// TODO: handle the NV8 defined in the Unicode idna data set to allow
|
// TODO: handle the NV8 defined in the Unicode idna data set to allow
|
||||||
@@ -397,21 +416,50 @@ func validateRegistration(p *Profile, s string) (string, error) {
|
|||||||
case valid, deviation:
|
case valid, deviation:
|
||||||
case disallowed, mapped, unknown, ignored:
|
case disallowed, mapped, unknown, ignored:
|
||||||
r, _ := utf8.DecodeRuneInString(s[i:])
|
r, _ := utf8.DecodeRuneInString(s[i:])
|
||||||
return s, runeError(r)
|
return s, bidi, runeError(r)
|
||||||
}
|
}
|
||||||
i += sz
|
i += sz
|
||||||
}
|
}
|
||||||
return s, nil
|
return s, bidi, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateAndMap(p *Profile, s string) (string, error) {
|
func (c info) isBidi(s string) bool {
|
||||||
|
if !c.isMapped() {
|
||||||
|
return c&attributesMask == rtl
|
||||||
|
}
|
||||||
|
// TODO: also store bidi info for mapped data. This is possible, but a bit
|
||||||
|
// cumbersome and not for the common case.
|
||||||
|
p, _ := bidi.LookupString(s)
|
||||||
|
switch p.Class() {
|
||||||
|
case bidi.R, bidi.AL, bidi.AN:
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func validateAndMap(p *Profile, s string) (vm string, bidi bool, err error) {
|
||||||
var (
|
var (
|
||||||
err error
|
b []byte
|
||||||
b []byte
|
k int
|
||||||
k int
|
|
||||||
)
|
)
|
||||||
|
// combinedInfoBits contains the or-ed bits of all runes. We use this
|
||||||
|
// to derive the mayNeedNorm bit later. This may trigger normalization
|
||||||
|
// overeagerly, but it will not do so in the common case. The end result
|
||||||
|
// is another 10% saving on BenchmarkProfile for the common case.
|
||||||
|
var combinedInfoBits info
|
||||||
for i := 0; i < len(s); {
|
for i := 0; i < len(s); {
|
||||||
v, sz := trie.lookupString(s[i:])
|
v, sz := trie.lookupString(s[i:])
|
||||||
|
if sz == 0 {
|
||||||
|
b = append(b, s[k:i]...)
|
||||||
|
b = append(b, "\ufffd"...)
|
||||||
|
k = len(s)
|
||||||
|
if err == nil {
|
||||||
|
err = runeError(utf8.RuneError)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
combinedInfoBits |= info(v)
|
||||||
|
bidi = bidi || info(v).isBidi(s[i:])
|
||||||
start := i
|
start := i
|
||||||
i += sz
|
i += sz
|
||||||
// Copy bytes not copied so far.
|
// Copy bytes not copied so far.
|
||||||
@@ -438,7 +486,9 @@ func validateAndMap(p *Profile, s string) (string, error) {
|
|||||||
}
|
}
|
||||||
if k == 0 {
|
if k == 0 {
|
||||||
// No changes so far.
|
// No changes so far.
|
||||||
s = norm.NFC.String(s)
|
if combinedInfoBits&mayNeedNorm != 0 {
|
||||||
|
s = norm.NFC.String(s)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
b = append(b, s[k:]...)
|
b = append(b, s[k:]...)
|
||||||
if norm.NFC.QuickSpan(b) != len(b) {
|
if norm.NFC.QuickSpan(b) != len(b) {
|
||||||
@@ -447,7 +497,7 @@ func validateAndMap(p *Profile, s string) (string, error) {
|
|||||||
// TODO: the punycode converters require strings as input.
|
// TODO: the punycode converters require strings as input.
|
||||||
s = string(b)
|
s = string(b)
|
||||||
}
|
}
|
||||||
return s, err
|
return s, bidi, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// A labelIter allows iterating over domain name labels.
|
// A labelIter allows iterating over domain name labels.
|
||||||
@@ -542,8 +592,13 @@ func validateFromPunycode(p *Profile, s string) error {
|
|||||||
if !norm.NFC.IsNormalString(s) {
|
if !norm.NFC.IsNormalString(s) {
|
||||||
return &labelError{s, "V1"}
|
return &labelError{s, "V1"}
|
||||||
}
|
}
|
||||||
|
// TODO: detect whether string may have to be normalized in the following
|
||||||
|
// loop.
|
||||||
for i := 0; i < len(s); {
|
for i := 0; i < len(s); {
|
||||||
v, sz := trie.lookupString(s[i:])
|
v, sz := trie.lookupString(s[i:])
|
||||||
|
if sz == 0 {
|
||||||
|
return runeError(utf8.RuneError)
|
||||||
|
}
|
||||||
if c := p.simplify(info(v).category()); c != valid && c != deviation {
|
if c := p.simplify(info(v).category()); c != valid && c != deviation {
|
||||||
return &labelError{s, "V6"}
|
return &labelError{s, "V6"}
|
||||||
}
|
}
|
||||||
@@ -616,16 +671,13 @@ var joinStates = [][numJoinTypes]joinState{
|
|||||||
|
|
||||||
// validateLabel validates the criteria from Section 4.1. Item 1, 4, and 6 are
|
// validateLabel validates the criteria from Section 4.1. Item 1, 4, and 6 are
|
||||||
// already implicitly satisfied by the overall implementation.
|
// already implicitly satisfied by the overall implementation.
|
||||||
func (p *Profile) validateLabel(s string) error {
|
func (p *Profile) validateLabel(s string) (err error) {
|
||||||
if s == "" {
|
if s == "" {
|
||||||
if p.verifyDNSLength {
|
if p.verifyDNSLength {
|
||||||
return &labelError{s, "A4"}
|
return &labelError{s, "A4"}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if p.bidirule != nil && !p.bidirule(s) {
|
|
||||||
return &labelError{s, "B"}
|
|
||||||
}
|
|
||||||
if !p.validateLabels {
|
if !p.validateLabels {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
+2238
-2158
File diff suppressed because it is too large
Load Diff
+11
-6
@@ -26,9 +26,9 @@ package idna
|
|||||||
// 15..3 index into xor or mapping table
|
// 15..3 index into xor or mapping table
|
||||||
// }
|
// }
|
||||||
// } else {
|
// } else {
|
||||||
// 15..13 unused
|
// 15..14 unused
|
||||||
// 12 modifier (including virama)
|
// 13 mayNeedNorm
|
||||||
// 11 virama modifier
|
// 12..11 attributes
|
||||||
// 10..8 joining type
|
// 10..8 joining type
|
||||||
// 7..3 category type
|
// 7..3 category type
|
||||||
// }
|
// }
|
||||||
@@ -49,15 +49,20 @@ const (
|
|||||||
joinShift = 8
|
joinShift = 8
|
||||||
joinMask = 0x07
|
joinMask = 0x07
|
||||||
|
|
||||||
viramaModifier = 0x0800
|
// Attributes
|
||||||
|
attributesMask = 0x1800
|
||||||
|
viramaModifier = 0x1800
|
||||||
modifier = 0x1000
|
modifier = 0x1000
|
||||||
|
rtl = 0x0800
|
||||||
|
|
||||||
|
mayNeedNorm = 0x2000
|
||||||
)
|
)
|
||||||
|
|
||||||
// A category corresponds to a category defined in the IDNA mapping table.
|
// A category corresponds to a category defined in the IDNA mapping table.
|
||||||
type category uint16
|
type category uint16
|
||||||
|
|
||||||
const (
|
const (
|
||||||
unknown category = 0 // not defined currently in unicode.
|
unknown category = 0 // not currently defined in unicode.
|
||||||
mapped category = 1
|
mapped category = 1
|
||||||
disallowedSTD3Mapped category = 2
|
disallowedSTD3Mapped category = 2
|
||||||
deviation category = 3
|
deviation category = 3
|
||||||
@@ -110,5 +115,5 @@ func (c info) isModifier() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c info) isViramaModifier() bool {
|
func (c info) isViramaModifier() bool {
|
||||||
return c&(viramaModifier|catSmallMask) == viramaModifier
|
return c&(attributesMask|catSmallMask) == viramaModifier
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -223,7 +223,7 @@ message Webhook {
|
|||||||
// connection with the webhook
|
// connection with the webhook
|
||||||
message WebhookClientConfig {
|
message WebhookClientConfig {
|
||||||
// `url` gives the location of the webhook, in standard URL form
|
// `url` gives the location of the webhook, in standard URL form
|
||||||
// (`[scheme://]host:port/path`). Exactly one of `url` or `service`
|
// (`scheme://host:port/path`). Exactly one of `url` or `service`
|
||||||
// must be specified.
|
// must be specified.
|
||||||
//
|
//
|
||||||
// The `host` should not refer to a service running in the cluster; use
|
// The `host` should not refer to a service running in the cluster; use
|
||||||
|
|||||||
+1
-1
@@ -246,7 +246,7 @@ const (
|
|||||||
// connection with the webhook
|
// connection with the webhook
|
||||||
type WebhookClientConfig struct {
|
type WebhookClientConfig struct {
|
||||||
// `url` gives the location of the webhook, in standard URL form
|
// `url` gives the location of the webhook, in standard URL form
|
||||||
// (`[scheme://]host:port/path`). Exactly one of `url` or `service`
|
// (`scheme://host:port/path`). Exactly one of `url` or `service`
|
||||||
// must be specified.
|
// must be specified.
|
||||||
//
|
//
|
||||||
// The `host` should not refer to a service running in the cluster; use
|
// The `host` should not refer to a service running in the cluster; use
|
||||||
|
|||||||
+1
-1
@@ -114,7 +114,7 @@ func (Webhook) SwaggerDoc() map[string]string {
|
|||||||
|
|
||||||
var map_WebhookClientConfig = map[string]string{
|
var map_WebhookClientConfig = map[string]string{
|
||||||
"": "WebhookClientConfig contains the information to make a TLS connection with the webhook",
|
"": "WebhookClientConfig contains the information to make a TLS connection with the webhook",
|
||||||
"url": "`url` gives the location of the webhook, in standard URL form (`[scheme://]host:port/path`). Exactly one of `url` or `service` must be specified.\n\nThe `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some apiservers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address.\n\nPlease note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster.\n\nThe scheme must be \"https\"; the URL must begin with \"https://\".\n\nA path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier.\n\nAttempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either.",
|
"url": "`url` gives the location of the webhook, in standard URL form (`scheme://host:port/path`). Exactly one of `url` or `service` must be specified.\n\nThe `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some apiservers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address.\n\nPlease note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster.\n\nThe scheme must be \"https\"; the URL must begin with \"https://\".\n\nA path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier.\n\nAttempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either.",
|
||||||
"service": "`service` is a reference to the service for this webhook. Either `service` or `url` must be specified.\n\nIf the webhook is running within the cluster, then you should use `service`.\n\nPort 443 will be used if it is open, otherwise it is an error.",
|
"service": "`service` is a reference to the service for this webhook. Either `service` or `url` must be specified.\n\nIf the webhook is running within the cluster, then you should use `service`.\n\nPort 443 will be used if it is open, otherwise it is an error.",
|
||||||
"caBundle": "`caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used.",
|
"caBundle": "`caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used.",
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -280,6 +280,7 @@ message DeploymentSpec {
|
|||||||
|
|
||||||
// The deployment strategy to use to replace existing pods with new ones.
|
// The deployment strategy to use to replace existing pods with new ones.
|
||||||
// +optional
|
// +optional
|
||||||
|
// +patchStrategy=retainKeys
|
||||||
optional DeploymentStrategy strategy = 4;
|
optional DeploymentStrategy strategy = 4;
|
||||||
|
|
||||||
// Minimum number of seconds for which a newly created pod should be ready
|
// Minimum number of seconds for which a newly created pod should be ready
|
||||||
|
|||||||
+8
-1
@@ -32,6 +32,8 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// +genclient
|
// +genclient
|
||||||
|
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale
|
||||||
|
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
// StatefulSet represents a set of pods with consistent identities.
|
// StatefulSet represents a set of pods with consistent identities.
|
||||||
@@ -244,6 +246,8 @@ type StatefulSetList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// +genclient
|
// +genclient
|
||||||
|
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale
|
||||||
|
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
// Deployment enables declarative updates for Pods and ReplicaSets.
|
// Deployment enables declarative updates for Pods and ReplicaSets.
|
||||||
@@ -279,7 +283,8 @@ type DeploymentSpec struct {
|
|||||||
|
|
||||||
// The deployment strategy to use to replace existing pods with new ones.
|
// The deployment strategy to use to replace existing pods with new ones.
|
||||||
// +optional
|
// +optional
|
||||||
Strategy DeploymentStrategy `json:"strategy,omitempty" protobuf:"bytes,4,opt,name=strategy"`
|
// +patchStrategy=retainKeys
|
||||||
|
Strategy DeploymentStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys" protobuf:"bytes,4,opt,name=strategy"`
|
||||||
|
|
||||||
// Minimum number of seconds for which a newly created pod should be ready
|
// Minimum number of seconds for which a newly created pod should be ready
|
||||||
// without any of its container crashing, for it to be considered available.
|
// without any of its container crashing, for it to be considered available.
|
||||||
@@ -653,6 +658,8 @@ type DaemonSetList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// +genclient
|
// +genclient
|
||||||
|
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale
|
||||||
|
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
// ReplicaSet ensures that a specified number of pod replicas are running at any given time.
|
// ReplicaSet ensures that a specified number of pod replicas are running at any given time.
|
||||||
|
|||||||
+1
@@ -143,6 +143,7 @@ message DeploymentSpec {
|
|||||||
|
|
||||||
// The deployment strategy to use to replace existing pods with new ones.
|
// The deployment strategy to use to replace existing pods with new ones.
|
||||||
// +optional
|
// +optional
|
||||||
|
// +patchStrategy=retainKeys
|
||||||
optional DeploymentStrategy strategy = 4;
|
optional DeploymentStrategy strategy = 4;
|
||||||
|
|
||||||
// Minimum number of seconds for which a newly created pod should be ready
|
// Minimum number of seconds for which a newly created pod should be ready
|
||||||
|
|||||||
+2
-3
@@ -55,8 +55,6 @@ type ScaleStatus struct {
|
|||||||
TargetSelector string `json:"targetSelector,omitempty" protobuf:"bytes,3,opt,name=targetSelector"`
|
TargetSelector string `json:"targetSelector,omitempty" protobuf:"bytes,3,opt,name=targetSelector"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +genclient
|
|
||||||
// +genclient:noVerbs
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
// Scale represents a scaling request for a resource.
|
// Scale represents a scaling request for a resource.
|
||||||
@@ -323,7 +321,8 @@ type DeploymentSpec struct {
|
|||||||
|
|
||||||
// The deployment strategy to use to replace existing pods with new ones.
|
// The deployment strategy to use to replace existing pods with new ones.
|
||||||
// +optional
|
// +optional
|
||||||
Strategy DeploymentStrategy `json:"strategy,omitempty" protobuf:"bytes,4,opt,name=strategy"`
|
// +patchStrategy=retainKeys
|
||||||
|
Strategy DeploymentStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys" protobuf:"bytes,4,opt,name=strategy"`
|
||||||
|
|
||||||
// Minimum number of seconds for which a newly created pod should be ready
|
// Minimum number of seconds for which a newly created pod should be ready
|
||||||
// without any of its container crashing, for it to be considered available.
|
// without any of its container crashing, for it to be considered available.
|
||||||
|
|||||||
+1
@@ -286,6 +286,7 @@ message DeploymentSpec {
|
|||||||
|
|
||||||
// The deployment strategy to use to replace existing pods with new ones.
|
// The deployment strategy to use to replace existing pods with new ones.
|
||||||
// +optional
|
// +optional
|
||||||
|
// +patchStrategy=retainKeys
|
||||||
optional DeploymentStrategy strategy = 4;
|
optional DeploymentStrategy strategy = 4;
|
||||||
|
|
||||||
// Minimum number of seconds for which a newly created pod should be ready
|
// Minimum number of seconds for which a newly created pod should be ready
|
||||||
|
|||||||
+2
-3
@@ -57,8 +57,6 @@ type ScaleStatus struct {
|
|||||||
TargetSelector string `json:"targetSelector,omitempty" protobuf:"bytes,3,opt,name=targetSelector"`
|
TargetSelector string `json:"targetSelector,omitempty" protobuf:"bytes,3,opt,name=targetSelector"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +genclient
|
|
||||||
// +genclient:noVerbs
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
// Scale represents a scaling request for a resource.
|
// Scale represents a scaling request for a resource.
|
||||||
@@ -331,7 +329,8 @@ type DeploymentSpec struct {
|
|||||||
|
|
||||||
// The deployment strategy to use to replace existing pods with new ones.
|
// The deployment strategy to use to replace existing pods with new ones.
|
||||||
// +optional
|
// +optional
|
||||||
Strategy DeploymentStrategy `json:"strategy,omitempty" protobuf:"bytes,4,opt,name=strategy"`
|
// +patchStrategy=retainKeys
|
||||||
|
Strategy DeploymentStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys" protobuf:"bytes,4,opt,name=strategy"`
|
||||||
|
|
||||||
// Minimum number of seconds for which a newly created pod should be ready
|
// Minimum number of seconds for which a newly created pod should be ready
|
||||||
// without any of its container crashing, for it to be considered available.
|
// without any of its container crashing, for it to be considered available.
|
||||||
|
|||||||
+1
-1
@@ -99,7 +99,7 @@ message Webhook {
|
|||||||
// WebhookClientConfig contains the information to make a connection with the webhook
|
// WebhookClientConfig contains the information to make a connection with the webhook
|
||||||
message WebhookClientConfig {
|
message WebhookClientConfig {
|
||||||
// `url` gives the location of the webhook, in standard URL form
|
// `url` gives the location of the webhook, in standard URL form
|
||||||
// (`[scheme://]host:port/path`). Exactly one of `url` or `service`
|
// (`scheme://host:port/path`). Exactly one of `url` or `service`
|
||||||
// must be specified.
|
// must be specified.
|
||||||
//
|
//
|
||||||
// The `host` should not refer to a service running in the cluster; use
|
// The `host` should not refer to a service running in the cluster; use
|
||||||
|
|||||||
+1
-1
@@ -133,7 +133,7 @@ type WebhookThrottleConfig struct {
|
|||||||
// WebhookClientConfig contains the information to make a connection with the webhook
|
// WebhookClientConfig contains the information to make a connection with the webhook
|
||||||
type WebhookClientConfig struct {
|
type WebhookClientConfig struct {
|
||||||
// `url` gives the location of the webhook, in standard URL form
|
// `url` gives the location of the webhook, in standard URL form
|
||||||
// (`[scheme://]host:port/path`). Exactly one of `url` or `service`
|
// (`scheme://host:port/path`). Exactly one of `url` or `service`
|
||||||
// must be specified.
|
// must be specified.
|
||||||
//
|
//
|
||||||
// The `host` should not refer to a service running in the cluster; use
|
// The `host` should not refer to a service running in the cluster; use
|
||||||
|
|||||||
+1
-1
@@ -88,7 +88,7 @@ func (Webhook) SwaggerDoc() map[string]string {
|
|||||||
|
|
||||||
var map_WebhookClientConfig = map[string]string{
|
var map_WebhookClientConfig = map[string]string{
|
||||||
"": "WebhookClientConfig contains the information to make a connection with the webhook",
|
"": "WebhookClientConfig contains the information to make a connection with the webhook",
|
||||||
"url": "`url` gives the location of the webhook, in standard URL form (`[scheme://]host:port/path`). Exactly one of `url` or `service` must be specified.\n\nThe `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some apiservers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address.\n\nPlease note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster.\n\nThe scheme must be \"https\"; the URL must begin with \"https://\".\n\nA path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier.\n\nAttempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either.",
|
"url": "`url` gives the location of the webhook, in standard URL form (`scheme://host:port/path`). Exactly one of `url` or `service` must be specified.\n\nThe `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some apiservers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address.\n\nPlease note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster.\n\nThe scheme must be \"https\"; the URL must begin with \"https://\".\n\nA path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier.\n\nAttempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either.",
|
||||||
"service": "`service` is a reference to the service for this webhook. Either `service` or `url` must be specified.\n\nIf the webhook is running within the cluster, then you should use `service`.\n\nPort 443 will be used if it is open, otherwise it is an error.",
|
"service": "`service` is a reference to the service for this webhook. Either `service` or `url` must be specified.\n\nIf the webhook is running within the cluster, then you should use `service`.\n\nPort 443 will be used if it is open, otherwise it is an error.",
|
||||||
"caBundle": "`caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used.",
|
"caBundle": "`caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used.",
|
||||||
}
|
}
|
||||||
|
|||||||
+160
-57
@@ -355,6 +355,21 @@ func (m *TokenReviewSpec) MarshalTo(dAtA []byte) (int, error) {
|
|||||||
i++
|
i++
|
||||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Token)))
|
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Token)))
|
||||||
i += copy(dAtA[i:], m.Token)
|
i += copy(dAtA[i:], m.Token)
|
||||||
|
if len(m.Audiences) > 0 {
|
||||||
|
for _, s := range m.Audiences {
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
i++
|
||||||
|
l = len(s)
|
||||||
|
for l >= 1<<7 {
|
||||||
|
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
|
||||||
|
l >>= 7
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
dAtA[i] = uint8(l)
|
||||||
|
i++
|
||||||
|
i += copy(dAtA[i:], s)
|
||||||
|
}
|
||||||
|
}
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,6 +408,21 @@ func (m *TokenReviewStatus) MarshalTo(dAtA []byte) (int, error) {
|
|||||||
i++
|
i++
|
||||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Error)))
|
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Error)))
|
||||||
i += copy(dAtA[i:], m.Error)
|
i += copy(dAtA[i:], m.Error)
|
||||||
|
if len(m.Audiences) > 0 {
|
||||||
|
for _, s := range m.Audiences {
|
||||||
|
dAtA[i] = 0x22
|
||||||
|
i++
|
||||||
|
l = len(s)
|
||||||
|
for l >= 1<<7 {
|
||||||
|
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
|
||||||
|
l >>= 7
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
dAtA[i] = uint8(l)
|
||||||
|
i++
|
||||||
|
i += copy(dAtA[i:], s)
|
||||||
|
}
|
||||||
|
}
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -561,6 +591,12 @@ func (m *TokenReviewSpec) Size() (n int) {
|
|||||||
_ = l
|
_ = l
|
||||||
l = len(m.Token)
|
l = len(m.Token)
|
||||||
n += 1 + l + sovGenerated(uint64(l))
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
if len(m.Audiences) > 0 {
|
||||||
|
for _, s := range m.Audiences {
|
||||||
|
l = len(s)
|
||||||
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
}
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -572,6 +608,12 @@ func (m *TokenReviewStatus) Size() (n int) {
|
|||||||
n += 1 + l + sovGenerated(uint64(l))
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
l = len(m.Error)
|
l = len(m.Error)
|
||||||
n += 1 + l + sovGenerated(uint64(l))
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
if len(m.Audiences) > 0 {
|
||||||
|
for _, s := range m.Audiences {
|
||||||
|
l = len(s)
|
||||||
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
}
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -679,6 +721,7 @@ func (this *TokenReviewSpec) String() string {
|
|||||||
}
|
}
|
||||||
s := strings.Join([]string{`&TokenReviewSpec{`,
|
s := strings.Join([]string{`&TokenReviewSpec{`,
|
||||||
`Token:` + fmt.Sprintf("%v", this.Token) + `,`,
|
`Token:` + fmt.Sprintf("%v", this.Token) + `,`,
|
||||||
|
`Audiences:` + fmt.Sprintf("%v", this.Audiences) + `,`,
|
||||||
`}`,
|
`}`,
|
||||||
}, "")
|
}, "")
|
||||||
return s
|
return s
|
||||||
@@ -691,6 +734,7 @@ func (this *TokenReviewStatus) String() string {
|
|||||||
`Authenticated:` + fmt.Sprintf("%v", this.Authenticated) + `,`,
|
`Authenticated:` + fmt.Sprintf("%v", this.Authenticated) + `,`,
|
||||||
`User:` + strings.Replace(strings.Replace(this.User.String(), "UserInfo", "UserInfo", 1), `&`, ``, 1) + `,`,
|
`User:` + strings.Replace(strings.Replace(this.User.String(), "UserInfo", "UserInfo", 1), `&`, ``, 1) + `,`,
|
||||||
`Error:` + fmt.Sprintf("%v", this.Error) + `,`,
|
`Error:` + fmt.Sprintf("%v", this.Error) + `,`,
|
||||||
|
`Audiences:` + fmt.Sprintf("%v", this.Audiences) + `,`,
|
||||||
`}`,
|
`}`,
|
||||||
}, "")
|
}, "")
|
||||||
return s
|
return s
|
||||||
@@ -1550,6 +1594,35 @@ func (m *TokenReviewSpec) Unmarshal(dAtA []byte) error {
|
|||||||
}
|
}
|
||||||
m.Token = string(dAtA[iNdEx:postIndex])
|
m.Token = string(dAtA[iNdEx:postIndex])
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Audiences", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthGenerated
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Audiences = append(m.Audiences, string(dAtA[iNdEx:postIndex]))
|
||||||
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipGenerated(dAtA[iNdEx:])
|
skippy, err := skipGenerated(dAtA[iNdEx:])
|
||||||
@@ -1679,6 +1752,35 @@ func (m *TokenReviewStatus) Unmarshal(dAtA []byte) error {
|
|||||||
}
|
}
|
||||||
m.Error = string(dAtA[iNdEx:postIndex])
|
m.Error = string(dAtA[iNdEx:postIndex])
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
|
case 4:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Audiences", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthGenerated
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Audiences = append(m.Audiences, string(dAtA[iNdEx:postIndex]))
|
||||||
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipGenerated(dAtA[iNdEx:])
|
skippy, err := skipGenerated(dAtA[iNdEx:])
|
||||||
@@ -2070,61 +2172,62 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptorGenerated = []byte{
|
var fileDescriptorGenerated = []byte{
|
||||||
// 892 bytes of a gzipped FileDescriptorProto
|
// 900 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xcf, 0x8f, 0xdb, 0x44,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xcf, 0x6f, 0xe3, 0x44,
|
||||||
0x14, 0x8e, 0xf3, 0x63, 0xb5, 0x99, 0x74, 0x97, 0xdd, 0x29, 0x95, 0xa2, 0x05, 0xec, 0x60, 0x24,
|
0x14, 0x8e, 0xf3, 0xa3, 0x4a, 0x26, 0xdb, 0xd2, 0xce, 0xb2, 0x52, 0x54, 0xc0, 0x2e, 0x41, 0x42,
|
||||||
0x14, 0x01, 0xb5, 0x9b, 0x08, 0x95, 0xaa, 0x48, 0x48, 0x6b, 0x36, 0x82, 0x08, 0x41, 0xab, 0x69,
|
0x15, 0xb0, 0xf6, 0x26, 0x42, 0xb0, 0x5a, 0x24, 0xa4, 0x9a, 0x46, 0x10, 0x21, 0xd8, 0xd5, 0xec,
|
||||||
0x77, 0x41, 0x9c, 0x98, 0xd8, 0x6f, 0xb3, 0x26, 0x78, 0x6c, 0xec, 0x71, 0x68, 0x6e, 0xfd, 0x13,
|
0xb6, 0x20, 0x4e, 0x4c, 0xec, 0xd7, 0xc4, 0x04, 0x8f, 0x8d, 0x3d, 0x0e, 0x9b, 0xdb, 0xfe, 0x09,
|
||||||
0x38, 0x82, 0xc4, 0x81, 0x3f, 0x02, 0x89, 0x23, 0xd7, 0x3d, 0x56, 0x9c, 0x7a, 0x40, 0x11, 0x6b,
|
0x1c, 0x41, 0xe2, 0xc0, 0x1f, 0x81, 0xc4, 0xbf, 0xd0, 0xe3, 0x8a, 0xd3, 0x1e, 0x50, 0x44, 0xcd,
|
||||||
0xfe, 0x05, 0x4e, 0x9c, 0xd0, 0x8c, 0x67, 0xe3, 0xfc, 0xd8, 0x4d, 0x73, 0xea, 0x2d, 0xf3, 0xde,
|
0x95, 0x23, 0x27, 0x4e, 0x68, 0xc6, 0xd3, 0x38, 0x4e, 0xda, 0x34, 0x27, 0x6e, 0x9e, 0xf7, 0xbe,
|
||||||
0xf7, 0xbe, 0x79, 0xef, 0x9b, 0x2f, 0xcf, 0xa8, 0x37, 0xba, 0x97, 0x58, 0x7e, 0x68, 0x8f, 0xd2,
|
0xf7, 0xbd, 0x37, 0xdf, 0x7c, 0x9e, 0x41, 0xbd, 0xf1, 0xfd, 0xd8, 0xf4, 0x02, 0x6b, 0x9c, 0x0c,
|
||||||
0x01, 0xc4, 0x0c, 0x38, 0x24, 0xf6, 0x18, 0x98, 0x17, 0xc6, 0xb6, 0x4a, 0xd0, 0xc8, 0xb7, 0x69,
|
0x20, 0x62, 0xc0, 0x21, 0xb6, 0x26, 0xc0, 0xdc, 0x20, 0xb2, 0x54, 0x82, 0x86, 0x9e, 0x45, 0x13,
|
||||||
0xca, 0xcf, 0x80, 0x71, 0xdf, 0xa5, 0xdc, 0x0f, 0x99, 0x3d, 0xee, 0xd8, 0x43, 0x60, 0x10, 0x53,
|
0x3e, 0x02, 0xc6, 0x3d, 0x87, 0x72, 0x2f, 0x60, 0xd6, 0xa4, 0x63, 0x0d, 0x81, 0x41, 0x44, 0x39,
|
||||||
0x0e, 0x9e, 0x15, 0xc5, 0x21, 0x0f, 0xf1, 0xeb, 0x39, 0xda, 0xa2, 0x91, 0x6f, 0x2d, 0xa2, 0xad,
|
0xb8, 0x66, 0x18, 0x05, 0x3c, 0xc0, 0xaf, 0x66, 0x68, 0x93, 0x86, 0x9e, 0x59, 0x44, 0x9b, 0x93,
|
||||||
0x71, 0xe7, 0xe0, 0xf6, 0xd0, 0xe7, 0x67, 0xe9, 0xc0, 0x72, 0xc3, 0xc0, 0x1e, 0x86, 0xc3, 0xd0,
|
0xce, 0xfe, 0xdd, 0xa1, 0xc7, 0x47, 0xc9, 0xc0, 0x74, 0x02, 0xdf, 0x1a, 0x06, 0xc3, 0xc0, 0x92,
|
||||||
0x96, 0x45, 0x83, 0xf4, 0x54, 0x9e, 0xe4, 0x41, 0xfe, 0xca, 0xc9, 0x0e, 0xde, 0x2f, 0xae, 0x0e,
|
0x45, 0x83, 0xe4, 0x4c, 0xae, 0xe4, 0x42, 0x7e, 0x65, 0x64, 0xfb, 0xef, 0xe6, 0xad, 0x7d, 0xea,
|
||||||
0xa8, 0x7b, 0xe6, 0x33, 0x88, 0x27, 0x76, 0x34, 0x1a, 0x8a, 0x40, 0x62, 0x07, 0xc0, 0xe9, 0x15,
|
0x8c, 0x3c, 0x06, 0xd1, 0xd4, 0x0a, 0xc7, 0x43, 0x11, 0x88, 0x2d, 0x1f, 0x38, 0xbd, 0x62, 0x84,
|
||||||
0x2d, 0x1c, 0xd8, 0xd7, 0x55, 0xc5, 0x29, 0xe3, 0x7e, 0x00, 0x2b, 0x05, 0x77, 0x5f, 0x54, 0x90,
|
0x7d, 0xeb, 0xba, 0xaa, 0x28, 0x61, 0xdc, 0xf3, 0x61, 0xa5, 0xe0, 0xbd, 0x9b, 0x0a, 0x62, 0x67,
|
||||||
0xb8, 0x67, 0x10, 0xd0, 0xe5, 0x3a, 0xf3, 0x4f, 0x0d, 0xbd, 0xea, 0x84, 0x29, 0xf3, 0x1e, 0x0c,
|
0x04, 0x3e, 0x5d, 0xae, 0x6b, 0xff, 0xae, 0xa1, 0x97, 0xed, 0x20, 0x61, 0xee, 0xc3, 0xc1, 0x37,
|
||||||
0xbe, 0x05, 0x97, 0x13, 0x38, 0x85, 0x18, 0x98, 0x0b, 0xb8, 0x85, 0xaa, 0x23, 0x9f, 0x79, 0x4d,
|
0xe0, 0x70, 0x02, 0x67, 0x10, 0x01, 0x73, 0x00, 0x1f, 0xa0, 0xea, 0xd8, 0x63, 0x6e, 0x4b, 0x3b,
|
||||||
0xad, 0xa5, 0xb5, 0xeb, 0xce, 0x8d, 0xf3, 0xa9, 0x51, 0xca, 0xa6, 0x46, 0xf5, 0x33, 0x9f, 0x79,
|
0xd0, 0x0e, 0x1b, 0xf6, 0xad, 0xf3, 0x99, 0x51, 0x4a, 0x67, 0x46, 0xf5, 0x53, 0x8f, 0xb9, 0x44,
|
||||||
0x44, 0x66, 0x70, 0x17, 0x21, 0xfa, 0xb0, 0x7f, 0x02, 0x71, 0xe2, 0x87, 0xac, 0x59, 0x96, 0x38,
|
0x66, 0x70, 0x17, 0x21, 0xfa, 0xa8, 0x7f, 0x0a, 0x51, 0xec, 0x05, 0xac, 0x55, 0x96, 0x38, 0xac,
|
||||||
0xac, 0x70, 0xe8, 0x70, 0x96, 0x21, 0x73, 0x28, 0xc1, 0xca, 0x68, 0x00, 0xcd, 0xca, 0x22, 0xeb,
|
0x70, 0xe8, 0x68, 0x9e, 0x21, 0x0b, 0x28, 0xc1, 0xca, 0xa8, 0x0f, 0xad, 0x4a, 0x91, 0xf5, 0x73,
|
||||||
0x17, 0x34, 0x00, 0x22, 0x33, 0xd8, 0x41, 0x95, 0xb4, 0x7f, 0xd4, 0xac, 0x4a, 0xc0, 0x1d, 0x05,
|
0xea, 0x03, 0x91, 0x19, 0x6c, 0xa3, 0x4a, 0xd2, 0x3f, 0x6e, 0x55, 0x25, 0xe0, 0x9e, 0x02, 0x54,
|
||||||
0xa8, 0x1c, 0xf7, 0x8f, 0xfe, 0x9b, 0x1a, 0x6f, 0x5e, 0x37, 0x24, 0x9f, 0x44, 0x90, 0x58, 0xc7,
|
0x4e, 0xfa, 0xc7, 0xff, 0xce, 0x8c, 0xd7, 0xaf, 0xdb, 0x24, 0x9f, 0x86, 0x10, 0x9b, 0x27, 0xfd,
|
||||||
0xfd, 0x23, 0x22, 0x8a, 0xcd, 0x0f, 0x10, 0xea, 0x3d, 0xe1, 0x31, 0x3d, 0xa1, 0xdf, 0xa5, 0x80,
|
0x63, 0x22, 0x8a, 0xdb, 0xef, 0x23, 0xd4, 0x7b, 0xca, 0x23, 0x7a, 0x4a, 0xbf, 0x4d, 0x00, 0x1b,
|
||||||
0x0d, 0x54, 0xf3, 0x39, 0x04, 0x49, 0x53, 0x6b, 0x55, 0xda, 0x75, 0xa7, 0x9e, 0x4d, 0x8d, 0x5a,
|
0xa8, 0xe6, 0x71, 0xf0, 0xe3, 0x96, 0x76, 0x50, 0x39, 0x6c, 0xd8, 0x8d, 0x74, 0x66, 0xd4, 0xfa,
|
||||||
0x5f, 0x04, 0x48, 0x1e, 0xbf, 0xbf, 0xfd, 0xd3, 0xaf, 0x46, 0xe9, 0xe9, 0x5f, 0xad, 0x92, 0xf9,
|
0x22, 0x40, 0xb2, 0xf8, 0x83, 0xfa, 0x8f, 0xbf, 0x18, 0xa5, 0x67, 0x7f, 0x1c, 0x94, 0xda, 0x3f,
|
||||||
0x4b, 0x19, 0xdd, 0x78, 0x1c, 0x8e, 0x80, 0x11, 0xf8, 0x3e, 0x85, 0x84, 0xe3, 0x6f, 0xd0, 0xb6,
|
0x97, 0xd1, 0xad, 0x27, 0xc1, 0x18, 0x18, 0x81, 0xef, 0x12, 0x88, 0x39, 0xfe, 0x1a, 0xd5, 0xc5,
|
||||||
0x78, 0x22, 0x8f, 0x72, 0x2a, 0x95, 0x68, 0x74, 0xef, 0x58, 0x85, 0x3b, 0x66, 0x4d, 0x58, 0xd1,
|
0x11, 0xb9, 0x94, 0x53, 0xa9, 0x44, 0xb3, 0x7b, 0xcf, 0xcc, 0xdd, 0x31, 0x1f, 0xc2, 0x0c, 0xc7,
|
||||||
0x68, 0x28, 0x02, 0x89, 0x25, 0xd0, 0xd6, 0xb8, 0x63, 0xe5, 0x72, 0x7e, 0x0e, 0x9c, 0x16, 0x9a,
|
0x43, 0x11, 0x88, 0x4d, 0x81, 0x36, 0x27, 0x1d, 0x33, 0x93, 0xf3, 0x33, 0xe0, 0x34, 0xd7, 0x24,
|
||||||
0x14, 0x31, 0x32, 0x63, 0xc5, 0x0f, 0x51, 0x35, 0x89, 0xc0, 0x95, 0xfa, 0x35, 0xba, 0x96, 0xb5,
|
0x8f, 0x91, 0x39, 0x2b, 0x7e, 0x84, 0xaa, 0x71, 0x08, 0x8e, 0xd4, 0xaf, 0xd9, 0x35, 0xcd, 0x75,
|
||||||
0xce, 0x7b, 0xd6, 0x7c, 0x6f, 0x8f, 0x22, 0x70, 0x0b, 0x05, 0xc5, 0x89, 0x48, 0x26, 0xfc, 0x15,
|
0xde, 0x33, 0x17, 0x67, 0x7b, 0x1c, 0x82, 0x93, 0x2b, 0x28, 0x56, 0x44, 0x32, 0xe1, 0x2f, 0xd1,
|
||||||
0xda, 0x4a, 0x38, 0xe5, 0x69, 0x22, 0x55, 0x5e, 0xec, 0xf8, 0x45, 0x9c, 0xb2, 0xce, 0xd9, 0x55,
|
0x56, 0xcc, 0x29, 0x4f, 0x62, 0xa9, 0x72, 0x71, 0xe2, 0x9b, 0x38, 0x65, 0x9d, 0xbd, 0xa3, 0x58,
|
||||||
0xac, 0x5b, 0xf9, 0x99, 0x28, 0x3e, 0xf3, 0x5f, 0x0d, 0xed, 0x2d, 0xb7, 0x80, 0xdf, 0x45, 0x75,
|
0xb7, 0xb2, 0x35, 0x51, 0x7c, 0xed, 0x7f, 0x34, 0xb4, 0xbb, 0x3c, 0x02, 0x7e, 0x1b, 0x35, 0x68,
|
||||||
0x9a, 0x7a, 0xbe, 0x30, 0xcd, 0xa5, 0xc4, 0x3b, 0xd9, 0xd4, 0xa8, 0x1f, 0x5e, 0x06, 0x49, 0x91,
|
0xe2, 0x7a, 0xc2, 0x34, 0x97, 0x12, 0x6f, 0xa7, 0x33, 0xa3, 0x71, 0x74, 0x19, 0x24, 0x79, 0x1e,
|
||||||
0xc7, 0x0c, 0xed, 0x0e, 0x16, 0xdc, 0xa6, 0x7a, 0xec, 0xae, 0xef, 0xf1, 0x2a, 0x87, 0x3a, 0x38,
|
0x33, 0xb4, 0x33, 0x28, 0xb8, 0x4d, 0xcd, 0xd8, 0x5d, 0x3f, 0xe3, 0x55, 0x0e, 0xb5, 0x71, 0x3a,
|
||||||
0x9b, 0x1a, 0xbb, 0x8b, 0x19, 0xb2, 0xc4, 0x8e, 0x3f, 0x46, 0xfb, 0xf0, 0x24, 0xf2, 0x63, 0xc9,
|
0x33, 0x76, 0x8a, 0x19, 0xb2, 0xc4, 0x8e, 0x3f, 0x42, 0x7b, 0xf0, 0x34, 0xf4, 0x22, 0xc9, 0xf4,
|
||||||
0xf4, 0x08, 0xdc, 0x90, 0x79, 0x89, 0xf4, 0x56, 0xc5, 0xb9, 0x95, 0x4d, 0x8d, 0xfd, 0xde, 0x72,
|
0x18, 0x9c, 0x80, 0xb9, 0xb1, 0xf4, 0x56, 0xc5, 0xbe, 0x93, 0xce, 0x8c, 0xbd, 0xde, 0x72, 0x92,
|
||||||
0x92, 0xac, 0xe2, 0xcd, 0xdf, 0x34, 0x84, 0x57, 0x55, 0xc2, 0x6f, 0xa1, 0x1a, 0x17, 0x51, 0xf5,
|
0xac, 0xe2, 0xdb, 0xbf, 0x6a, 0x08, 0xaf, 0xaa, 0x84, 0xdf, 0x40, 0x35, 0x2e, 0xa2, 0xea, 0x17,
|
||||||
0x17, 0xd9, 0x51, 0xa2, 0xd5, 0x72, 0x68, 0x9e, 0xc3, 0x13, 0x74, 0xb3, 0x20, 0x7c, 0xec, 0x07,
|
0xd9, 0x56, 0xa2, 0xd5, 0x32, 0x68, 0x96, 0xc3, 0x53, 0x74, 0x3b, 0x27, 0x7c, 0xe2, 0xf9, 0x10,
|
||||||
0x90, 0x70, 0x1a, 0x44, 0xea, 0xb5, 0xdf, 0xd9, 0xcc, 0x4b, 0xa2, 0xcc, 0x79, 0x4d, 0xd1, 0xdf,
|
0x73, 0xea, 0x87, 0xea, 0xb4, 0xdf, 0xda, 0xcc, 0x4b, 0xa2, 0xcc, 0x7e, 0x45, 0xd1, 0xdf, 0xee,
|
||||||
0xec, 0xad, 0xd2, 0x91, 0xab, 0xee, 0x30, 0x7f, 0x2e, 0xa3, 0x86, 0x6a, 0x7b, 0xec, 0xc3, 0x0f,
|
0xad, 0xd2, 0x91, 0xab, 0x7a, 0xb4, 0x7f, 0x2a, 0xa3, 0xa6, 0x1a, 0x7b, 0xe2, 0xc1, 0xf7, 0xff,
|
||||||
0x2f, 0xc1, 0xcb, 0x0f, 0x16, 0xbc, 0x7c, 0x7b, 0x23, 0xdf, 0x89, 0xd6, 0xae, 0xb5, 0xf2, 0x97,
|
0x83, 0x97, 0x1f, 0x16, 0xbc, 0x7c, 0x77, 0x23, 0xdf, 0x89, 0xd1, 0xae, 0xb5, 0xf2, 0x17, 0x4b,
|
||||||
0x4b, 0x56, 0xb6, 0x37, 0xa7, 0x5c, 0xef, 0xe4, 0xbb, 0xe8, 0x95, 0xa5, 0xfb, 0x37, 0x7a, 0x4e,
|
0x56, 0xb6, 0x36, 0xa7, 0x5c, 0xef, 0x64, 0x07, 0xbd, 0xb4, 0xd4, 0x7f, 0xb3, 0xe3, 0x2c, 0x98,
|
||||||
0xf3, 0x0f, 0x0d, 0xed, 0xaf, 0xdc, 0x82, 0x3f, 0x44, 0x3b, 0x73, 0xcd, 0x40, 0xbe, 0x34, 0xb7,
|
0xbd, 0xbc, 0xde, 0xec, 0xed, 0xbf, 0x35, 0xb4, 0xb7, 0x32, 0x12, 0xfe, 0x00, 0x6d, 0x2f, 0x4c,
|
||||||
0x9d, 0x5b, 0x8a, 0x62, 0xe7, 0x70, 0x3e, 0x49, 0x16, 0xb1, 0xf8, 0x53, 0x54, 0x4d, 0x13, 0x88,
|
0x0e, 0xd9, 0x0d, 0x5b, 0xb7, 0xef, 0xa8, 0x7e, 0xdb, 0x47, 0x8b, 0x49, 0x52, 0xc4, 0xe2, 0x4f,
|
||||||
0x95, 0x68, 0x6f, 0xaf, 0x9f, 0xf0, 0x38, 0x81, 0xb8, 0xcf, 0x4e, 0xc3, 0x42, 0x2d, 0x11, 0x21,
|
0x50, 0x35, 0x89, 0x21, 0x52, 0x0a, 0xbf, 0xb9, 0x5e, 0x8e, 0x93, 0x18, 0xa2, 0x3e, 0x3b, 0x0b,
|
||||||
0x92, 0x41, 0x4c, 0x00, 0x71, 0x1c, 0xc6, 0x6a, 0xbb, 0xce, 0x26, 0xe8, 0x89, 0x20, 0xc9, 0x73,
|
0x72, 0x69, 0x45, 0x84, 0x48, 0x06, 0xb1, 0x5d, 0x88, 0xa2, 0x20, 0x52, 0x57, 0xf1, 0x7c, 0xbb,
|
||||||
0xe6, 0xef, 0x65, 0xb4, 0x7d, 0xc9, 0x82, 0xdf, 0x43, 0xdb, 0xa2, 0x52, 0xae, 0xe4, 0x7c, 0xec,
|
0x3d, 0x11, 0x24, 0x59, 0xae, 0xb8, 0xdd, 0xea, 0x0d, 0xdb, 0xfd, 0xad, 0x8c, 0xea, 0x97, 0x2d,
|
||||||
0x3d, 0x55, 0x24, 0x31, 0x22, 0x4e, 0x66, 0x08, 0xfc, 0x06, 0xaa, 0xa4, 0xbe, 0xa7, 0x36, 0x7d,
|
0xf1, 0x3b, 0xa8, 0x2e, 0xda, 0xc8, 0xcb, 0x3e, 0x13, 0x74, 0x57, 0x75, 0x90, 0x18, 0x11, 0x27,
|
||||||
0x63, 0x6e, 0x35, 0x13, 0x11, 0xc7, 0x26, 0xda, 0x1a, 0xc6, 0x61, 0x1a, 0x89, 0xc7, 0x12, 0x5b,
|
0x73, 0x04, 0x7e, 0x0d, 0x55, 0x12, 0xcf, 0x55, 0x6f, 0x48, 0x73, 0xe1, 0xd2, 0x27, 0x22, 0x8e,
|
||||||
0x00, 0x09, 0xdd, 0x3f, 0x91, 0x11, 0xa2, 0x32, 0xf8, 0x04, 0xd5, 0x40, 0x6c, 0xe6, 0x66, 0xb5,
|
0xdb, 0x68, 0x6b, 0x18, 0x05, 0x49, 0x28, 0x6c, 0x20, 0x66, 0x40, 0xe2, 0x44, 0x3f, 0x96, 0x11,
|
||||||
0x55, 0x69, 0x37, 0xba, 0x9d, 0xcd, 0xa6, 0xb5, 0xe4, 0x36, 0xef, 0x31, 0x1e, 0x4f, 0xe6, 0xa6,
|
0xa2, 0x32, 0xf8, 0x14, 0xd5, 0x40, 0xdc, 0xf9, 0x72, 0xcc, 0x66, 0xb7, 0xb3, 0x99, 0x34, 0xa6,
|
||||||
0x12, 0x31, 0x92, 0xd3, 0x1d, 0x0c, 0xd4, 0xc6, 0x97, 0x18, 0xbc, 0x87, 0x2a, 0x23, 0x98, 0xe4,
|
0x7c, 0x27, 0x7a, 0x8c, 0x47, 0xd3, 0x05, 0x09, 0x44, 0x8c, 0x64, 0x74, 0xfb, 0x03, 0xf5, 0x96,
|
||||||
0x13, 0x11, 0xf1, 0x13, 0x7f, 0x84, 0x6a, 0x63, 0xf1, 0x31, 0x50, 0x2a, 0xb7, 0xd7, 0xdf, 0x5b,
|
0x48, 0x0c, 0xde, 0x45, 0x95, 0x31, 0x4c, 0xb3, 0x1d, 0x11, 0xf1, 0x89, 0x3f, 0x44, 0xb5, 0x89,
|
||||||
0x7c, 0x3c, 0x48, 0x5e, 0x76, 0xbf, 0x7c, 0x4f, 0x73, 0xda, 0xe7, 0x17, 0x7a, 0xe9, 0xd9, 0x85,
|
0x78, 0x66, 0xd4, 0x91, 0x1c, 0xae, 0xef, 0x9b, 0x3f, 0x4b, 0x24, 0x2b, 0x7b, 0x50, 0xbe, 0xaf,
|
||||||
0x5e, 0x7a, 0x7e, 0xa1, 0x97, 0x9e, 0x66, 0xba, 0x76, 0x9e, 0xe9, 0xda, 0xb3, 0x4c, 0xd7, 0x9e,
|
0xd9, 0x87, 0xe7, 0x17, 0x7a, 0xe9, 0xf9, 0x85, 0x5e, 0x7a, 0x71, 0xa1, 0x97, 0x9e, 0xa5, 0xba,
|
||||||
0x67, 0xba, 0xf6, 0x77, 0xa6, 0x6b, 0x3f, 0xfe, 0xa3, 0x97, 0xbe, 0x2e, 0x8f, 0x3b, 0xff, 0x07,
|
0x76, 0x9e, 0xea, 0xda, 0xf3, 0x54, 0xd7, 0x5e, 0xa4, 0xba, 0xf6, 0x67, 0xaa, 0x6b, 0x3f, 0xfc,
|
||||||
0x00, 0x00, 0xff, 0xff, 0x5e, 0x8d, 0x94, 0x78, 0x88, 0x08, 0x00, 0x00,
|
0xa5, 0x97, 0xbe, 0x2a, 0x4f, 0x3a, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x5f, 0x04, 0x81, 0x6f,
|
||||||
|
0xe2, 0x08, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|||||||
+20
@@ -118,6 +118,14 @@ message TokenReviewSpec {
|
|||||||
// Token is the opaque bearer token.
|
// Token is the opaque bearer token.
|
||||||
// +optional
|
// +optional
|
||||||
optional string token = 1;
|
optional string token = 1;
|
||||||
|
|
||||||
|
// Audiences is a list of the identifiers that the resource server presented
|
||||||
|
// with the token identifies as. Audience-aware token authenticators will
|
||||||
|
// verify that the token was intended for at least one of the audiences in
|
||||||
|
// this list. If no audiences are provided, the audience will default to the
|
||||||
|
// audience of the Kubernetes apiserver.
|
||||||
|
// +optional
|
||||||
|
repeated string audiences = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TokenReviewStatus is the result of the token authentication request.
|
// TokenReviewStatus is the result of the token authentication request.
|
||||||
@@ -130,6 +138,18 @@ message TokenReviewStatus {
|
|||||||
// +optional
|
// +optional
|
||||||
optional UserInfo user = 2;
|
optional UserInfo user = 2;
|
||||||
|
|
||||||
|
// Audiences are audience identifiers chosen by the authenticator that are
|
||||||
|
// compatible with both the TokenReview and token. An identifier is any
|
||||||
|
// identifier in the intersection of the TokenReviewSpec audiences and the
|
||||||
|
// token's audiences. A client of the TokenReview API that sets the
|
||||||
|
// spec.audiences field should validate that a compatible audience identifier
|
||||||
|
// is returned in the status.audiences field to ensure that the TokenReview
|
||||||
|
// server is audience aware. If a TokenReview returns an empty
|
||||||
|
// status.audience field where status.authenticated is "true", the token is
|
||||||
|
// valid against the audience of the Kubernetes API server.
|
||||||
|
// +optional
|
||||||
|
repeated string audiences = 4;
|
||||||
|
|
||||||
// Error indicates that the token couldn't be checked
|
// Error indicates that the token couldn't be checked
|
||||||
// +optional
|
// +optional
|
||||||
optional string error = 3;
|
optional string error = 3;
|
||||||
|
|||||||
+18
@@ -64,6 +64,13 @@ type TokenReviewSpec struct {
|
|||||||
// Token is the opaque bearer token.
|
// Token is the opaque bearer token.
|
||||||
// +optional
|
// +optional
|
||||||
Token string `json:"token,omitempty" protobuf:"bytes,1,opt,name=token"`
|
Token string `json:"token,omitempty" protobuf:"bytes,1,opt,name=token"`
|
||||||
|
// Audiences is a list of the identifiers that the resource server presented
|
||||||
|
// with the token identifies as. Audience-aware token authenticators will
|
||||||
|
// verify that the token was intended for at least one of the audiences in
|
||||||
|
// this list. If no audiences are provided, the audience will default to the
|
||||||
|
// audience of the Kubernetes apiserver.
|
||||||
|
// +optional
|
||||||
|
Audiences []string `json:"audiences,omitempty" protobuf:"bytes,2,rep,name=audiences"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TokenReviewStatus is the result of the token authentication request.
|
// TokenReviewStatus is the result of the token authentication request.
|
||||||
@@ -74,6 +81,17 @@ type TokenReviewStatus struct {
|
|||||||
// User is the UserInfo associated with the provided token.
|
// User is the UserInfo associated with the provided token.
|
||||||
// +optional
|
// +optional
|
||||||
User UserInfo `json:"user,omitempty" protobuf:"bytes,2,opt,name=user"`
|
User UserInfo `json:"user,omitempty" protobuf:"bytes,2,opt,name=user"`
|
||||||
|
// Audiences are audience identifiers chosen by the authenticator that are
|
||||||
|
// compatible with both the TokenReview and token. An identifier is any
|
||||||
|
// identifier in the intersection of the TokenReviewSpec audiences and the
|
||||||
|
// token's audiences. A client of the TokenReview API that sets the
|
||||||
|
// spec.audiences field should validate that a compatible audience identifier
|
||||||
|
// is returned in the status.audiences field to ensure that the TokenReview
|
||||||
|
// server is audience aware. If a TokenReview returns an empty
|
||||||
|
// status.audience field where status.authenticated is "true", the token is
|
||||||
|
// valid against the audience of the Kubernetes API server.
|
||||||
|
// +optional
|
||||||
|
Audiences []string `json:"audiences,omitempty" protobuf:"bytes,4,rep,name=audiences"`
|
||||||
// Error indicates that the token couldn't be checked
|
// Error indicates that the token couldn't be checked
|
||||||
// +optional
|
// +optional
|
||||||
Error string `json:"error,omitempty" protobuf:"bytes,3,opt,name=error"`
|
Error string `json:"error,omitempty" protobuf:"bytes,3,opt,name=error"`
|
||||||
|
|||||||
+4
-2
@@ -79,8 +79,9 @@ func (TokenReview) SwaggerDoc() map[string]string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var map_TokenReviewSpec = map[string]string{
|
var map_TokenReviewSpec = map[string]string{
|
||||||
"": "TokenReviewSpec is a description of the token authentication request.",
|
"": "TokenReviewSpec is a description of the token authentication request.",
|
||||||
"token": "Token is the opaque bearer token.",
|
"token": "Token is the opaque bearer token.",
|
||||||
|
"audiences": "Audiences is a list of the identifiers that the resource server presented with the token identifies as. Audience-aware token authenticators will verify that the token was intended for at least one of the audiences in this list. If no audiences are provided, the audience will default to the audience of the Kubernetes apiserver.",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (TokenReviewSpec) SwaggerDoc() map[string]string {
|
func (TokenReviewSpec) SwaggerDoc() map[string]string {
|
||||||
@@ -91,6 +92,7 @@ var map_TokenReviewStatus = map[string]string{
|
|||||||
"": "TokenReviewStatus is the result of the token authentication request.",
|
"": "TokenReviewStatus is the result of the token authentication request.",
|
||||||
"authenticated": "Authenticated indicates that the token was associated with a known user.",
|
"authenticated": "Authenticated indicates that the token was associated with a known user.",
|
||||||
"user": "User is the UserInfo associated with the provided token.",
|
"user": "User is the UserInfo associated with the provided token.",
|
||||||
|
"audiences": "Audiences are audience identifiers chosen by the authenticator that are compatible with both the TokenReview and token. An identifier is any identifier in the intersection of the TokenReviewSpec audiences and the token's audiences. A client of the TokenReview API that sets the spec.audiences field should validate that a compatible audience identifier is returned in the status.audiences field to ensure that the TokenReview server is audience aware. If a TokenReview returns an empty status.audience field where status.authenticated is \"true\", the token is valid against the audience of the Kubernetes API server.",
|
||||||
"error": "Error indicates that the token couldn't be checked",
|
"error": "Error indicates that the token couldn't be checked",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-1
@@ -141,7 +141,7 @@ func (in *TokenReview) DeepCopyInto(out *TokenReview) {
|
|||||||
*out = *in
|
*out = *in
|
||||||
out.TypeMeta = in.TypeMeta
|
out.TypeMeta = in.TypeMeta
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
out.Spec = in.Spec
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
in.Status.DeepCopyInto(&out.Status)
|
in.Status.DeepCopyInto(&out.Status)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -167,6 +167,11 @@ func (in *TokenReview) DeepCopyObject() runtime.Object {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *TokenReviewSpec) DeepCopyInto(out *TokenReviewSpec) {
|
func (in *TokenReviewSpec) DeepCopyInto(out *TokenReviewSpec) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
if in.Audiences != nil {
|
||||||
|
in, out := &in.Audiences, &out.Audiences
|
||||||
|
*out = make([]string, len(*in))
|
||||||
|
copy(*out, *in)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,6 +189,11 @@ func (in *TokenReviewSpec) DeepCopy() *TokenReviewSpec {
|
|||||||
func (in *TokenReviewStatus) DeepCopyInto(out *TokenReviewStatus) {
|
func (in *TokenReviewStatus) DeepCopyInto(out *TokenReviewStatus) {
|
||||||
*out = *in
|
*out = *in
|
||||||
in.User.DeepCopyInto(&out.User)
|
in.User.DeepCopyInto(&out.User)
|
||||||
|
if in.Audiences != nil {
|
||||||
|
in, out := &in.Audiences, &out.Audiences
|
||||||
|
*out = make([]string, len(*in))
|
||||||
|
copy(*out, *in)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+145
-41
@@ -175,6 +175,21 @@ func (m *TokenReviewSpec) MarshalTo(dAtA []byte) (int, error) {
|
|||||||
i++
|
i++
|
||||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Token)))
|
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Token)))
|
||||||
i += copy(dAtA[i:], m.Token)
|
i += copy(dAtA[i:], m.Token)
|
||||||
|
if len(m.Audiences) > 0 {
|
||||||
|
for _, s := range m.Audiences {
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
i++
|
||||||
|
l = len(s)
|
||||||
|
for l >= 1<<7 {
|
||||||
|
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
|
||||||
|
l >>= 7
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
dAtA[i] = uint8(l)
|
||||||
|
i++
|
||||||
|
i += copy(dAtA[i:], s)
|
||||||
|
}
|
||||||
|
}
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,6 +228,21 @@ func (m *TokenReviewStatus) MarshalTo(dAtA []byte) (int, error) {
|
|||||||
i++
|
i++
|
||||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Error)))
|
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Error)))
|
||||||
i += copy(dAtA[i:], m.Error)
|
i += copy(dAtA[i:], m.Error)
|
||||||
|
if len(m.Audiences) > 0 {
|
||||||
|
for _, s := range m.Audiences {
|
||||||
|
dAtA[i] = 0x22
|
||||||
|
i++
|
||||||
|
l = len(s)
|
||||||
|
for l >= 1<<7 {
|
||||||
|
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
|
||||||
|
l >>= 7
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
dAtA[i] = uint8(l)
|
||||||
|
i++
|
||||||
|
i += copy(dAtA[i:], s)
|
||||||
|
}
|
||||||
|
}
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,6 +356,12 @@ func (m *TokenReviewSpec) Size() (n int) {
|
|||||||
_ = l
|
_ = l
|
||||||
l = len(m.Token)
|
l = len(m.Token)
|
||||||
n += 1 + l + sovGenerated(uint64(l))
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
if len(m.Audiences) > 0 {
|
||||||
|
for _, s := range m.Audiences {
|
||||||
|
l = len(s)
|
||||||
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
}
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,6 +373,12 @@ func (m *TokenReviewStatus) Size() (n int) {
|
|||||||
n += 1 + l + sovGenerated(uint64(l))
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
l = len(m.Error)
|
l = len(m.Error)
|
||||||
n += 1 + l + sovGenerated(uint64(l))
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
if len(m.Audiences) > 0 {
|
||||||
|
for _, s := range m.Audiences {
|
||||||
|
l = len(s)
|
||||||
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
}
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,6 +438,7 @@ func (this *TokenReviewSpec) String() string {
|
|||||||
}
|
}
|
||||||
s := strings.Join([]string{`&TokenReviewSpec{`,
|
s := strings.Join([]string{`&TokenReviewSpec{`,
|
||||||
`Token:` + fmt.Sprintf("%v", this.Token) + `,`,
|
`Token:` + fmt.Sprintf("%v", this.Token) + `,`,
|
||||||
|
`Audiences:` + fmt.Sprintf("%v", this.Audiences) + `,`,
|
||||||
`}`,
|
`}`,
|
||||||
}, "")
|
}, "")
|
||||||
return s
|
return s
|
||||||
@@ -408,6 +451,7 @@ func (this *TokenReviewStatus) String() string {
|
|||||||
`Authenticated:` + fmt.Sprintf("%v", this.Authenticated) + `,`,
|
`Authenticated:` + fmt.Sprintf("%v", this.Authenticated) + `,`,
|
||||||
`User:` + strings.Replace(strings.Replace(this.User.String(), "UserInfo", "UserInfo", 1), `&`, ``, 1) + `,`,
|
`User:` + strings.Replace(strings.Replace(this.User.String(), "UserInfo", "UserInfo", 1), `&`, ``, 1) + `,`,
|
||||||
`Error:` + fmt.Sprintf("%v", this.Error) + `,`,
|
`Error:` + fmt.Sprintf("%v", this.Error) + `,`,
|
||||||
|
`Audiences:` + fmt.Sprintf("%v", this.Audiences) + `,`,
|
||||||
`}`,
|
`}`,
|
||||||
}, "")
|
}, "")
|
||||||
return s
|
return s
|
||||||
@@ -720,6 +764,35 @@ func (m *TokenReviewSpec) Unmarshal(dAtA []byte) error {
|
|||||||
}
|
}
|
||||||
m.Token = string(dAtA[iNdEx:postIndex])
|
m.Token = string(dAtA[iNdEx:postIndex])
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Audiences", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthGenerated
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Audiences = append(m.Audiences, string(dAtA[iNdEx:postIndex]))
|
||||||
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipGenerated(dAtA[iNdEx:])
|
skippy, err := skipGenerated(dAtA[iNdEx:])
|
||||||
@@ -849,6 +922,35 @@ func (m *TokenReviewStatus) Unmarshal(dAtA []byte) error {
|
|||||||
}
|
}
|
||||||
m.Error = string(dAtA[iNdEx:postIndex])
|
m.Error = string(dAtA[iNdEx:postIndex])
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
|
case 4:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Audiences", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthGenerated
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Audiences = append(m.Audiences, string(dAtA[iNdEx:postIndex]))
|
||||||
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipGenerated(dAtA[iNdEx:])
|
skippy, err := skipGenerated(dAtA[iNdEx:])
|
||||||
@@ -1240,45 +1342,47 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptorGenerated = []byte{
|
var fileDescriptorGenerated = []byte{
|
||||||
// 635 bytes of a gzipped FileDescriptorProto
|
// 663 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xcf, 0x4f, 0xd4, 0x40,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xcd, 0x4e, 0x14, 0x4d,
|
||||||
0x14, 0x6e, 0xf7, 0x07, 0xee, 0xce, 0x8a, 0xe2, 0x24, 0x26, 0x9b, 0x4d, 0xec, 0xae, 0xeb, 0x85,
|
0x14, 0xed, 0x9e, 0x1f, 0xbe, 0x99, 0x9a, 0x6f, 0x14, 0x2b, 0x31, 0x99, 0x4c, 0x62, 0x0f, 0x8e,
|
||||||
0x44, 0x99, 0x0a, 0x21, 0x48, 0xf0, 0x64, 0x95, 0x18, 0x4c, 0x88, 0xc9, 0x08, 0x1e, 0xd4, 0x83,
|
0x1b, 0x12, 0xa4, 0x5a, 0x08, 0x41, 0x82, 0x2b, 0x5a, 0x89, 0xc1, 0x84, 0x98, 0x94, 0xe0, 0x42,
|
||||||
0xb3, 0xdd, 0x47, 0xb7, 0xae, 0xed, 0x34, 0xd3, 0x69, 0x95, 0x1b, 0x7f, 0x82, 0x47, 0x8f, 0x26,
|
0x5d, 0x58, 0xd3, 0x73, 0xe9, 0x69, 0xc7, 0xfe, 0x49, 0x55, 0xf5, 0x28, 0x3b, 0x1e, 0xc1, 0xa5,
|
||||||
0xfe, 0x25, 0x26, 0x1e, 0x38, 0x72, 0xe4, 0x60, 0x88, 0xd4, 0x7f, 0xc4, 0xcc, 0x74, 0x64, 0x17,
|
0x4b, 0x13, 0x9f, 0xc4, 0x1d, 0x4b, 0x96, 0x2c, 0xcc, 0x44, 0xda, 0x27, 0xf0, 0x0d, 0x4c, 0x55,
|
||||||
0x88, 0x01, 0x6e, 0xf3, 0xbe, 0xf7, 0xbe, 0x6f, 0xde, 0xf7, 0x66, 0x1e, 0x7a, 0x31, 0x5e, 0x4d,
|
0x17, 0xcc, 0x00, 0x31, 0xc0, 0xae, 0xeb, 0xdc, 0x7b, 0xce, 0x3d, 0xf7, 0x54, 0x17, 0x7a, 0x31,
|
||||||
0x49, 0xc8, 0xdd, 0x71, 0x36, 0x00, 0x11, 0x83, 0x84, 0xd4, 0xcd, 0x21, 0x1e, 0x72, 0xe1, 0x9a,
|
0x5c, 0x13, 0x24, 0x4c, 0xdc, 0x61, 0xd6, 0x03, 0x1e, 0x83, 0x04, 0xe1, 0x8e, 0x20, 0xee, 0x27,
|
||||||
0x04, 0x4b, 0x42, 0x97, 0x65, 0x72, 0x04, 0xb1, 0x0c, 0x7d, 0x26, 0x43, 0x1e, 0xbb, 0xf9, 0xe2,
|
0xdc, 0x35, 0x05, 0x96, 0x86, 0x2e, 0xcb, 0xe4, 0x00, 0x62, 0x19, 0xfa, 0x4c, 0x86, 0x49, 0xec,
|
||||||
0x00, 0x24, 0x5b, 0x74, 0x03, 0x88, 0x41, 0x30, 0x09, 0x43, 0x92, 0x08, 0x2e, 0x39, 0xbe, 0x5b,
|
0x8e, 0x96, 0x7a, 0x20, 0xd9, 0x92, 0x1b, 0x40, 0x0c, 0x9c, 0x49, 0xe8, 0x93, 0x94, 0x27, 0x32,
|
||||||
0x52, 0x08, 0x4b, 0x42, 0x72, 0x9a, 0x42, 0x0c, 0xa5, 0xb3, 0x10, 0x84, 0x72, 0x94, 0x0d, 0x88,
|
0xc1, 0xf7, 0x0b, 0x0a, 0x61, 0x69, 0x48, 0xce, 0x53, 0x88, 0xa1, 0xb4, 0x17, 0x83, 0x50, 0x0e,
|
||||||
0xcf, 0x23, 0x37, 0xe0, 0x01, 0x77, 0x35, 0x73, 0x90, 0xed, 0xe8, 0x48, 0x07, 0xfa, 0x54, 0x2a,
|
0xb2, 0x1e, 0xf1, 0x93, 0xc8, 0x0d, 0x92, 0x20, 0x71, 0x35, 0xb3, 0x97, 0xed, 0xe9, 0x93, 0x3e,
|
||||||
0x76, 0x96, 0x27, 0x4d, 0x44, 0xcc, 0x1f, 0x85, 0x31, 0x88, 0x5d, 0x37, 0x19, 0x07, 0x0a, 0x48,
|
0xe8, 0xaf, 0x42, 0xb1, 0xbd, 0x32, 0x31, 0x11, 0x31, 0x7f, 0x10, 0xc6, 0xc0, 0xf7, 0xdd, 0x74,
|
||||||
0xdd, 0x08, 0x24, 0x73, 0xf3, 0x73, 0x7d, 0x74, 0xdc, 0xff, 0xb1, 0x44, 0x16, 0xcb, 0x30, 0x82,
|
0x18, 0x28, 0x40, 0xb8, 0x11, 0x48, 0xe6, 0x8e, 0x2e, 0xf9, 0x68, 0xbb, 0xff, 0x62, 0xf1, 0x2c,
|
||||||
0x73, 0x84, 0x95, 0x8b, 0x08, 0xa9, 0x3f, 0x82, 0x88, 0x9d, 0xe5, 0xf5, 0x1f, 0x21, 0xb4, 0xfe,
|
0x96, 0x61, 0x04, 0x97, 0x08, 0xab, 0x57, 0x11, 0x84, 0x3f, 0x80, 0x88, 0x5d, 0xe4, 0x75, 0x1f,
|
||||||
0x59, 0x0a, 0xf6, 0x9a, 0x7d, 0xcc, 0x00, 0x77, 0x51, 0x3d, 0x94, 0x10, 0xa5, 0x6d, 0xbb, 0x57,
|
0x23, 0xb4, 0xf9, 0x59, 0x72, 0xf6, 0x9a, 0x7d, 0xcc, 0x00, 0x77, 0x50, 0x35, 0x94, 0x10, 0x89,
|
||||||
0x9d, 0x6f, 0x7a, 0xcd, 0xe2, 0xa8, 0x5b, 0xdf, 0x50, 0x00, 0x2d, 0xf1, 0xb5, 0xc6, 0xd7, 0x6f,
|
0x96, 0x3d, 0x57, 0x9e, 0xaf, 0x7b, 0xf5, 0x7c, 0xdc, 0xa9, 0x6e, 0x29, 0x80, 0x16, 0xf8, 0x7a,
|
||||||
0x5d, 0x6b, 0xef, 0x57, 0xcf, 0xea, 0x7f, 0xaf, 0xa0, 0xd6, 0x16, 0x1f, 0x43, 0x4c, 0x21, 0x0f,
|
0xed, 0xeb, 0xb7, 0x8e, 0x75, 0xf0, 0x73, 0xce, 0xea, 0x7e, 0x2f, 0xa1, 0xc6, 0x4e, 0x32, 0x84,
|
||||||
0xe1, 0x13, 0x7e, 0x8f, 0x1a, 0xca, 0xcc, 0x90, 0x49, 0xd6, 0xb6, 0x7b, 0xf6, 0x7c, 0x6b, 0xe9,
|
0x98, 0xc2, 0x28, 0x84, 0x4f, 0xf8, 0x3d, 0xaa, 0xa9, 0x65, 0xfa, 0x4c, 0xb2, 0x96, 0x3d, 0x67,
|
||||||
0x21, 0x99, 0x0c, 0xf3, 0xa4, 0x27, 0x92, 0x8c, 0x03, 0x05, 0xa4, 0x44, 0x55, 0x93, 0x7c, 0x91,
|
0xcf, 0x37, 0x96, 0x1f, 0x91, 0x49, 0x98, 0x67, 0x9e, 0x48, 0x3a, 0x0c, 0x14, 0x20, 0x88, 0xea,
|
||||||
0xbc, 0x1c, 0x7c, 0x00, 0x5f, 0x6e, 0x82, 0x64, 0x1e, 0xde, 0x3f, 0xea, 0x5a, 0xc5, 0x51, 0x17,
|
0x26, 0xa3, 0x25, 0xf2, 0xb2, 0xf7, 0x01, 0x7c, 0xb9, 0x0d, 0x92, 0x79, 0xf8, 0x70, 0xdc, 0xb1,
|
||||||
0x4d, 0x30, 0x7a, 0xa2, 0x8a, 0xb7, 0x50, 0x2d, 0x4d, 0xc0, 0x6f, 0x57, 0xb4, 0xfa, 0x12, 0xb9,
|
0xf2, 0x71, 0x07, 0x4d, 0x30, 0x7a, 0xa6, 0x8a, 0x77, 0x50, 0x45, 0xa4, 0xe0, 0xb7, 0x4a, 0x5a,
|
||||||
0xf0, 0xa9, 0xc8, 0x54, 0x7f, 0xaf, 0x12, 0xf0, 0xbd, 0xeb, 0x46, 0xbf, 0xa6, 0x22, 0xaa, 0xd5,
|
0x7d, 0x99, 0x5c, 0x79, 0x55, 0x64, 0xca, 0xdf, 0xab, 0x14, 0x7c, 0xef, 0x7f, 0xa3, 0x5f, 0x51,
|
||||||
0xf0, 0x3b, 0x34, 0x93, 0x4a, 0x26, 0xb3, 0xb4, 0x5d, 0xd5, 0xba, 0xcb, 0x57, 0xd4, 0xd5, 0x5c,
|
0x27, 0xaa, 0xd5, 0xf0, 0x3b, 0x34, 0x23, 0x24, 0x93, 0x99, 0x68, 0x95, 0xb5, 0xee, 0xca, 0x0d,
|
||||||
0xef, 0x86, 0x51, 0x9e, 0x29, 0x63, 0x6a, 0x34, 0xfb, 0x2b, 0xe8, 0xe6, 0x99, 0x26, 0xf0, 0x3d,
|
0x75, 0x35, 0xd7, 0xbb, 0x65, 0x94, 0x67, 0x8a, 0x33, 0x35, 0x9a, 0x5d, 0x1f, 0xdd, 0xbe, 0x60,
|
||||||
0x54, 0x97, 0x0a, 0xd2, 0x53, 0x6a, 0x7a, 0xb3, 0x86, 0x59, 0x2f, 0xeb, 0xca, 0x5c, 0xff, 0xa7,
|
0x02, 0x3f, 0x40, 0x55, 0xa9, 0x20, 0x9d, 0x52, 0xdd, 0x6b, 0x1a, 0x66, 0xb5, 0xe8, 0x2b, 0x6a,
|
||||||
0x8d, 0x6e, 0x9d, 0xbb, 0x05, 0x3f, 0x46, 0xb3, 0x53, 0x1d, 0xc1, 0x50, 0x4b, 0x34, 0xbc, 0xdb,
|
0x78, 0x01, 0xd5, 0x59, 0xd6, 0x0f, 0x21, 0xf6, 0x41, 0xb4, 0x4a, 0xfa, 0x32, 0x9a, 0xf9, 0xb8,
|
||||||
0x46, 0x62, 0xf6, 0xc9, 0x74, 0x92, 0x9e, 0xae, 0xc5, 0x9b, 0xa8, 0x96, 0xa5, 0x20, 0xcc, 0xf8,
|
0x53, 0xdf, 0x38, 0x05, 0xe9, 0xa4, 0xde, 0xfd, 0x63, 0xa3, 0x3b, 0x97, 0x2c, 0xe1, 0x27, 0xa8,
|
||||||
0xee, 0x5f, 0xc2, 0xe6, 0x76, 0x0a, 0x62, 0x23, 0xde, 0xe1, 0x93, 0xb9, 0x29, 0x84, 0x6a, 0x19,
|
0x39, 0x65, 0x1f, 0xfa, 0x7a, 0x5e, 0xcd, 0xbb, 0x6b, 0xe6, 0x35, 0x37, 0xa6, 0x8b, 0xf4, 0x7c,
|
||||||
0x65, 0x03, 0x84, 0xe0, 0x42, 0x8f, 0x6d, 0xca, 0xc6, 0xba, 0x02, 0x69, 0x99, 0xeb, 0xff, 0xa8,
|
0x2f, 0xde, 0x46, 0x95, 0x4c, 0x00, 0x37, 0x59, 0x2f, 0x5c, 0x23, 0x93, 0x5d, 0x01, 0x7c, 0x2b,
|
||||||
0xa0, 0xc6, 0x3f, 0x15, 0xfc, 0x00, 0x35, 0x14, 0x33, 0x66, 0x11, 0x18, 0xef, 0x73, 0x86, 0xa4,
|
0xde, 0x4b, 0x26, 0x21, 0x2b, 0x84, 0x6a, 0x19, 0xb5, 0x33, 0x70, 0x9e, 0x70, 0x9d, 0xf1, 0xd4,
|
||||||
0x6b, 0x14, 0x4e, 0x4f, 0x2a, 0xf0, 0x1d, 0x54, 0xcd, 0xc2, 0xa1, 0xee, 0xb6, 0xe9, 0xb5, 0x4c,
|
0xce, 0x9b, 0x0a, 0xa4, 0x45, 0xed, 0xfc, 0xce, 0x95, 0x2b, 0x76, 0xfe, 0x51, 0x42, 0xb5, 0xd3,
|
||||||
0x61, 0x75, 0x7b, 0xe3, 0x19, 0x55, 0x38, 0xee, 0xa3, 0x99, 0x40, 0xf0, 0x2c, 0x51, 0xcf, 0xa6,
|
0x91, 0xf8, 0x21, 0xaa, 0xa9, 0x31, 0x31, 0x8b, 0xc0, 0xa4, 0x3a, 0x6b, 0x26, 0xe8, 0x1e, 0x85,
|
||||||
0xbe, 0x2a, 0x52, 0xc3, 0x7f, 0xae, 0x11, 0x6a, 0x32, 0xf8, 0x2d, 0xaa, 0x83, 0xfa, 0xdb, 0xed,
|
0xd3, 0xb3, 0x0e, 0x7c, 0x0f, 0x95, 0xb3, 0xb0, 0xaf, 0x57, 0xab, 0x7b, 0x0d, 0xd3, 0x58, 0xde,
|
||||||
0x5a, 0xaf, 0x3a, 0xdf, 0x5a, 0x5a, 0xb9, 0x82, 0x65, 0xa2, 0x97, 0x62, 0x3d, 0x96, 0x62, 0x77,
|
0xdd, 0x7a, 0x46, 0x15, 0x8e, 0xbb, 0x68, 0x26, 0xe0, 0x49, 0x96, 0xaa, 0x1f, 0x42, 0x79, 0x40,
|
||||||
0xca, 0x9a, 0xc2, 0x68, 0xa9, 0xd9, 0x09, 0xcc, 0xe2, 0xe8, 0x1a, 0x3c, 0x87, 0xaa, 0x63, 0xd8,
|
0xea, 0x5a, 0x9f, 0x6b, 0x84, 0x9a, 0x0a, 0x7e, 0x8b, 0xaa, 0xa0, 0x5e, 0x8d, 0xb6, 0xd9, 0x58,
|
||||||
0x2d, 0x6d, 0x51, 0x75, 0xc4, 0x4f, 0x51, 0x3d, 0x57, 0x3b, 0x65, 0xe6, 0xbd, 0x70, 0x89, 0xcb,
|
0x5e, 0xbd, 0x41, 0x3e, 0x44, 0x3f, 0xb7, 0xcd, 0x58, 0xf2, 0xfd, 0xa9, 0x1c, 0x14, 0x46, 0x0b,
|
||||||
0x27, 0x8b, 0x48, 0x4b, 0xee, 0x5a, 0x65, 0xd5, 0xf6, 0x16, 0xf6, 0x8f, 0x1d, 0xeb, 0xe0, 0xd8,
|
0xcd, 0x76, 0x60, 0x9e, 0xa4, 0xee, 0xc1, 0xb3, 0xa8, 0x3c, 0x84, 0xfd, 0x62, 0x2d, 0xaa, 0x3e,
|
||||||
0xb1, 0x0e, 0x8f, 0x1d, 0x6b, 0xaf, 0x70, 0xec, 0xfd, 0xc2, 0xb1, 0x0f, 0x0a, 0xc7, 0x3e, 0x2c,
|
0xf1, 0x53, 0x54, 0x1d, 0xa9, 0xd7, 0x6a, 0x2e, 0x67, 0xf1, 0x1a, 0xc3, 0x27, 0x4f, 0x9c, 0x16,
|
||||||
0x1c, 0xfb, 0x77, 0xe1, 0xd8, 0x5f, 0xfe, 0x38, 0xd6, 0x9b, 0x6b, 0x46, 0xe4, 0x6f, 0x00, 0x00,
|
0xdc, 0xf5, 0xd2, 0x9a, 0xed, 0x2d, 0x1e, 0x9e, 0x38, 0xd6, 0xd1, 0x89, 0x63, 0x1d, 0x9f, 0x38,
|
||||||
0x00, 0xff, 0xff, 0x39, 0x00, 0xe7, 0xfa, 0x0e, 0x05, 0x00, 0x00,
|
0xd6, 0x41, 0xee, 0xd8, 0x87, 0xb9, 0x63, 0x1f, 0xe5, 0x8e, 0x7d, 0x9c, 0x3b, 0xf6, 0xaf, 0xdc,
|
||||||
|
0xb1, 0xbf, 0xfc, 0x76, 0xac, 0x37, 0xff, 0x19, 0x91, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf7,
|
||||||
|
0xd6, 0x32, 0x28, 0x68, 0x05, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|||||||
+20
@@ -57,6 +57,14 @@ message TokenReviewSpec {
|
|||||||
// Token is the opaque bearer token.
|
// Token is the opaque bearer token.
|
||||||
// +optional
|
// +optional
|
||||||
optional string token = 1;
|
optional string token = 1;
|
||||||
|
|
||||||
|
// Audiences is a list of the identifiers that the resource server presented
|
||||||
|
// with the token identifies as. Audience-aware token authenticators will
|
||||||
|
// verify that the token was intended for at least one of the audiences in
|
||||||
|
// this list. If no audiences are provided, the audience will default to the
|
||||||
|
// audience of the Kubernetes apiserver.
|
||||||
|
// +optional
|
||||||
|
repeated string audiences = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TokenReviewStatus is the result of the token authentication request.
|
// TokenReviewStatus is the result of the token authentication request.
|
||||||
@@ -69,6 +77,18 @@ message TokenReviewStatus {
|
|||||||
// +optional
|
// +optional
|
||||||
optional UserInfo user = 2;
|
optional UserInfo user = 2;
|
||||||
|
|
||||||
|
// Audiences are audience identifiers chosen by the authenticator that are
|
||||||
|
// compatible with both the TokenReview and token. An identifier is any
|
||||||
|
// identifier in the intersection of the TokenReviewSpec audiences and the
|
||||||
|
// token's audiences. A client of the TokenReview API that sets the
|
||||||
|
// spec.audiences field should validate that a compatible audience identifier
|
||||||
|
// is returned in the status.audiences field to ensure that the TokenReview
|
||||||
|
// server is audience aware. If a TokenReview returns an empty
|
||||||
|
// status.audience field where status.authenticated is "true", the token is
|
||||||
|
// valid against the audience of the Kubernetes API server.
|
||||||
|
// +optional
|
||||||
|
repeated string audiences = 4;
|
||||||
|
|
||||||
// Error indicates that the token couldn't be checked
|
// Error indicates that the token couldn't be checked
|
||||||
// +optional
|
// +optional
|
||||||
optional string error = 3;
|
optional string error = 3;
|
||||||
|
|||||||
+18
@@ -48,6 +48,13 @@ type TokenReviewSpec struct {
|
|||||||
// Token is the opaque bearer token.
|
// Token is the opaque bearer token.
|
||||||
// +optional
|
// +optional
|
||||||
Token string `json:"token,omitempty" protobuf:"bytes,1,opt,name=token"`
|
Token string `json:"token,omitempty" protobuf:"bytes,1,opt,name=token"`
|
||||||
|
// Audiences is a list of the identifiers that the resource server presented
|
||||||
|
// with the token identifies as. Audience-aware token authenticators will
|
||||||
|
// verify that the token was intended for at least one of the audiences in
|
||||||
|
// this list. If no audiences are provided, the audience will default to the
|
||||||
|
// audience of the Kubernetes apiserver.
|
||||||
|
// +optional
|
||||||
|
Audiences []string `json:"audiences,omitempty" protobuf:"bytes,2,rep,name=audiences"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TokenReviewStatus is the result of the token authentication request.
|
// TokenReviewStatus is the result of the token authentication request.
|
||||||
@@ -58,6 +65,17 @@ type TokenReviewStatus struct {
|
|||||||
// User is the UserInfo associated with the provided token.
|
// User is the UserInfo associated with the provided token.
|
||||||
// +optional
|
// +optional
|
||||||
User UserInfo `json:"user,omitempty" protobuf:"bytes,2,opt,name=user"`
|
User UserInfo `json:"user,omitempty" protobuf:"bytes,2,opt,name=user"`
|
||||||
|
// Audiences are audience identifiers chosen by the authenticator that are
|
||||||
|
// compatible with both the TokenReview and token. An identifier is any
|
||||||
|
// identifier in the intersection of the TokenReviewSpec audiences and the
|
||||||
|
// token's audiences. A client of the TokenReview API that sets the
|
||||||
|
// spec.audiences field should validate that a compatible audience identifier
|
||||||
|
// is returned in the status.audiences field to ensure that the TokenReview
|
||||||
|
// server is audience aware. If a TokenReview returns an empty
|
||||||
|
// status.audience field where status.authenticated is "true", the token is
|
||||||
|
// valid against the audience of the Kubernetes API server.
|
||||||
|
// +optional
|
||||||
|
Audiences []string `json:"audiences,omitempty" protobuf:"bytes,4,rep,name=audiences"`
|
||||||
// Error indicates that the token couldn't be checked
|
// Error indicates that the token couldn't be checked
|
||||||
// +optional
|
// +optional
|
||||||
Error string `json:"error,omitempty" protobuf:"bytes,3,opt,name=error"`
|
Error string `json:"error,omitempty" protobuf:"bytes,3,opt,name=error"`
|
||||||
|
|||||||
+4
-2
@@ -38,8 +38,9 @@ func (TokenReview) SwaggerDoc() map[string]string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var map_TokenReviewSpec = map[string]string{
|
var map_TokenReviewSpec = map[string]string{
|
||||||
"": "TokenReviewSpec is a description of the token authentication request.",
|
"": "TokenReviewSpec is a description of the token authentication request.",
|
||||||
"token": "Token is the opaque bearer token.",
|
"token": "Token is the opaque bearer token.",
|
||||||
|
"audiences": "Audiences is a list of the identifiers that the resource server presented with the token identifies as. Audience-aware token authenticators will verify that the token was intended for at least one of the audiences in this list. If no audiences are provided, the audience will default to the audience of the Kubernetes apiserver.",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (TokenReviewSpec) SwaggerDoc() map[string]string {
|
func (TokenReviewSpec) SwaggerDoc() map[string]string {
|
||||||
@@ -50,6 +51,7 @@ var map_TokenReviewStatus = map[string]string{
|
|||||||
"": "TokenReviewStatus is the result of the token authentication request.",
|
"": "TokenReviewStatus is the result of the token authentication request.",
|
||||||
"authenticated": "Authenticated indicates that the token was associated with a known user.",
|
"authenticated": "Authenticated indicates that the token was associated with a known user.",
|
||||||
"user": "User is the UserInfo associated with the provided token.",
|
"user": "User is the UserInfo associated with the provided token.",
|
||||||
|
"audiences": "Audiences are audience identifiers chosen by the authenticator that are compatible with both the TokenReview and token. An identifier is any identifier in the intersection of the TokenReviewSpec audiences and the token's audiences. A client of the TokenReview API that sets the spec.audiences field should validate that a compatible audience identifier is returned in the status.audiences field to ensure that the TokenReview server is audience aware. If a TokenReview returns an empty status.audience field where status.authenticated is \"true\", the token is valid against the audience of the Kubernetes API server.",
|
||||||
"error": "Error indicates that the token couldn't be checked",
|
"error": "Error indicates that the token couldn't be checked",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-1
@@ -49,7 +49,7 @@ func (in *TokenReview) DeepCopyInto(out *TokenReview) {
|
|||||||
*out = *in
|
*out = *in
|
||||||
out.TypeMeta = in.TypeMeta
|
out.TypeMeta = in.TypeMeta
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
out.Spec = in.Spec
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
in.Status.DeepCopyInto(&out.Status)
|
in.Status.DeepCopyInto(&out.Status)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -75,6 +75,11 @@ func (in *TokenReview) DeepCopyObject() runtime.Object {
|
|||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *TokenReviewSpec) DeepCopyInto(out *TokenReviewSpec) {
|
func (in *TokenReviewSpec) DeepCopyInto(out *TokenReviewSpec) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
if in.Audiences != nil {
|
||||||
|
in, out := &in.Audiences, &out.Audiences
|
||||||
|
*out = make([]string, len(*in))
|
||||||
|
copy(*out, *in)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,6 +97,11 @@ func (in *TokenReviewSpec) DeepCopy() *TokenReviewSpec {
|
|||||||
func (in *TokenReviewStatus) DeepCopyInto(out *TokenReviewStatus) {
|
func (in *TokenReviewStatus) DeepCopyInto(out *TokenReviewStatus) {
|
||||||
*out = *in
|
*out = *in
|
||||||
in.User.DeepCopyInto(&out.User)
|
in.User.DeepCopyInto(&out.User)
|
||||||
|
if in.Audiences != nil {
|
||||||
|
in, out := &in.Audiences, &out.Audiences
|
||||||
|
*out = make([]string, len(*in))
|
||||||
|
copy(*out, *in)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1178
-942
File diff suppressed because it is too large
Load Diff
+28
-4
@@ -641,7 +641,7 @@ message Container {
|
|||||||
repeated VolumeMount volumeMounts = 9;
|
repeated VolumeMount volumeMounts = 9;
|
||||||
|
|
||||||
// volumeDevices is the list of block devices to be used by the container.
|
// volumeDevices is the list of block devices to be used by the container.
|
||||||
// This is an alpha feature and may change in the future.
|
// This is a beta feature.
|
||||||
// +patchMergeKey=devicePath
|
// +patchMergeKey=devicePath
|
||||||
// +patchStrategy=merge
|
// +patchStrategy=merge
|
||||||
// +optional
|
// +optional
|
||||||
@@ -1373,6 +1373,30 @@ message GitRepoVolumeSource {
|
|||||||
optional string directory = 3;
|
optional string directory = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Represents a Glusterfs mount that lasts the lifetime of a pod.
|
||||||
|
// Glusterfs volumes do not support ownership management or SELinux relabeling.
|
||||||
|
message GlusterfsPersistentVolumeSource {
|
||||||
|
// EndpointsName is the endpoint name that details Glusterfs topology.
|
||||||
|
// More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod
|
||||||
|
optional string endpoints = 1;
|
||||||
|
|
||||||
|
// Path is the Glusterfs volume path.
|
||||||
|
// More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod
|
||||||
|
optional string path = 2;
|
||||||
|
|
||||||
|
// ReadOnly here will force the Glusterfs volume to be mounted with read-only permissions.
|
||||||
|
// Defaults to false.
|
||||||
|
// More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod
|
||||||
|
// +optional
|
||||||
|
optional bool readOnly = 3;
|
||||||
|
|
||||||
|
// EndpointsNamespace is the namespace that contains Glusterfs endpoint.
|
||||||
|
// If this field is empty, the EndpointNamespace defaults to the same namespace as the bound PVC.
|
||||||
|
// More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod
|
||||||
|
// +optional
|
||||||
|
optional string endpointsNamespace = 4;
|
||||||
|
}
|
||||||
|
|
||||||
// Represents a Glusterfs mount that lasts the lifetime of a pod.
|
// Represents a Glusterfs mount that lasts the lifetime of a pod.
|
||||||
// Glusterfs volumes do not support ownership management or SELinux relabeling.
|
// Glusterfs volumes do not support ownership management or SELinux relabeling.
|
||||||
message GlusterfsVolumeSource {
|
message GlusterfsVolumeSource {
|
||||||
@@ -2296,7 +2320,7 @@ message PersistentVolumeClaimSpec {
|
|||||||
|
|
||||||
// volumeMode defines what type of volume is required by the claim.
|
// volumeMode defines what type of volume is required by the claim.
|
||||||
// Value of Filesystem is implied when not included in claim spec.
|
// Value of Filesystem is implied when not included in claim spec.
|
||||||
// This is an alpha feature and may change in the future.
|
// This is a beta feature.
|
||||||
// +optional
|
// +optional
|
||||||
optional string volumeMode = 6;
|
optional string volumeMode = 6;
|
||||||
|
|
||||||
@@ -2389,7 +2413,7 @@ message PersistentVolumeSource {
|
|||||||
// exposed to the pod. Provisioned by an admin.
|
// exposed to the pod. Provisioned by an admin.
|
||||||
// More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md
|
// More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md
|
||||||
// +optional
|
// +optional
|
||||||
optional GlusterfsVolumeSource glusterfs = 4;
|
optional GlusterfsPersistentVolumeSource glusterfs = 4;
|
||||||
|
|
||||||
// NFS represents an NFS mount on the host. Provisioned by an admin.
|
// NFS represents an NFS mount on the host. Provisioned by an admin.
|
||||||
// More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs
|
// More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs
|
||||||
@@ -2512,7 +2536,7 @@ message PersistentVolumeSpec {
|
|||||||
|
|
||||||
// volumeMode defines if a volume is intended to be used with a formatted filesystem
|
// volumeMode defines if a volume is intended to be used with a formatted filesystem
|
||||||
// or to remain in raw block state. Value of Filesystem is implied when not included in spec.
|
// or to remain in raw block state. Value of Filesystem is implied when not included in spec.
|
||||||
// This is an alpha feature and may change in the future.
|
// This is a beta feature.
|
||||||
// +optional
|
// +optional
|
||||||
optional string volumeMode = 8;
|
optional string volumeMode = 8;
|
||||||
|
|
||||||
|
|||||||
+30
-6
@@ -191,7 +191,7 @@ type PersistentVolumeSource struct {
|
|||||||
// exposed to the pod. Provisioned by an admin.
|
// exposed to the pod. Provisioned by an admin.
|
||||||
// More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md
|
// More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md
|
||||||
// +optional
|
// +optional
|
||||||
Glusterfs *GlusterfsVolumeSource `json:"glusterfs,omitempty" protobuf:"bytes,4,opt,name=glusterfs"`
|
Glusterfs *GlusterfsPersistentVolumeSource `json:"glusterfs,omitempty" protobuf:"bytes,4,opt,name=glusterfs"`
|
||||||
// NFS represents an NFS mount on the host. Provisioned by an admin.
|
// NFS represents an NFS mount on the host. Provisioned by an admin.
|
||||||
// More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs
|
// More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs
|
||||||
// +optional
|
// +optional
|
||||||
@@ -326,7 +326,7 @@ type PersistentVolumeSpec struct {
|
|||||||
MountOptions []string `json:"mountOptions,omitempty" protobuf:"bytes,7,opt,name=mountOptions"`
|
MountOptions []string `json:"mountOptions,omitempty" protobuf:"bytes,7,opt,name=mountOptions"`
|
||||||
// volumeMode defines if a volume is intended to be used with a formatted filesystem
|
// volumeMode defines if a volume is intended to be used with a formatted filesystem
|
||||||
// or to remain in raw block state. Value of Filesystem is implied when not included in spec.
|
// or to remain in raw block state. Value of Filesystem is implied when not included in spec.
|
||||||
// This is an alpha feature and may change in the future.
|
// This is a beta feature.
|
||||||
// +optional
|
// +optional
|
||||||
VolumeMode *PersistentVolumeMode `json:"volumeMode,omitempty" protobuf:"bytes,8,opt,name=volumeMode,casttype=PersistentVolumeMode"`
|
VolumeMode *PersistentVolumeMode `json:"volumeMode,omitempty" protobuf:"bytes,8,opt,name=volumeMode,casttype=PersistentVolumeMode"`
|
||||||
// NodeAffinity defines constraints that limit what nodes this volume can be accessed from.
|
// NodeAffinity defines constraints that limit what nodes this volume can be accessed from.
|
||||||
@@ -455,7 +455,7 @@ type PersistentVolumeClaimSpec struct {
|
|||||||
StorageClassName *string `json:"storageClassName,omitempty" protobuf:"bytes,5,opt,name=storageClassName"`
|
StorageClassName *string `json:"storageClassName,omitempty" protobuf:"bytes,5,opt,name=storageClassName"`
|
||||||
// volumeMode defines what type of volume is required by the claim.
|
// volumeMode defines what type of volume is required by the claim.
|
||||||
// Value of Filesystem is implied when not included in claim spec.
|
// Value of Filesystem is implied when not included in claim spec.
|
||||||
// This is an alpha feature and may change in the future.
|
// This is a beta feature.
|
||||||
// +optional
|
// +optional
|
||||||
VolumeMode *PersistentVolumeMode `json:"volumeMode,omitempty" protobuf:"bytes,6,opt,name=volumeMode,casttype=PersistentVolumeMode"`
|
VolumeMode *PersistentVolumeMode `json:"volumeMode,omitempty" protobuf:"bytes,6,opt,name=volumeMode,casttype=PersistentVolumeMode"`
|
||||||
// This field requires the VolumeSnapshotDataSource alpha feature gate to be
|
// This field requires the VolumeSnapshotDataSource alpha feature gate to be
|
||||||
@@ -636,6 +636,30 @@ type GlusterfsVolumeSource struct {
|
|||||||
ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"`
|
ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Represents a Glusterfs mount that lasts the lifetime of a pod.
|
||||||
|
// Glusterfs volumes do not support ownership management or SELinux relabeling.
|
||||||
|
type GlusterfsPersistentVolumeSource struct {
|
||||||
|
// EndpointsName is the endpoint name that details Glusterfs topology.
|
||||||
|
// More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod
|
||||||
|
EndpointsName string `json:"endpoints" protobuf:"bytes,1,opt,name=endpoints"`
|
||||||
|
|
||||||
|
// Path is the Glusterfs volume path.
|
||||||
|
// More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod
|
||||||
|
Path string `json:"path" protobuf:"bytes,2,opt,name=path"`
|
||||||
|
|
||||||
|
// ReadOnly here will force the Glusterfs volume to be mounted with read-only permissions.
|
||||||
|
// Defaults to false.
|
||||||
|
// More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod
|
||||||
|
// +optional
|
||||||
|
ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"`
|
||||||
|
|
||||||
|
// EndpointsNamespace is the namespace that contains Glusterfs endpoint.
|
||||||
|
// If this field is empty, the EndpointNamespace defaults to the same namespace as the bound PVC.
|
||||||
|
// More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod
|
||||||
|
// +optional
|
||||||
|
EndpointsNamespace *string `json:"endpointsNamespace,omitempty" protobuf:"bytes,4,opt,name=endpointsNamespace"`
|
||||||
|
}
|
||||||
|
|
||||||
// Represents a Rados Block Device mount that lasts the lifetime of a pod.
|
// Represents a Rados Block Device mount that lasts the lifetime of a pod.
|
||||||
// RBD volumes support ownership management and SELinux relabeling.
|
// RBD volumes support ownership management and SELinux relabeling.
|
||||||
type RBDVolumeSource struct {
|
type RBDVolumeSource struct {
|
||||||
@@ -2090,7 +2114,7 @@ type Container struct {
|
|||||||
// +patchStrategy=merge
|
// +patchStrategy=merge
|
||||||
VolumeMounts []VolumeMount `json:"volumeMounts,omitempty" patchStrategy:"merge" patchMergeKey:"mountPath" protobuf:"bytes,9,rep,name=volumeMounts"`
|
VolumeMounts []VolumeMount `json:"volumeMounts,omitempty" patchStrategy:"merge" patchMergeKey:"mountPath" protobuf:"bytes,9,rep,name=volumeMounts"`
|
||||||
// volumeDevices is the list of block devices to be used by the container.
|
// volumeDevices is the list of block devices to be used by the container.
|
||||||
// This is an alpha feature and may change in the future.
|
// This is a beta feature.
|
||||||
// +patchMergeKey=devicePath
|
// +patchMergeKey=devicePath
|
||||||
// +patchStrategy=merge
|
// +patchStrategy=merge
|
||||||
// +optional
|
// +optional
|
||||||
@@ -3285,8 +3309,8 @@ type ReplicationControllerCondition struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// +genclient
|
// +genclient
|
||||||
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/extensions/v1beta1.Scale
|
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale
|
||||||
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/extensions/v1beta1.Scale,result=k8s.io/api/extensions/v1beta1.Scale
|
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
// ReplicationController represents the configuration of a replication controller.
|
// ReplicationController represents the configuration of a replication controller.
|
||||||
|
|||||||
+15
-3
@@ -321,7 +321,7 @@ var map_Container = map[string]string{
|
|||||||
"env": "List of environment variables to set in the container. Cannot be updated.",
|
"env": "List of environment variables to set in the container. Cannot be updated.",
|
||||||
"resources": "Compute Resources required by this container. Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
|
"resources": "Compute Resources required by this container. Cannot be updated. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
|
||||||
"volumeMounts": "Pod volumes to mount into the container's filesystem. Cannot be updated.",
|
"volumeMounts": "Pod volumes to mount into the container's filesystem. Cannot be updated.",
|
||||||
"volumeDevices": "volumeDevices is the list of block devices to be used by the container. This is an alpha feature and may change in the future.",
|
"volumeDevices": "volumeDevices is the list of block devices to be used by the container. This is a beta feature.",
|
||||||
"livenessProbe": "Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
|
"livenessProbe": "Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
|
||||||
"readinessProbe": "Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
|
"readinessProbe": "Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes",
|
||||||
"lifecycle": "Actions that the management system should take in response to container lifecycle events. Cannot be updated.",
|
"lifecycle": "Actions that the management system should take in response to container lifecycle events. Cannot be updated.",
|
||||||
@@ -695,6 +695,18 @@ func (GitRepoVolumeSource) SwaggerDoc() map[string]string {
|
|||||||
return map_GitRepoVolumeSource
|
return map_GitRepoVolumeSource
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var map_GlusterfsPersistentVolumeSource = map[string]string{
|
||||||
|
"": "Represents a Glusterfs mount that lasts the lifetime of a pod. Glusterfs volumes do not support ownership management or SELinux relabeling.",
|
||||||
|
"endpoints": "EndpointsName is the endpoint name that details Glusterfs topology. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod",
|
||||||
|
"path": "Path is the Glusterfs volume path. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod",
|
||||||
|
"readOnly": "ReadOnly here will force the Glusterfs volume to be mounted with read-only permissions. Defaults to false. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod",
|
||||||
|
"endpointsNamespace": "EndpointsNamespace is the namespace that contains Glusterfs endpoint. If this field is empty, the EndpointNamespace defaults to the same namespace as the bound PVC. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (GlusterfsPersistentVolumeSource) SwaggerDoc() map[string]string {
|
||||||
|
return map_GlusterfsPersistentVolumeSource
|
||||||
|
}
|
||||||
|
|
||||||
var map_GlusterfsVolumeSource = map[string]string{
|
var map_GlusterfsVolumeSource = map[string]string{
|
||||||
"": "Represents a Glusterfs mount that lasts the lifetime of a pod. Glusterfs volumes do not support ownership management or SELinux relabeling.",
|
"": "Represents a Glusterfs mount that lasts the lifetime of a pod. Glusterfs volumes do not support ownership management or SELinux relabeling.",
|
||||||
"endpoints": "EndpointsName is the endpoint name that details Glusterfs topology. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod",
|
"endpoints": "EndpointsName is the endpoint name that details Glusterfs topology. More info: https://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod",
|
||||||
@@ -1210,7 +1222,7 @@ var map_PersistentVolumeClaimSpec = map[string]string{
|
|||||||
"resources": "Resources represents the minimum resources the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources",
|
"resources": "Resources represents the minimum resources the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources",
|
||||||
"volumeName": "VolumeName is the binding reference to the PersistentVolume backing this claim.",
|
"volumeName": "VolumeName is the binding reference to the PersistentVolume backing this claim.",
|
||||||
"storageClassName": "Name of the StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1",
|
"storageClassName": "Name of the StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1",
|
||||||
"volumeMode": "volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec. This is an alpha feature and may change in the future.",
|
"volumeMode": "volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec. This is a beta feature.",
|
||||||
"dataSource": "This field requires the VolumeSnapshotDataSource alpha feature gate to be enabled and currently VolumeSnapshot is the only supported data source. If the provisioner can support VolumeSnapshot data source, it will create a new volume and data will be restored to the volume at the same time. If the provisioner does not support VolumeSnapshot data source, volume will not be created and the failure will be reported as an event. In the future, we plan to support more data source types and the behavior of the provisioner may change.",
|
"dataSource": "This field requires the VolumeSnapshotDataSource alpha feature gate to be enabled and currently VolumeSnapshot is the only supported data source. If the provisioner can support VolumeSnapshot data source, it will create a new volume and data will be restored to the volume at the same time. If the provisioner does not support VolumeSnapshot data source, volume will not be created and the failure will be reported as an event. In the future, we plan to support more data source types and the behavior of the provisioner may change.",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1288,7 +1300,7 @@ var map_PersistentVolumeSpec = map[string]string{
|
|||||||
"persistentVolumeReclaimPolicy": "What happens to a persistent volume when released from its claim. Valid options are Retain (default for manually created PersistentVolumes), Delete (default for dynamically provisioned PersistentVolumes), and Recycle (deprecated). Recycle must be supported by the volume plugin underlying this PersistentVolume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming",
|
"persistentVolumeReclaimPolicy": "What happens to a persistent volume when released from its claim. Valid options are Retain (default for manually created PersistentVolumes), Delete (default for dynamically provisioned PersistentVolumes), and Recycle (deprecated). Recycle must be supported by the volume plugin underlying this PersistentVolume. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming",
|
||||||
"storageClassName": "Name of StorageClass to which this persistent volume belongs. Empty value means that this volume does not belong to any StorageClass.",
|
"storageClassName": "Name of StorageClass to which this persistent volume belongs. Empty value means that this volume does not belong to any StorageClass.",
|
||||||
"mountOptions": "A list of mount options, e.g. [\"ro\", \"soft\"]. Not validated - mount will simply fail if one is invalid. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options",
|
"mountOptions": "A list of mount options, e.g. [\"ro\", \"soft\"]. Not validated - mount will simply fail if one is invalid. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options",
|
||||||
"volumeMode": "volumeMode defines if a volume is intended to be used with a formatted filesystem or to remain in raw block state. Value of Filesystem is implied when not included in spec. This is an alpha feature and may change in the future.",
|
"volumeMode": "volumeMode defines if a volume is intended to be used with a formatted filesystem or to remain in raw block state. Value of Filesystem is implied when not included in spec. This is a beta feature.",
|
||||||
"nodeAffinity": "NodeAffinity defines constraints that limit what nodes this volume can be accessed from. This field influences the scheduling of pods that use this volume.",
|
"nodeAffinity": "NodeAffinity defines constraints that limit what nodes this volume can be accessed from. This field influences the scheduling of pods that use this volume.",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+23
-2
@@ -1498,6 +1498,27 @@ func (in *GitRepoVolumeSource) DeepCopy() *GitRepoVolumeSource {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *GlusterfsPersistentVolumeSource) DeepCopyInto(out *GlusterfsPersistentVolumeSource) {
|
||||||
|
*out = *in
|
||||||
|
if in.EndpointsNamespace != nil {
|
||||||
|
in, out := &in.EndpointsNamespace, &out.EndpointsNamespace
|
||||||
|
*out = new(string)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlusterfsPersistentVolumeSource.
|
||||||
|
func (in *GlusterfsPersistentVolumeSource) DeepCopy() *GlusterfsPersistentVolumeSource {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(GlusterfsPersistentVolumeSource)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *GlusterfsVolumeSource) DeepCopyInto(out *GlusterfsVolumeSource) {
|
func (in *GlusterfsVolumeSource) DeepCopyInto(out *GlusterfsVolumeSource) {
|
||||||
*out = *in
|
*out = *in
|
||||||
@@ -2806,8 +2827,8 @@ func (in *PersistentVolumeSource) DeepCopyInto(out *PersistentVolumeSource) {
|
|||||||
}
|
}
|
||||||
if in.Glusterfs != nil {
|
if in.Glusterfs != nil {
|
||||||
in, out := &in.Glusterfs, &out.Glusterfs
|
in, out := &in.Glusterfs, &out.Glusterfs
|
||||||
*out = new(GlusterfsVolumeSource)
|
*out = new(GlusterfsPersistentVolumeSource)
|
||||||
**out = **in
|
(*in).DeepCopyInto(*out)
|
||||||
}
|
}
|
||||||
if in.NFS != nil {
|
if in.NFS != nil {
|
||||||
in, out := &in.NFS, &out.NFS
|
in, out := &in.NFS, &out.NFS
|
||||||
|
|||||||
-2
@@ -49,8 +49,6 @@ type ScaleStatus struct {
|
|||||||
TargetSelector string `json:"targetSelector,omitempty" protobuf:"bytes,3,opt,name=targetSelector"`
|
TargetSelector string `json:"targetSelector,omitempty" protobuf:"bytes,3,opt,name=targetSelector"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +genclient
|
|
||||||
// +genclient:noVerbs
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
// represents a scaling request for a resource.
|
// represents a scaling request for a resource.
|
||||||
|
|||||||
+1327
-42
File diff suppressed because it is too large
Load Diff
+96
@@ -88,3 +88,99 @@ message StorageClassList {
|
|||||||
repeated StorageClass items = 2;
|
repeated StorageClass items = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VolumeAttachment captures the intent to attach or detach the specified volume
|
||||||
|
// to/from the specified node.
|
||||||
|
//
|
||||||
|
// VolumeAttachment objects are non-namespaced.
|
||||||
|
message VolumeAttachment {
|
||||||
|
// Standard object metadata.
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||||
|
// +optional
|
||||||
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||||
|
|
||||||
|
// Specification of the desired attach/detach volume behavior.
|
||||||
|
// Populated by the Kubernetes system.
|
||||||
|
optional VolumeAttachmentSpec spec = 2;
|
||||||
|
|
||||||
|
// Status of the VolumeAttachment request.
|
||||||
|
// Populated by the entity completing the attach or detach
|
||||||
|
// operation, i.e. the external-attacher.
|
||||||
|
// +optional
|
||||||
|
optional VolumeAttachmentStatus status = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// VolumeAttachmentList is a collection of VolumeAttachment objects.
|
||||||
|
message VolumeAttachmentList {
|
||||||
|
// Standard list metadata
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||||
|
// +optional
|
||||||
|
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
|
||||||
|
|
||||||
|
// Items is the list of VolumeAttachments
|
||||||
|
repeated VolumeAttachment items = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// VolumeAttachmentSource represents a volume that should be attached.
|
||||||
|
// Right now only PersistenVolumes can be attached via external attacher,
|
||||||
|
// in future we may allow also inline volumes in pods.
|
||||||
|
// Exactly one member can be set.
|
||||||
|
message VolumeAttachmentSource {
|
||||||
|
// Name of the persistent volume to attach.
|
||||||
|
// +optional
|
||||||
|
optional string persistentVolumeName = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// VolumeAttachmentSpec is the specification of a VolumeAttachment request.
|
||||||
|
message VolumeAttachmentSpec {
|
||||||
|
// Attacher indicates the name of the volume driver that MUST handle this
|
||||||
|
// request. This is the name returned by GetPluginName().
|
||||||
|
optional string attacher = 1;
|
||||||
|
|
||||||
|
// Source represents the volume that should be attached.
|
||||||
|
optional VolumeAttachmentSource source = 2;
|
||||||
|
|
||||||
|
// The node that the volume should be attached to.
|
||||||
|
optional string nodeName = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// VolumeAttachmentStatus is the status of a VolumeAttachment request.
|
||||||
|
message VolumeAttachmentStatus {
|
||||||
|
// Indicates the volume is successfully attached.
|
||||||
|
// This field must only be set by the entity completing the attach
|
||||||
|
// operation, i.e. the external-attacher.
|
||||||
|
optional bool attached = 1;
|
||||||
|
|
||||||
|
// Upon successful attach, this field is populated with any
|
||||||
|
// information returned by the attach operation that must be passed
|
||||||
|
// into subsequent WaitForAttach or Mount calls.
|
||||||
|
// This field must only be set by the entity completing the attach
|
||||||
|
// operation, i.e. the external-attacher.
|
||||||
|
// +optional
|
||||||
|
map<string, string> attachmentMetadata = 2;
|
||||||
|
|
||||||
|
// The last error encountered during attach operation, if any.
|
||||||
|
// This field must only be set by the entity completing the attach
|
||||||
|
// operation, i.e. the external-attacher.
|
||||||
|
// +optional
|
||||||
|
optional VolumeError attachError = 3;
|
||||||
|
|
||||||
|
// The last error encountered during detach operation, if any.
|
||||||
|
// This field must only be set by the entity completing the detach
|
||||||
|
// operation, i.e. the external-attacher.
|
||||||
|
// +optional
|
||||||
|
optional VolumeError detachError = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// VolumeError captures an error encountered during a volume operation.
|
||||||
|
message VolumeError {
|
||||||
|
// Time the error was encountered.
|
||||||
|
// +optional
|
||||||
|
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
|
||||||
|
// information.
|
||||||
|
// +optional
|
||||||
|
optional string message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
+3
@@ -46,6 +46,9 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
|||||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
&StorageClass{},
|
&StorageClass{},
|
||||||
&StorageClassList{},
|
&StorageClassList{},
|
||||||
|
|
||||||
|
&VolumeAttachment{},
|
||||||
|
&VolumeAttachmentList{},
|
||||||
)
|
)
|
||||||
|
|
||||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
|
|||||||
+107
@@ -102,3 +102,110 @@ const (
|
|||||||
// binding will occur during Pod scheduing.
|
// binding will occur during Pod scheduing.
|
||||||
VolumeBindingWaitForFirstConsumer VolumeBindingMode = "WaitForFirstConsumer"
|
VolumeBindingWaitForFirstConsumer VolumeBindingMode = "WaitForFirstConsumer"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// +genclient
|
||||||
|
// +genclient:nonNamespaced
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// VolumeAttachment captures the intent to attach or detach the specified volume
|
||||||
|
// to/from the specified node.
|
||||||
|
//
|
||||||
|
// VolumeAttachment objects are non-namespaced.
|
||||||
|
type VolumeAttachment struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
|
||||||
|
// Standard object metadata.
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||||
|
// +optional
|
||||||
|
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||||
|
|
||||||
|
// Specification of the desired attach/detach volume behavior.
|
||||||
|
// Populated by the Kubernetes system.
|
||||||
|
Spec VolumeAttachmentSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
|
||||||
|
|
||||||
|
// Status of the VolumeAttachment request.
|
||||||
|
// Populated by the entity completing the attach or detach
|
||||||
|
// operation, i.e. the external-attacher.
|
||||||
|
// +optional
|
||||||
|
Status VolumeAttachmentStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// VolumeAttachmentList is a collection of VolumeAttachment objects.
|
||||||
|
type VolumeAttachmentList struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
// Standard list metadata
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||||
|
// +optional
|
||||||
|
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||||
|
|
||||||
|
// Items is the list of VolumeAttachments
|
||||||
|
Items []VolumeAttachment `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// VolumeAttachmentSpec is the specification of a VolumeAttachment request.
|
||||||
|
type VolumeAttachmentSpec struct {
|
||||||
|
// Attacher indicates the name of the volume driver that MUST handle this
|
||||||
|
// request. This is the name returned by GetPluginName().
|
||||||
|
Attacher string `json:"attacher" protobuf:"bytes,1,opt,name=attacher"`
|
||||||
|
|
||||||
|
// Source represents the volume that should be attached.
|
||||||
|
Source VolumeAttachmentSource `json:"source" protobuf:"bytes,2,opt,name=source"`
|
||||||
|
|
||||||
|
// The node that the volume should be attached to.
|
||||||
|
NodeName string `json:"nodeName" protobuf:"bytes,3,opt,name=nodeName"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// VolumeAttachmentSource represents a volume that should be attached.
|
||||||
|
// Right now only PersistenVolumes can be attached via external attacher,
|
||||||
|
// in future we may allow also inline volumes in pods.
|
||||||
|
// Exactly one member can be set.
|
||||||
|
type VolumeAttachmentSource struct {
|
||||||
|
// Name of the persistent volume to attach.
|
||||||
|
// +optional
|
||||||
|
PersistentVolumeName *string `json:"persistentVolumeName,omitempty" protobuf:"bytes,1,opt,name=persistentVolumeName"`
|
||||||
|
|
||||||
|
// Placeholder for *VolumeSource to accommodate inline volumes in pods.
|
||||||
|
}
|
||||||
|
|
||||||
|
// VolumeAttachmentStatus is the status of a VolumeAttachment request.
|
||||||
|
type VolumeAttachmentStatus struct {
|
||||||
|
// Indicates the volume is successfully attached.
|
||||||
|
// This field must only be set by the entity completing the attach
|
||||||
|
// operation, i.e. the external-attacher.
|
||||||
|
Attached bool `json:"attached" protobuf:"varint,1,opt,name=attached"`
|
||||||
|
|
||||||
|
// Upon successful attach, this field is populated with any
|
||||||
|
// information returned by the attach operation that must be passed
|
||||||
|
// into subsequent WaitForAttach or Mount calls.
|
||||||
|
// This field must only be set by the entity completing the attach
|
||||||
|
// operation, i.e. the external-attacher.
|
||||||
|
// +optional
|
||||||
|
AttachmentMetadata map[string]string `json:"attachmentMetadata,omitempty" protobuf:"bytes,2,rep,name=attachmentMetadata"`
|
||||||
|
|
||||||
|
// The last error encountered during attach operation, if any.
|
||||||
|
// This field must only be set by the entity completing the attach
|
||||||
|
// operation, i.e. the external-attacher.
|
||||||
|
// +optional
|
||||||
|
AttachError *VolumeError `json:"attachError,omitempty" protobuf:"bytes,3,opt,name=attachError,casttype=VolumeError"`
|
||||||
|
|
||||||
|
// The last error encountered during detach operation, if any.
|
||||||
|
// This field must only be set by the entity completing the detach
|
||||||
|
// operation, i.e. the external-attacher.
|
||||||
|
// +optional
|
||||||
|
DetachError *VolumeError `json:"detachError,omitempty" protobuf:"bytes,4,opt,name=detachError,casttype=VolumeError"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// VolumeError captures an error encountered during a volume operation.
|
||||||
|
type VolumeError struct {
|
||||||
|
// Time the error was encountered.
|
||||||
|
// +optional
|
||||||
|
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
|
||||||
|
// information.
|
||||||
|
// +optional
|
||||||
|
Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"`
|
||||||
|
}
|
||||||
|
|||||||
+63
@@ -53,4 +53,67 @@ func (StorageClassList) SwaggerDoc() map[string]string {
|
|||||||
return map_StorageClassList
|
return map_StorageClassList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var map_VolumeAttachment = map[string]string{
|
||||||
|
"": "VolumeAttachment captures the intent to attach or detach the specified volume to/from the specified node.\n\nVolumeAttachment objects are non-namespaced.",
|
||||||
|
"metadata": "Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
|
||||||
|
"spec": "Specification of the desired attach/detach volume behavior. Populated by the Kubernetes system.",
|
||||||
|
"status": "Status of the VolumeAttachment request. Populated by the entity completing the attach or detach operation, i.e. the external-attacher.",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (VolumeAttachment) SwaggerDoc() map[string]string {
|
||||||
|
return map_VolumeAttachment
|
||||||
|
}
|
||||||
|
|
||||||
|
var map_VolumeAttachmentList = map[string]string{
|
||||||
|
"": "VolumeAttachmentList is a collection of VolumeAttachment objects.",
|
||||||
|
"metadata": "Standard list metadata More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
|
||||||
|
"items": "Items is the list of VolumeAttachments",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (VolumeAttachmentList) SwaggerDoc() map[string]string {
|
||||||
|
return map_VolumeAttachmentList
|
||||||
|
}
|
||||||
|
|
||||||
|
var map_VolumeAttachmentSource = map[string]string{
|
||||||
|
"": "VolumeAttachmentSource represents a volume that should be attached. Right now only PersistenVolumes can be attached via external attacher, in future we may allow also inline volumes in pods. Exactly one member can be set.",
|
||||||
|
"persistentVolumeName": "Name of the persistent volume to attach.",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (VolumeAttachmentSource) SwaggerDoc() map[string]string {
|
||||||
|
return map_VolumeAttachmentSource
|
||||||
|
}
|
||||||
|
|
||||||
|
var map_VolumeAttachmentSpec = map[string]string{
|
||||||
|
"": "VolumeAttachmentSpec is the specification of a VolumeAttachment request.",
|
||||||
|
"attacher": "Attacher indicates the name of the volume driver that MUST handle this request. This is the name returned by GetPluginName().",
|
||||||
|
"source": "Source represents the volume that should be attached.",
|
||||||
|
"nodeName": "The node that the volume should be attached to.",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (VolumeAttachmentSpec) SwaggerDoc() map[string]string {
|
||||||
|
return map_VolumeAttachmentSpec
|
||||||
|
}
|
||||||
|
|
||||||
|
var map_VolumeAttachmentStatus = map[string]string{
|
||||||
|
"": "VolumeAttachmentStatus is the status of a VolumeAttachment request.",
|
||||||
|
"attached": "Indicates the volume is successfully attached. This field must only be set by the entity completing the attach operation, i.e. the external-attacher.",
|
||||||
|
"attachmentMetadata": "Upon successful attach, this field is populated with any information returned by the attach operation that must be passed into subsequent WaitForAttach or Mount calls. This field must only be set by the entity completing the attach operation, i.e. the external-attacher.",
|
||||||
|
"attachError": "The last error encountered during attach operation, if any. This field must only be set by the entity completing the attach operation, i.e. the external-attacher.",
|
||||||
|
"detachError": "The last error encountered during detach operation, if any. This field must only be set by the entity completing the detach operation, i.e. the external-attacher.",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (VolumeAttachmentStatus) SwaggerDoc() map[string]string {
|
||||||
|
return map_VolumeAttachmentStatus
|
||||||
|
}
|
||||||
|
|
||||||
|
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.",
|
||||||
|
}
|
||||||
|
|
||||||
|
func (VolumeError) SwaggerDoc() map[string]string {
|
||||||
|
return map_VolumeError
|
||||||
|
}
|
||||||
|
|
||||||
// AUTO-GENERATED FUNCTIONS END HERE
|
// AUTO-GENERATED FUNCTIONS END HERE
|
||||||
|
|||||||
+149
@@ -117,3 +117,152 @@ func (in *StorageClassList) DeepCopyObject() runtime.Object {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *VolumeAttachment) DeepCopyInto(out *VolumeAttachment) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
|
in.Spec.DeepCopyInto(&out.Spec)
|
||||||
|
in.Status.DeepCopyInto(&out.Status)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeAttachment.
|
||||||
|
func (in *VolumeAttachment) DeepCopy() *VolumeAttachment {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(VolumeAttachment)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *VolumeAttachment) DeepCopyObject() runtime.Object {
|
||||||
|
if c := in.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *VolumeAttachmentList) DeepCopyInto(out *VolumeAttachmentList) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
out.ListMeta = in.ListMeta
|
||||||
|
if in.Items != nil {
|
||||||
|
in, out := &in.Items, &out.Items
|
||||||
|
*out = make([]VolumeAttachment, len(*in))
|
||||||
|
for i := range *in {
|
||||||
|
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeAttachmentList.
|
||||||
|
func (in *VolumeAttachmentList) DeepCopy() *VolumeAttachmentList {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(VolumeAttachmentList)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *VolumeAttachmentList) DeepCopyObject() runtime.Object {
|
||||||
|
if c := in.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *VolumeAttachmentSource) DeepCopyInto(out *VolumeAttachmentSource) {
|
||||||
|
*out = *in
|
||||||
|
if in.PersistentVolumeName != nil {
|
||||||
|
in, out := &in.PersistentVolumeName, &out.PersistentVolumeName
|
||||||
|
*out = new(string)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeAttachmentSource.
|
||||||
|
func (in *VolumeAttachmentSource) DeepCopy() *VolumeAttachmentSource {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(VolumeAttachmentSource)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *VolumeAttachmentSpec) DeepCopyInto(out *VolumeAttachmentSpec) {
|
||||||
|
*out = *in
|
||||||
|
in.Source.DeepCopyInto(&out.Source)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeAttachmentSpec.
|
||||||
|
func (in *VolumeAttachmentSpec) DeepCopy() *VolumeAttachmentSpec {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(VolumeAttachmentSpec)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *VolumeAttachmentStatus) DeepCopyInto(out *VolumeAttachmentStatus) {
|
||||||
|
*out = *in
|
||||||
|
if in.AttachmentMetadata != nil {
|
||||||
|
in, out := &in.AttachmentMetadata, &out.AttachmentMetadata
|
||||||
|
*out = make(map[string]string, len(*in))
|
||||||
|
for key, val := range *in {
|
||||||
|
(*out)[key] = val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if in.AttachError != nil {
|
||||||
|
in, out := &in.AttachError, &out.AttachError
|
||||||
|
*out = new(VolumeError)
|
||||||
|
(*in).DeepCopyInto(*out)
|
||||||
|
}
|
||||||
|
if in.DetachError != nil {
|
||||||
|
in, out := &in.DetachError, &out.DetachError
|
||||||
|
*out = new(VolumeError)
|
||||||
|
(*in).DeepCopyInto(*out)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeAttachmentStatus.
|
||||||
|
func (in *VolumeAttachmentStatus) DeepCopy() *VolumeAttachmentStatus {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(VolumeAttachmentStatus)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *VolumeError) DeepCopyInto(out *VolumeError) {
|
||||||
|
*out = *in
|
||||||
|
in.Time.DeepCopyInto(&out.Time)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeError.
|
||||||
|
func (in *VolumeError) DeepCopy() *VolumeError {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(VolumeError)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|||||||
+24
@@ -341,6 +341,17 @@ func NewTooManyRequestsError(message string) *StatusError {
|
|||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewRequestEntityTooLargeError returns an error indicating that the request
|
||||||
|
// entity was too large.
|
||||||
|
func NewRequestEntityTooLargeError(message string) *StatusError {
|
||||||
|
return &StatusError{metav1.Status{
|
||||||
|
Status: metav1.StatusFailure,
|
||||||
|
Code: http.StatusRequestEntityTooLarge,
|
||||||
|
Reason: metav1.StatusReasonRequestEntityTooLarge,
|
||||||
|
Message: fmt.Sprintf("Request entity too large: %s", message),
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
// NewGenericServerResponse returns a new error for server responses that are not in a recognizable form.
|
// NewGenericServerResponse returns a new error for server responses that are not in a recognizable form.
|
||||||
func NewGenericServerResponse(code int, verb string, qualifiedResource schema.GroupResource, name, serverMessage string, retryAfterSeconds int, isUnexpectedResponse bool) *StatusError {
|
func NewGenericServerResponse(code int, verb string, qualifiedResource schema.GroupResource, name, serverMessage string, retryAfterSeconds int, isUnexpectedResponse bool) *StatusError {
|
||||||
reason := metav1.StatusReasonUnknown
|
reason := metav1.StatusReasonUnknown
|
||||||
@@ -527,6 +538,19 @@ func IsTooManyRequests(err error) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsRequestEntityTooLargeError determines if err is an error which indicates
|
||||||
|
// the request entity is too large.
|
||||||
|
func IsRequestEntityTooLargeError(err error) bool {
|
||||||
|
if ReasonForError(err) == metav1.StatusReasonRequestEntityTooLarge {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
switch t := err.(type) {
|
||||||
|
case APIStatus:
|
||||||
|
return t.Status().Code == http.StatusRequestEntityTooLarge
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// IsUnexpectedServerError returns true if the server response was not in the expected API format,
|
// IsUnexpectedServerError returns true if the server response was not in the expected API format,
|
||||||
// and may be the result of another HTTP actor.
|
// and may be the result of another HTTP actor.
|
||||||
func IsUnexpectedServerError(err error) bool {
|
func IsUnexpectedServerError(err error) bool {
|
||||||
|
|||||||
+5
-5
@@ -20,7 +20,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
|
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
|
||||||
@@ -607,7 +607,7 @@ func (a genericAccessor) GetOwnerReferences() []metav1.OwnerReference {
|
|||||||
var ret []metav1.OwnerReference
|
var ret []metav1.OwnerReference
|
||||||
s := a.ownerReferences
|
s := a.ownerReferences
|
||||||
if s.Kind() != reflect.Ptr || s.Elem().Kind() != reflect.Slice {
|
if s.Kind() != reflect.Ptr || s.Elem().Kind() != reflect.Slice {
|
||||||
glog.Errorf("expect %v to be a pointer to slice", s)
|
klog.Errorf("expect %v to be a pointer to slice", s)
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
s = s.Elem()
|
s = s.Elem()
|
||||||
@@ -615,7 +615,7 @@ func (a genericAccessor) GetOwnerReferences() []metav1.OwnerReference {
|
|||||||
ret = make([]metav1.OwnerReference, s.Len(), s.Len()+1)
|
ret = make([]metav1.OwnerReference, s.Len(), s.Len()+1)
|
||||||
for i := 0; i < s.Len(); i++ {
|
for i := 0; i < s.Len(); i++ {
|
||||||
if err := extractFromOwnerReference(s.Index(i), &ret[i]); err != nil {
|
if err := extractFromOwnerReference(s.Index(i), &ret[i]); err != nil {
|
||||||
glog.Errorf("extractFromOwnerReference failed: %v", err)
|
klog.Errorf("extractFromOwnerReference failed: %v", err)
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -625,13 +625,13 @@ func (a genericAccessor) GetOwnerReferences() []metav1.OwnerReference {
|
|||||||
func (a genericAccessor) SetOwnerReferences(references []metav1.OwnerReference) {
|
func (a genericAccessor) SetOwnerReferences(references []metav1.OwnerReference) {
|
||||||
s := a.ownerReferences
|
s := a.ownerReferences
|
||||||
if s.Kind() != reflect.Ptr || s.Elem().Kind() != reflect.Slice {
|
if s.Kind() != reflect.Ptr || s.Elem().Kind() != reflect.Slice {
|
||||||
glog.Errorf("expect %v to be a pointer to slice", s)
|
klog.Errorf("expect %v to be a pointer to slice", s)
|
||||||
}
|
}
|
||||||
s = s.Elem()
|
s = s.Elem()
|
||||||
newReferences := reflect.MakeSlice(s.Type(), len(references), len(references))
|
newReferences := reflect.MakeSlice(s.Type(), len(references), len(references))
|
||||||
for i := 0; i < len(references); i++ {
|
for i := 0; i < len(references); i++ {
|
||||||
if err := setOwnerReference(newReferences.Index(i), &references[i]); err != nil {
|
if err := setOwnerReference(newReferences.Index(i), &references[i]); err != nil {
|
||||||
glog.Errorf("setOwnerReference failed: %v", err)
|
klog.Errorf("setOwnerReference failed: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -620,8 +620,8 @@ message ObjectMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// OwnerReference contains enough information to let you identify an owning
|
// OwnerReference contains enough information to let you identify an owning
|
||||||
// object. Currently, an owning object must be in the same namespace, so there
|
// object. An owning object must be in the same namespace as the dependent, or
|
||||||
// is no namespace field.
|
// be cluster-scoped, so there is no namespace field.
|
||||||
message OwnerReference {
|
message OwnerReference {
|
||||||
// API version of the referent.
|
// API version of the referent.
|
||||||
optional string apiVersion = 5;
|
optional string apiVersion = 5;
|
||||||
|
|||||||
+6
-2
@@ -286,8 +286,8 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// OwnerReference contains enough information to let you identify an owning
|
// OwnerReference contains enough information to let you identify an owning
|
||||||
// object. Currently, an owning object must be in the same namespace, so there
|
// object. An owning object must be in the same namespace as the dependent, or
|
||||||
// is no namespace field.
|
// be cluster-scoped, so there is no namespace field.
|
||||||
type OwnerReference struct {
|
type OwnerReference struct {
|
||||||
// API version of the referent.
|
// API version of the referent.
|
||||||
APIVersion string `json:"apiVersion" protobuf:"bytes,5,opt,name=apiVersion"`
|
APIVersion string `json:"apiVersion" protobuf:"bytes,5,opt,name=apiVersion"`
|
||||||
@@ -713,6 +713,10 @@ const (
|
|||||||
// Status code 406
|
// Status code 406
|
||||||
StatusReasonNotAcceptable StatusReason = "NotAcceptable"
|
StatusReasonNotAcceptable StatusReason = "NotAcceptable"
|
||||||
|
|
||||||
|
// StatusReasonRequestEntityTooLarge means that the request entity is too large.
|
||||||
|
// Status code 413
|
||||||
|
StatusReasonRequestEntityTooLarge StatusReason = "RequestEntityTooLarge"
|
||||||
|
|
||||||
// StatusReasonUnsupportedMediaType means that the content type sent by the client is not acceptable
|
// StatusReasonUnsupportedMediaType means that the content type sent by the client is not acceptable
|
||||||
// to the server - for instance, attempting to send protobuf for a resource that supports only json and yaml.
|
// to the server - for instance, attempting to send protobuf for a resource that supports only json and yaml.
|
||||||
// API calls that return UnsupportedMediaType can never succeed.
|
// API calls that return UnsupportedMediaType can never succeed.
|
||||||
|
|||||||
+1
-1
@@ -240,7 +240,7 @@ func (ObjectMeta) SwaggerDoc() map[string]string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var map_OwnerReference = map[string]string{
|
var map_OwnerReference = map[string]string{
|
||||||
"": "OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.",
|
"": "OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field.",
|
||||||
"apiVersion": "API version of the referent.",
|
"apiVersion": "API version of the referent.",
|
||||||
"kind": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
|
"kind": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
|
||||||
"name": "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names",
|
"name": "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names",
|
||||||
|
|||||||
+4
-4
@@ -23,10 +23,10 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"k8s.io/apimachinery/pkg/selection"
|
"k8s.io/apimachinery/pkg/selection"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
"k8s.io/apimachinery/pkg/util/validation"
|
"k8s.io/apimachinery/pkg/util/validation"
|
||||||
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Requirements is AND of all requirements.
|
// Requirements is AND of all requirements.
|
||||||
@@ -211,13 +211,13 @@ func (r *Requirement) Matches(ls Labels) bool {
|
|||||||
}
|
}
|
||||||
lsValue, err := strconv.ParseInt(ls.Get(r.key), 10, 64)
|
lsValue, err := strconv.ParseInt(ls.Get(r.key), 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.V(10).Infof("ParseInt failed for value %+v in label %+v, %+v", ls.Get(r.key), ls, err)
|
klog.V(10).Infof("ParseInt failed for value %+v in label %+v, %+v", ls.Get(r.key), ls, err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// There should be only one strValue in r.strValues, and can be converted to a integer.
|
// There should be only one strValue in r.strValues, and can be converted to a integer.
|
||||||
if len(r.strValues) != 1 {
|
if len(r.strValues) != 1 {
|
||||||
glog.V(10).Infof("Invalid values count %+v of requirement %#v, for 'Gt', 'Lt' operators, exactly one value is required", len(r.strValues), r)
|
klog.V(10).Infof("Invalid values count %+v of requirement %#v, for 'Gt', 'Lt' operators, exactly one value is required", len(r.strValues), r)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ func (r *Requirement) Matches(ls Labels) bool {
|
|||||||
for i := range r.strValues {
|
for i := range r.strValues {
|
||||||
rValue, err = strconv.ParseInt(r.strValues[i], 10, 64)
|
rValue, err = strconv.ParseInt(r.strValues[i], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.V(10).Infof("ParseInt failed for value %+v in requirement %#v, for 'Gt', 'Lt' operators, the value must be an integer", r.strValues[i], r)
|
klog.V(10).Infof("ParseInt failed for value %+v in requirement %#v, for 'Gt', 'Lt' operators, the value must be an integer", r.strValues[i], r)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+20
@@ -283,6 +283,7 @@ var _ GroupVersioner = multiGroupVersioner{}
|
|||||||
type multiGroupVersioner struct {
|
type multiGroupVersioner struct {
|
||||||
target schema.GroupVersion
|
target schema.GroupVersion
|
||||||
acceptedGroupKinds []schema.GroupKind
|
acceptedGroupKinds []schema.GroupKind
|
||||||
|
coerce bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMultiGroupVersioner returns the provided group version for any kind that matches one of the provided group kinds.
|
// NewMultiGroupVersioner returns the provided group version for any kind that matches one of the provided group kinds.
|
||||||
@@ -294,6 +295,22 @@ func NewMultiGroupVersioner(gv schema.GroupVersion, groupKinds ...schema.GroupKi
|
|||||||
return multiGroupVersioner{target: gv, acceptedGroupKinds: groupKinds}
|
return multiGroupVersioner{target: gv, acceptedGroupKinds: groupKinds}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewCoercingMultiGroupVersioner returns the provided group version for any incoming kind.
|
||||||
|
// Incoming kinds that match the provided groupKinds are preferred.
|
||||||
|
// Kind may be empty in the provided group kind, in which case any kind will match.
|
||||||
|
// Examples:
|
||||||
|
// gv=mygroup/__internal, groupKinds=mygroup/Foo, anothergroup/Bar
|
||||||
|
// KindForGroupVersionKinds(yetanother/v1/Baz, anothergroup/v1/Bar) -> mygroup/__internal/Bar (matched preferred group/kind)
|
||||||
|
//
|
||||||
|
// gv=mygroup/__internal, groupKinds=mygroup, anothergroup
|
||||||
|
// KindForGroupVersionKinds(yetanother/v1/Baz, anothergroup/v1/Bar) -> mygroup/__internal/Bar (matched preferred group)
|
||||||
|
//
|
||||||
|
// gv=mygroup/__internal, groupKinds=mygroup, anothergroup
|
||||||
|
// KindForGroupVersionKinds(yetanother/v1/Baz, yetanother/v1/Bar) -> mygroup/__internal/Baz (no preferred group/kind match, uses first kind in list)
|
||||||
|
func NewCoercingMultiGroupVersioner(gv schema.GroupVersion, groupKinds ...schema.GroupKind) GroupVersioner {
|
||||||
|
return multiGroupVersioner{target: gv, acceptedGroupKinds: groupKinds, coerce: true}
|
||||||
|
}
|
||||||
|
|
||||||
// KindForGroupVersionKinds returns the target group version if any kind matches any of the original group kinds. It will
|
// KindForGroupVersionKinds returns the target group version if any kind matches any of the original group kinds. It will
|
||||||
// use the originating kind where possible.
|
// use the originating kind where possible.
|
||||||
func (v multiGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersionKind) (schema.GroupVersionKind, bool) {
|
func (v multiGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersionKind) (schema.GroupVersionKind, bool) {
|
||||||
@@ -308,5 +325,8 @@ func (v multiGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersio
|
|||||||
return v.target.WithKind(src.Kind), true
|
return v.target.WithKind(src.Kind), true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if v.coerce && len(kinds) > 0 {
|
||||||
|
return v.target.WithKind(kinds[0].Kind), true
|
||||||
|
}
|
||||||
return schema.GroupVersionKind{}, false
|
return schema.GroupVersionKind{}, false
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -33,7 +33,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/util/json"
|
"k8s.io/apimachinery/pkg/util/json"
|
||||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UnstructuredConverter is an interface for converting between interface{}
|
// UnstructuredConverter is an interface for converting between interface{}
|
||||||
@@ -133,10 +133,10 @@ func (c *unstructuredConverter) FromUnstructured(u map[string]interface{}, obj i
|
|||||||
newObj := reflect.New(t.Elem()).Interface()
|
newObj := reflect.New(t.Elem()).Interface()
|
||||||
newErr := fromUnstructuredViaJSON(u, newObj)
|
newErr := fromUnstructuredViaJSON(u, newObj)
|
||||||
if (err != nil) != (newErr != nil) {
|
if (err != nil) != (newErr != nil) {
|
||||||
glog.Fatalf("FromUnstructured unexpected error for %v: error: %v", u, err)
|
klog.Fatalf("FromUnstructured unexpected error for %v: error: %v", u, err)
|
||||||
}
|
}
|
||||||
if err == nil && !c.comparison.DeepEqual(obj, newObj) {
|
if err == nil && !c.comparison.DeepEqual(obj, newObj) {
|
||||||
glog.Fatalf("FromUnstructured mismatch\nobj1: %#v\nobj2: %#v", obj, newObj)
|
klog.Fatalf("FromUnstructured mismatch\nobj1: %#v\nobj2: %#v", obj, newObj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
@@ -424,10 +424,10 @@ func (c *unstructuredConverter) ToUnstructured(obj interface{}) (map[string]inte
|
|||||||
newUnstr := map[string]interface{}{}
|
newUnstr := map[string]interface{}{}
|
||||||
newErr := toUnstructuredViaJSON(obj, &newUnstr)
|
newErr := toUnstructuredViaJSON(obj, &newUnstr)
|
||||||
if (err != nil) != (newErr != nil) {
|
if (err != nil) != (newErr != nil) {
|
||||||
glog.Fatalf("ToUnstructured unexpected error for %v: error: %v; newErr: %v", obj, err, newErr)
|
klog.Fatalf("ToUnstructured unexpected error for %v: error: %v; newErr: %v", obj, err, newErr)
|
||||||
}
|
}
|
||||||
if err == nil && !c.comparison.DeepEqual(u, newUnstr) {
|
if err == nil && !c.comparison.DeepEqual(u, newUnstr) {
|
||||||
glog.Fatalf("ToUnstructured mismatch\nobj1: %#v\nobj2: %#v", u, newUnstr)
|
klog.Fatalf("ToUnstructured mismatch\nobj1: %#v\nobj2: %#v", u, newUnstr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
+1
-1
@@ -22,9 +22,9 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/ghodss/yaml"
|
|
||||||
jsoniter "github.com/json-iterator/go"
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/modern-go/reflect2"
|
"github.com/modern-go/reflect2"
|
||||||
|
"sigs.k8s.io/yaml"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
|||||||
+1
-1
@@ -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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -25,8 +25,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/google/gofuzz"
|
"github.com/google/gofuzz"
|
||||||
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IntOrString is a type that can hold an int32 or a string. When used in
|
// IntOrString is a type that can hold an int32 or a string. When used in
|
||||||
@@ -58,7 +58,7 @@ const (
|
|||||||
// TODO: convert to (val int32)
|
// TODO: convert to (val int32)
|
||||||
func FromInt(val int) IntOrString {
|
func FromInt(val int) IntOrString {
|
||||||
if val > math.MaxInt32 || val < math.MinInt32 {
|
if val > math.MaxInt32 || val < math.MinInt32 {
|
||||||
glog.Errorf("value: %d overflows int32\n%s\n", val, debug.Stack())
|
klog.Errorf("value: %d overflows int32\n%s\n", val, debug.Stack())
|
||||||
}
|
}
|
||||||
return IntOrString{Type: Int, IntVal: int32(val)}
|
return IntOrString{Type: Int, IntVal: int32(val)}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/ghodss/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PreconditionFunc asserts that an incompatible change is not present within a patch.
|
// PreconditionFunc asserts that an incompatible change is not present within a patch.
|
||||||
|
|||||||
+4
-4
@@ -31,8 +31,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"golang.org/x/net/http2"
|
"golang.org/x/net/http2"
|
||||||
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// JoinPreservingTrailingSlash does a path.Join of the specified elements,
|
// JoinPreservingTrailingSlash does a path.Join of the specified elements,
|
||||||
@@ -107,10 +107,10 @@ func SetTransportDefaults(t *http.Transport) *http.Transport {
|
|||||||
t = SetOldTransportDefaults(t)
|
t = SetOldTransportDefaults(t)
|
||||||
// Allow clients to disable http2 if needed.
|
// Allow clients to disable http2 if needed.
|
||||||
if s := os.Getenv("DISABLE_HTTP2"); len(s) > 0 {
|
if s := os.Getenv("DISABLE_HTTP2"); len(s) > 0 {
|
||||||
glog.Infof("HTTP2 has been explicitly disabled")
|
klog.Infof("HTTP2 has been explicitly disabled")
|
||||||
} else {
|
} else {
|
||||||
if err := http2.ConfigureTransport(t); err != nil {
|
if err := http2.ConfigureTransport(t); err != nil {
|
||||||
glog.Warningf("Transport failed http2 configuration: %v", err)
|
klog.Warningf("Transport failed http2 configuration: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return t
|
return t
|
||||||
@@ -368,7 +368,7 @@ redirectLoop:
|
|||||||
resp, err := http.ReadResponse(respReader, nil)
|
resp, err := http.ReadResponse(respReader, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Unable to read the backend response; let the client handle it.
|
// Unable to read the backend response; let the client handle it.
|
||||||
glog.Warningf("Error reading backend response: %v", err)
|
klog.Warningf("Error reading backend response: %v", err)
|
||||||
break redirectLoop
|
break redirectLoop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+19
-19
@@ -26,7 +26,7 @@ import (
|
|||||||
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AddressFamily uint
|
type AddressFamily uint
|
||||||
@@ -193,7 +193,7 @@ func isInterfaceUp(intf *net.Interface) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if intf.Flags&net.FlagUp != 0 {
|
if intf.Flags&net.FlagUp != 0 {
|
||||||
glog.V(4).Infof("Interface %v is up", intf.Name)
|
klog.V(4).Infof("Interface %v is up", intf.Name)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@@ -208,20 +208,20 @@ func isLoopbackOrPointToPoint(intf *net.Interface) bool {
|
|||||||
func getMatchingGlobalIP(addrs []net.Addr, family AddressFamily) (net.IP, error) {
|
func getMatchingGlobalIP(addrs []net.Addr, family AddressFamily) (net.IP, error) {
|
||||||
if len(addrs) > 0 {
|
if len(addrs) > 0 {
|
||||||
for i := range addrs {
|
for i := range addrs {
|
||||||
glog.V(4).Infof("Checking addr %s.", addrs[i].String())
|
klog.V(4).Infof("Checking addr %s.", addrs[i].String())
|
||||||
ip, _, err := net.ParseCIDR(addrs[i].String())
|
ip, _, err := net.ParseCIDR(addrs[i].String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if memberOf(ip, family) {
|
if memberOf(ip, family) {
|
||||||
if ip.IsGlobalUnicast() {
|
if ip.IsGlobalUnicast() {
|
||||||
glog.V(4).Infof("IP found %v", ip)
|
klog.V(4).Infof("IP found %v", ip)
|
||||||
return ip, nil
|
return ip, nil
|
||||||
} else {
|
} else {
|
||||||
glog.V(4).Infof("Non-global unicast address found %v", ip)
|
klog.V(4).Infof("Non-global unicast address found %v", ip)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
glog.V(4).Infof("%v is not an IPv%d address", ip, int(family))
|
klog.V(4).Infof("%v is not an IPv%d address", ip, int(family))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -241,13 +241,13 @@ func getIPFromInterface(intfName string, forFamily AddressFamily, nw networkInte
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
glog.V(4).Infof("Interface %q has %d addresses :%v.", intfName, len(addrs), addrs)
|
klog.V(4).Infof("Interface %q has %d addresses :%v.", intfName, len(addrs), addrs)
|
||||||
matchingIP, err := getMatchingGlobalIP(addrs, forFamily)
|
matchingIP, err := getMatchingGlobalIP(addrs, forFamily)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if matchingIP != nil {
|
if matchingIP != nil {
|
||||||
glog.V(4).Infof("Found valid IPv%d address %v for interface %q.", int(forFamily), matchingIP, intfName)
|
klog.V(4).Infof("Found valid IPv%d address %v for interface %q.", int(forFamily), matchingIP, intfName)
|
||||||
return matchingIP, nil
|
return matchingIP, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,14 +275,14 @@ func chooseIPFromHostInterfaces(nw networkInterfacer) (net.IP, error) {
|
|||||||
return nil, fmt.Errorf("no interfaces found on host.")
|
return nil, fmt.Errorf("no interfaces found on host.")
|
||||||
}
|
}
|
||||||
for _, family := range []AddressFamily{familyIPv4, familyIPv6} {
|
for _, family := range []AddressFamily{familyIPv4, familyIPv6} {
|
||||||
glog.V(4).Infof("Looking for system interface with a global IPv%d address", uint(family))
|
klog.V(4).Infof("Looking for system interface with a global IPv%d address", uint(family))
|
||||||
for _, intf := range intfs {
|
for _, intf := range intfs {
|
||||||
if !isInterfaceUp(&intf) {
|
if !isInterfaceUp(&intf) {
|
||||||
glog.V(4).Infof("Skipping: down interface %q", intf.Name)
|
klog.V(4).Infof("Skipping: down interface %q", intf.Name)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if isLoopbackOrPointToPoint(&intf) {
|
if isLoopbackOrPointToPoint(&intf) {
|
||||||
glog.V(4).Infof("Skipping: LB or P2P interface %q", intf.Name)
|
klog.V(4).Infof("Skipping: LB or P2P interface %q", intf.Name)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
addrs, err := nw.Addrs(&intf)
|
addrs, err := nw.Addrs(&intf)
|
||||||
@@ -290,7 +290,7 @@ func chooseIPFromHostInterfaces(nw networkInterfacer) (net.IP, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if len(addrs) == 0 {
|
if len(addrs) == 0 {
|
||||||
glog.V(4).Infof("Skipping: no addresses on interface %q", intf.Name)
|
klog.V(4).Infof("Skipping: no addresses on interface %q", intf.Name)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
@@ -299,15 +299,15 @@ func chooseIPFromHostInterfaces(nw networkInterfacer) (net.IP, error) {
|
|||||||
return nil, fmt.Errorf("Unable to parse CIDR for interface %q: %s", intf.Name, err)
|
return nil, fmt.Errorf("Unable to parse CIDR for interface %q: %s", intf.Name, err)
|
||||||
}
|
}
|
||||||
if !memberOf(ip, family) {
|
if !memberOf(ip, family) {
|
||||||
glog.V(4).Infof("Skipping: no address family match for %q on interface %q.", ip, intf.Name)
|
klog.V(4).Infof("Skipping: no address family match for %q on interface %q.", ip, intf.Name)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// TODO: Decide if should open up to allow IPv6 LLAs in future.
|
// TODO: Decide if should open up to allow IPv6 LLAs in future.
|
||||||
if !ip.IsGlobalUnicast() {
|
if !ip.IsGlobalUnicast() {
|
||||||
glog.V(4).Infof("Skipping: non-global address %q on interface %q.", ip, intf.Name)
|
klog.V(4).Infof("Skipping: non-global address %q on interface %q.", ip, intf.Name)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
glog.V(4).Infof("Found global unicast address %q on interface %q.", ip, intf.Name)
|
klog.V(4).Infof("Found global unicast address %q on interface %q.", ip, intf.Name)
|
||||||
return ip, nil
|
return ip, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -381,23 +381,23 @@ func getAllDefaultRoutes() ([]Route, error) {
|
|||||||
// an IPv4 IP, and then will look at each IPv6 route for an IPv6 IP.
|
// an IPv4 IP, and then will look at each IPv6 route for an IPv6 IP.
|
||||||
func chooseHostInterfaceFromRoute(routes []Route, nw networkInterfacer) (net.IP, error) {
|
func chooseHostInterfaceFromRoute(routes []Route, nw networkInterfacer) (net.IP, error) {
|
||||||
for _, family := range []AddressFamily{familyIPv4, familyIPv6} {
|
for _, family := range []AddressFamily{familyIPv4, familyIPv6} {
|
||||||
glog.V(4).Infof("Looking for default routes with IPv%d addresses", uint(family))
|
klog.V(4).Infof("Looking for default routes with IPv%d addresses", uint(family))
|
||||||
for _, route := range routes {
|
for _, route := range routes {
|
||||||
if route.Family != family {
|
if route.Family != family {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
glog.V(4).Infof("Default route transits interface %q", route.Interface)
|
klog.V(4).Infof("Default route transits interface %q", route.Interface)
|
||||||
finalIP, err := getIPFromInterface(route.Interface, family, nw)
|
finalIP, err := getIPFromInterface(route.Interface, family, nw)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if finalIP != nil {
|
if finalIP != nil {
|
||||||
glog.V(4).Infof("Found active IP %v ", finalIP)
|
klog.V(4).Infof("Found active IP %v ", finalIP)
|
||||||
return finalIP, nil
|
return finalIP, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glog.V(4).Infof("No active IP found by looking at default routes")
|
klog.V(4).Infof("No active IP found by looking at default routes")
|
||||||
return nil, fmt.Errorf("unable to select an IP from default routes.")
|
return nil, fmt.Errorf("unable to select an IP from default routes.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-3
@@ -22,7 +22,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -63,7 +63,11 @@ func HandleCrash(additionalHandlers ...func(interface{})) {
|
|||||||
// logPanic logs the caller tree when a panic occurs.
|
// logPanic logs the caller tree when a panic occurs.
|
||||||
func logPanic(r interface{}) {
|
func logPanic(r interface{}) {
|
||||||
callers := getCallers(r)
|
callers := getCallers(r)
|
||||||
glog.Errorf("Observed a panic: %#v (%v)\n%v", r, r, callers)
|
if _, ok := r.(string); ok {
|
||||||
|
klog.Errorf("Observed a panic: %s\n%v", r, callers)
|
||||||
|
} else {
|
||||||
|
klog.Errorf("Observed a panic: %#v (%v)\n%v", r, r, callers)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCallers(r interface{}) string {
|
func getCallers(r interface{}) string {
|
||||||
@@ -111,7 +115,7 @@ func HandleError(err error) {
|
|||||||
|
|
||||||
// logError prints an error with the call stack of the location it was reported
|
// logError prints an error with the call stack of the location it was reported
|
||||||
func logError(err error) {
|
func logError(err error) {
|
||||||
glog.ErrorDepth(2, err)
|
klog.ErrorDepth(2, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
type rudimentaryErrorBackoff struct {
|
type rudimentaryErrorBackoff struct {
|
||||||
|
|||||||
+5
-5
@@ -26,8 +26,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
"github.com/ghodss/yaml"
|
"k8s.io/klog"
|
||||||
"github.com/golang/glog"
|
"sigs.k8s.io/yaml"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ToJSON converts a single YAML document into a JSON document
|
// ToJSON converts a single YAML document into a JSON document
|
||||||
@@ -217,11 +217,11 @@ func (d *YAMLOrJSONDecoder) Decode(into interface{}) error {
|
|||||||
if d.decoder == nil {
|
if d.decoder == nil {
|
||||||
buffer, origData, isJSON := GuessJSONStream(d.r, d.bufferSize)
|
buffer, origData, isJSON := GuessJSONStream(d.r, d.bufferSize)
|
||||||
if isJSON {
|
if isJSON {
|
||||||
glog.V(4).Infof("decoding stream as JSON")
|
klog.V(4).Infof("decoding stream as JSON")
|
||||||
d.decoder = json.NewDecoder(buffer)
|
d.decoder = json.NewDecoder(buffer)
|
||||||
d.rawData = origData
|
d.rawData = origData
|
||||||
} else {
|
} else {
|
||||||
glog.V(4).Infof("decoding stream as YAML")
|
klog.V(4).Infof("decoding stream as YAML")
|
||||||
d.decoder = NewYAMLToJSONDecoder(buffer)
|
d.decoder = NewYAMLToJSONDecoder(buffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,7 +230,7 @@ func (d *YAMLOrJSONDecoder) Decode(into interface{}) error {
|
|||||||
if syntax, ok := err.(*json.SyntaxError); ok {
|
if syntax, ok := err.(*json.SyntaxError); ok {
|
||||||
data, readErr := ioutil.ReadAll(jsonDecoder.Buffered())
|
data, readErr := ioutil.ReadAll(jsonDecoder.Buffered())
|
||||||
if readErr != nil {
|
if readErr != nil {
|
||||||
glog.V(4).Infof("reading stream failed: %v", readErr)
|
klog.V(4).Infof("reading stream failed: %v", readErr)
|
||||||
}
|
}
|
||||||
js := string(data)
|
js := string(data)
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -20,10 +20,10 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/net"
|
"k8s.io/apimachinery/pkg/util/net"
|
||||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Decoder allows StreamWatcher to watch any stream for which a Decoder can be written.
|
// Decoder allows StreamWatcher to watch any stream for which a Decoder can be written.
|
||||||
@@ -100,13 +100,13 @@ func (sw *StreamWatcher) receive() {
|
|||||||
case io.EOF:
|
case io.EOF:
|
||||||
// watch closed normally
|
// watch closed normally
|
||||||
case io.ErrUnexpectedEOF:
|
case io.ErrUnexpectedEOF:
|
||||||
glog.V(1).Infof("Unexpected EOF during watch stream event decoding: %v", err)
|
klog.V(1).Infof("Unexpected EOF during watch stream event decoding: %v", err)
|
||||||
default:
|
default:
|
||||||
msg := "Unable to decode an event from the watch stream: %v"
|
msg := "Unable to decode an event from the watch stream: %v"
|
||||||
if net.IsProbableEOF(err) {
|
if net.IsProbableEOF(err) {
|
||||||
glog.V(5).Infof(msg, err)
|
klog.V(5).Infof(msg, err)
|
||||||
} else {
|
} else {
|
||||||
glog.Errorf(msg, err)
|
klog.Errorf(msg, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|||||||
+3
-3
@@ -20,7 +20,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"k8s.io/klog"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
@@ -106,7 +106,7 @@ func (f *FakeWatcher) Stop() {
|
|||||||
f.Lock()
|
f.Lock()
|
||||||
defer f.Unlock()
|
defer f.Unlock()
|
||||||
if !f.Stopped {
|
if !f.Stopped {
|
||||||
glog.V(4).Infof("Stopping fake watcher.")
|
klog.V(4).Infof("Stopping fake watcher.")
|
||||||
close(f.result)
|
close(f.result)
|
||||||
f.Stopped = true
|
f.Stopped = true
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ func (f *RaceFreeFakeWatcher) Stop() {
|
|||||||
f.Lock()
|
f.Lock()
|
||||||
defer f.Unlock()
|
defer f.Unlock()
|
||||||
if !f.Stopped {
|
if !f.Stopped {
|
||||||
glog.V(4).Infof("Stopping fake watcher.")
|
klog.V(4).Infof("Stopping fake watcher.")
|
||||||
close(f.result)
|
close(f.result)
|
||||||
f.Stopped = true
|
f.Stopped = true
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-9
@@ -25,8 +25,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/googleapis/gnostic/OpenAPIv2"
|
"github.com/googleapis/gnostic/OpenAPIv2"
|
||||||
|
"k8s.io/klog"
|
||||||
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
@@ -67,23 +67,23 @@ func (d *CachedDiscoveryClient) ServerResourcesForGroupVersion(groupVersion stri
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
cachedResources := &metav1.APIResourceList{}
|
cachedResources := &metav1.APIResourceList{}
|
||||||
if err := runtime.DecodeInto(scheme.Codecs.UniversalDecoder(), cachedBytes, cachedResources); err == nil {
|
if err := runtime.DecodeInto(scheme.Codecs.UniversalDecoder(), cachedBytes, cachedResources); err == nil {
|
||||||
glog.V(10).Infof("returning cached discovery info from %v", filename)
|
klog.V(10).Infof("returning cached discovery info from %v", filename)
|
||||||
return cachedResources, nil
|
return cachedResources, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
liveResources, err := d.delegate.ServerResourcesForGroupVersion(groupVersion)
|
liveResources, err := d.delegate.ServerResourcesForGroupVersion(groupVersion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.V(3).Infof("skipped caching discovery info due to %v", err)
|
klog.V(3).Infof("skipped caching discovery info due to %v", err)
|
||||||
return liveResources, err
|
return liveResources, err
|
||||||
}
|
}
|
||||||
if liveResources == nil || len(liveResources.APIResources) == 0 {
|
if liveResources == nil || len(liveResources.APIResources) == 0 {
|
||||||
glog.V(3).Infof("skipped caching discovery info, no resources found")
|
klog.V(3).Infof("skipped caching discovery info, no resources found")
|
||||||
return liveResources, err
|
return liveResources, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := d.writeCachedFile(filename, liveResources); err != nil {
|
if err := d.writeCachedFile(filename, liveResources); err != nil {
|
||||||
glog.V(1).Infof("failed to write cache to %v due to %v", filename, err)
|
klog.V(1).Infof("failed to write cache to %v due to %v", filename, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return liveResources, nil
|
return liveResources, nil
|
||||||
@@ -103,23 +103,23 @@ func (d *CachedDiscoveryClient) ServerGroups() (*metav1.APIGroupList, error) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
cachedGroups := &metav1.APIGroupList{}
|
cachedGroups := &metav1.APIGroupList{}
|
||||||
if err := runtime.DecodeInto(scheme.Codecs.UniversalDecoder(), cachedBytes, cachedGroups); err == nil {
|
if err := runtime.DecodeInto(scheme.Codecs.UniversalDecoder(), cachedBytes, cachedGroups); err == nil {
|
||||||
glog.V(10).Infof("returning cached discovery info from %v", filename)
|
klog.V(10).Infof("returning cached discovery info from %v", filename)
|
||||||
return cachedGroups, nil
|
return cachedGroups, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
liveGroups, err := d.delegate.ServerGroups()
|
liveGroups, err := d.delegate.ServerGroups()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.V(3).Infof("skipped caching discovery info due to %v", err)
|
klog.V(3).Infof("skipped caching discovery info due to %v", err)
|
||||||
return liveGroups, err
|
return liveGroups, err
|
||||||
}
|
}
|
||||||
if liveGroups == nil || len(liveGroups.Groups) == 0 {
|
if liveGroups == nil || len(liveGroups.Groups) == 0 {
|
||||||
glog.V(3).Infof("skipped caching discovery info, no groups found")
|
klog.V(3).Infof("skipped caching discovery info, no groups found")
|
||||||
return liveGroups, err
|
return liveGroups, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := d.writeCachedFile(filename, liveGroups); err != nil {
|
if err := d.writeCachedFile(filename, liveGroups); err != nil {
|
||||||
glog.V(1).Infof("failed to write cache to %v due to %v", filename, err)
|
klog.V(1).Infof("failed to write cache to %v due to %v", filename, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return liveGroups, nil
|
return liveGroups, nil
|
||||||
|
|||||||
+2
-2
@@ -20,10 +20,10 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
"github.com/gregjones/httpcache"
|
"github.com/gregjones/httpcache"
|
||||||
"github.com/gregjones/httpcache/diskcache"
|
"github.com/gregjones/httpcache/diskcache"
|
||||||
"github.com/peterbourgon/diskv"
|
"github.com/peterbourgon/diskv"
|
||||||
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
type cacheRoundTripper struct {
|
type cacheRoundTripper struct {
|
||||||
@@ -55,7 +55,7 @@ func (rt *cacheRoundTripper) CancelRequest(req *http.Request) {
|
|||||||
if cr, ok := rt.rt.Transport.(canceler); ok {
|
if cr, ok := rt.rt.Transport.(canceler); ok {
|
||||||
cr.CancelRequest(req)
|
cr.CancelRequest(req)
|
||||||
} else {
|
} else {
|
||||||
glog.Errorf("CancelRequest not implemented by %T", rt.rt.Transport)
|
klog.Errorf("CancelRequest not implemented by %T", rt.rt.Transport)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
@@ -262,6 +262,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
|||||||
// Group=storage.k8s.io, Version=v1
|
// Group=storage.k8s.io, Version=v1
|
||||||
case storagev1.SchemeGroupVersion.WithResource("storageclasses"):
|
case storagev1.SchemeGroupVersion.WithResource("storageclasses"):
|
||||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().StorageClasses().Informer()}, nil
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().StorageClasses().Informer()}, nil
|
||||||
|
case storagev1.SchemeGroupVersion.WithResource("volumeattachments"):
|
||||||
|
return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().VolumeAttachments().Informer()}, nil
|
||||||
|
|
||||||
// Group=storage.k8s.io, Version=v1alpha1
|
// Group=storage.k8s.io, Version=v1alpha1
|
||||||
case storagev1alpha1.SchemeGroupVersion.WithResource("volumeattachments"):
|
case storagev1alpha1.SchemeGroupVersion.WithResource("volumeattachments"):
|
||||||
|
|||||||
+7
@@ -26,6 +26,8 @@ import (
|
|||||||
type Interface interface {
|
type Interface interface {
|
||||||
// StorageClasses returns a StorageClassInformer.
|
// StorageClasses returns a StorageClassInformer.
|
||||||
StorageClasses() StorageClassInformer
|
StorageClasses() StorageClassInformer
|
||||||
|
// VolumeAttachments returns a VolumeAttachmentInformer.
|
||||||
|
VolumeAttachments() VolumeAttachmentInformer
|
||||||
}
|
}
|
||||||
|
|
||||||
type version struct {
|
type version struct {
|
||||||
@@ -43,3 +45,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
|
|||||||
func (v *version) StorageClasses() StorageClassInformer {
|
func (v *version) StorageClasses() StorageClassInformer {
|
||||||
return &storageClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
return &storageClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VolumeAttachments returns a VolumeAttachmentInformer.
|
||||||
|
func (v *version) VolumeAttachments() VolumeAttachmentInformer {
|
||||||
|
return &volumeAttachmentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||||
|
}
|
||||||
|
|||||||
+88
@@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
Copyright The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Code generated by informer-gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
time "time"
|
||||||
|
|
||||||
|
storagev1 "k8s.io/api/storage/v1"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
|
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
|
||||||
|
kubernetes "k8s.io/client-go/kubernetes"
|
||||||
|
v1 "k8s.io/client-go/listers/storage/v1"
|
||||||
|
cache "k8s.io/client-go/tools/cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
// VolumeAttachmentInformer provides access to a shared informer and lister for
|
||||||
|
// VolumeAttachments.
|
||||||
|
type VolumeAttachmentInformer interface {
|
||||||
|
Informer() cache.SharedIndexInformer
|
||||||
|
Lister() v1.VolumeAttachmentLister
|
||||||
|
}
|
||||||
|
|
||||||
|
type volumeAttachmentInformer struct {
|
||||||
|
factory internalinterfaces.SharedInformerFactory
|
||||||
|
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type.
|
||||||
|
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||||
|
// one. This reduces memory footprint and number of connections to the server.
|
||||||
|
func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||||
|
return cache.NewSharedIndexInformer(
|
||||||
|
&cache.ListWatch{
|
||||||
|
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.StorageV1().VolumeAttachments().List(options)
|
||||||
|
},
|
||||||
|
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
if tweakListOptions != nil {
|
||||||
|
tweakListOptions(&options)
|
||||||
|
}
|
||||||
|
return client.StorageV1().VolumeAttachments().Watch(options)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
&storagev1.VolumeAttachment{},
|
||||||
|
resyncPeriod,
|
||||||
|
indexers,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||||
|
return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer {
|
||||||
|
return f.factory.InformerFor(&storagev1.VolumeAttachment{}, f.defaultInformer)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *volumeAttachmentInformer) Lister() v1.VolumeAttachmentLister {
|
||||||
|
return v1.NewVolumeAttachmentLister(f.Informer().GetIndexer())
|
||||||
|
}
|
||||||
Generated
Vendored
+17
@@ -19,6 +19,8 @@ limitations under the License.
|
|||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
|
v1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
@@ -72,10 +74,15 @@ func (c *initializerConfigurations) Get(name string, options v1.GetOptions) (res
|
|||||||
|
|
||||||
// List takes label and field selectors, and returns the list of InitializerConfigurations that match those selectors.
|
// List takes label and field selectors, and returns the list of InitializerConfigurations that match those selectors.
|
||||||
func (c *initializerConfigurations) List(opts v1.ListOptions) (result *v1alpha1.InitializerConfigurationList, err error) {
|
func (c *initializerConfigurations) List(opts v1.ListOptions) (result *v1alpha1.InitializerConfigurationList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
result = &v1alpha1.InitializerConfigurationList{}
|
result = &v1alpha1.InitializerConfigurationList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Resource("initializerconfigurations").
|
Resource("initializerconfigurations").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Do().
|
Do().
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
@@ -83,10 +90,15 @@ func (c *initializerConfigurations) List(opts v1.ListOptions) (result *v1alpha1.
|
|||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested initializerConfigurations.
|
// Watch returns a watch.Interface that watches the requested initializerConfigurations.
|
||||||
func (c *initializerConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
func (c *initializerConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
opts.Watch = true
|
opts.Watch = true
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Resource("initializerconfigurations").
|
Resource("initializerconfigurations").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,9 +137,14 @@ func (c *initializerConfigurations) Delete(name string, options *v1.DeleteOption
|
|||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *initializerConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
func (c *initializerConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Resource("initializerconfigurations").
|
Resource("initializerconfigurations").
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do().
|
Do().
|
||||||
Error()
|
Error()
|
||||||
|
|||||||
Generated
Vendored
+17
@@ -19,6 +19,8 @@ limitations under the License.
|
|||||||
package v1beta1
|
package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1beta1 "k8s.io/api/admissionregistration/v1beta1"
|
v1beta1 "k8s.io/api/admissionregistration/v1beta1"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
@@ -72,10 +74,15 @@ func (c *mutatingWebhookConfigurations) Get(name string, options v1.GetOptions)
|
|||||||
|
|
||||||
// List takes label and field selectors, and returns the list of MutatingWebhookConfigurations that match those selectors.
|
// List takes label and field selectors, and returns the list of MutatingWebhookConfigurations that match those selectors.
|
||||||
func (c *mutatingWebhookConfigurations) List(opts v1.ListOptions) (result *v1beta1.MutatingWebhookConfigurationList, err error) {
|
func (c *mutatingWebhookConfigurations) List(opts v1.ListOptions) (result *v1beta1.MutatingWebhookConfigurationList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
result = &v1beta1.MutatingWebhookConfigurationList{}
|
result = &v1beta1.MutatingWebhookConfigurationList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Resource("mutatingwebhookconfigurations").
|
Resource("mutatingwebhookconfigurations").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Do().
|
Do().
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
@@ -83,10 +90,15 @@ func (c *mutatingWebhookConfigurations) List(opts v1.ListOptions) (result *v1bet
|
|||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested mutatingWebhookConfigurations.
|
// Watch returns a watch.Interface that watches the requested mutatingWebhookConfigurations.
|
||||||
func (c *mutatingWebhookConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
func (c *mutatingWebhookConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
opts.Watch = true
|
opts.Watch = true
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Resource("mutatingwebhookconfigurations").
|
Resource("mutatingwebhookconfigurations").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,9 +137,14 @@ func (c *mutatingWebhookConfigurations) Delete(name string, options *v1.DeleteOp
|
|||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *mutatingWebhookConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
func (c *mutatingWebhookConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Resource("mutatingwebhookconfigurations").
|
Resource("mutatingwebhookconfigurations").
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do().
|
Do().
|
||||||
Error()
|
Error()
|
||||||
|
|||||||
Generated
Vendored
+17
@@ -19,6 +19,8 @@ limitations under the License.
|
|||||||
package v1beta1
|
package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1beta1 "k8s.io/api/admissionregistration/v1beta1"
|
v1beta1 "k8s.io/api/admissionregistration/v1beta1"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
@@ -72,10 +74,15 @@ func (c *validatingWebhookConfigurations) Get(name string, options v1.GetOptions
|
|||||||
|
|
||||||
// List takes label and field selectors, and returns the list of ValidatingWebhookConfigurations that match those selectors.
|
// List takes label and field selectors, and returns the list of ValidatingWebhookConfigurations that match those selectors.
|
||||||
func (c *validatingWebhookConfigurations) List(opts v1.ListOptions) (result *v1beta1.ValidatingWebhookConfigurationList, err error) {
|
func (c *validatingWebhookConfigurations) List(opts v1.ListOptions) (result *v1beta1.ValidatingWebhookConfigurationList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
result = &v1beta1.ValidatingWebhookConfigurationList{}
|
result = &v1beta1.ValidatingWebhookConfigurationList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Resource("validatingwebhookconfigurations").
|
Resource("validatingwebhookconfigurations").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Do().
|
Do().
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
@@ -83,10 +90,15 @@ func (c *validatingWebhookConfigurations) List(opts v1.ListOptions) (result *v1b
|
|||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested validatingWebhookConfigurations.
|
// Watch returns a watch.Interface that watches the requested validatingWebhookConfigurations.
|
||||||
func (c *validatingWebhookConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
func (c *validatingWebhookConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
opts.Watch = true
|
opts.Watch = true
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Resource("validatingwebhookconfigurations").
|
Resource("validatingwebhookconfigurations").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,9 +137,14 @@ func (c *validatingWebhookConfigurations) Delete(name string, options *v1.Delete
|
|||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *validatingWebhookConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
func (c *validatingWebhookConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Resource("validatingwebhookconfigurations").
|
Resource("validatingwebhookconfigurations").
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do().
|
Do().
|
||||||
Error()
|
Error()
|
||||||
|
|||||||
+17
@@ -19,6 +19,8 @@ limitations under the License.
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1 "k8s.io/api/apps/v1"
|
v1 "k8s.io/api/apps/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
@@ -75,11 +77,16 @@ func (c *controllerRevisions) Get(name string, options metav1.GetOptions) (resul
|
|||||||
|
|
||||||
// List takes label and field selectors, and returns the list of ControllerRevisions that match those selectors.
|
// List takes label and field selectors, and returns the list of ControllerRevisions that match those selectors.
|
||||||
func (c *controllerRevisions) List(opts metav1.ListOptions) (result *v1.ControllerRevisionList, err error) {
|
func (c *controllerRevisions) List(opts metav1.ListOptions) (result *v1.ControllerRevisionList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
result = &v1.ControllerRevisionList{}
|
result = &v1.ControllerRevisionList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("controllerrevisions").
|
Resource("controllerrevisions").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Do().
|
Do().
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
@@ -87,11 +94,16 @@ func (c *controllerRevisions) List(opts metav1.ListOptions) (result *v1.Controll
|
|||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested controllerRevisions.
|
// Watch returns a watch.Interface that watches the requested controllerRevisions.
|
||||||
func (c *controllerRevisions) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
func (c *controllerRevisions) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
opts.Watch = true
|
opts.Watch = true
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("controllerrevisions").
|
Resource("controllerrevisions").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,10 +145,15 @@ func (c *controllerRevisions) Delete(name string, options *metav1.DeleteOptions)
|
|||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *controllerRevisions) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
|
func (c *controllerRevisions) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("controllerrevisions").
|
Resource("controllerrevisions").
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do().
|
Do().
|
||||||
Error()
|
Error()
|
||||||
|
|||||||
+17
@@ -19,6 +19,8 @@ limitations under the License.
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1 "k8s.io/api/apps/v1"
|
v1 "k8s.io/api/apps/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
@@ -76,11 +78,16 @@ func (c *daemonSets) Get(name string, options metav1.GetOptions) (result *v1.Dae
|
|||||||
|
|
||||||
// List takes label and field selectors, and returns the list of DaemonSets that match those selectors.
|
// List takes label and field selectors, and returns the list of DaemonSets that match those selectors.
|
||||||
func (c *daemonSets) List(opts metav1.ListOptions) (result *v1.DaemonSetList, err error) {
|
func (c *daemonSets) List(opts metav1.ListOptions) (result *v1.DaemonSetList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
result = &v1.DaemonSetList{}
|
result = &v1.DaemonSetList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("daemonsets").
|
Resource("daemonsets").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Do().
|
Do().
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
@@ -88,11 +95,16 @@ func (c *daemonSets) List(opts metav1.ListOptions) (result *v1.DaemonSetList, er
|
|||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested daemonSets.
|
// Watch returns a watch.Interface that watches the requested daemonSets.
|
||||||
func (c *daemonSets) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
func (c *daemonSets) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
opts.Watch = true
|
opts.Watch = true
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("daemonsets").
|
Resource("daemonsets").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,10 +162,15 @@ func (c *daemonSets) Delete(name string, options *metav1.DeleteOptions) error {
|
|||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *daemonSets) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
|
func (c *daemonSets) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("daemonsets").
|
Resource("daemonsets").
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do().
|
Do().
|
||||||
Error()
|
Error()
|
||||||
|
|||||||
+49
@@ -19,7 +19,10 @@ limitations under the License.
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1 "k8s.io/api/apps/v1"
|
v1 "k8s.io/api/apps/v1"
|
||||||
|
autoscalingv1 "k8s.io/api/autoscaling/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
@@ -44,6 +47,9 @@ type DeploymentInterface interface {
|
|||||||
List(opts metav1.ListOptions) (*v1.DeploymentList, error)
|
List(opts metav1.ListOptions) (*v1.DeploymentList, error)
|
||||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Deployment, err error)
|
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.Deployment, err error)
|
||||||
|
GetScale(deploymentName string, options metav1.GetOptions) (*autoscalingv1.Scale, error)
|
||||||
|
UpdateScale(deploymentName string, scale *autoscalingv1.Scale) (*autoscalingv1.Scale, error)
|
||||||
|
|
||||||
DeploymentExpansion
|
DeploymentExpansion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,11 +82,16 @@ func (c *deployments) Get(name string, options metav1.GetOptions) (result *v1.De
|
|||||||
|
|
||||||
// List takes label and field selectors, and returns the list of Deployments that match those selectors.
|
// List takes label and field selectors, and returns the list of Deployments that match those selectors.
|
||||||
func (c *deployments) List(opts metav1.ListOptions) (result *v1.DeploymentList, err error) {
|
func (c *deployments) List(opts metav1.ListOptions) (result *v1.DeploymentList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
result = &v1.DeploymentList{}
|
result = &v1.DeploymentList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("deployments").
|
Resource("deployments").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Do().
|
Do().
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
@@ -88,11 +99,16 @@ func (c *deployments) List(opts metav1.ListOptions) (result *v1.DeploymentList,
|
|||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested deployments.
|
// Watch returns a watch.Interface that watches the requested deployments.
|
||||||
func (c *deployments) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
func (c *deployments) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
opts.Watch = true
|
opts.Watch = true
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("deployments").
|
Resource("deployments").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,10 +166,15 @@ func (c *deployments) Delete(name string, options *metav1.DeleteOptions) error {
|
|||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *deployments) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
|
func (c *deployments) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("deployments").
|
Resource("deployments").
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do().
|
Do().
|
||||||
Error()
|
Error()
|
||||||
@@ -172,3 +193,31 @@ func (c *deployments) Patch(name string, pt types.PatchType, data []byte, subres
|
|||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetScale takes name of the deployment, and returns the corresponding autoscalingv1.Scale object, and an error if there is any.
|
||||||
|
func (c *deployments) GetScale(deploymentName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
|
||||||
|
result = &autoscalingv1.Scale{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("deployments").
|
||||||
|
Name(deploymentName).
|
||||||
|
SubResource("scale").
|
||||||
|
VersionedParams(&options, scheme.ParameterCodec).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||||
|
func (c *deployments) UpdateScale(deploymentName string, scale *autoscalingv1.Scale) (result *autoscalingv1.Scale, err error) {
|
||||||
|
result = &autoscalingv1.Scale{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("deployments").
|
||||||
|
Name(deploymentName).
|
||||||
|
SubResource("scale").
|
||||||
|
Body(scale).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
+23
@@ -20,6 +20,7 @@ package fake
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
|
autoscalingv1 "k8s.io/api/autoscaling/v1"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
labels "k8s.io/apimachinery/pkg/labels"
|
labels "k8s.io/apimachinery/pkg/labels"
|
||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
@@ -138,3 +139,25 @@ func (c *FakeDeployments) Patch(name string, pt types.PatchType, data []byte, su
|
|||||||
}
|
}
|
||||||
return obj.(*appsv1.Deployment), err
|
return obj.(*appsv1.Deployment), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetScale takes name of the deployment, and returns the corresponding scale object, and an error if there is any.
|
||||||
|
func (c *FakeDeployments) GetScale(deploymentName string, options v1.GetOptions) (result *autoscalingv1.Scale, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewGetSubresourceAction(deploymentsResource, c.ns, "scale", deploymentName), &autoscalingv1.Scale{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*autoscalingv1.Scale), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||||
|
func (c *FakeDeployments) UpdateScale(deploymentName string, scale *autoscalingv1.Scale) (result *autoscalingv1.Scale, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewUpdateSubresourceAction(deploymentsResource, "scale", c.ns, scale), &autoscalingv1.Scale{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*autoscalingv1.Scale), err
|
||||||
|
}
|
||||||
|
|||||||
+23
@@ -20,6 +20,7 @@ package fake
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
|
autoscalingv1 "k8s.io/api/autoscaling/v1"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
labels "k8s.io/apimachinery/pkg/labels"
|
labels "k8s.io/apimachinery/pkg/labels"
|
||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
@@ -138,3 +139,25 @@ func (c *FakeReplicaSets) Patch(name string, pt types.PatchType, data []byte, su
|
|||||||
}
|
}
|
||||||
return obj.(*appsv1.ReplicaSet), err
|
return obj.(*appsv1.ReplicaSet), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetScale takes name of the replicaSet, and returns the corresponding scale object, and an error if there is any.
|
||||||
|
func (c *FakeReplicaSets) GetScale(replicaSetName string, options v1.GetOptions) (result *autoscalingv1.Scale, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewGetSubresourceAction(replicasetsResource, c.ns, "scale", replicaSetName), &autoscalingv1.Scale{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*autoscalingv1.Scale), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||||
|
func (c *FakeReplicaSets) UpdateScale(replicaSetName string, scale *autoscalingv1.Scale) (result *autoscalingv1.Scale, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewUpdateSubresourceAction(replicasetsResource, "scale", c.ns, scale), &autoscalingv1.Scale{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*autoscalingv1.Scale), err
|
||||||
|
}
|
||||||
|
|||||||
+23
@@ -20,6 +20,7 @@ package fake
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
|
autoscalingv1 "k8s.io/api/autoscaling/v1"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
labels "k8s.io/apimachinery/pkg/labels"
|
labels "k8s.io/apimachinery/pkg/labels"
|
||||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
@@ -138,3 +139,25 @@ func (c *FakeStatefulSets) Patch(name string, pt types.PatchType, data []byte, s
|
|||||||
}
|
}
|
||||||
return obj.(*appsv1.StatefulSet), err
|
return obj.(*appsv1.StatefulSet), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetScale takes name of the statefulSet, and returns the corresponding scale object, and an error if there is any.
|
||||||
|
func (c *FakeStatefulSets) GetScale(statefulSetName string, options v1.GetOptions) (result *autoscalingv1.Scale, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewGetSubresourceAction(statefulsetsResource, c.ns, "scale", statefulSetName), &autoscalingv1.Scale{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*autoscalingv1.Scale), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||||
|
func (c *FakeStatefulSets) UpdateScale(statefulSetName string, scale *autoscalingv1.Scale) (result *autoscalingv1.Scale, err error) {
|
||||||
|
obj, err := c.Fake.
|
||||||
|
Invokes(testing.NewUpdateSubresourceAction(statefulsetsResource, "scale", c.ns, scale), &autoscalingv1.Scale{})
|
||||||
|
|
||||||
|
if obj == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return obj.(*autoscalingv1.Scale), err
|
||||||
|
}
|
||||||
|
|||||||
+49
@@ -19,7 +19,10 @@ limitations under the License.
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1 "k8s.io/api/apps/v1"
|
v1 "k8s.io/api/apps/v1"
|
||||||
|
autoscalingv1 "k8s.io/api/autoscaling/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
@@ -44,6 +47,9 @@ type ReplicaSetInterface interface {
|
|||||||
List(opts metav1.ListOptions) (*v1.ReplicaSetList, error)
|
List(opts metav1.ListOptions) (*v1.ReplicaSetList, error)
|
||||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ReplicaSet, err error)
|
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ReplicaSet, err error)
|
||||||
|
GetScale(replicaSetName string, options metav1.GetOptions) (*autoscalingv1.Scale, error)
|
||||||
|
UpdateScale(replicaSetName string, scale *autoscalingv1.Scale) (*autoscalingv1.Scale, error)
|
||||||
|
|
||||||
ReplicaSetExpansion
|
ReplicaSetExpansion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,11 +82,16 @@ func (c *replicaSets) Get(name string, options metav1.GetOptions) (result *v1.Re
|
|||||||
|
|
||||||
// List takes label and field selectors, and returns the list of ReplicaSets that match those selectors.
|
// List takes label and field selectors, and returns the list of ReplicaSets that match those selectors.
|
||||||
func (c *replicaSets) List(opts metav1.ListOptions) (result *v1.ReplicaSetList, err error) {
|
func (c *replicaSets) List(opts metav1.ListOptions) (result *v1.ReplicaSetList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
result = &v1.ReplicaSetList{}
|
result = &v1.ReplicaSetList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("replicasets").
|
Resource("replicasets").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Do().
|
Do().
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
@@ -88,11 +99,16 @@ func (c *replicaSets) List(opts metav1.ListOptions) (result *v1.ReplicaSetList,
|
|||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested replicaSets.
|
// Watch returns a watch.Interface that watches the requested replicaSets.
|
||||||
func (c *replicaSets) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
func (c *replicaSets) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
opts.Watch = true
|
opts.Watch = true
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("replicasets").
|
Resource("replicasets").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,10 +166,15 @@ func (c *replicaSets) Delete(name string, options *metav1.DeleteOptions) error {
|
|||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *replicaSets) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
|
func (c *replicaSets) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("replicasets").
|
Resource("replicasets").
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do().
|
Do().
|
||||||
Error()
|
Error()
|
||||||
@@ -172,3 +193,31 @@ func (c *replicaSets) Patch(name string, pt types.PatchType, data []byte, subres
|
|||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetScale takes name of the replicaSet, and returns the corresponding autoscalingv1.Scale object, and an error if there is any.
|
||||||
|
func (c *replicaSets) GetScale(replicaSetName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
|
||||||
|
result = &autoscalingv1.Scale{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("replicasets").
|
||||||
|
Name(replicaSetName).
|
||||||
|
SubResource("scale").
|
||||||
|
VersionedParams(&options, scheme.ParameterCodec).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||||
|
func (c *replicaSets) UpdateScale(replicaSetName string, scale *autoscalingv1.Scale) (result *autoscalingv1.Scale, err error) {
|
||||||
|
result = &autoscalingv1.Scale{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("replicasets").
|
||||||
|
Name(replicaSetName).
|
||||||
|
SubResource("scale").
|
||||||
|
Body(scale).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
+49
@@ -19,7 +19,10 @@ limitations under the License.
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1 "k8s.io/api/apps/v1"
|
v1 "k8s.io/api/apps/v1"
|
||||||
|
autoscalingv1 "k8s.io/api/autoscaling/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
watch "k8s.io/apimachinery/pkg/watch"
|
watch "k8s.io/apimachinery/pkg/watch"
|
||||||
@@ -44,6 +47,9 @@ type StatefulSetInterface interface {
|
|||||||
List(opts metav1.ListOptions) (*v1.StatefulSetList, error)
|
List(opts metav1.ListOptions) (*v1.StatefulSetList, error)
|
||||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.StatefulSet, err error)
|
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.StatefulSet, err error)
|
||||||
|
GetScale(statefulSetName string, options metav1.GetOptions) (*autoscalingv1.Scale, error)
|
||||||
|
UpdateScale(statefulSetName string, scale *autoscalingv1.Scale) (*autoscalingv1.Scale, error)
|
||||||
|
|
||||||
StatefulSetExpansion
|
StatefulSetExpansion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,11 +82,16 @@ func (c *statefulSets) Get(name string, options metav1.GetOptions) (result *v1.S
|
|||||||
|
|
||||||
// List takes label and field selectors, and returns the list of StatefulSets that match those selectors.
|
// List takes label and field selectors, and returns the list of StatefulSets that match those selectors.
|
||||||
func (c *statefulSets) List(opts metav1.ListOptions) (result *v1.StatefulSetList, err error) {
|
func (c *statefulSets) List(opts metav1.ListOptions) (result *v1.StatefulSetList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
result = &v1.StatefulSetList{}
|
result = &v1.StatefulSetList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("statefulsets").
|
Resource("statefulsets").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Do().
|
Do().
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
@@ -88,11 +99,16 @@ func (c *statefulSets) List(opts metav1.ListOptions) (result *v1.StatefulSetList
|
|||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested statefulSets.
|
// Watch returns a watch.Interface that watches the requested statefulSets.
|
||||||
func (c *statefulSets) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
func (c *statefulSets) Watch(opts metav1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
opts.Watch = true
|
opts.Watch = true
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("statefulsets").
|
Resource("statefulsets").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,10 +166,15 @@ func (c *statefulSets) Delete(name string, options *metav1.DeleteOptions) error
|
|||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *statefulSets) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
|
func (c *statefulSets) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("statefulsets").
|
Resource("statefulsets").
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do().
|
Do().
|
||||||
Error()
|
Error()
|
||||||
@@ -172,3 +193,31 @@ func (c *statefulSets) Patch(name string, pt types.PatchType, data []byte, subre
|
|||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetScale takes name of the statefulSet, and returns the corresponding autoscalingv1.Scale object, and an error if there is any.
|
||||||
|
func (c *statefulSets) GetScale(statefulSetName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
|
||||||
|
result = &autoscalingv1.Scale{}
|
||||||
|
err = c.client.Get().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("statefulsets").
|
||||||
|
Name(statefulSetName).
|
||||||
|
SubResource("scale").
|
||||||
|
VersionedParams(&options, scheme.ParameterCodec).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||||
|
func (c *statefulSets) UpdateScale(statefulSetName string, scale *autoscalingv1.Scale) (result *autoscalingv1.Scale, err error) {
|
||||||
|
result = &autoscalingv1.Scale{}
|
||||||
|
err = c.client.Put().
|
||||||
|
Namespace(c.ns).
|
||||||
|
Resource("statefulsets").
|
||||||
|
Name(statefulSetName).
|
||||||
|
SubResource("scale").
|
||||||
|
Body(scale).
|
||||||
|
Do().
|
||||||
|
Into(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
-5
@@ -29,7 +29,6 @@ type AppsV1beta1Interface interface {
|
|||||||
RESTClient() rest.Interface
|
RESTClient() rest.Interface
|
||||||
ControllerRevisionsGetter
|
ControllerRevisionsGetter
|
||||||
DeploymentsGetter
|
DeploymentsGetter
|
||||||
ScalesGetter
|
|
||||||
StatefulSetsGetter
|
StatefulSetsGetter
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,10 +45,6 @@ func (c *AppsV1beta1Client) Deployments(namespace string) DeploymentInterface {
|
|||||||
return newDeployments(c, namespace)
|
return newDeployments(c, namespace)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *AppsV1beta1Client) Scales(namespace string) ScaleInterface {
|
|
||||||
return newScales(c, namespace)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *AppsV1beta1Client) StatefulSets(namespace string) StatefulSetInterface {
|
func (c *AppsV1beta1Client) StatefulSets(namespace string) StatefulSetInterface {
|
||||||
return newStatefulSets(c, namespace)
|
return newStatefulSets(c, namespace)
|
||||||
}
|
}
|
||||||
|
|||||||
+17
@@ -19,6 +19,8 @@ limitations under the License.
|
|||||||
package v1beta1
|
package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1beta1 "k8s.io/api/apps/v1beta1"
|
v1beta1 "k8s.io/api/apps/v1beta1"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
@@ -75,11 +77,16 @@ func (c *controllerRevisions) Get(name string, options v1.GetOptions) (result *v
|
|||||||
|
|
||||||
// List takes label and field selectors, and returns the list of ControllerRevisions that match those selectors.
|
// List takes label and field selectors, and returns the list of ControllerRevisions that match those selectors.
|
||||||
func (c *controllerRevisions) List(opts v1.ListOptions) (result *v1beta1.ControllerRevisionList, err error) {
|
func (c *controllerRevisions) List(opts v1.ListOptions) (result *v1beta1.ControllerRevisionList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
result = &v1beta1.ControllerRevisionList{}
|
result = &v1beta1.ControllerRevisionList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("controllerrevisions").
|
Resource("controllerrevisions").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Do().
|
Do().
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
@@ -87,11 +94,16 @@ func (c *controllerRevisions) List(opts v1.ListOptions) (result *v1beta1.Control
|
|||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested controllerRevisions.
|
// Watch returns a watch.Interface that watches the requested controllerRevisions.
|
||||||
func (c *controllerRevisions) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
func (c *controllerRevisions) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
opts.Watch = true
|
opts.Watch = true
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("controllerrevisions").
|
Resource("controllerrevisions").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,10 +145,15 @@ func (c *controllerRevisions) Delete(name string, options *v1.DeleteOptions) err
|
|||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *controllerRevisions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
func (c *controllerRevisions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("controllerrevisions").
|
Resource("controllerrevisions").
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do().
|
Do().
|
||||||
Error()
|
Error()
|
||||||
|
|||||||
+17
@@ -19,6 +19,8 @@ limitations under the License.
|
|||||||
package v1beta1
|
package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1beta1 "k8s.io/api/apps/v1beta1"
|
v1beta1 "k8s.io/api/apps/v1beta1"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
@@ -76,11 +78,16 @@ func (c *deployments) Get(name string, options v1.GetOptions) (result *v1beta1.D
|
|||||||
|
|
||||||
// List takes label and field selectors, and returns the list of Deployments that match those selectors.
|
// List takes label and field selectors, and returns the list of Deployments that match those selectors.
|
||||||
func (c *deployments) List(opts v1.ListOptions) (result *v1beta1.DeploymentList, err error) {
|
func (c *deployments) List(opts v1.ListOptions) (result *v1beta1.DeploymentList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
result = &v1beta1.DeploymentList{}
|
result = &v1beta1.DeploymentList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("deployments").
|
Resource("deployments").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Do().
|
Do().
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
@@ -88,11 +95,16 @@ func (c *deployments) List(opts v1.ListOptions) (result *v1beta1.DeploymentList,
|
|||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested deployments.
|
// Watch returns a watch.Interface that watches the requested deployments.
|
||||||
func (c *deployments) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
func (c *deployments) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
opts.Watch = true
|
opts.Watch = true
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("deployments").
|
Resource("deployments").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,10 +162,15 @@ func (c *deployments) Delete(name string, options *v1.DeleteOptions) error {
|
|||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *deployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
func (c *deployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("deployments").
|
Resource("deployments").
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do().
|
Do().
|
||||||
Error()
|
Error()
|
||||||
|
|||||||
-4
@@ -36,10 +36,6 @@ func (c *FakeAppsV1beta1) Deployments(namespace string) v1beta1.DeploymentInterf
|
|||||||
return &FakeDeployments{c, namespace}
|
return &FakeDeployments{c, namespace}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeAppsV1beta1) Scales(namespace string) v1beta1.ScaleInterface {
|
|
||||||
return &FakeScales{c, namespace}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeAppsV1beta1) StatefulSets(namespace string) v1beta1.StatefulSetInterface {
|
func (c *FakeAppsV1beta1) StatefulSets(namespace string) v1beta1.StatefulSetInterface {
|
||||||
return &FakeStatefulSets{c, namespace}
|
return &FakeStatefulSets{c, namespace}
|
||||||
}
|
}
|
||||||
|
|||||||
-25
@@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright The Kubernetes Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package fake
|
|
||||||
|
|
||||||
// FakeScales implements ScaleInterface
|
|
||||||
type FakeScales struct {
|
|
||||||
Fake *FakeAppsV1beta1
|
|
||||||
ns string
|
|
||||||
}
|
|
||||||
-2
@@ -22,6 +22,4 @@ type ControllerRevisionExpansion interface{}
|
|||||||
|
|
||||||
type DeploymentExpansion interface{}
|
type DeploymentExpansion interface{}
|
||||||
|
|
||||||
type ScaleExpansion interface{}
|
|
||||||
|
|
||||||
type StatefulSetExpansion interface{}
|
type StatefulSetExpansion interface{}
|
||||||
|
|||||||
-48
@@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright The Kubernetes Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by client-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
rest "k8s.io/client-go/rest"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ScalesGetter has a method to return a ScaleInterface.
|
|
||||||
// A group's client should implement this interface.
|
|
||||||
type ScalesGetter interface {
|
|
||||||
Scales(namespace string) ScaleInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
// ScaleInterface has methods to work with Scale resources.
|
|
||||||
type ScaleInterface interface {
|
|
||||||
ScaleExpansion
|
|
||||||
}
|
|
||||||
|
|
||||||
// scales implements ScaleInterface
|
|
||||||
type scales struct {
|
|
||||||
client rest.Interface
|
|
||||||
ns string
|
|
||||||
}
|
|
||||||
|
|
||||||
// newScales returns a Scales
|
|
||||||
func newScales(c *AppsV1beta1Client, namespace string) *scales {
|
|
||||||
return &scales{
|
|
||||||
client: c.RESTClient(),
|
|
||||||
ns: namespace,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+17
@@ -19,6 +19,8 @@ limitations under the License.
|
|||||||
package v1beta1
|
package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1beta1 "k8s.io/api/apps/v1beta1"
|
v1beta1 "k8s.io/api/apps/v1beta1"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
@@ -76,11 +78,16 @@ func (c *statefulSets) Get(name string, options v1.GetOptions) (result *v1beta1.
|
|||||||
|
|
||||||
// List takes label and field selectors, and returns the list of StatefulSets that match those selectors.
|
// List takes label and field selectors, and returns the list of StatefulSets that match those selectors.
|
||||||
func (c *statefulSets) List(opts v1.ListOptions) (result *v1beta1.StatefulSetList, err error) {
|
func (c *statefulSets) List(opts v1.ListOptions) (result *v1beta1.StatefulSetList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
result = &v1beta1.StatefulSetList{}
|
result = &v1beta1.StatefulSetList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("statefulsets").
|
Resource("statefulsets").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Do().
|
Do().
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
@@ -88,11 +95,16 @@ func (c *statefulSets) List(opts v1.ListOptions) (result *v1beta1.StatefulSetLis
|
|||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested statefulSets.
|
// Watch returns a watch.Interface that watches the requested statefulSets.
|
||||||
func (c *statefulSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
func (c *statefulSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
opts.Watch = true
|
opts.Watch = true
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("statefulsets").
|
Resource("statefulsets").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,10 +162,15 @@ func (c *statefulSets) Delete(name string, options *v1.DeleteOptions) error {
|
|||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *statefulSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
func (c *statefulSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("statefulsets").
|
Resource("statefulsets").
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do().
|
Do().
|
||||||
Error()
|
Error()
|
||||||
|
|||||||
-5
@@ -31,7 +31,6 @@ type AppsV1beta2Interface interface {
|
|||||||
DaemonSetsGetter
|
DaemonSetsGetter
|
||||||
DeploymentsGetter
|
DeploymentsGetter
|
||||||
ReplicaSetsGetter
|
ReplicaSetsGetter
|
||||||
ScalesGetter
|
|
||||||
StatefulSetsGetter
|
StatefulSetsGetter
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,10 +55,6 @@ func (c *AppsV1beta2Client) ReplicaSets(namespace string) ReplicaSetInterface {
|
|||||||
return newReplicaSets(c, namespace)
|
return newReplicaSets(c, namespace)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *AppsV1beta2Client) Scales(namespace string) ScaleInterface {
|
|
||||||
return newScales(c, namespace)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *AppsV1beta2Client) StatefulSets(namespace string) StatefulSetInterface {
|
func (c *AppsV1beta2Client) StatefulSets(namespace string) StatefulSetInterface {
|
||||||
return newStatefulSets(c, namespace)
|
return newStatefulSets(c, namespace)
|
||||||
}
|
}
|
||||||
|
|||||||
+17
@@ -19,6 +19,8 @@ limitations under the License.
|
|||||||
package v1beta2
|
package v1beta2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1beta2 "k8s.io/api/apps/v1beta2"
|
v1beta2 "k8s.io/api/apps/v1beta2"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
@@ -75,11 +77,16 @@ func (c *controllerRevisions) Get(name string, options v1.GetOptions) (result *v
|
|||||||
|
|
||||||
// List takes label and field selectors, and returns the list of ControllerRevisions that match those selectors.
|
// List takes label and field selectors, and returns the list of ControllerRevisions that match those selectors.
|
||||||
func (c *controllerRevisions) List(opts v1.ListOptions) (result *v1beta2.ControllerRevisionList, err error) {
|
func (c *controllerRevisions) List(opts v1.ListOptions) (result *v1beta2.ControllerRevisionList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
result = &v1beta2.ControllerRevisionList{}
|
result = &v1beta2.ControllerRevisionList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("controllerrevisions").
|
Resource("controllerrevisions").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Do().
|
Do().
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
@@ -87,11 +94,16 @@ func (c *controllerRevisions) List(opts v1.ListOptions) (result *v1beta2.Control
|
|||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested controllerRevisions.
|
// Watch returns a watch.Interface that watches the requested controllerRevisions.
|
||||||
func (c *controllerRevisions) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
func (c *controllerRevisions) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
opts.Watch = true
|
opts.Watch = true
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("controllerrevisions").
|
Resource("controllerrevisions").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,10 +145,15 @@ func (c *controllerRevisions) Delete(name string, options *v1.DeleteOptions) err
|
|||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *controllerRevisions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
func (c *controllerRevisions) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("controllerrevisions").
|
Resource("controllerrevisions").
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do().
|
Do().
|
||||||
Error()
|
Error()
|
||||||
|
|||||||
+17
@@ -19,6 +19,8 @@ limitations under the License.
|
|||||||
package v1beta2
|
package v1beta2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1beta2 "k8s.io/api/apps/v1beta2"
|
v1beta2 "k8s.io/api/apps/v1beta2"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
@@ -76,11 +78,16 @@ func (c *daemonSets) Get(name string, options v1.GetOptions) (result *v1beta2.Da
|
|||||||
|
|
||||||
// List takes label and field selectors, and returns the list of DaemonSets that match those selectors.
|
// List takes label and field selectors, and returns the list of DaemonSets that match those selectors.
|
||||||
func (c *daemonSets) List(opts v1.ListOptions) (result *v1beta2.DaemonSetList, err error) {
|
func (c *daemonSets) List(opts v1.ListOptions) (result *v1beta2.DaemonSetList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
result = &v1beta2.DaemonSetList{}
|
result = &v1beta2.DaemonSetList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("daemonsets").
|
Resource("daemonsets").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Do().
|
Do().
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
@@ -88,11 +95,16 @@ func (c *daemonSets) List(opts v1.ListOptions) (result *v1beta2.DaemonSetList, e
|
|||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested daemonSets.
|
// Watch returns a watch.Interface that watches the requested daemonSets.
|
||||||
func (c *daemonSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
func (c *daemonSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
opts.Watch = true
|
opts.Watch = true
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("daemonsets").
|
Resource("daemonsets").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,10 +162,15 @@ func (c *daemonSets) Delete(name string, options *v1.DeleteOptions) error {
|
|||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *daemonSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
func (c *daemonSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("daemonsets").
|
Resource("daemonsets").
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do().
|
Do().
|
||||||
Error()
|
Error()
|
||||||
|
|||||||
+17
@@ -19,6 +19,8 @@ limitations under the License.
|
|||||||
package v1beta2
|
package v1beta2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
v1beta2 "k8s.io/api/apps/v1beta2"
|
v1beta2 "k8s.io/api/apps/v1beta2"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
types "k8s.io/apimachinery/pkg/types"
|
types "k8s.io/apimachinery/pkg/types"
|
||||||
@@ -76,11 +78,16 @@ func (c *deployments) Get(name string, options v1.GetOptions) (result *v1beta2.D
|
|||||||
|
|
||||||
// List takes label and field selectors, and returns the list of Deployments that match those selectors.
|
// List takes label and field selectors, and returns the list of Deployments that match those selectors.
|
||||||
func (c *deployments) List(opts v1.ListOptions) (result *v1beta2.DeploymentList, err error) {
|
func (c *deployments) List(opts v1.ListOptions) (result *v1beta2.DeploymentList, err error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
result = &v1beta2.DeploymentList{}
|
result = &v1beta2.DeploymentList{}
|
||||||
err = c.client.Get().
|
err = c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("deployments").
|
Resource("deployments").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Do().
|
Do().
|
||||||
Into(result)
|
Into(result)
|
||||||
return
|
return
|
||||||
@@ -88,11 +95,16 @@ func (c *deployments) List(opts v1.ListOptions) (result *v1beta2.DeploymentList,
|
|||||||
|
|
||||||
// Watch returns a watch.Interface that watches the requested deployments.
|
// Watch returns a watch.Interface that watches the requested deployments.
|
||||||
func (c *deployments) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
func (c *deployments) Watch(opts v1.ListOptions) (watch.Interface, error) {
|
||||||
|
var timeout time.Duration
|
||||||
|
if opts.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
opts.Watch = true
|
opts.Watch = true
|
||||||
return c.client.Get().
|
return c.client.Get().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("deployments").
|
Resource("deployments").
|
||||||
VersionedParams(&opts, scheme.ParameterCodec).
|
VersionedParams(&opts, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,10 +162,15 @@ func (c *deployments) Delete(name string, options *v1.DeleteOptions) error {
|
|||||||
|
|
||||||
// DeleteCollection deletes a collection of objects.
|
// DeleteCollection deletes a collection of objects.
|
||||||
func (c *deployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
func (c *deployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
|
||||||
|
var timeout time.Duration
|
||||||
|
if listOptions.TimeoutSeconds != nil {
|
||||||
|
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
|
||||||
|
}
|
||||||
return c.client.Delete().
|
return c.client.Delete().
|
||||||
Namespace(c.ns).
|
Namespace(c.ns).
|
||||||
Resource("deployments").
|
Resource("deployments").
|
||||||
VersionedParams(&listOptions, scheme.ParameterCodec).
|
VersionedParams(&listOptions, scheme.ParameterCodec).
|
||||||
|
Timeout(timeout).
|
||||||
Body(options).
|
Body(options).
|
||||||
Do().
|
Do().
|
||||||
Error()
|
Error()
|
||||||
|
|||||||
-4
@@ -44,10 +44,6 @@ func (c *FakeAppsV1beta2) ReplicaSets(namespace string) v1beta2.ReplicaSetInterf
|
|||||||
return &FakeReplicaSets{c, namespace}
|
return &FakeReplicaSets{c, namespace}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FakeAppsV1beta2) Scales(namespace string) v1beta2.ScaleInterface {
|
|
||||||
return &FakeScales{c, namespace}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *FakeAppsV1beta2) StatefulSets(namespace string) v1beta2.StatefulSetInterface {
|
func (c *FakeAppsV1beta2) StatefulSets(namespace string) v1beta2.StatefulSetInterface {
|
||||||
return &FakeStatefulSets{c, namespace}
|
return &FakeStatefulSets{c, namespace}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user