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

default no providers, mark providers required #159

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
validate openapi exclusivity
  • Loading branch information
LiorLieberman committed Jun 13, 2024
commit be8c05160064da96b319c6eaf9ec7dffbab41eb9
8 changes: 8 additions & 0 deletions cmd/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package cmd
import (
"fmt"
"os"
"slices"
"strings"

"github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw"
Expand Down Expand Up @@ -237,6 +238,13 @@ func newPrintCommand() *cobra.Command {
Use: "print",
Short: "Prints Gateway API objects generated from ingress and provider-specific resources.",
RunE: pr.PrintGatewayAPIObjects,
PreRunE: func(cmd *cobra.Command, args []string) error {
openAPIExist := slices.Contains(pr.providers, "openapi3")
if openAPIExist && len(pr.providers) != 1 {
return fmt.Errorf("openapi3 must be the only provider when specified")
}
return nil
},
}

cmd.Flags().StringVarP(&pr.outputFormat, "output", "o", "yaml",
Expand Down
4 changes: 0 additions & 4 deletions pkg/i2gw/providers/kong/resource_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ import (
"github.com/kubernetes-sigs/ingress2gateway/pkg/i2gw/providers/common"
)

var count int

// converter implements the i2gw.CustomResourceReader interface.
type resourceReader struct {
conf *i2gw.ProviderConf
Expand Down Expand Up @@ -90,8 +88,6 @@ func (r *resourceReader) readResourcesFromFile(filename string) (*storage, error
// -----------------------------------------------------------------------------

func (r *resourceReader) readTCPIngressesFromCluster(ctx context.Context) ([]kongv1beta1.TCPIngress, error) {
count++
fmt.Println(count)
tcpIngressList := &unstructured.UnstructuredList{}
tcpIngressList.SetGroupVersionKind(tcpIngressGVK)

Expand Down
Loading