Skip to content
Closed
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions pkg/operator/controller/gateway-service-dns/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ func (r *reconciler) Reconcile(ctx context.Context, request reconcile.Request) (
return reconcile.Result{}, nil
}

if dnsConfig.Spec.PublicZone == nil && dnsConfig.Spec.PrivateZone == nil {
log.Info("DNS Public and Private zones not present; no public records should be created; reconciliation will be skipped")
return reconcile.Result{}, nil
}

domains := getGatewayHostnames(&gateway)
var errs []error
errs = append(errs, r.ensureDNSRecordsForGateway(ctx, &gateway, &service, domains.List(), infraConfig, dnsConfig)...)
Expand Down
30 changes: 29 additions & 1 deletion pkg/operator/controller/gateway-service-dns/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,26 @@ import (
)

func Test_Reconcile(t *testing.T) {
validPublicZone := &configv1.DNSZone{
ID: "12345",
}
validPrivateZone := &configv1.DNSZone{
ID: "56789",
}
dnsConfig := &configv1.DNS{
ObjectMeta: metav1.ObjectMeta{Name: "cluster"},
Spec: configv1.DNSSpec{
BaseDomain: "example.com",
BaseDomain: "example.com",
PublicZone: validPublicZone,
PrivateZone: validPrivateZone,
},
}
dnsConfigNilZones := &configv1.DNS{
ObjectMeta: metav1.ObjectMeta{Name: "cluster"},
Spec: configv1.DNSSpec{
BaseDomain: "example.com",
PublicZone: nil,
PrivateZone: nil,
},
}
infraConfig := &configv1.Infrastructure{
Expand Down Expand Up @@ -129,6 +145,18 @@ func Test_Reconcile(t *testing.T) {
expectDelete: []client.Object{},
expectError: `dnses.config.openshift.io "cluster" not found`,
},
{
name: "dns config containing no zones",
existingObjects: []runtime.Object{
dnsConfigNilZones, infraConfig,
gw("example-gateway", l("stage-http", "*.stage.example.com", 80)),
svc("example-gateway", exampleManagedGatewayLabel, ingHost("lb.example.com")),
},
reconcileRequest: req("openshift-ingress", "example-gateway"),
expectCreate: []client.Object{},
expectUpdate: []client.Object{},
expectDelete: []client.Object{},
},
{
name: "missing infrastructure config",
existingObjects: []runtime.Object{
Expand Down