iosnapshot

package
v1.18.0-beta28 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Json marshals the data into json, with indents included
	Json = iota

	// JsonCompact marshals the data into json, but without indents
	JsonCompact

	// Yaml marshals the data into yaml
	Yaml
)

Variables

View Source
var (
	KubernetesCoreGVKs = []schema.GroupVersionKind{
		wellknownkube.SecretGVK,
		wellknownkube.ConfigMapGVK,
	}

	GlooGVKs = []schema.GroupVersionKind{
		gloov1.SettingsGVK,
		gloov1.UpstreamGVK,
		gloov1.UpstreamGroupGVK,
		gloov1.ProxyGVK,
	}

	// PolicyGVKs is the set of GVKs that are used by a classic Gloo Gateway installation.
	// This is the common set of GVKs that are available when Edge Gateway APIs are being
	// used. See KubernetesGatewayIntegrationPolicyGVKs for the set of GVKs that are added
	// when the Kubernetes Gateway API is enabled
	PolicyGVKs = []schema.GroupVersionKind{
		gatewayv1.VirtualHostOptionGVK,
		gatewayv1.RouteOptionGVK,
	}

	EdgeGatewayGVKs = []schema.GroupVersionKind{
		gatewayv1.GatewayGVK,
		gatewayv1.MatchableHttpGatewayGVK,
		gatewayv1.MatchableTcpGatewayGVK,
		gatewayv1.VirtualServiceGVK,
		gatewayv1.RouteTableGVK,
	}

	KubernetesGatewayGVKs = []schema.GroupVersionKind{
		wellknown.GatewayClassGVK,
		wellknown.GatewayGVK,
		wellknown.HTTPRouteGVK,
		wellknown.ReferenceGrantGVK,
	}

	KubernetesGatewayIntegrationPolicyGVKs = []schema.GroupVersionKind{
		v1alpha1.GatewayParametersGVK,

		gatewayv1.ListenerOptionGVK,
		gatewayv1.HttpListenerOptionGVK,
	}

	EdgeOnlyInputSnapshotGVKs = slices.Concat(
		KubernetesCoreGVKs,
		GlooGVKs,
		PolicyGVKs,
		EdgeGatewayGVKs,
	)

	// CompleteInputSnapshotGVKs is the list of GVKs that will be returned by the InputSnapshot API
	CompleteInputSnapshotGVKs = slices.Concat(
		EdgeOnlyInputSnapshotGVKs,
		KubernetesGatewayGVKs,
		KubernetesGatewayIntegrationPolicyGVKs,
	)
)

Functions

This section is empty.

Types

type History

type History interface {
	// SetApiSnapshot sets the latest Edge ApiSnapshot.
	SetApiSnapshot(latestInput *v1snap.ApiSnapshot)

	// GetInputSnapshot returns all resources in the Edge input snapshot, and if Kubernetes
	// Gateway integration is enabled, it additionally returns all resources on the cluster
	// with types specified by `inputSnapshotGvks`.
	GetInputSnapshot(ctx context.Context) SnapshotResponseData

	// GetEdgeApiSnapshot returns all resources in the Edge input snapshot
	GetEdgeApiSnapshot(ctx context.Context) SnapshotResponseData

	// GetProxySnapshot returns the Proxies generated for all components.
	GetProxySnapshot(ctx context.Context) SnapshotResponseData

	// GetXdsSnapshot returns the entire cache of xDS snapshots
	// NOTE: This contains sensitive data, as it is the exact inputs that used by Envoy
	GetXdsSnapshot(ctx context.Context) SnapshotResponseData
}

History represents an object that maintains state about the running system The ControlPlane will use the Setters to update the last known state, and the Getters will be used by the Admin Server

func NewHistory

func NewHistory(cache cache.SnapshotCache, settings *gloov1.Settings, kubeClient client.Client, kubeGatewayGvks []schema.GroupVersionKind) History

NewHistory returns an implementation of the History interface

  • `cache` is the control plane's xDS snapshot cache
  • `settings` specifies the Settings for this control plane instance
  • `inputSnapshotGvks` specifies the list of resource types to return in the input snapshot when Kubernetes Gateway integration is enabled. For example, this may include Gateway API resources, Portal resources, or other resources specific to the Kubernetes Gateway integration. If not set, then only Edge ApiSnapshot resources will be returned from `GetInputSnapshot`.

type HistoryFactory added in v1.17.1

type HistoryFactory func(params HistoryFactoryParameters) History

HistoryFactory is a function that produces a History object

func GetHistoryFactory added in v1.17.1

func GetHistoryFactory() HistoryFactory

GetHistoryFactory returns a default HistoryFactory implementation

type HistoryFactoryParameters added in v1.17.1

type HistoryFactoryParameters struct {
	Settings                    *gloov1.Settings
	Cache                       cache.SnapshotCache
	EnableK8sGatewayIntegration bool
}

HistoryFactoryParameters are the inputs used to create a History object

type OutputFormat added in v1.17.4

type OutputFormat int

OutputFormat identifies the format to output an object

func (OutputFormat) String added in v1.17.4

func (f OutputFormat) String() string

type SnapshotResponseData added in v1.17.4

type SnapshotResponseData struct {
	Data  interface{} `json:"data"`
	Error error       `json:"error"`
}

SnapshotResponseData is the data that is returned by Getter methods on the History object It allows us to encapsulate data and errors together, so that if an issue occurs during the request, we can get access to all the relevant information

func (SnapshotResponseData) Format added in v1.17.4

func (r SnapshotResponseData) Format(format OutputFormat) ([]byte, error)

func (SnapshotResponseData) MarshalJSON added in v1.17.4

func (r SnapshotResponseData) MarshalJSON() ([]byte, error)

func (SnapshotResponseData) MarshalJSONString added in v1.17.4

func (r SnapshotResponseData) MarshalJSONString() string

Jump to

Keyboard shortcuts

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