Skip to content

Commit

Permalink
Merge pull request #1254 from hzxuzhonghu/master
Browse files Browse the repository at this point in the history
fix Type transform panic
  • Loading branch information
aledbf authored Aug 28, 2017
2 parents 69c89cc + af6a7f6 commit d6efc29
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/pkg/ingress/annotations/alias/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ func NewParser() parser.IngressAnnotation {
// used to add an alias to the provided hosts
func (a alias) Parse(ing *extensions.Ingress) (interface{}, error) {
return parser.GetStringAnnotation(annotation, ing)
}
}
2 changes: 1 addition & 1 deletion core/pkg/ingress/annotations/clientbodybuffersize/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ func NewParser() parser.IngressAnnotation {
// used to add an client-body-buffer-size to the provided locations
func (a clientBodyBufferSize) Parse(ing *extensions.Ingress) (interface{}, error) {
return parser.GetStringAnnotation(annotation, ing)
}
}
30 changes: 28 additions & 2 deletions core/pkg/ingress/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,20 @@ func newIngressController(config *Configuration) *GenericController {
ic.syncQueue.Enqueue(obj)
},
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) {
glog.Infof("ignoring delete for ingress %v based on annotation %v", delIng.Name, class.IngressKey)
return
Expand Down Expand Up @@ -223,7 +236,20 @@ func newIngressController(config *Configuration) *GenericController {
}
},
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)
ic.sslCertTracker.DeleteAll(key)
},
Expand Down

0 comments on commit d6efc29

Please sign in to comment.