Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error parsing unquoted timestamp in ConfigGroup #501

Closed
hazsetata opened this issue Mar 26, 2019 · 3 comments · Fixed by #638
Closed

Error parsing unquoted timestamp in ConfigGroup #501

hazsetata opened this issue Mar 26, 2019 · 3 comments · Fixed by #638
Assignees
Labels
area/sdk Related to the Kubernetes SDKs (nodejs, Python, etc.) kind/bug Some behavior is incorrect or out of spec

Comments

@hazsetata
Copy link

Trying to add a YAML file as ConfigGroup like this:

let linkerdCG = new k8s.yaml.ConfigGroup("linkerd-cg",
    {
        files: "t.yaml",
    },
    {
        providers: {
            kubernetes: kubernetesCluster.kubernetesProvider
        },
        dependsOn: [ kubernetesCluster.kubernetesProvider ]
    }
);

with t.yaml's content being:

---
kind: Namespace
apiVersion: v1
metadata:
  name: linkerd
  annotations:
    linkerd.io/inject: disabled
---
kind: Secret
apiVersion: v1
metadata:
  name: linkerd-identity-issuer
  namespace: linkerd
  labels:
    linkerd.io/control-plane-component: identity
  annotations:
    linkerd.io/created-by: linkerd/cli edge-19.3.3
    linkerd.io/identity-issuer-expiry: 2020-03-25T13:37:11Z
data:
  crt.pem: ZXhhbXBsZQ==
  key.pem: dmFsdWU=

results in an error:

error: Plan apply failed: Secret in version "v1" cannot be handled as a Secret: v1.Secret.ObjectMeta: v1.ObjectMeta.Annotations: ReadString: expects " or n, but found {, error found in #10 byte of ...|-expiry":{}},"labels|..., bigger context ...|edge-19.3.3","linkerd.io/identity-issuer-expiry":{}},"labels":{"app.kubernetes.io/managed-by":"pulum|...

kubectl apply -f t.yaml succeeds, also if the date at the error position is double-quoted ("2020-03-25T13:37:11Z") it succeeds.

@hausdorff hausdorff added area/sdk Related to the Kubernetes SDKs (nodejs, Python, etc.) kind/bug Some behavior is incorrect or out of spec labels Mar 26, 2019
@hausdorff
Copy link
Contributor

Thanks for the report! This seems like a bug in either their our our YAML parser. I do wonder how many problems like this there are... cc @lblackstone

@hausdorff
Copy link
Contributor

I think we should serialize all values in annotations as a string, because that is the type the Kubernetes OpenAPI spec asks for.

The sequence of events that happens right now is: this gets parsed by js-yaml correctly into a Date, which then gets sent to the Secret constructor, which happily sends it to the Kubernetes provider serialized this not as a string but as an empty gRPC struct. client-go sees this empty struct and happily ignores it.

@hausdorff
Copy link
Contributor

Actually, looking at the Kubernetes data structures in client-go, it seems like they only have json: tags on their fields -- so an even simpler solution is to just use the JSON datatype schema for deserialization.

hausdorff added a commit that referenced this issue Jul 13, 2019
hausdorff added a commit that referenced this issue Jul 13, 2019
The fields of the Kubernetes core resource types are tagged with Go's
`"json:"` serialization metadata. They expect things like JavaScript's
`Date` to be serialized as string.

Fixes #501.
hausdorff added a commit that referenced this issue Jul 15, 2019
The fields of the Kubernetes core resource types are tagged with Go's
`"json:"` serialization metadata. They expect things like JavaScript's
`Date` to be serialized as string.

Fixes #501.
lblackstone pushed a commit that referenced this issue Jul 22, 2019
The fields of the Kubernetes core resource types are tagged with Go's
`"json:"` serialization metadata. They expect things like JavaScript's
`Date` to be serialized as string.

Fixes #501.
@hausdorff hausdorff added this to backlog in Q3 Kubernetes Jul 22, 2019
lblackstone pushed a commit that referenced this issue Jul 22, 2019
The fields of the Kubernetes core resource types are tagged with Go's
`"json:"` serialization metadata. They expect things like JavaScript's
`Date` to be serialized as string.

Fixes #501.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sdk Related to the Kubernetes SDKs (nodejs, Python, etc.) kind/bug Some behavior is incorrect or out of spec
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants