Documentation
¶
Index ¶
- Variables
- func MustPrettyPrint(data any)
- func NamespaceForTest(name string) *corev1.Namespace
- func NewDefaultGroupKindFetcher(factory Factory, options ...groupKindFetcherOption) *defaultGroupKindFetcher
- func WithAdditionalResources(resources []*unstructured.Unstructured) groupKindFetcherOption
- type Factory
- type GKNN
- type GroupKindFetcher
- type JSONString
- type MultiLine
- type ReferenceFromTo
- type ReferenceNotPermittedError
- type ReferenceToNonExistentResourceError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( GatewayClassGK schema.GroupKind = schema.GroupKind{Group: gatewayv1.GroupName, Kind: "GatewayClass"} GatewayGK schema.GroupKind = schema.GroupKind{Group: gatewayv1.GroupName, Kind: "Gateway"} HTTPRouteGK schema.GroupKind = schema.GroupKind{Group: gatewayv1.GroupName, Kind: "HTTPRoute"} NamespaceGK schema.GroupKind = schema.GroupKind{Group: corev1.GroupName, Kind: "Namespace"} ServiceGK schema.GroupKind = schema.GroupKind{Group: corev1.GroupName, Kind: "Service"} ReferenceGrantGK schema.GroupKind = schema.GroupKind{Group: gatewayv1beta1.GroupName, Kind: "ReferenceGrant"} PolicyGK schema.GroupKind = schema.GroupKind{Group: gwctlPolicyGroup, Kind: "Policy"} PolicyCRDGK schema.GroupKind = schema.GroupKind{Group: gwctlPolicyGroup, Kind: "PolicyCRD"} )
View Source
var MultiLineTransformer = cmp.Transformer("MultiLine", func(m MultiLine) []string { return strings.Split(string(m), "\n") })
MultiLineTransformer transforms a MultiLine into a slice of strings by splitting on each new line. This allows the diffing function (used in tests) to compare each line independently. The result is that the diff output marks each line where a diff was observed.
Functions ¶
func MustPrettyPrint ¶
func MustPrettyPrint(data any)
func NamespaceForTest ¶
func NewDefaultGroupKindFetcher ¶
func NewDefaultGroupKindFetcher(factory Factory, options ...groupKindFetcherOption) *defaultGroupKindFetcher
func WithAdditionalResources ¶
func WithAdditionalResources(resources []*unstructured.Unstructured) groupKindFetcherOption
Types ¶
type Factory ¶
type Factory interface { NewBuilder() *resource.Builder KubeConfigNamespace() (string, bool, error) }
func NewFactory ¶
func NewFactory(clientGetter genericclioptions.RESTClientGetter) Factory
type GKNN ¶
type GKNN struct { Group string `json:",omitempty"` Kind string `json:",omitempty"` Namespace string `json:",omitempty"` Name string `json:",omitempty"` }
func GKNNFromUnstructured ¶
func GKNNFromUnstructured(u *unstructured.Unstructured) GKNN
func (GKNN) MarshalText ¶
func (GKNN) NamespacedName ¶
func (g GKNN) NamespacedName() types.NamespacedName
type GroupKindFetcher ¶
type GroupKindFetcher interface {
Fetch(gk schema.GroupKind) ([]*unstructured.Unstructured, error)
}
type JSONString ¶
type JSONString string
func (JSONString) CmpDiff ¶
func (src JSONString) CmpDiff(tgt JSONString) (diff string, err error)
type MultiLine ¶
type MultiLine string
MultiLine defines a custom type for wrapping texts spanning multilpe lines. It makes use of MultiLineTransformer to generate slightly better diffing output from cmp.Diff() for multi-line texts.
type ReferenceFromTo ¶
type ReferenceNotPermittedError ¶
type ReferenceNotPermittedError struct {
ReferenceFromTo
}
func (ReferenceNotPermittedError) Error ¶
func (r ReferenceNotPermittedError) Error() string
type ReferenceToNonExistentResourceError ¶
type ReferenceToNonExistentResourceError struct {
ReferenceFromTo
}
func (ReferenceToNonExistentResourceError) Error ¶
func (r ReferenceToNonExistentResourceError) Error() string
Click to show internal directories.
Click to hide internal directories.