Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move internal function to private #154

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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