Skip to content

Commit

Permalink
ingress: rename, group and move consts
Browse files Browse the repository at this point in the history
This commit renames and moves the Ingress related constants to
the corresponding annotation package.

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
  • Loading branch information
mhofstetter authored and pull[bot] committed Apr 29, 2024
1 parent c350a91 commit 6b29720
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 5 additions & 0 deletions operator/pkg/ingress/annotations/annotations.go
Expand Up @@ -47,6 +47,11 @@ const (
defaultWebsocketEnabled = 0 // 1 - Enabled, 0 - Disabled
)

const (
LoadbalancerModeDedicated = "dedicated"
LoadbalancerModeShared = "shared"
)

// GetAnnotationIngressLoadbalancerMode returns the loadbalancer mode for the ingress if possible.
func GetAnnotationIngressLoadbalancerMode(ingress *networkingv1.Ingress) string {
value, _ := annotation.Get(ingress, LBModeAnnotation, LBModeAnnotationAlias)
Expand Down
4 changes: 0 additions & 4 deletions operator/pkg/ingress/ingress.go
Expand Up @@ -17,11 +17,7 @@ import (

const (
ciliumIngressPrefix = "cilium-ingress"
ciliumIngressLabelKey = "cilium.io/ingress"
ciliumIngressClassName = "cilium"

dedicatedLoadbalancerMode = "dedicated"
sharedLoadbalancerMode = "shared"
)

// ingressReconciler reconciles a Ingress object
Expand Down
6 changes: 3 additions & 3 deletions operator/pkg/ingress/ingress_reconcile.go
Expand Up @@ -427,11 +427,11 @@ func convertToNetworkV1IngressLoadBalancerIngress(lbIngresses []corev1.LoadBalan
func (r *ingressReconciler) isEffectiveLoadbalancerModeDedicated(ing *networkingv1.Ingress) bool {
value := annotations.GetAnnotationIngressLoadbalancerMode(ing)
switch value {
case dedicatedLoadbalancerMode:
case annotations.LoadbalancerModeDedicated:
return true
case sharedLoadbalancerMode:
case annotations.LoadbalancerModeShared:
return false
default:
return r.defaultLoadbalancerMode == dedicatedLoadbalancerMode
return r.defaultLoadbalancerMode == annotations.LoadbalancerModeDedicated
}
}

0 comments on commit 6b29720

Please sign in to comment.