Skip to content

Commit

Permalink
Fixed validations for details, load configs for all namespaces (#7296)
Browse files Browse the repository at this point in the history
* Fixed validations for details, load configs for all namespaces, added tests.

* fixed test
  • Loading branch information
hhovsepy committed Apr 24, 2024
1 parent 768f84a commit ce40189
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
20 changes: 20 additions & 0 deletions business/checkers/virtualservices/no_gateway_checker_test.go
Expand Up @@ -131,6 +131,26 @@ func TestFoundGateway(t *testing.T) {
assert.Empty(vals)
}

func TestFoundRemoteGateway(t *testing.T) {
assert := assert.New(t)
conf := config.NewConfig()
config.Set(conf)

virtualService := data.AddGatewaysToVirtualService([]string{"remote/my-gateway", "mesh"}, data.CreateVirtualService())
gatewayNames := kubernetes.GatewayNames([]*networking_v1beta1.Gateway{
data.CreateEmptyGateway("my-gateway", "remote", make(map[string]string)),
})

checker := NoGatewayChecker{
VirtualService: virtualService,
GatewayNames: gatewayNames,
}

vals, valid := checker.Check()
assert.True(valid)
assert.Empty(vals)
}

func TestFoundGatewayTwoPartNaming(t *testing.T) {
assert := assert.New(t)
conf := config.NewConfig()
Expand Down
4 changes: 3 additions & 1 deletion business/istio_validations.go
Expand Up @@ -8,6 +8,8 @@ import (
networking_v1beta1 "istio.io/client-go/pkg/apis/networking/v1beta1"
security_v1beta "istio.io/client-go/pkg/apis/security/v1beta1"

meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/kiali/kiali/business/checkers"
"github.com/kiali/kiali/business/references"
"github.com/kiali/kiali/config"
Expand Down Expand Up @@ -419,7 +421,7 @@ func (in *IstioValidationsService) fetchIstioConfigList(ctx context.Context, rVa
IncludeK8sGateways: true,
IncludeK8sReferenceGrants: true,
}
istioConfigMap, err := in.businessLayer.IstioConfig.GetIstioConfigMap(ctx, namespace, criteria)
istioConfigMap, err := in.businessLayer.IstioConfig.GetIstioConfigMap(ctx, meta_v1.NamespaceAll, criteria)
if err != nil {
errChan <- err
return
Expand Down
11 changes: 11 additions & 0 deletions frontend/cypress/integration/featureFiles/istio_config.feature
Expand Up @@ -281,6 +281,17 @@ Feature: Kiali Istio Config page
When user selects the "sleep" namespace
Then the "foo" "VirtualService" of the "sleep" namespace should have a "danger"

@crd-validation
@bookinfo-app
@sleep-app
Scenario: VirtualService references to Gateway
Given there is a "foo" Gateway on "bookinfo" namespace for "productpage.local" hosts on HTTP port 80 with "app=productpage" labels selector
And there is a "foo" VirtualService in the "sleep" namespace with a "foo-route" http-route to host "sleep"
And the VirtualService applies to "sleep" hosts
And the VirtualService references "bookinfo/foo" gateways
When user selects the "sleep" namespace
Then the "foo" "VirtualService" of the "sleep" namespace should have a "success"

@crd-validation
@bookinfo-app
@sleep-app
Expand Down

0 comments on commit ce40189

Please sign in to comment.