Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature to exclude an asset via command line parameter #260

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions admiral/cmd/admiral/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ import (
"context"
"flag"
"fmt"
"github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/routes"
"github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/server"
"github.com/istio-ecosystem/admiral/admiral/pkg/clusters"
"github.com/istio-ecosystem/admiral/admiral/pkg/controller/common"
log "github.com/sirupsen/logrus"
"os"
"os/signal"
"sync"
"syscall"
"time"

"github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/routes"
"github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/server"
"github.com/istio-ecosystem/admiral/admiral/pkg/clusters"
"github.com/istio-ecosystem/admiral/admiral/pkg/controller/common"
log "github.com/sirupsen/logrus"

"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -142,6 +143,8 @@ func GetRootCmd(args []string) *cobra.Command {
"The value of envoy filter is to add additional config to the filter config section")
rootCmd.PersistentFlags().BoolVar(&params.EnableRoutingPolicy, "enable_routing_policy", false,
"If Routing Policy feature needs to be enabled")
rootCmd.PersistentFlags().StringArrayVar(&params.ExcludeAssetList, "exclude_asset_list", []string{},
"List of assets which should be excluded from getting processed")
return rootCmd
}

Expand Down
5 changes: 1 addition & 4 deletions admiral/pkg/clusters/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (
"strings"
"time"

argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1"
"github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/model"
v1 "github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/v1"
"github.com/istio-ecosystem/admiral/admiral/pkg/controller/admiral"
"github.com/istio-ecosystem/admiral/admiral/pkg/controller/common"
"github.com/istio-ecosystem/admiral/admiral/pkg/controller/util"

argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1"
"github.com/golang/protobuf/ptypes/duration"
"github.com/golang/protobuf/ptypes/wrappers"
"github.com/google/go-cmp/cmp"
Expand Down Expand Up @@ -103,7 +103,6 @@ func getDestinationRule(se *v1alpha32.ServiceEntry, locality string, gtpTrafficP
},
},
}

if len(locality) == 0 {
log.Warnf(LogErrFormat, "Process", "GlobalTrafficPolicy", dr.Host, "", "Skipping gtp processing, locality of the cluster nodes cannot be determined. Is this minikube?")
processGtp = false
Expand Down Expand Up @@ -330,7 +329,6 @@ func handleDestinationRuleEvent(ctx context.Context, obj *v1alpha3.DestinationRu
dependentClusters = r.AdmiralCache.CnameDependentClusterCache.Get(destinationRule.Host).Copy()
allDependentClusters = make(map[string]string)
)

if len(dependentClusters) > 0 {
log.Infof(LogFormat, "Event", "DestinationRule", obj.Name, clusterId, "Processing")
util.MapCopy(allDependentClusters, dependentClusters)
Expand Down Expand Up @@ -396,7 +394,6 @@ func handleVirtualServiceEvent(
syncNamespace = common.GetSyncNamespace()
)
log.Infof(LogFormat, "Event", resourceType, obj.Name, vh.ClusterID, "Received event")

if len(virtualService.Hosts) > 1 {
log.Errorf(LogFormat, "Event", resourceType, obj.Name, clusterId, "Skipping as multiple hosts not supported for virtual service namespace="+obj.Namespace)
return nil
Expand Down
10 changes: 4 additions & 6 deletions admiral/pkg/clusters/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import (
"testing"
"time"

argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1"
"github.com/golang/protobuf/ptypes/duration"
"github.com/golang/protobuf/ptypes/wrappers"
"github.com/google/go-cmp/cmp"
"github.com/istio-ecosystem/admiral/admiral/pkg/apis/admiral/model"
"github.com/istio-ecosystem/admiral/admiral/pkg/controller/admiral"
"github.com/istio-ecosystem/admiral/admiral/pkg/controller/common"
"github.com/istio-ecosystem/admiral/admiral/pkg/controller/istio"
"github.com/istio-ecosystem/admiral/admiral/pkg/test"

argo "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1"
"github.com/golang/protobuf/ptypes/duration"
"github.com/golang/protobuf/ptypes/wrappers"
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert"
"google.golang.org/protobuf/testing/protocmp"
"istio.io/api/networking/v1alpha3"
Expand Down Expand Up @@ -197,7 +197,6 @@ func TestGetDestinationRule(t *testing.T) {
},
},
}

se := &v1alpha3.ServiceEntry{Hosts: []string{"qa.myservice.global"}, Endpoints: []*v1alpha3.WorkloadEntry{
{Address: "east.com", Locality: "us-east-2"}, {Address: "west.com", Locality: "us-west-2"},
}}
Expand Down Expand Up @@ -1589,7 +1588,6 @@ func TestAddUpdateServiceEntry(t *testing.T) {
IstioClient: fakeIstioClient,
}
)

twoEndpointSe := v1alpha3.ServiceEntry{
Hosts: []string{"e2e.my-first-service.mesh"},
Addresses: []string{"240.10.1.1"},
Expand Down
Loading