From a2cd0581458cae094c5fcb95fd078b7580c935c5 Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Wed, 17 Apr 2024 10:41:54 +0200 Subject: [PATCH] Remove nginx from ingress type (#2864) Signed-off-by: Pavol Loffay --- apis/v1beta1/collector_webhook.go | 6 +++--- apis/v1beta1/collector_webhook_test.go | 2 +- apis/v1beta1/ingress.go | 6 +++--- controllers/builder_test.go | 2 +- internal/manifests/collector/ingress.go | 2 +- internal/manifests/collector/ingress_test.go | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apis/v1beta1/collector_webhook.go b/apis/v1beta1/collector_webhook.go index 693823f370..e26f4e232c 100644 --- a/apis/v1beta1/collector_webhook.go +++ b/apis/v1beta1/collector_webhook.go @@ -151,7 +151,7 @@ func (c CollectorWebhook) Default(_ context.Context, obj runtime.Object) error { if otelcol.Spec.Ingress.Type == IngressTypeRoute && otelcol.Spec.Ingress.Route.Termination == "" { otelcol.Spec.Ingress.Route.Termination = TLSRouteTerminationTypeEdge } - if otelcol.Spec.Ingress.Type == IngressTypeNginx && otelcol.Spec.Ingress.RuleType == "" { + if otelcol.Spec.Ingress.Type == IngressTypeIngress && otelcol.Spec.Ingress.RuleType == "" { otelcol.Spec.Ingress.RuleType = IngressRuleTypePath } // If someone upgrades to a later version without upgrading their CRD they will not have a management state set. @@ -275,13 +275,13 @@ func (c CollectorWebhook) validate(ctx context.Context, r *OpenTelemetryCollecto } } - if r.Spec.Ingress.Type == IngressTypeNginx && r.Spec.Mode == ModeSidecar { + if r.Spec.Ingress.Type == IngressTypeIngress && r.Spec.Mode == ModeSidecar { return warnings, fmt.Errorf("the OpenTelemetry Spec Ingress configuration is incorrect. Ingress can only be used in combination with the modes: %s, %s, %s", ModeDeployment, ModeDaemonSet, ModeStatefulSet, ) } - if r.Spec.Ingress.Type == IngressTypeNginx && r.Spec.Mode == ModeSidecar { + if r.Spec.Ingress.Type == IngressTypeIngress && r.Spec.Mode == ModeSidecar { return warnings, fmt.Errorf("the OpenTelemetry Spec Ingress configuiration is incorrect. Ingress can only be used in combination with the modes: %s, %s, %s", ModeDeployment, ModeDaemonSet, ModeStatefulSet, ) diff --git a/apis/v1beta1/collector_webhook_test.go b/apis/v1beta1/collector_webhook_test.go index 3489d035de..253ae99971 100644 --- a/apis/v1beta1/collector_webhook_test.go +++ b/apis/v1beta1/collector_webhook_test.go @@ -967,7 +967,7 @@ func TestOTELColValidatingWebhook(t *testing.T) { Spec: OpenTelemetryCollectorSpec{ Mode: ModeSidecar, Ingress: Ingress{ - Type: IngressTypeNginx, + Type: IngressTypeIngress, }, }, }, diff --git a/apis/v1beta1/ingress.go b/apis/v1beta1/ingress.go index 8c28d95571..eee8077c80 100644 --- a/apis/v1beta1/ingress.go +++ b/apis/v1beta1/ingress.go @@ -23,9 +23,9 @@ type ( ) const ( - // IngressTypeNginx specifies that an ingress entry should be created. - IngressTypeNginx IngressType = "ingress" - // IngressTypeOpenshiftRoute specifies that an route entry should be created. + // IngressTypeIngress specifies that an ingress should be created. + IngressTypeIngress IngressType = "ingress" + // IngressTypeRoute IngressTypeOpenshiftRoute specifies that an route should be created. IngressTypeRoute IngressType = "route" ) diff --git a/controllers/builder_test.go b/controllers/builder_test.go index d3ea678ef7..5614b3fc80 100644 --- a/controllers/builder_test.go +++ b/controllers/builder_test.go @@ -351,7 +351,7 @@ service: }, Mode: "deployment", Ingress: v1beta1.Ingress{ - Type: v1beta1.IngressTypeNginx, + Type: v1beta1.IngressTypeIngress, Hostname: "example.com", Annotations: map[string]string{ "something": "true", diff --git a/internal/manifests/collector/ingress.go b/internal/manifests/collector/ingress.go index cfede9e1af..e646a5446d 100644 --- a/internal/manifests/collector/ingress.go +++ b/internal/manifests/collector/ingress.go @@ -32,7 +32,7 @@ import ( func Ingress(params manifests.Params) (*networkingv1.Ingress, error) { name := naming.Ingress(params.OtelCol.Name) labels := manifestutils.Labels(params.OtelCol.ObjectMeta, name, params.OtelCol.Spec.Image, ComponentOpenTelemetryCollector, params.Config.LabelsFilter()) - if params.OtelCol.Spec.Ingress.Type != v1beta1.IngressTypeNginx { + if params.OtelCol.Spec.Ingress.Type != v1beta1.IngressTypeIngress { return nil, nil } diff --git a/internal/manifests/collector/ingress_test.go b/internal/manifests/collector/ingress_test.go index c3e5932a5a..40e736b7bb 100644 --- a/internal/manifests/collector/ingress_test.go +++ b/internal/manifests/collector/ingress_test.go @@ -74,7 +74,7 @@ func TestDesiredIngresses(t *testing.T) { Spec: v1beta1.OpenTelemetryCollectorSpec{ Config: v1beta1.Config{}, Ingress: v1beta1.Ingress{ - Type: v1beta1.IngressTypeNginx, + Type: v1beta1.IngressTypeIngress, }, }, }, @@ -99,7 +99,7 @@ func TestDesiredIngresses(t *testing.T) { params.OtelCol.Namespace = ns params.OtelCol.Spec.Ingress = v1beta1.Ingress{ - Type: v1beta1.IngressTypeNginx, + Type: v1beta1.IngressTypeIngress, Hostname: hostname, Annotations: map[string]string{"some.key": "some.value"}, IngressClassName: &ingressClassName, @@ -190,7 +190,7 @@ func TestDesiredIngresses(t *testing.T) { params.OtelCol.Namespace = ns params.OtelCol.Spec.Ingress = v1beta1.Ingress{ - Type: v1beta1.IngressTypeNginx, + Type: v1beta1.IngressTypeIngress, RuleType: v1beta1.IngressRuleTypeSubdomain, Hostname: hostname, Annotations: map[string]string{"some.key": "some.value"},