Help us shape the future of Go! Take the 2026 Go Developer Survey

convert

package
v1.22.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 35 Imported by: 0

README

glooctl gateway-api convert

A CLI tool to migrate from Gloo Edge APIs to the Kubernetes Gateway API.

The CLI accepts a single Kubernetes YAML file or a Gloo Gateway input snapshot. It can also scan an entire directory to find Gloo Gateway YAML files that use the Gloo Edge API.

Requirements

  • Gloo Gateway and VirtualService objects must be provided and correctly associated for conversion. The tool matches the correct VirtualService with the Gateway based on its selectors.
  • This tool defines all Listeners using xListenerSet which is a beta feature in Gateway API. See ListenerSets
  • To apply the generated CRDs you must apply the latest experimental schema definition from here. CustomResourceDefinition
  • This must be used with Gloo Gateway version 1.19 or greater
  • The generated output must be written to a new empty directory, Use --delete-output-dir to have the tool delete it before starting

Use

  • Read a single input yaml file and generate Gateway API Output
glooctl gateway-api convert --input-file gloo-yamls.yaml --output-dir ./_output
  • Scan a nested directory for .yaml and .yml files and convert them to the Gateway API.
glooctl gateway-api convert --input-dir ./gloo-configs --output-dir ./_output --retain-input-folder-structure
  • Generate Gateway API YAML files from a Gloo Gateway input snapshot.
kubectl -n gloo-system port-forward deploy/gloo 9091
curl localhost:9091/snapshots/input > gg-input.json

glooctl gateway-api convert --input-snapshot gg-input.json --output-dir ./_output

Output Formats

  • Files by namespace: By default, a separate file is created for each generated Gateway API resource. All resources are placed into namespace-specific directories.
  • Retain input folder structure: When you convert files in a givenCI/CD pipeline folder structure, you might want to retain the generated configuration in the files they were converted from. To do this, add the --retain-input-folder-structure option.

Documentation

Index

Constants

View Source
const (
	RandomSuffix = 4
	RandomSeed   = 1
)
View Source
const (
	ERROR_TYPE_UPDATE_OBJECT             ErrorType = "UPDATE_OBJECT"
	ERROR_TYPE_NOT_SUPPORTED                       = "NOT_SUPPORTED"
	ERROR_TYPE_IGNORED                             = "IGNORED"
	ERROR_TYPE_UNKNOWN_REFERENCE                   = "UNKNOWN_REFERENCE"
	ERROR_TYPE_NO_REFERENCES                       = "NO_REFERENCES"
	ERROR_TYPE_CEL_VALIDATION_CORRECTION           = "CEL_VALIDATION_CORRECTION"
)

Variables

This section is empty.

Functions

func NewPortForwardedClient

func NewPortForwardedClient(ctx context.Context, kubectlCli *kubectl.Cli, proxySelector, namespace string) (*admincli.Client, func(), error)

func RandStringRunes

func RandStringRunes(n int) string

func RootCmd

func RootCmd(op *options.Options) *cobra.Command

Types

type ErrorType

type ErrorType string

type GatewayAPICache added in v1.20.0

func (*GatewayAPICache) AddAuthConfig added in v1.20.0

func (g *GatewayAPICache) AddAuthConfig(a *snapshot.AuthConfigWrapper)

func (*GatewayAPICache) AddDirectResponse added in v1.20.0

func (g *GatewayAPICache) AddDirectResponse(d *snapshot.DirectResponseWrapper)

func (*GatewayAPICache) AddGateway added in v1.20.0

func (g *GatewayAPICache) AddGateway(gw *snapshot.GatewayWrapper)

func (*GatewayAPICache) AddHTTPListenerOption added in v1.20.0

func (g *GatewayAPICache) AddHTTPListenerOption(h *snapshot.HTTPListenerOptionWrapper)

func (*GatewayAPICache) AddHTTPRoute added in v1.20.0

func (g *GatewayAPICache) AddHTTPRoute(route *snapshot.HTTPRouteWrapper)

func (*GatewayAPICache) AddListenerOption added in v1.20.0

func (g *GatewayAPICache) AddListenerOption(l *snapshot.ListenerOptionWrapper)

func (*GatewayAPICache) AddListenerSet added in v1.20.0

func (g *GatewayAPICache) AddListenerSet(l *snapshot.ListenerSetWrapper)

func (*GatewayAPICache) AddRouteOption added in v1.20.0

func (g *GatewayAPICache) AddRouteOption(r *snapshot.RouteOptionWrapper)

func (*GatewayAPICache) AddSettings added in v1.20.0

func (g *GatewayAPICache) AddSettings(s *snapshot.SettingsWrapper)

func (*GatewayAPICache) AddUpstream added in v1.20.0

func (g *GatewayAPICache) AddUpstream(u *snapshot.UpstreamWrapper)

func (*GatewayAPICache) AddVirtualHostOption added in v1.20.0

func (g *GatewayAPICache) AddVirtualHostOption(v *snapshot.VirtualHostOptionWrapper)

func (*GatewayAPICache) AddYAML added in v1.20.0

func (g *GatewayAPICache) AddYAML(y *snapshot.YAMLWrapper)

func (*GatewayAPICache) GetGateway added in v1.20.0

func (g *GatewayAPICache) GetGateway(namespacedName types.NamespacedName) *snapshot.GatewayWrapper

type GatewayAPIOutput

type GatewayAPIOutput struct {
	// contains filtered or unexported fields
}

func NewGatewayAPIOutput

func NewGatewayAPIOutput() *GatewayAPIOutput

func (*GatewayAPIOutput) AddError

func (o *GatewayAPIOutput) AddError(errType ErrorType, msg string, args ...interface{})

func (*GatewayAPIOutput) AddErrorFromWrapper

func (o *GatewayAPIOutput) AddErrorFromWrapper(errType ErrorType, wrapper snapshot.Wrapper, msg string, args ...interface{})

func (*GatewayAPIOutput) Convert

func (o *GatewayAPIOutput) Convert() error

func (*GatewayAPIOutput) EdgeCache added in v1.20.0

func (o *GatewayAPIOutput) EdgeCache(instance *snapshot.Instance)

func (*GatewayAPIOutput) GetEdgeCache added in v1.20.0

func (o *GatewayAPIOutput) GetEdgeCache() *snapshot.Instance

func (*GatewayAPIOutput) GetGatewayAPICache added in v1.20.0

func (o *GatewayAPIOutput) GetGatewayAPICache() *GatewayAPICache

func (*GatewayAPIOutput) PostProcess

func (o *GatewayAPIOutput) PostProcess(opts *Options) error

func (*GatewayAPIOutput) PreProcess

func (o *GatewayAPIOutput) PreProcess(splitMatchers bool) error

func (*GatewayAPIOutput) PrintMetrics added in v1.20.0

func (o *GatewayAPIOutput) PrintMetrics(filesEvaluated int)

func (*GatewayAPIOutput) Write

func (o *GatewayAPIOutput) Write(opts *Options) error

type GlooError

type GlooError struct {
	// contains filtered or unexported fields
}

type Options

type Options struct {
	*options.Options
	InputFile               string
	InputDir                string
	GlooSnapshotFile        string
	OutputDir               string
	Stats                   bool
	CombineRouteOptions     bool
	RetainFolderStructure   bool
	IncludeUnknownResources bool
	DeleteOutputDir         bool
	CreateNamespaces        bool
	ControlPlaneName        string
	ControlPlaneNamespace   string
}

type YamlMarshaller

type YamlMarshaller struct{}

func (YamlMarshaller) ToYaml

func (YamlMarshaller) ToYaml(resource interface{}) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL