Skip to content

Commit

Permalink
Add make target for fixing imports
Browse files Browse the repository at this point in the history
Signed-off-by: Jacek Ewertowski <[email protected]>
  • Loading branch information
jewertow committed Oct 7, 2024
1 parent ff5e6cb commit 2dac9cb
Show file tree
Hide file tree
Showing 20 changed files with 69 additions and 47 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ OUT := $(shell pwd)
default: build test

export TAG ?= latest
export HUB ?= quay.io/openshift-service-mesh
export HUB ?= quay.io/jewertow
export ISTIO_VERSION ?= 1.23.0

.PHONY: build
Expand Down Expand Up @@ -54,6 +54,10 @@ e2e-test:
.PHONY: e2e
e2e: kind-clusters e2e-test

.PHONY: fix-imports
fix-imports:
goimports -local "github.com/openshift-service-mesh/federation" -w .

LICENSE_FILE := /tmp/license.txt
GO_FILES := $(shell find . -name '*.go')

Expand Down
15 changes: 8 additions & 7 deletions cmd/federation-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ import (
"syscall"

discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
"github.com/spf13/cobra"
istiolog "istio.io/istio/pkg/log"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/utils/env"

"github.com/openshift-service-mesh/federation/internal/pkg/config"
"github.com/openshift-service-mesh/federation/internal/pkg/fds"
"github.com/openshift-service-mesh/federation/internal/pkg/informer"
Expand All @@ -32,13 +40,6 @@ import (
"github.com/openshift-service-mesh/federation/internal/pkg/xds"
"github.com/openshift-service-mesh/federation/internal/pkg/xds/adsc"
"github.com/openshift-service-mesh/federation/internal/pkg/xds/adss"
"github.com/spf13/cobra"
istiolog "istio.io/istio/pkg/log"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/utils/env"
)

// Global variable to store the parsed commandline arguments
Expand Down
5 changes: 3 additions & 2 deletions internal/api/federation/v1alpha1/exported_service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion internal/pkg/common/match_exported.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
package common

import (
"github.com/openshift-service-mesh/federation/internal/pkg/config"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/labels"

"github.com/openshift-service-mesh/federation/internal/pkg/config"
)

func MatchExportRules(svc *corev1.Service, exportedLabelSelectors []config.LabelSelectors) bool {
Expand Down
9 changes: 5 additions & 4 deletions internal/pkg/fds/exported_service_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ import (
"fmt"
"strings"

"github.com/openshift-service-mesh/federation/internal/api/federation/v1alpha1"
"github.com/openshift-service-mesh/federation/internal/pkg/config"
"github.com/openshift-service-mesh/federation/internal/pkg/xds"
"github.com/openshift-service-mesh/federation/internal/pkg/xds/adss"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"
"k8s.io/apimachinery/pkg/labels"
v1 "k8s.io/client-go/listers/core/v1"

"github.com/openshift-service-mesh/federation/internal/api/federation/v1alpha1"
"github.com/openshift-service-mesh/federation/internal/pkg/config"
"github.com/openshift-service-mesh/federation/internal/pkg/xds"
"github.com/openshift-service-mesh/federation/internal/pkg/xds/adss"
)

var _ adss.RequestHandler = (*ExportedServicesGenerator)(nil)
Expand Down
7 changes: 4 additions & 3 deletions internal/pkg/fds/exported_service_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ import (
"reflect"
"testing"

"github.com/openshift-service-mesh/federation/internal/api/federation/v1alpha1"
"github.com/openshift-service-mesh/federation/internal/pkg/config"
"github.com/openshift-service-mesh/federation/internal/pkg/informer"
"golang.org/x/net/context"
"google.golang.org/protobuf/types/known/anypb"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes/fake"

"github.com/openshift-service-mesh/federation/internal/api/federation/v1alpha1"
"github.com/openshift-service-mesh/federation/internal/pkg/config"
"github.com/openshift-service-mesh/federation/internal/pkg/informer"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions internal/pkg/fds/import_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ package fds
import (
"fmt"

"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"

"github.com/openshift-service-mesh/federation/internal/api/federation/v1alpha1"
"github.com/openshift-service-mesh/federation/internal/pkg/xds"
"github.com/openshift-service-mesh/federation/internal/pkg/xds/adsc"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"
)

var _ adsc.ResponseHandler = (*ImportedServiceHandler)(nil)
Expand Down
5 changes: 3 additions & 2 deletions internal/pkg/informer/service_export_event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
package informer

import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"

"github.com/openshift-service-mesh/federation/internal/pkg/common"
"github.com/openshift-service-mesh/federation/internal/pkg/config"
"github.com/openshift-service-mesh/federation/internal/pkg/xds"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)

var _ Handler = (*ServiceExportEventHandler)(nil)
Expand Down
5 changes: 3 additions & 2 deletions internal/pkg/informer/service_export_event_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ import (
"testing"
"time"

"github.com/openshift-service-mesh/federation/internal/pkg/config"
"github.com/openshift-service-mesh/federation/internal/pkg/xds"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/openshift-service-mesh/federation/internal/pkg/config"
"github.com/openshift-service-mesh/federation/internal/pkg/xds"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions internal/pkg/mcp/destination_rule_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
package mcp

import (
"google.golang.org/protobuf/types/known/anypb"
istiocfg "istio.io/istio/pkg/config"

"github.com/openshift-service-mesh/federation/internal/pkg/istio"
"github.com/openshift-service-mesh/federation/internal/pkg/xds"
"github.com/openshift-service-mesh/federation/internal/pkg/xds/adss"
"google.golang.org/protobuf/types/known/anypb"
istiocfg "istio.io/istio/pkg/config"
)

var _ adss.RequestHandler = (*DestinationRuleResourceGenerator)(nil)
Expand Down
5 changes: 3 additions & 2 deletions internal/pkg/mcp/gateway_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ package mcp
import (
"fmt"

"google.golang.org/protobuf/types/known/anypb"
istiocfg "istio.io/istio/pkg/config"

"github.com/openshift-service-mesh/federation/internal/pkg/istio"
"github.com/openshift-service-mesh/federation/internal/pkg/xds"
"github.com/openshift-service-mesh/federation/internal/pkg/xds/adss"
"google.golang.org/protobuf/types/known/anypb"
istiocfg "istio.io/istio/pkg/config"
)

var _ adss.RequestHandler = (*GatewayResourceGenerator)(nil)
Expand Down
3 changes: 2 additions & 1 deletion internal/pkg/mcp/gateway_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
package mcp

import (
"github.com/openshift-service-mesh/federation/internal/pkg/fds"
"reflect"
"testing"

"github.com/openshift-service-mesh/federation/internal/pkg/fds"

"golang.org/x/net/context"
istionetv1alpha3 "istio.io/api/networking/v1alpha3"
istiocfg "istio.io/istio/pkg/config"
Expand Down
5 changes: 3 additions & 2 deletions internal/pkg/mcp/service_entry_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ package mcp
import (
"fmt"

"google.golang.org/protobuf/types/known/anypb"
istioconfig "istio.io/istio/pkg/config"

"github.com/openshift-service-mesh/federation/internal/pkg/istio"
"github.com/openshift-service-mesh/federation/internal/pkg/xds"
"github.com/openshift-service-mesh/federation/internal/pkg/xds/adss"
"google.golang.org/protobuf/types/known/anypb"
istioconfig "istio.io/istio/pkg/config"
)

var _ adss.RequestHandler = (*ServiceEntryGenerator)(nil)
Expand Down
11 changes: 6 additions & 5 deletions internal/pkg/mcp/service_entry_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ import (
"strings"
"testing"

"github.com/openshift-service-mesh/federation/internal/api/federation/v1alpha1"
"github.com/openshift-service-mesh/federation/internal/pkg/config"
"github.com/openshift-service-mesh/federation/internal/pkg/fds"
"github.com/openshift-service-mesh/federation/internal/pkg/informer"
"github.com/openshift-service-mesh/federation/internal/pkg/istio"
"golang.org/x/net/context"
"google.golang.org/protobuf/types/known/anypb"
mcp "istio.io/api/mcp/v1alpha1"
Expand All @@ -34,6 +29,12 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes/fake"

"github.com/openshift-service-mesh/federation/internal/api/federation/v1alpha1"
"github.com/openshift-service-mesh/federation/internal/pkg/config"
"github.com/openshift-service-mesh/federation/internal/pkg/fds"
"github.com/openshift-service-mesh/federation/internal/pkg/informer"
"github.com/openshift-service-mesh/federation/internal/pkg/istio"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions internal/pkg/mcp/virtual_service_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
package mcp

import (
"google.golang.org/protobuf/types/known/anypb"
istiocfg "istio.io/istio/pkg/config"

"github.com/openshift-service-mesh/federation/internal/pkg/istio"
"github.com/openshift-service-mesh/federation/internal/pkg/xds"
"github.com/openshift-service-mesh/federation/internal/pkg/xds/adss"
"google.golang.org/protobuf/types/known/anypb"
istiocfg "istio.io/istio/pkg/config"
)

var _ adss.RequestHandler = (*VirtualServiceResourceGenerator)(nil)
Expand Down
5 changes: 3 additions & 2 deletions internal/pkg/mcp/workload_entry_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ package mcp
import (
"fmt"

"google.golang.org/protobuf/types/known/anypb"
istioconfig "istio.io/istio/pkg/config"

"github.com/openshift-service-mesh/federation/internal/pkg/istio"
"github.com/openshift-service-mesh/federation/internal/pkg/xds"
"github.com/openshift-service-mesh/federation/internal/pkg/xds/adss"
"google.golang.org/protobuf/types/known/anypb"
istioconfig "istio.io/istio/pkg/config"
)

var _ adss.RequestHandler = (*WorkloadEntryGenerator)(nil)
Expand Down
9 changes: 5 additions & 4 deletions internal/pkg/mcp/workload_entry_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ import (
"reflect"
"testing"

"github.com/openshift-service-mesh/federation/internal/api/federation/v1alpha1"
"github.com/openshift-service-mesh/federation/internal/pkg/fds"
"github.com/openshift-service-mesh/federation/internal/pkg/informer"
"github.com/openshift-service-mesh/federation/internal/pkg/istio"
istiocfg "istio.io/istio/pkg/config"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes/fake"

"github.com/openshift-service-mesh/federation/internal/api/federation/v1alpha1"
"github.com/openshift-service-mesh/federation/internal/pkg/fds"
"github.com/openshift-service-mesh/federation/internal/pkg/informer"
"github.com/openshift-service-mesh/federation/internal/pkg/istio"
)

func TestWorkloadEntryGenerator(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion internal/pkg/xds/adss/adss_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ import (

envoycfgcorev3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
"github.com/openshift-service-mesh/federation/internal/pkg/xds"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/anypb"
istiolog "istio.io/istio/pkg/log"

"github.com/openshift-service-mesh/federation/internal/pkg/xds"
)

var log = istiolog.RegisterScope("adss", "Aggregated Discovery Service Server")
Expand Down
3 changes: 2 additions & 1 deletion internal/pkg/xds/adss/grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ import (
"net"

discovery "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
"github.com/openshift-service-mesh/federation/internal/pkg/xds"
"golang.org/x/sync/errgroup"
"google.golang.org/grpc"

"github.com/openshift-service-mesh/federation/internal/pkg/xds"
)

type Server struct {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var (
_, file, _, _ = runtime.Caller(0)
rootDir = filepath.Join(filepath.Dir(file), "../..")

testHub = env.GetString("HUB", "quay.io/openshift-service-mesh")
testHub = env.GetString("HUB", "quay.io/jewertow")
testTag = env.GetString("TAG", "latest")

istioVersion = env.GetString("ISTIO_VERSION", "1.22.1")
Expand Down

0 comments on commit 2dac9cb

Please sign in to comment.