mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
revert 'fix kyaml issue with multiline scalars'
This commit is contained in:
@@ -6,6 +6,6 @@ This code is used by the starlark runtime. We copied it in to reduce the depende
|
|||||||
|
|
||||||
## go-yaml/yaml
|
## go-yaml/yaml
|
||||||
|
|
||||||
This code is used extensively by kyaml. It is a copy of upstream at a particular revision that kubectl is using, with fixes we need cherry-picked on top ([#753](https://github.com/go-yaml/yaml/pull/753), [#766](https://github.com/go-yaml/yaml/pull/766)). For background information on this problem, see https://github.com/kubernetes-sigs/kustomize/issues/3946.
|
This code is used extensively by kyaml. It is a copy of upstream at a particular revision that kubectl is using, with fixes we need cherry-picked on top ([#753](https://github.com/go-yaml/yaml/pull/753)). For background information on this problem, see https://github.com/kubernetes-sigs/kustomize/issues/3946.
|
||||||
|
|
||||||
This copy was created using the [git subtree technique](https://medium.com/@porteneuve/mastering-git-subtrees-943d29a798ec) and can be recreated on top of a new version of go-yaml v3 using the [update-go-yaml.sh](update-go-yaml.sh) script. To add an additional go-yaml PR to be cherry-picked, simply update the script's `GO_YAML_PRS` variable. Please note that there is nothing special about the fork directory, so copy-paste with manual edits will work just fine if you prefer.
|
This copy was created using the [git subtree technique](https://medium.com/@porteneuve/mastering-git-subtrees-943d29a798ec) and can be recreated on top of a new version of go-yaml v3 using the [update-go-yaml.sh](update-go-yaml.sh) script. To add an additional go-yaml PR to be cherry-picked, simply update the script's `GO_YAML_PRS` variable. Please note that there is nothing special about the fork directory, so copy-paste with manual edits will work just fine if you prefer.
|
||||||
|
|||||||
@@ -46,9 +46,6 @@ var unmarshalTests = []struct {
|
|||||||
map[string]string{"v": "hi"},
|
map[string]string{"v": "hi"},
|
||||||
}, {
|
}, {
|
||||||
"v: hi", map[string]interface{}{"v": "hi"},
|
"v: hi", map[string]interface{}{"v": "hi"},
|
||||||
}, {
|
|
||||||
"v: 'hi\nthis is a\nmultiline string\n'",
|
|
||||||
map[string]interface {}{"v":"hi\nthis is a\nmultiline string\n"},
|
|
||||||
}, {
|
}, {
|
||||||
"v: true",
|
"v: true",
|
||||||
map[string]string{"v": "true"},
|
map[string]string{"v": "true"},
|
||||||
|
|||||||
@@ -1699,8 +1699,8 @@ func yaml_emitter_write_single_quoted_scalar(emitter *yaml_emitter_t, value []by
|
|||||||
if !put_break(emitter) {
|
if !put_break(emitter) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
i++
|
}
|
||||||
} else if !write_break(emitter, value, &i) {
|
if !write_break(emitter, value, &i) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
//emitter.indention = true
|
//emitter.indention = true
|
||||||
|
|||||||
@@ -2653,7 +2653,7 @@ func yaml_parser_scan_flow_scalar(parser *yaml_parser_t, token *yaml_token_t, si
|
|||||||
// Do we need to fold line breaks?
|
// Do we need to fold line breaks?
|
||||||
if len(leading_break) > 0 && leading_break[0] == '\n' {
|
if len(leading_break) > 0 && leading_break[0] == '\n' {
|
||||||
if len(trailing_breaks) == 0 {
|
if len(trailing_breaks) == 0 {
|
||||||
s = append(s, '\n')
|
s = append(s, ' ')
|
||||||
} else {
|
} else {
|
||||||
s = append(s, trailing_breaks...)
|
s = append(s, trailing_breaks...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export GOYAML_SHA=$1
|
|||||||
export GOYAML_REF="goyaml-$GOYAML_SHA"
|
export GOYAML_REF="goyaml-$GOYAML_SHA"
|
||||||
|
|
||||||
# The PRs we need to cherry-pick onto the above commit
|
# The PRs we need to cherry-pick onto the above commit
|
||||||
declare -r GO_YAML_PRS=(753 766)
|
declare -r GO_YAML_PRS=(753)
|
||||||
|
|
||||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||||
declare -r REPO_ROOT
|
declare -r REPO_ROOT
|
||||||
|
|||||||
@@ -51,52 +51,6 @@ items:
|
|||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
name: "round_trip_with_multiline_scalar",
|
|
||||||
input: `
|
|
||||||
apiVersion: custom
|
|
||||||
kind: Custom
|
|
||||||
metadata:
|
|
||||||
name: my-resource
|
|
||||||
spec:
|
|
||||||
validation:
|
|
||||||
openAPIV3Schema:
|
|
||||||
description: CanonicalService is the Schema for the canonicalservices API
|
|
||||||
properties:
|
|
||||||
apiVersion:
|
|
||||||
description: 'APIVersion defines the versioned schema of this representation
|
|
||||||
of an object. Servers should convert recognized schemas to the latest
|
|
||||||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
|
|
||||||
type: string
|
|
||||||
kind:
|
|
||||||
description: 'Kind is a string value representing the REST resource this
|
|
||||||
object represents. Servers may infer this from the endpoint the client
|
|
||||||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
|
|
||||||
type: string
|
|
||||||
`,
|
|
||||||
expectedOutput: `
|
|
||||||
apiVersion: custom
|
|
||||||
kind: Custom
|
|
||||||
metadata:
|
|
||||||
name: my-resource
|
|
||||||
spec:
|
|
||||||
validation:
|
|
||||||
openAPIV3Schema:
|
|
||||||
description: CanonicalService is the Schema for the canonicalservices API
|
|
||||||
properties:
|
|
||||||
apiVersion:
|
|
||||||
description: 'APIVersion defines the versioned schema of this representation
|
|
||||||
of an object. Servers should convert recognized schemas to the latest
|
|
||||||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
|
|
||||||
type: string
|
|
||||||
kind:
|
|
||||||
description: 'Kind is a string value representing the REST resource this
|
|
||||||
object represents. Servers may infer this from the endpoint the client
|
|
||||||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
|
|
||||||
type: string
|
|
||||||
`,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name: "function_config",
|
name: "function_config",
|
||||||
input: `
|
input: `
|
||||||
|
|||||||
@@ -20,16 +20,14 @@ spec:
|
|||||||
description: Workspace is the Schema for the workspaces API
|
description: Workspace is the Schema for the workspaces API
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: |-
|
description: 'APIVersion defines the versioned schema of this representation
|
||||||
APIVersion defines the versioned schema of this representation
|
|
||||||
of an object. Servers should convert recognized schemas to the latest
|
of an object. Servers should convert recognized schemas to the latest
|
||||||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
|
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
|
||||||
type: string
|
type: string
|
||||||
kind:
|
kind:
|
||||||
description: |-
|
description: 'Kind is a string value representing the REST resource this
|
||||||
Kind is a string value representing the REST resource this
|
|
||||||
object represents. Servers may infer this from the endpoint the client
|
object represents. Servers may infer this from the endpoint the client
|
||||||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
|
||||||
type: string
|
type: string
|
||||||
metadata:
|
metadata:
|
||||||
type: object
|
type: object
|
||||||
@@ -113,9 +111,8 @@ spec:
|
|||||||
description: The key to select.
|
description: The key to select.
|
||||||
type: string
|
type: string
|
||||||
name:
|
name:
|
||||||
description: |-
|
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
|
||||||
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
|
TODO: Add other useful fields. apiVersion, kind, uid?'
|
||||||
TODO: Add other useful fields. apiVersion, kind, uid?
|
|
||||||
type: string
|
type: string
|
||||||
optional:
|
optional:
|
||||||
description: Specify whether the ConfigMap or its key
|
description: Specify whether the ConfigMap or its key
|
||||||
@@ -125,11 +122,10 @@ spec:
|
|||||||
- key
|
- key
|
||||||
type: object
|
type: object
|
||||||
fieldRef:
|
fieldRef:
|
||||||
description: |-
|
description: 'Selects a field of the pod: supports metadata.name,
|
||||||
Selects a field of the pod: supports metadata.name,
|
|
||||||
metadata.namespace, metadata.labels, metadata.annotations,
|
metadata.namespace, metadata.labels, metadata.annotations,
|
||||||
spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP,
|
spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP,
|
||||||
status.podIPs.
|
status.podIPs.'
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: Version of the schema the FieldPath is written
|
description: Version of the schema the FieldPath is written
|
||||||
@@ -143,16 +139,14 @@ spec:
|
|||||||
- fieldPath
|
- fieldPath
|
||||||
type: object
|
type: object
|
||||||
resourceFieldRef:
|
resourceFieldRef:
|
||||||
description: |-
|
description: 'Selects a resource of the container: only resources
|
||||||
Selects a resource of the container: only resources
|
|
||||||
limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage,
|
limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage,
|
||||||
requests.cpu, requests.memory and requests.ephemeral-storage)
|
requests.cpu, requests.memory and requests.ephemeral-storage)
|
||||||
are currently supported.
|
are currently supported.'
|
||||||
properties:
|
properties:
|
||||||
containerName:
|
containerName:
|
||||||
description: |-
|
description: 'Container name: required for volumes, optional
|
||||||
Container name: required for volumes, optional
|
for env vars'
|
||||||
for env vars
|
|
||||||
type: string
|
type: string
|
||||||
divisor:
|
divisor:
|
||||||
anyOf:
|
anyOf:
|
||||||
@@ -176,9 +170,8 @@ spec:
|
|||||||
be a valid secret key.
|
be a valid secret key.
|
||||||
type: string
|
type: string
|
||||||
name:
|
name:
|
||||||
description: |-
|
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
|
||||||
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
|
TODO: Add other useful fields. apiVersion, kind, uid?'
|
||||||
TODO: Add other useful fields. apiVersion, kind, uid?
|
|
||||||
type: string
|
type: string
|
||||||
optional:
|
optional:
|
||||||
description: Specify whether the Secret or its key must
|
description: Specify whether the Secret or its key must
|
||||||
|
|||||||
Reference in New Issue
Block a user