Merge pull request #1254 from hzxuzhonghu/master
fix Type transform panic
This commit is contained in:
commit
d6efc293c4
3 changed files with 30 additions and 4 deletions
|
@ -38,4 +38,4 @@ func NewParser() parser.IngressAnnotation {
|
||||||
// used to add an alias to the provided hosts
|
// used to add an alias to the provided hosts
|
||||||
func (a alias) Parse(ing *extensions.Ingress) (interface{}, error) {
|
func (a alias) Parse(ing *extensions.Ingress) (interface{}, error) {
|
||||||
return parser.GetStringAnnotation(annotation, ing)
|
return parser.GetStringAnnotation(annotation, ing)
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,4 +38,4 @@ func NewParser() parser.IngressAnnotation {
|
||||||
// used to add an client-body-buffer-size to the provided locations
|
// used to add an client-body-buffer-size to the provided locations
|
||||||
func (a clientBodyBufferSize) Parse(ing *extensions.Ingress) (interface{}, error) {
|
func (a clientBodyBufferSize) Parse(ing *extensions.Ingress) (interface{}, error) {
|
||||||
return parser.GetStringAnnotation(annotation, ing)
|
return parser.GetStringAnnotation(annotation, ing)
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,20 @@ func newIngressController(config *Configuration) *GenericController {
|
||||||
ic.syncQueue.Enqueue(obj)
|
ic.syncQueue.Enqueue(obj)
|
||||||
},
|
},
|
||||||
DeleteFunc: func(obj interface{}) {
|
DeleteFunc: func(obj interface{}) {
|
||||||
delIng := obj.(*extensions.Ingress)
|
delIng, ok := obj.(*extensions.Ingress)
|
||||||
|
if !ok {
|
||||||
|
// If we reached here it means the ingress was deleted but its final state is unrecorded.
|
||||||
|
tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
|
||||||
|
if !ok {
|
||||||
|
glog.Errorf("couldn't get object from tombstone %#v", obj)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
delIng, ok = tombstone.Obj.(*extensions.Ingress)
|
||||||
|
if !ok {
|
||||||
|
glog.Errorf("Tombstone contained object that is not an Ingress: %#v", obj)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
if !class.IsValid(delIng, ic.cfg.IngressClass, ic.cfg.DefaultIngressClass) {
|
if !class.IsValid(delIng, ic.cfg.IngressClass, ic.cfg.DefaultIngressClass) {
|
||||||
glog.Infof("ignoring delete for ingress %v based on annotation %v", delIng.Name, class.IngressKey)
|
glog.Infof("ignoring delete for ingress %v based on annotation %v", delIng.Name, class.IngressKey)
|
||||||
return
|
return
|
||||||
|
@ -223,7 +236,20 @@ func newIngressController(config *Configuration) *GenericController {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
DeleteFunc: func(obj interface{}) {
|
DeleteFunc: func(obj interface{}) {
|
||||||
sec := obj.(*api.Secret)
|
sec, ok := obj.(*api.Secret)
|
||||||
|
if !ok {
|
||||||
|
// If we reached here it means the secret was deleted but its final state is unrecorded.
|
||||||
|
tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
|
||||||
|
if !ok {
|
||||||
|
glog.Errorf("couldn't get object from tombstone %#v", obj)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
sec, ok = tombstone.Obj.(*api.Secret)
|
||||||
|
if !ok {
|
||||||
|
glog.Errorf("Tombstone contained object that is not a Secret: %#v", obj)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
key := fmt.Sprintf("%v/%v", sec.Namespace, sec.Name)
|
key := fmt.Sprintf("%v/%v", sec.Namespace, sec.Name)
|
||||||
ic.sslCertTracker.DeleteAll(key)
|
ic.sslCertTracker.DeleteAll(key)
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue