Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
leoporoli committed Oct 21, 2024
1 parent fe79f7a commit 9a155b4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(corev1.AddToScheme(scheme))
utilruntime.Must(istioclient.AddToScheme(scheme))
utilruntime.Must(gateway.AddToScheme(scheme))
utilruntime.Must(gateway.Install(scheme))
// +kubebuilder:scaffold:scheme
}

Expand Down
7 changes: 3 additions & 4 deletions internal/controller/core/flow_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ package core

import (
"context"
"github.com/sirupsen/logrus"

"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/runtime"
corev1 "kardinal.dev/kardinal-operator/api/core/v1"
"kardinal.dev/kardinal-operator/kardinal/reconciler"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"

corev1 "kardinal.dev/kardinal-operator/api/core/v1"
"kardinal.dev/kardinal-operator/kardinal/reconciler"
)

// FlowReconciler reconciles a Flow object
Expand Down
4 changes: 2 additions & 2 deletions kardinal/resources/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package resources

import (
"context"
gateway "sigs.k8s.io/gateway-api/apis/v1"
"strings"

"github.com/kurtosis-tech/stacktrace"
Expand All @@ -15,6 +14,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kardinalcorev1 "kardinal.dev/kardinal-operator/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
gateway "sigs.k8s.io/gateway-api/apis/v1"
)

const (
Expand Down Expand Up @@ -201,7 +201,7 @@ func ApplyResources(
}
} else {
namespaceObjectLabels := namespaceObject.GetLabels()
//OPERATOR-TODO we have to check if it was marked for deletion by Kubernetes and handle it that situation
// OPERATOR-TODO we have to check if it was marked for deletion by Kubernetes and handle it that situation
isManaged, found := namespaceObjectLabels[kardinalManagedLabelKey]
if found && isManaged == trueStr {
if !compareObjectsFunc(clusterTopologyNamespaceObject, namespaceObject) {
Expand Down
20 changes: 10 additions & 10 deletions kardinal/topology/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ package topology
import (
"context"
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"reflect"
gateway "sigs.k8s.io/gateway-api/apis/v1"
"strings"

"github.com/brunoga/deep"
Expand All @@ -17,8 +15,10 @@ import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
net "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"kardinal.dev/kardinal-operator/kardinal/resources"
"sigs.k8s.io/controller-runtime/pkg/client"
gateway "sigs.k8s.io/gateway-api/apis/v1"
)

const (
Expand Down Expand Up @@ -211,7 +211,7 @@ func (clusterTopology *ClusterTopology) GetResources() (*resources.Resources, er

frontServices := []*corev1.Service{}
// OPERATOR-TODO include []istioclient.EnvoyFilter as the third returned value once we add the envoy filters objects
//routes, frontServices, inboundFrontFilters := clusterTopology.getHttpRoutes()
// routes, frontServices, inboundFrontFilters := clusterTopology.getHttpRoutes()
routes, frontServicesFromHttpRoutes := clusterTopology.getHttpRoutes()
groupedRoutes := lo.GroupBy(routes, func(routes *gateway.HTTPRoute) string { return routes.Namespace })
for namespace, routes := range groupedRoutes {
Expand Down Expand Up @@ -562,7 +562,7 @@ func (clusterTopology *ClusterTopology) getHttpRoutes() ([]*gateway.HTTPRoute, [
frontServices := map[string]*corev1.Service{}

// OPERATOR-TODO include []istioclient.EnvoyFilter as the third returned value once we add the envoy filters objects
//filters := []istioclient.EnvoyFilter{}
// filters := []istioclient.EnvoyFilter{}

for _, activeFlowID := range clusterTopology.GatewayAndRoutes.ActiveFlowIDs {
logrus.Infof("Setting gateway route for active flow ID: %v", activeFlowID)
Expand All @@ -589,20 +589,20 @@ func (clusterTopology *ClusterTopology) getHttpRoutes() ([]*gateway.HTTPRoute, [
if !serviceAlreadyAdded {
frontServices[idVersion] = target.GetVersionedService(activeFlowID, namespace)
ref.Name = gateway.ObjectName(idVersion)
//OPERATOR-TODO creo que tambien el problema es que hay 2 http route para el baseline flow
// OPERATOR-TODO creo que tambien el problema es que hay 2 http route para el baseline flow
rule.BackendRefs[refIx] = ref

// OPERATOR-TODO include []istioclient.EnvoyFilter as the third returned value once we add the envoy filters objects
//hostnames := lo.Map(routeSpec.Hostnames, func(item gateway.Hostname, _ int) string { return string(item) })

// Set Envoy FIlter for the service
//filter := &externalInboudFilter{
// filter := &externalInboudFilter{
// filter: generateDynamicLuaScript(allServices, activeFlowID, namespace, hostnames),
// name: strings.Join(hostnames, "-"),
//}
//inboundFilter := getInboundFilter(target.ServiceID, namespace, -1, &target.Version, filter)
//logrus.Debugf("Adding inbound filter to setup routing table for flow '%s' on service '%s', version '%s'", activeFlowID, target.ServiceID, target.Version)
//filters = append(filters, inboundFilter)
// }
// inboundFilter := getInboundFilter(target.ServiceID, namespace, -1, &target.Version, filter)
// logrus.Debugf("Adding inbound filter to setup routing table for flow '%s' on service '%s', version '%s'", activeFlowID, target.ServiceID, target.Version)
// filters = append(filters, inboundFilter)
}
} else {
logrus.Errorf(">> service not found %v", ref.Name)
Expand Down

0 comments on commit 9a155b4

Please sign in to comment.