Skip to content

Commit

Permalink
fixed as per review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Shriram Sharma <[email protected]>
  • Loading branch information
shriramsharma committed Aug 23, 2024
1 parent 29e8a80 commit d4c9629
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions admiral/cmd/admiral/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ func GetRootCmd(args []string) *cobra.Command {
// Flags pertaining to VS based routing
rootCmd.PersistentFlags().BoolVar(&params.EnableVSRouting, "enable_vs_routing", false, "Enable/Disable VS Based Routing")
rootCmd.PersistentFlags().StringArrayVar(&params.VSRoutingGateways, "vs_routing_gateways", []string{}, "The PASSTHROUGH gateways to use for VS based routing")
rootCmd.PersistentFlags().StringArrayVar(&params.IngressVSExportToNamespaces, "ingress_vs_export_to_namespaces", []string{"istio-system"}, "List of namespaces where the ingress VS should be exported")

return rootCmd
}
Expand Down
2 changes: 1 addition & 1 deletion admiral/pkg/clusters/virtualservice_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ func getBaseVirtualServiceForIngress(host, sniHost string) (*v1alpha3.VirtualSer
// We are using the SNI host in hosts field as they need to match
Hosts: []string{sniHost},
Gateways: gateways,
ExportTo: []string{"istio-system"},
ExportTo: common.GetIngressVSExportToNamespace(),
Tls: []*networkingV1Alpha3.TLSRoute{
{
Match: []*networkingV1Alpha3.TLSMatchAttributes{
Expand Down
1 change: 1 addition & 0 deletions admiral/pkg/clusters/virtualservice_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2254,6 +2254,7 @@ func TestGetBaseVirtualServiceForIngress(t *testing.T) {

admiralParams := common.AdmiralParams{
SyncNamespace: "test-sync-ns",
IngressVSExportToNamespaces: []string{"istio-system"},
}

vsLabels := map[string]string{
Expand Down
6 changes: 6 additions & 0 deletions admiral/pkg/controller/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,12 @@ func EnableSWAwareNSCaches() bool {
return wrapper.params.EnableSWAwareNSCaches
}

func GetIngressVSExportToNamespace() []string {
wrapper.RLock()
defer wrapper.RUnlock()
return wrapper.params.IngressVSExportToNamespaces
}

func IsVSBasedRoutingEnabled() bool {
wrapper.RLock()
defer wrapper.RUnlock()
Expand Down
5 changes: 3 additions & 2 deletions admiral/pkg/controller/common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ type AdmiralParams struct {
OperatorSecretFilterTags string

// VS Based Routing
EnableVSRouting bool
VSRoutingGateways []string
EnableVSRouting bool
VSRoutingGateways []string
IngressVSExportToNamespaces []string
}

func (b AdmiralParams) String() string {
Expand Down

0 comments on commit d4c9629

Please sign in to comment.