util

package
v2.13.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsOneOfField

func IsOneOfField(field reflect.StructField) bool

IsOneOfField checks if a field is tagged with oneOf

func UnmarshalClusterVolumes

func UnmarshalClusterVolumes(value *yaml.Node) (volumes []v1.Volume, remaining []byte, result error)

UnmarshalClusterVolumes provides a helper function to for a custom unmarshler to deal with https://github.com/GoogleContainerTools/skaffold/issues/4175

func UnmarshalKanikoArtifact

func UnmarshalKanikoArtifact(value *yaml.Node) (mounts []v1.VolumeMount, remaining []byte, result error)

UnmarshalKanikoArtifact provides a helper function to for a custom unmarshaller to deal with https://github.com/GoogleContainerTools/skaffold/issues/4175

func UpgradePipelines

func UpgradePipelines(oldConfig, newConfig interface{}, upgrade func(o, n interface{}) error) (err error)

Types

type FlatMap

type FlatMap map[string]string

FlatMap flattens deeply nested yaml into a map with corresponding dot separated keys

func (*FlatMap) UnmarshalYAML

func (m *FlatMap) UnmarshalYAML(unmarshal func(interface{}) error) error

type HelmOverrides

type HelmOverrides struct {
	Values map[string]interface{} `yaml:",inline"`
}

HelmOverrides is a helper struct to aid with json serialization of map[string]interface{}

func (*HelmOverrides) MarshalJSON

func (h *HelmOverrides) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON marshalling by including the value as an inline yaml fragment.

func (*HelmOverrides) UnmarshalJSON

func (h *HelmOverrides) UnmarshalJSON(text []byte) error

UnmarshalYAML implements JSON unmarshalling by reading an inline yaml fragment.

type IntOrString

type IntOrString struct {
	Type   Type
	IntVal int
	StrVal string
}

func FromInt

func FromInt(val int) IntOrString

FromInt creates an IntOrString object with an int32 value.

func FromString

func FromString(val string) IntOrString

FromString creates an IntOrString object with a string value.

func (IntOrString) MarshalJSON

func (t IntOrString) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (IntOrString) MarshalYAML

func (t IntOrString) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Marshaler interface.

func (*IntOrString) String

func (t *IntOrString) String() string

String returns the string value, or the Itoa of the int value.

func (*IntOrString) UnmarshalJSON

func (t *IntOrString) UnmarshalJSON(value []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*IntOrString) UnmarshalYAML

func (t *IntOrString) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type Type

type Type int
const (
	Int    Type = iota // The IntOrString holds an int.
	String             // The IntOrString holds a string.
)

type VersionedConfig

type VersionedConfig interface {
	GetVersion() string
	Upgrade() (VersionedConfig, error)
}

type YamlpatchNode

type YamlpatchNode struct {
	// node is an arbitrary yaml fragment
	Node yamlpatch.Node
}

YamlpatchNode wraps a `yamlpatch.Node` and makes it serializable to JSON. The yaml serialization needs to be implemented manually, because the node may be an arbitrary yaml fragment so that a field tag `yaml:",inline"` does not work here.

func (*YamlpatchNode) MarshalJSON

func (n *YamlpatchNode) MarshalJSON() ([]byte, error)

MarshalJSON implements JSON marshalling by including the value as an inline yaml fragment.

func (*YamlpatchNode) MarshalYAML

func (n *YamlpatchNode) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (*YamlpatchNode) UnmarshalJSON

func (n *YamlpatchNode) UnmarshalJSON(text []byte) error

UnmarshalYAML implements JSON unmarshalling by reading an inline yaml fragment.

func (*YamlpatchNode) UnmarshalYAML

func (n *YamlpatchNode) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler

Jump to

Keyboard shortcuts

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