Skip to content

Commit

Permalink
chore: move internal function to private (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
mavimo authored Oct 16, 2023
1 parent 539dc67 commit 5e9d877
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/k8s/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ func WatchIngresses(options IngressParams, funcs IngressHandlers) cache.SharedIn
AddFunc: func(obj interface{}) {
ingress, ok := obj.(*networkingv1.Ingress)

if ok && IsControllerIngress(options, ingress) {
if ok && isControllerIngress(options, ingress) {
funcs.AddFunc(ingress)
}
},
UpdateFunc: func(oldObj, newObj interface{}) {
oldIng, ok1 := oldObj.(*networkingv1.Ingress)
newIng, ok2 := newObj.(*networkingv1.Ingress)

if ok1 && ok2 && IsControllerIngress(options, newIng) {
if ok1 && ok2 && isControllerIngress(options, newIng) {
funcs.UpdateFunc(oldIng, newIng)
}
},
DeleteFunc: func(obj interface{}) {
ingress, ok := obj.(*networkingv1.Ingress)

if ok && IsControllerIngress(options, ingress) {
if ok && isControllerIngress(options, ingress) {
funcs.DeleteFunc(ingress)
}
},
Expand All @@ -55,8 +55,8 @@ func WatchIngresses(options IngressParams, funcs IngressHandlers) cache.SharedIn
return informer
}

// IsControllerIngress check if the ingress object can be controlled by us
func IsControllerIngress(options IngressParams, ingress *networkingv1.Ingress) bool {
// isControllerIngress check if the ingress object can be controlled by us
func isControllerIngress(options IngressParams, ingress *networkingv1.Ingress) bool {
ingressClass := ingress.Annotations["kubernetes.io/ingress.class"]
if ingressClass == "" && ingress.Spec.IngressClassName != nil {
ingressClass = *ingress.Spec.IngressClassName
Expand Down

0 comments on commit 5e9d877

Please sign in to comment.