Upgrade k8s package verison (#5358)
* upgrade k8s package version Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io> * Script upgrade and code formatting. Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io> Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>
This commit is contained in:
61
vendor/sigs.k8s.io/kustomize/kyaml/yaml/alias.go
generated
vendored
61
vendor/sigs.k8s.io/kustomize/kyaml/yaml/alias.go
generated
vendored
@@ -4,11 +4,32 @@
|
||||
package yaml
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
"sigs.k8s.io/kustomize/kyaml/internal/forked/github.com/go-yaml/yaml"
|
||||
)
|
||||
|
||||
const (
|
||||
WideSequenceStyle SequenceIndentStyle = "wide"
|
||||
CompactSequenceStyle SequenceIndentStyle = "compact"
|
||||
DefaultIndent = 2
|
||||
// BareSeqNodeWrappingKey kyaml uses reader annotations to track resources, it is not possible to
|
||||
// add them to bare sequence nodes, this key is used to wrap such bare
|
||||
// sequence nodes into map node, byteio_writer unwraps it while writing back
|
||||
BareSeqNodeWrappingKey = "bareSeqNodeWrappingKey"
|
||||
)
|
||||
|
||||
// SeqIndentType holds the indentation style for sequence nodes
|
||||
type SequenceIndentStyle string
|
||||
|
||||
// EncoderOptions are options that can be used to configure the encoder,
|
||||
// do not expose new options without considerable justification
|
||||
type EncoderOptions struct {
|
||||
// SeqIndent is the indentation style for YAML Sequence nodes
|
||||
SeqIndent SequenceIndentStyle
|
||||
}
|
||||
|
||||
// Expose the yaml.v3 functions so this package can be used as a replacement
|
||||
|
||||
type Decoder = yaml.Decoder
|
||||
@@ -21,15 +42,45 @@ type Style = yaml.Style
|
||||
type TypeError = yaml.TypeError
|
||||
type Unmarshaler = yaml.Unmarshaler
|
||||
|
||||
var Marshal = yaml.Marshal
|
||||
var Marshal = func(in interface{}) ([]byte, error) {
|
||||
var buf bytes.Buffer
|
||||
err := NewEncoder(&buf).Encode(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
var Unmarshal = yaml.Unmarshal
|
||||
var NewDecoder = yaml.NewDecoder
|
||||
var NewEncoder = func(w io.Writer) *yaml.Encoder {
|
||||
e := yaml.NewEncoder(w)
|
||||
e.SetIndent(2)
|
||||
e.SetIndent(DefaultIndent)
|
||||
e.CompactSeqIndent()
|
||||
return e
|
||||
}
|
||||
|
||||
// MarshalWithOptions marshals the input interface with provided options
|
||||
func MarshalWithOptions(in interface{}, opts *EncoderOptions) ([]byte, error) {
|
||||
var buf bytes.Buffer
|
||||
err := NewEncoderWithOptions(&buf, opts).Encode(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
// NewEncoderWithOptions returns the encoder with provided options
|
||||
func NewEncoderWithOptions(w io.Writer, opts *EncoderOptions) *yaml.Encoder {
|
||||
encoder := NewEncoder(w)
|
||||
encoder.SetIndent(DefaultIndent)
|
||||
if opts.SeqIndent == WideSequenceStyle {
|
||||
encoder.DefaultSeqIndent()
|
||||
} else {
|
||||
encoder.CompactSeqIndent()
|
||||
}
|
||||
return encoder
|
||||
}
|
||||
|
||||
var AliasNode yaml.Kind = yaml.AliasNode
|
||||
var DocumentNode yaml.Kind = yaml.DocumentNode
|
||||
var MappingNode yaml.Kind = yaml.MappingNode
|
||||
@@ -42,3 +93,7 @@ var FoldedStyle yaml.Style = yaml.FoldedStyle
|
||||
var LiteralStyle yaml.Style = yaml.LiteralStyle
|
||||
var SingleQuotedStyle yaml.Style = yaml.SingleQuotedStyle
|
||||
var TaggedStyle yaml.Style = yaml.TaggedStyle
|
||||
|
||||
const (
|
||||
MergeTag = "!!merge"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user