Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b2efd21
Base openapi provider implementation
guicassolato Apr 26, 2024
d52c628
Return without error from unimplemented ReadResourcesFromCluster func
guicassolato May 6, 2024
f23ab1e
Move slice helper functions Map nd Filter into the providers/common p…
guicassolato May 6, 2024
acc95e9
openapi package renamed openapi3
guicassolato May 6, 2024
6a22070
thread-safe storage of specs
guicassolato May 6, 2024
7151f6a
refactor: resource reader simplified as part of Provider and removing…
guicassolato May 6, 2024
f9d8d13
make provider resilient to invalid input openapi specs
guicassolato May 6, 2024
8f48ece
Gateway and parentRefs
guicassolato May 7, 2024
4c4ebaa
Declare github.com/getkin/kin-openapi as a direct dependency
guicassolato May 7, 2024
98db36e
Use github.com/samber/lo for handling slices based on common patterns…
guicassolato May 8, 2024
808a044
Remove initialization of non converted kinds of resources TLSRoutes, …
guicassolato May 8, 2024
5964eeb
init func brought further upwards
guicassolato May 8, 2024
fd6a097
code format
guicassolato May 8, 2024
12dd6a0
Provider-specific options --openapi3-backend and --openapi3-gateway-c…
guicassolato May 9, 2024
8c03640
Merge branch 'main' into openapi-provider
guicassolato May 9, 2024
b568bc9
provider-specific flag: --openapi3-gateway-tls-secret
guicassolato May 9, 2024
deb54dc
ReferenceGrants for HTTPRoute to Backends and Gateway to TLS Secrets
guicassolato May 9, 2024
0de2c24
fix: provider-specific configs for providers with dashes in the name
guicassolato May 10, 2024
0f47121
name Gateway and HTTPRoutes after the OAS title
guicassolato May 10, 2024
170c24c
fix: missing backend ref argument
guicassolato May 10, 2024
ce7e0b1
update README
guicassolato May 10, 2024
455fbbb
Support for backend port numbers
guicassolato May 14, 2024
74711bc
refactor: addressed comments from the pr
guicassolato May 21, 2024
febc49a
log message in case of provider-specific flag supplied without a matc…
guicassolato May 21, 2024
d9a40ab
more comments to explain the flow and decision of the converter
guicassolato May 21, 2024
48dc906
lint: typos, gofmt and false positives
guicassolato May 29, 2024
b174c23
return error in case of invalid OpenAPI 3.x spec
guicassolato May 29, 2024
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
36 changes: 32 additions & 4 deletions PROVIDER.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func newConverter(conf *i2gw.ProviderConf) *converter {
}
}
```
4. Create a new struct named after the provider you are implementing. This struct should embed the previous 2 structs
4. Create a new struct named after the provider you are implementing. This struct should embed the previous 2 structs
you created.
```go
package examplegateway
Expand Down Expand Up @@ -152,17 +152,45 @@ import (
In case you want to add support for the conversion of a specific feature within a provider (see for example the canary
feature of ingress-nginx) you'll want to implement a `FeatureParser` function.

Different `FeatureParsers` within the same provider will run in undetermined order. This means that when building a
Different `FeatureParsers` within the same provider will run in undetermined order. This means that when building a
`Gateway API` resource manifest, you cannot assume anything about previously initialized fields.
The function must modify / create only the required fields of the resource manifest and nothing else.

For example, lets say we are implementing the canary feature of some provider. When building the `HTTPRoute`, we cannot
assume that the `BackendRefs` is already initialized with every `BackendRef` required. The canary `FeatureParser`
assume that the `BackendRefs` is already initialized with every `BackendRef` required. The canary `FeatureParser`
function must add every missing `BackendRef` and update existing ones.

### Testing the feature parser
There are 2 main things that needs to be tested when creating a feature parser:
1. The conversion logic is actually correct.
2. The new function doesn't override other functions modifications.
For example, if one implemented the mirror backend feature and it deletes canary weight from `BackendRefs`, we have a
problem.
problem.

## Provider-specific flags
To define provider-specific flags the user can supply in the `print` command, call the
`i2gw.RegisterProviderSpecificFlag(ProviderName, i2gw.ProviderSpecificFlag)` function in the init function of the
provider. E.g.:
```go
const Name = "example-gateway-provider"

func init() {
i2gw.ProviderConstructorByName[Name] = NewProvider

i2gw.RegisterProviderSpecificFlag(ProviderName, i2gw.ProviderSpecificFlag{
Name: "infrastructure-labels",
Description: "Comma-separated list of Gateway infrastructure key=value labels",
DefaultValue: "",
})
}
```
Users can provide a value to the flag as follows:
```sh
./ingress2gateway print --providers=example-gateway-provider --example-gateway-provider-infrastructure-labels="app=my-app"
```
The values of all provider-specific flags supplied by the user can be retrieved from the provider `conf`:
```go
if ps := conf.ProviderSpecificFlags[ProviderName]; ps != nil {
labels := ps["infrastructure-labels"]
}
```
35 changes: 34 additions & 1 deletion cmd/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ package cmd

import (
"fmt"
"log"
"os"
"strings"

"github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw"
"github.com/samber/lo"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/cli-runtime/pkg/printers"
Expand All @@ -32,6 +34,7 @@ import (
_ "github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw/providers/ingressnginx"
_ "github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw/providers/istio"
_ "github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw/providers/kong"
_ "github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw/providers/openapi3"
)

type PrintRunner struct {
Expand Down Expand Up @@ -59,6 +62,9 @@ type PrintRunner struct {

// providers indicates which providers are used to execute convert action.
providers []string

// Provider specific flags --<provider>-<flag>.
providerSpecificFlags map[string]*string
}

// PrintGatewayAPIObjects performs necessary steps to digest and print
Expand All @@ -75,7 +81,7 @@ func (pr *PrintRunner) PrintGatewayAPIObjects(cmd *cobra.Command, _ []string) er
return fmt.Errorf("failed to initialize namespace filter: %w", err)
}

gatewayResources, err := i2gw.ToGatewayAPIResources(cmd.Context(), pr.namespaceFilter, pr.inputFile, pr.providers)
gatewayResources, err := i2gw.ToGatewayAPIResources(cmd.Context(), pr.namespaceFilter, pr.inputFile, pr.providers, pr.getProviderSpecificFlags())
if err != nil {
return err
}
Expand Down Expand Up @@ -249,6 +255,14 @@ if specified with --namespace.`)
cmd.Flags().StringSliceVar(&pr.providers, "providers", i2gw.GetSupportedProviders(),
fmt.Sprintf("If present, the tool will try to convert only resources related to the specified providers, supported values are %v.", i2gw.GetSupportedProviders()))

pr.providerSpecificFlags = make(map[string]*string)
for provider, flags := range i2gw.GetProviderSpecificFlagDefinitions() {
for _, flag := range flags {
flagName := fmt.Sprintf("%s-%s", provider, flag.Name)
pr.providerSpecificFlags[flagName] = cmd.Flags().String(flagName, flag.DefaultValue, fmt.Sprintf("Provider-specific: %s. %s", provider, flag.Description))
}
}

cmd.MarkFlagsMutuallyExclusive("namespace", "all-namespaces")
return cmd
}
Expand All @@ -262,3 +276,22 @@ func getNamespaceInCurrentContext() (string, error) {

return currentNamespace, err
}

// getProviderSpecificFlags returns the provider specific flags input by the user.
// The flags are returned in a map where the key is the provider name and the value is a map of flag name to flag value.
func (pr *PrintRunner) getProviderSpecificFlags() map[string]map[string]string {
providerSpecificFlags := make(map[string]map[string]string)
for flagName, value := range pr.providerSpecificFlags {
provider, found := lo.Find(pr.providers, func(p string) bool { return strings.HasPrefix(flagName, fmt.Sprintf("%s-", p)) })
if !found {
log.Printf("Warning: Ignoring flag %s as it does not match any of the providers", flagName)
continue
}
flagNameWithoutProvider := strings.TrimPrefix(flagName, fmt.Sprintf("%s-", provider))
if providerSpecificFlags[provider] == nil {
providerSpecificFlags[provider] = make(map[string]string)
}
providerSpecificFlags[provider][flagNameWithoutProvider] = *value
}
return providerSpecificFlags
}
58 changes: 58 additions & 0 deletions cmd/print_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"reflect"
"testing"

"github.com/google/go-cmp/cmp"
"k8s.io/cli-runtime/pkg/printers"
)

Expand Down Expand Up @@ -236,3 +237,60 @@ func Test_getNamespaceInCurrentContext(t *testing.T) {
actualNamespace, err, expectedNamespace, nil)
}
}

func Test_getProviderSpecificFlags(t *testing.T) {
value1 := "value1"
value2 := "value2"
testCases := []struct {
name string
providerSpecificFlags map[string]*string
providers []string
expected map[string]map[string]string
}{
{
name: "No provider specific configuration",
providerSpecificFlags: make(map[string]*string),
providers: []string{"provider"},
expected: map[string]map[string]string{},
},
{
name: "Provider specific configuration matching provider in the list",
providerSpecificFlags: map[string]*string{"provider-conf": &value1},
providers: []string{"provider"},
expected: map[string]map[string]string{
"provider": {"conf": value1},
},
},
{
name: "Provider specific configuration matching providers in the list with multiple providers",
providerSpecificFlags: map[string]*string{
"provider-a-conf1": &value1,
"provider-b-conf2": &value2,
},
providers: []string{"provider-a", "provider-b", "provider-c"},
expected: map[string]map[string]string{
"provider-a": {"conf1": value1},
"provider-b": {"conf2": value2},
},
},
{
name: "Provider specific configuration not matching provider in the list",
providerSpecificFlags: map[string]*string{"provider-conf": &value1},
providers: []string{"provider-a", "provider-b", "provider-c"},
expected: map[string]map[string]string{},
},
}

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
pr := PrintRunner{
providerSpecificFlags: tc.providerSpecificFlags,
providers: tc.providers,
}
actual := pr.getProviderSpecificFlags()
if diff := cmp.Diff(tc.expected, actual); diff != "" {
t.Errorf("Unexpected provider-specific flags, \n want: %+v\n got: %+v\n diff (-want +got):\n%s", tc.expected, actual, diff)
}
})
}
}
10 changes: 8 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/kubernetes-sigs/ingress2gateway
go 1.21

require (
github.com/getkin/kin-openapi v0.124.0
github.com/google/go-cmp v0.6.0
github.com/kong/kubernetes-ingress-controller/v2 v2.12.3
github.com/spf13/cobra v1.8.0
Expand All @@ -18,8 +19,13 @@ require (
)

require (
github.com/invopop/yaml v0.2.0 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/samber/lo v1.39.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
)

require (
Expand All @@ -29,9 +35,9 @@ require (
github.com/evanphx/json-patch/v5 v5.7.0 // indirect
github.com/go-errors/errors v1.5.1 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonpointer v0.20.2 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-openapi/swag v0.22.8 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/btree v1.1.2 // indirect
Expand Down
17 changes: 17 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ github.com/evanphx/json-patch/v5 v5.7.0 h1:nJqP7uwL84RJInrohHfW0Fx3awjbm8qZeFv0n
github.com/evanphx/json-patch/v5 v5.7.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/getkin/kin-openapi v0.124.0 h1:VSFNMB9C9rTKBnQ/fpyDU8ytMTr4dWI9QovSKj9kz/M=
github.com/getkin/kin-openapi v0.124.0/go.mod h1:wb1aSZA/iWmorQP9KTAS/phLj/t17B5jT7+fS8ed9NM=
github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk=
github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY=
Expand All @@ -25,11 +27,15 @@ github.com/go-logr/zapr v1.2.4/go.mod h1:FyHWQIzQORZ0QVE1BtVHv3cKtNLuXsbNLtpuhNa
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ=
github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA=
github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q=
github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs=
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-openapi/swag v0.22.8 h1:/9RjDSQ0vbFR+NyjGMkFTsA1IA0fmhKSThmfGZjicbw=
github.com/go-openapi/swag v0.22.8/go.mod h1:6QT22icPLEqAM/z/TChgb4WAveCHF92+2gF0CNjHpPI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
Expand All @@ -51,6 +57,7 @@ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec=
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20211214055906-6f57359322fd h1:1FjCyPC+syAzJ5/2S8fqdZK1R22vvA0J7JZKcuOIQ7Y=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
Expand All @@ -61,6 +68,8 @@ github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY=
github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
Expand All @@ -87,6 +96,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/2gBQ3RWajuToeY6ZtZTIKv2v7ThUy5KKusIT0yc0=
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
Expand All @@ -96,6 +107,8 @@ github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU
github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s=
github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw=
github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand All @@ -113,7 +126,10 @@ github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA=
github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
Expand Down Expand Up @@ -223,6 +239,7 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
istio.io/api v1.20.0 h1:heE1eQoMsuZlwWOf7Xm8TKqKLNKVs11G/zMe5QyR1u4=
Expand Down
7 changes: 4 additions & 3 deletions pkg/i2gw/ingress2gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
)

func ToGatewayAPIResources(ctx context.Context, namespace string, inputFile string, providers []string) ([]GatewayResources, error) {
func ToGatewayAPIResources(ctx context.Context, namespace string, inputFile string, providers []string, providerSpecificFlags map[string]map[string]string) ([]GatewayResources, error) {
var clusterClient client.Client

if inputFile == "" {
Expand All @@ -47,8 +47,9 @@ func ToGatewayAPIResources(ctx context.Context, namespace string, inputFile stri
}

providerByName, err := constructProviders(&ProviderConf{
Client: clusterClient,
Namespace: namespace,
Client: clusterClient,
Namespace: namespace,
ProviderSpecificFlags: providerSpecificFlags,
}, providers)
if err != nil {
return nil, err
Expand Down
Loading