convert

package
v1.19.2 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: Apache-2.0 Imports: 42 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 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 domain.Wrapper, msg string, args ...interface{})

func (*GatewayAPIOutput) AddObjectToGatewayAPIOutput

func (g *GatewayAPIOutput) AddObjectToGatewayAPIOutput(obj runtime.Object, fileName string, resourceYaml string)

func (*GatewayAPIOutput) Convert

func (g *GatewayAPIOutput) Convert() error

func (*GatewayAPIOutput) Load

func (g *GatewayAPIOutput) Load(files []string, isSnapshotFile bool) error

func (*GatewayAPIOutput) PostProcess

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

func (*GatewayAPIOutput) PreProcess

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

func (*GatewayAPIOutput) Write

func (g *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 SnapshotResponseData

type SnapshotResponseData struct {
	Data []map[string]interface{} `json:"data"`
}

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