Skip to content

Commit 21f9c46

Browse files
authored
OpenAPI Provider (#157)
* Base openapi provider implementation Signed-off-by: Guilherme Cassolato <[email protected]> * Return without error from unimplemented ReadResourcesFromCluster func * Move slice helper functions Map nd Filter into the providers/common package * openapi package renamed openapi3 * thread-safe storage of specs * refactor: resource reader simplified as part of Provider and removing converter's unused fields * make provider resilient to invalid input openapi specs * Gateway and parentRefs * Declare github.com/getkin/kin-openapi as a direct dependency * Use github.com/samber/lo for handling slices based on common patterns (mapping, filtering), instead of custom implementation * Remove initialization of non converted kinds of resources TLSRoutes, TCPRoutes, ReferenceGrants * init func brought further upwards * code format * Provider-specific options --openapi3-backend and --openapi3-gateway-class-name Defined using a newly introduced system of dynamically registered provider-specific configuration flags. * provider-specific flag: --openapi3-gateway-tls-secret * ReferenceGrants for HTTPRoute to Backends and Gateway to TLS Secrets * fix: provider-specific configs for providers with dashes in the name * name Gateway and HTTPRoutes after the OAS title * fix: missing backend ref argument * update README * Support for backend port numbers * refactor: addressed comments from the pr * provider-specific conf renamed as provided-specific flags * mutex to read/write provider-specific flag definitions wrapped within a type along with the definitions themselves * minor string handling enhancements (concatenation, trim prefix) * additional comments explaining logics and reasoning throughout the code (thread-safety, helper funcs and expressions, etc) * log message in case of provider-specific flag supplied without a matching provider * more comments to explain the flow and decision of the converter * lint: typos, gofmt and false positives * return error in case of invalid OpenAPI 3.x spec --------- Signed-off-by: Guilherme Cassolato <[email protected]>
1 parent 825f587 commit 21f9c46

24 files changed

+3380
-12
lines changed

PROVIDER.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func newConverter(conf *i2gw.ProviderConf) *converter {
9696
}
9797
}
9898
```
99-
4. Create a new struct named after the provider you are implementing. This struct should embed the previous 2 structs
99+
4. Create a new struct named after the provider you are implementing. This struct should embed the previous 2 structs
100100
you created.
101101
```go
102102
package examplegateway
@@ -152,17 +152,45 @@ import (
152152
In case you want to add support for the conversion of a specific feature within a provider (see for example the canary
153153
feature of ingress-nginx) you'll want to implement a `FeatureParser` function.
154154

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

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

163163
### Testing the feature parser
164164
There are 2 main things that needs to be tested when creating a feature parser:
165165
1. The conversion logic is actually correct.
166166
2. The new function doesn't override other functions modifications.
167167
For example, if one implemented the mirror backend feature and it deletes canary weight from `BackendRefs`, we have a
168-
problem.
168+
problem.
169+
170+
## Provider-specific flags
171+
To define provider-specific flags the user can supply in the `print` command, call the
172+
`i2gw.RegisterProviderSpecificFlag(ProviderName, i2gw.ProviderSpecificFlag)` function in the init function of the
173+
provider. E.g.:
174+
```go
175+
const Name = "example-gateway-provider"
176+
177+
func init() {
178+
i2gw.ProviderConstructorByName[Name] = NewProvider
179+
180+
i2gw.RegisterProviderSpecificFlag(ProviderName, i2gw.ProviderSpecificFlag{
181+
Name: "infrastructure-labels",
182+
Description: "Comma-separated list of Gateway infrastructure key=value labels",
183+
DefaultValue: "",
184+
})
185+
}
186+
```
187+
Users can provide a value to the flag as follows:
188+
```sh
189+
./ingress2gateway print --providers=example-gateway-provider --example-gateway-provider-infrastructure-labels="app=my-app"
190+
```
191+
The values of all provider-specific flags supplied by the user can be retrieved from the provider `conf`:
192+
```go
193+
if ps := conf.ProviderSpecificFlags[ProviderName]; ps != nil {
194+
labels := ps["infrastructure-labels"]
195+
}
196+
```

cmd/print.go

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ package cmd
1818

1919
import (
2020
"fmt"
21+
"log"
2122
"os"
2223
"strings"
2324

2425
"github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw"
26+
"github.com/samber/lo"
2527
"github.com/spf13/cobra"
2628
"k8s.io/cli-runtime/pkg/genericclioptions"
2729
"k8s.io/cli-runtime/pkg/printers"
@@ -32,6 +34,7 @@ import (
3234
_ "github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw/providers/ingressnginx"
3335
_ "github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw/providers/istio"
3436
_ "github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw/providers/kong"
37+
_ "github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw/providers/openapi3"
3538
)
3639

3740
type PrintRunner struct {
@@ -59,6 +62,9 @@ type PrintRunner struct {
5962

6063
// providers indicates which providers are used to execute convert action.
6164
providers []string
65+
66+
// Provider specific flags --<provider>-<flag>.
67+
providerSpecificFlags map[string]*string
6268
}
6369

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

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

258+
pr.providerSpecificFlags = make(map[string]*string)
259+
for provider, flags := range i2gw.GetProviderSpecificFlagDefinitions() {
260+
for _, flag := range flags {
261+
flagName := fmt.Sprintf("%s-%s", provider, flag.Name)
262+
pr.providerSpecificFlags[flagName] = cmd.Flags().String(flagName, flag.DefaultValue, fmt.Sprintf("Provider-specific: %s. %s", provider, flag.Description))
263+
}
264+
}
265+
252266
cmd.MarkFlagsMutuallyExclusive("namespace", "all-namespaces")
253267
return cmd
254268
}
@@ -262,3 +276,22 @@ func getNamespaceInCurrentContext() (string, error) {
262276

263277
return currentNamespace, err
264278
}
279+
280+
// getProviderSpecificFlags returns the provider specific flags input by the user.
281+
// 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.
282+
func (pr *PrintRunner) getProviderSpecificFlags() map[string]map[string]string {
283+
providerSpecificFlags := make(map[string]map[string]string)
284+
for flagName, value := range pr.providerSpecificFlags {
285+
provider, found := lo.Find(pr.providers, func(p string) bool { return strings.HasPrefix(flagName, fmt.Sprintf("%s-", p)) })
286+
if !found {
287+
log.Printf("Warning: Ignoring flag %s as it does not match any of the providers", flagName)
288+
continue
289+
}
290+
flagNameWithoutProvider := strings.TrimPrefix(flagName, fmt.Sprintf("%s-", provider))
291+
if providerSpecificFlags[provider] == nil {
292+
providerSpecificFlags[provider] = make(map[string]string)
293+
}
294+
providerSpecificFlags[provider][flagNameWithoutProvider] = *value
295+
}
296+
return providerSpecificFlags
297+
}

cmd/print_test.go

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"reflect"
2525
"testing"
2626

27+
"github.com/google/go-cmp/cmp"
2728
"k8s.io/cli-runtime/pkg/printers"
2829
)
2930

@@ -236,3 +237,60 @@ func Test_getNamespaceInCurrentContext(t *testing.T) {
236237
actualNamespace, err, expectedNamespace, nil)
237238
}
238239
}
240+
241+
func Test_getProviderSpecificFlags(t *testing.T) {
242+
value1 := "value1"
243+
value2 := "value2"
244+
testCases := []struct {
245+
name string
246+
providerSpecificFlags map[string]*string
247+
providers []string
248+
expected map[string]map[string]string
249+
}{
250+
{
251+
name: "No provider specific configuration",
252+
providerSpecificFlags: make(map[string]*string),
253+
providers: []string{"provider"},
254+
expected: map[string]map[string]string{},
255+
},
256+
{
257+
name: "Provider specific configuration matching provider in the list",
258+
providerSpecificFlags: map[string]*string{"provider-conf": &value1},
259+
providers: []string{"provider"},
260+
expected: map[string]map[string]string{
261+
"provider": {"conf": value1},
262+
},
263+
},
264+
{
265+
name: "Provider specific configuration matching providers in the list with multiple providers",
266+
providerSpecificFlags: map[string]*string{
267+
"provider-a-conf1": &value1,
268+
"provider-b-conf2": &value2,
269+
},
270+
providers: []string{"provider-a", "provider-b", "provider-c"},
271+
expected: map[string]map[string]string{
272+
"provider-a": {"conf1": value1},
273+
"provider-b": {"conf2": value2},
274+
},
275+
},
276+
{
277+
name: "Provider specific configuration not matching provider in the list",
278+
providerSpecificFlags: map[string]*string{"provider-conf": &value1},
279+
providers: []string{"provider-a", "provider-b", "provider-c"},
280+
expected: map[string]map[string]string{},
281+
},
282+
}
283+
284+
for _, tc := range testCases {
285+
t.Run(tc.name, func(t *testing.T) {
286+
pr := PrintRunner{
287+
providerSpecificFlags: tc.providerSpecificFlags,
288+
providers: tc.providers,
289+
}
290+
actual := pr.getProviderSpecificFlags()
291+
if diff := cmp.Diff(tc.expected, actual); diff != "" {
292+
t.Errorf("Unexpected provider-specific flags, \n want: %+v\n got: %+v\n diff (-want +got):\n%s", tc.expected, actual, diff)
293+
}
294+
})
295+
}
296+
}

go.mod

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/kubernetes-sigs/ingress2gateway
33
go 1.21
44

55
require (
6+
github.com/getkin/kin-openapi v0.124.0
67
github.com/google/go-cmp v0.6.0
78
github.com/kong/kubernetes-ingress-controller/v2 v2.12.3
89
github.com/spf13/cobra v1.8.0
@@ -18,8 +19,13 @@ require (
1819
)
1920

2021
require (
22+
github.com/invopop/yaml v0.2.0 // indirect
2123
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
24+
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
25+
github.com/perimeterx/marshmallow v1.1.5 // indirect
2226
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
27+
github.com/samber/lo v1.39.0 // indirect
28+
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
2329
)
2430

2531
require (
@@ -29,9 +35,9 @@ require (
2935
github.com/evanphx/json-patch/v5 v5.7.0 // indirect
3036
github.com/go-errors/errors v1.5.1 // indirect
3137
github.com/go-logr/logr v1.3.0 // indirect
32-
github.com/go-openapi/jsonpointer v0.20.0 // indirect
38+
github.com/go-openapi/jsonpointer v0.20.2 // indirect
3339
github.com/go-openapi/jsonreference v0.20.2 // indirect
34-
github.com/go-openapi/swag v0.22.4 // indirect
40+
github.com/go-openapi/swag v0.22.8 // indirect
3541
github.com/gogo/protobuf v1.3.2 // indirect
3642
github.com/golang/protobuf v1.5.3 // indirect
3743
github.com/google/btree v1.1.2 // indirect

go.sum

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ github.com/evanphx/json-patch/v5 v5.7.0 h1:nJqP7uwL84RJInrohHfW0Fx3awjbm8qZeFv0n
1616
github.com/evanphx/json-patch/v5 v5.7.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ=
1717
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
1818
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
19+
github.com/getkin/kin-openapi v0.124.0 h1:VSFNMB9C9rTKBnQ/fpyDU8ytMTr4dWI9QovSKj9kz/M=
20+
github.com/getkin/kin-openapi v0.124.0/go.mod h1:wb1aSZA/iWmorQP9KTAS/phLj/t17B5jT7+fS8ed9NM=
1921
github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk=
2022
github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
2123
github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY=
@@ -25,11 +27,15 @@ github.com/go-logr/zapr v1.2.4/go.mod h1:FyHWQIzQORZ0QVE1BtVHv3cKtNLuXsbNLtpuhNa
2527
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
2628
github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ=
2729
github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA=
30+
github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q=
31+
github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs=
2832
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
2933
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
3034
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
3135
github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
3236
github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
37+
github.com/go-openapi/swag v0.22.8 h1:/9RjDSQ0vbFR+NyjGMkFTsA1IA0fmhKSThmfGZjicbw=
38+
github.com/go-openapi/swag v0.22.8/go.mod h1:6QT22icPLEqAM/z/TChgb4WAveCHF92+2gF0CNjHpPI=
3339
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
3440
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
3541
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
@@ -51,6 +57,7 @@ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
5157
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
5258
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec=
5359
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
60+
github.com/google/pprof v0.0.0-20211214055906-6f57359322fd h1:1FjCyPC+syAzJ5/2S8fqdZK1R22vvA0J7JZKcuOIQ7Y=
5461
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
5562
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
5663
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
@@ -61,6 +68,8 @@ github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
6168
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
6269
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
6370
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
71+
github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY=
72+
github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q=
6473
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
6574
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
6675
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
@@ -87,6 +96,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
8796
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
8897
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
8998
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
99+
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
100+
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
90101
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/2gBQ3RWajuToeY6ZtZTIKv2v7ThUy5KKusIT0yc0=
91102
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4=
92103
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
@@ -96,6 +107,8 @@ github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU
96107
github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM=
97108
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
98109
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
110+
github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s=
111+
github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw=
99112
github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI=
100113
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
101114
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -113,7 +126,10 @@ github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k
113126
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
114127
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
115128
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
129+
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
116130
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
131+
github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA=
132+
github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
117133
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
118134
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
119135
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
@@ -223,6 +239,7 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
223239
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
224240
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
225241
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
242+
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
226243
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
227244
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
228245
istio.io/api v1.20.0 h1:heE1eQoMsuZlwWOf7Xm8TKqKLNKVs11G/zMe5QyR1u4=

pkg/i2gw/ingress2gateway.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1"
3131
)
3232

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

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

4949
providerByName, err := constructProviders(&ProviderConf{
50-
Client: clusterClient,
51-
Namespace: namespace,
50+
Client: clusterClient,
51+
Namespace: namespace,
52+
ProviderSpecificFlags: providerSpecificFlags,
5253
}, providers)
5354
if err != nil {
5455
return nil, err

0 commit comments

Comments
 (0)