Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 0dc0700

Browse files
committed
Add https port to host
1 parent cf7bf49 commit 0dc0700

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

cloud-integrations/kubernetes/controllers/ingress_scan_controller.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,31 @@ func (r *IngressScanReconciler) CreateOrUpdateTlsForHosts(ingress networking.Ing
9090
r.Log.Error(err, "unable to get host")
9191
return err
9292
}
93+
94+
containsHTTPSPort := false
95+
if host.Spec.Ports == nil {
96+
host.Spec.Ports = make([]targetsv1.HostPort, 0)
97+
}
98+
for _, port := range host.Spec.Ports {
99+
if port.Port == 443 {
100+
containsHTTPSPort = true
101+
break
102+
}
103+
}
104+
105+
if containsHTTPSPort == false {
106+
httpsPort := targetsv1.HostPort{
107+
Type: "https",
108+
Port: 443,
109+
}
110+
host.Spec.Ports = append(host.Spec.Ports, httpsPort)
111+
112+
err := r.Update(context.Background(), &host)
113+
if err != nil {
114+
r.Log.Error(err, "Failed to add https port to target")
115+
return err
116+
}
117+
}
93118
}
94119
}
95120

0 commit comments

Comments
 (0)