Skip to content

Commit

Permalink
Remove nginx from ingress type (#2864)
Browse files Browse the repository at this point in the history
Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
  • Loading branch information
pavolloffay authored Apr 17, 2024
1 parent dbf9628 commit a2cd058
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions apis/v1beta1/collector_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
)
Expand Down
2 changes: 1 addition & 1 deletion apis/v1beta1/collector_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ func TestOTELColValidatingWebhook(t *testing.T) {
Spec: OpenTelemetryCollectorSpec{
Mode: ModeSidecar,
Ingress: Ingress{
Type: IngressTypeNginx,
Type: IngressTypeIngress,
},
},
},
Expand Down
6 changes: 3 additions & 3 deletions apis/v1beta1/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion controllers/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion internal/manifests/collector/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions internal/manifests/collector/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestDesiredIngresses(t *testing.T) {
Spec: v1beta1.OpenTelemetryCollectorSpec{
Config: v1beta1.Config{},
Ingress: v1beta1.Ingress{
Type: v1beta1.IngressTypeNginx,
Type: v1beta1.IngressTypeIngress,
},
},
},
Expand All @@ -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,
Expand Down Expand Up @@ -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"},
Expand Down

0 comments on commit a2cd058

Please sign in to comment.