99 "sync"
1010 "time"
1111
12- "github.com/loft-sh/vcluster/pkg/config"
1312 "github.com/loft-sh/vcluster/pkg/constants"
1413 "github.com/loft-sh/vcluster/pkg/controllers/resources/nodes/nodeservice"
14+ "github.com/loft-sh/vcluster/pkg/syncer/synccontext"
1515 "github.com/loft-sh/vcluster/pkg/util/translate"
1616 corev1 "k8s.io/api/core/v1"
1717 kerrors "k8s.io/apimachinery/pkg/api/errors"
@@ -33,27 +33,31 @@ type Syncer interface {
3333 dynamiccertificates.CertKeyContentProvider
3434}
3535
36- func NewSyncer (_ context. Context , currentNamespace string , currentNamespaceClient client. Client , options * config. VirtualClusterConfig ) (Syncer , error ) {
36+ func NewSyncer (ctx * synccontext. ControllerContext ) (Syncer , error ) {
3737 return & syncer {
38- clusterDomain : options .Networking .Advanced .ClusterDomain ,
38+ clusterDomain : ctx . Config .Networking .Advanced .ClusterDomain ,
3939
40- serverCaKey : options .VirtualClusterKubeConfig ().ServerCAKey ,
41- serverCaCert : options .VirtualClusterKubeConfig ().ServerCACert ,
40+ ingressHost : ctx .Config .ControlPlane .Ingress .Host ,
4241
43- fakeKubeletIPs : options .Networking .Advanced .ProxyKubelets .ByIP ,
42+ serverCaKey : ctx .Config .VirtualClusterKubeConfig ().ServerCAKey ,
43+ serverCaCert : ctx .Config .VirtualClusterKubeConfig ().ServerCACert ,
4444
45- addSANs : options .ControlPlane .Proxy .ExtraSANs ,
45+ fakeKubeletIPs : ctx .Config .Networking .Advanced .ProxyKubelets .ByIP ,
46+
47+ addSANs : ctx .Config .ControlPlane .Proxy .ExtraSANs ,
4648 listeners : []dynamiccertificates.Listener {},
4749
48- serviceName : options .WorkloadService ,
49- currentNamespace : currentNamespace ,
50- currentNamespaceCient : currentNamespaceClient ,
50+ serviceName : ctx . Config .WorkloadService ,
51+ currentNamespace : ctx . Config . WorkloadNamespace ,
52+ currentNamespaceCient : ctx . WorkloadNamespaceClient ,
5153 }, nil
5254}
5355
5456type syncer struct {
5557 clusterDomain string
5658
59+ ingressHost string
60+
5761 serverCaCert string
5862 serverCaKey string
5963
@@ -187,6 +191,11 @@ func (s *syncer) getSANs(ctx context.Context) ([]string, error) {
187191 }
188192 }
189193
194+ // ingress host
195+ if s .ingressHost != "" {
196+ retSANs = append (retSANs , s .ingressHost )
197+ }
198+
190199 // make sure other sans are there as well
191200 retSANs = append (retSANs , s .addSANs ... )
192201 sort .Strings (retSANs )
0 commit comments