Update godeps
This commit is contained in:
parent
a965f44f84
commit
73e22a50d2
453 changed files with 84778 additions and 70308 deletions
12
vendor/k8s.io/kubernetes/pkg/client/cache/delta_fifo.go
generated
vendored
12
vendor/k8s.io/kubernetes/pkg/client/cache/delta_fifo.go
generated
vendored
|
|
@ -522,6 +522,18 @@ func (f *DeltaFIFO) syncKey(key string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// If we are doing Resync() and there is already an event queued for that object,
|
||||
// we ignore the Resync for it. This is to avoid the race, in which the resync
|
||||
// comes with the previous value of object (since queueing an event for the object
|
||||
// doesn't trigger changing the underlying store <knownObjects>.
|
||||
id, err := f.KeyOf(obj)
|
||||
if err != nil {
|
||||
return KeyError{obj, err}
|
||||
}
|
||||
if len(f.items[id]) > 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := f.queueActionLocked(Sync, obj); err != nil {
|
||||
return fmt.Errorf("couldn't queue object: %v", err)
|
||||
}
|
||||
|
|
|
|||
94
vendor/k8s.io/kubernetes/pkg/client/cache/listers.go
generated
vendored
94
vendor/k8s.io/kubernetes/pkg/client/cache/listers.go
generated
vendored
|
|
@ -285,12 +285,12 @@ func (s *StoreToReplicationControllerLister) GetPodControllers(pod *api.Pod) (co
|
|||
|
||||
// StoreToDeploymentLister gives a store List and Exists methods. The store must contain only Deployments.
|
||||
type StoreToDeploymentLister struct {
|
||||
Store
|
||||
Indexer
|
||||
}
|
||||
|
||||
// Exists checks if the given deployment exists in the store.
|
||||
func (s *StoreToDeploymentLister) Exists(deployment *extensions.Deployment) (bool, error) {
|
||||
_, exists, err := s.Store.Get(deployment)
|
||||
_, exists, err := s.Indexer.Get(deployment)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
|
@ -300,7 +300,7 @@ func (s *StoreToDeploymentLister) Exists(deployment *extensions.Deployment) (boo
|
|||
// StoreToDeploymentLister lists all deployments in the store.
|
||||
// TODO: converge on the interface in pkg/client
|
||||
func (s *StoreToDeploymentLister) List() (deployments []extensions.Deployment, err error) {
|
||||
for _, c := range s.Store.List() {
|
||||
for _, c := range s.Indexer.List() {
|
||||
deployments = append(deployments, *(c.(*extensions.Deployment)))
|
||||
}
|
||||
return deployments, nil
|
||||
|
|
@ -308,20 +308,17 @@ func (s *StoreToDeploymentLister) List() (deployments []extensions.Deployment, e
|
|||
|
||||
// GetDeploymentsForReplicaSet returns a list of deployments managing a replica set. Returns an error only if no matching deployments are found.
|
||||
func (s *StoreToDeploymentLister) GetDeploymentsForReplicaSet(rs *extensions.ReplicaSet) (deployments []extensions.Deployment, err error) {
|
||||
var d extensions.Deployment
|
||||
|
||||
if len(rs.Labels) == 0 {
|
||||
err = fmt.Errorf("no deployments found for ReplicaSet %v because it has no labels", rs.Name)
|
||||
return
|
||||
}
|
||||
|
||||
// TODO: MODIFY THIS METHOD so that it checks for the podTemplateSpecHash label
|
||||
for _, m := range s.Store.List() {
|
||||
d = *m.(*extensions.Deployment)
|
||||
if d.Namespace != rs.Namespace {
|
||||
continue
|
||||
}
|
||||
|
||||
dList, err := s.Deployments(rs.Namespace).List(labels.Everything())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for _, d := range dList {
|
||||
selector, err := unversioned.LabelSelectorAsSelector(d.Spec.Selector)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid label selector: %v", err)
|
||||
|
|
@ -338,6 +335,81 @@ func (s *StoreToDeploymentLister) GetDeploymentsForReplicaSet(rs *extensions.Rep
|
|||
return
|
||||
}
|
||||
|
||||
type storeToDeploymentNamespacer struct {
|
||||
indexer Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// storeToDeploymentNamespacer lists deployments under its namespace in the store.
|
||||
func (s storeToDeploymentNamespacer) List(selector labels.Selector) (deployments []extensions.Deployment, err error) {
|
||||
if s.namespace == api.NamespaceAll {
|
||||
for _, m := range s.indexer.List() {
|
||||
d := *(m.(*extensions.Deployment))
|
||||
if selector.Matches(labels.Set(d.Labels)) {
|
||||
deployments = append(deployments, d)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
key := &extensions.Deployment{ObjectMeta: api.ObjectMeta{Namespace: s.namespace}}
|
||||
items, err := s.indexer.Index(NamespaceIndex, key)
|
||||
if err != nil {
|
||||
// Ignore error; do slow search without index.
|
||||
glog.Warningf("can not retrieve list of objects using index : %v", err)
|
||||
for _, m := range s.indexer.List() {
|
||||
d := *(m.(*extensions.Deployment))
|
||||
if s.namespace == d.Namespace && selector.Matches(labels.Set(d.Labels)) {
|
||||
deployments = append(deployments, d)
|
||||
}
|
||||
}
|
||||
return deployments, nil
|
||||
}
|
||||
for _, m := range items {
|
||||
d := *(m.(*extensions.Deployment))
|
||||
if selector.Matches(labels.Set(d.Labels)) {
|
||||
deployments = append(deployments, d)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (s *StoreToDeploymentLister) Deployments(namespace string) storeToDeploymentNamespacer {
|
||||
return storeToDeploymentNamespacer{s.Indexer, namespace}
|
||||
}
|
||||
|
||||
// GetDeploymentsForPods returns a list of deployments managing a pod. Returns an error only if no matching deployments are found.
|
||||
func (s *StoreToDeploymentLister) GetDeploymentsForPod(pod *api.Pod) (deployments []extensions.Deployment, err error) {
|
||||
if len(pod.Labels) == 0 {
|
||||
err = fmt.Errorf("no deployments found for Pod %v because it has no labels", pod.Name)
|
||||
return
|
||||
}
|
||||
|
||||
if len(pod.Labels[extensions.DefaultDeploymentUniqueLabelKey]) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dList, err := s.Deployments(pod.Namespace).List(labels.Everything())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for _, d := range dList {
|
||||
selector, err := unversioned.LabelSelectorAsSelector(d.Spec.Selector)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid label selector: %v", err)
|
||||
}
|
||||
// If a deployment with a nil or empty selector creeps in, it should match nothing, not everything.
|
||||
if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) {
|
||||
continue
|
||||
}
|
||||
deployments = append(deployments, d)
|
||||
}
|
||||
if len(deployments) == 0 {
|
||||
err = fmt.Errorf("could not find deployments set for Pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// StoreToReplicaSetLister gives a store List and Exists methods. The store must contain only ReplicaSets.
|
||||
type StoreToReplicaSetLister struct {
|
||||
Store
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue