@@ -18,6 +18,7 @@ package controllers
1818
1919import (
2020 "context"
21+ "fmt"
2122
2223 "github.com/go-logr/logr"
2324 targetsv1 "github.com/secureCodeBox/secureCodeBox-v2-alpha/operator/apis/targets/v1"
@@ -77,7 +78,7 @@ func (r *IngressScanReconciler) CreateOrUpdateTlsForHosts(ingress networking.Ing
7778 host := targetsv1.Host {}
7879 err := r .Get (context .Background (), types.NamespacedName {Name : hostname , Namespace : ingress .Namespace }, & host )
7980 if apierrors .IsNotFound (err ) {
80- host .Name = hostname
81+ host .GenerateName = fmt . Sprintf ( "%s-" , ingress . Name )
8182 host .Namespace = ingress .Namespace
8283 host .Spec .Hostname = hostname
8384 host .Spec .Ports = make ([]targetsv1.HostPort , 0 )
@@ -126,16 +127,16 @@ func (r *IngressScanReconciler) SetupWithManager(mgr ctrl.Manager) error {
126127
127128 isInDemoNamespaceFilter := predicate.Funcs {
128129 CreateFunc : func (event event.CreateEvent ) bool {
129- return event .Meta .GetNamespace () == "demo "
130+ return event .Meta .GetNamespace () == "juice-shop" || event . Meta . GetNamespace () == "bodgeit "
130131 },
131132 DeleteFunc : func (event event.DeleteEvent ) bool {
132- return event .Meta .GetNamespace () == "demo "
133+ return event .Meta .GetNamespace () == "juice-shop" || event . Meta . GetNamespace () == "bodgeit "
133134 },
134135 UpdateFunc : func (event event.UpdateEvent ) bool {
135- return event .MetaNew .GetNamespace () == "demo "
136+ return event .MetaNew .GetNamespace () == "juice-shop" || event . MetaNew . GetNamespace () == "bodgeit "
136137 },
137138 GenericFunc : func (event event.GenericEvent ) bool {
138- return event .Meta .GetNamespace () == "demo "
139+ return event .Meta .GetNamespace () == "juice-shop" || event . Meta . GetNamespace () == "bodgeit "
139140 },
140141 }
141142
0 commit comments