Code Monkey home page Code Monkey logo

Comments (3)

tomwilkie avatar tomwilkie commented on June 1, 2024

Same problem with the beta2 libraries:

Toms-MacBook-Pro:private twilkie$ cat test.jsonnet 
local k = import "ksonnet.beta.2/k8s.libsonnet";

k.core.v1.service.new() +
  k.core.v1.service.mixin.metadata.name("frontend") +
  k.core.v1.service.mixin.spec.selector({name: "frontend"})
Toms-MacBook-Pro:private twilkie$ jsonnet -J production/ksonnet-lib ./test.jsonnet 
{
   "apiVersion": "v1",
   "kind": "Service",
   "metadata": {
      "name": "frontend"
   },
   "spec": {
      "selector": {
         "name": "frontend"
      }
   }
}
Toms-MacBook-Pro:private twilkie$ kubecfg -J production/ksonnet-lib show ./test.jsonnet 
Error: Error reading ./test.jsonnet: RUNTIME ERROR: Field does not exist: metadata
		object <anonymous>
	During manifestation	

from kubecfg.

tomwilkie avatar tomwilkie commented on June 1, 2024

Super minimal repro:

$ cat test.jsonnet 
{kind: "bar"} + {apiVersion+: "baz"}
Toms-MacBook-Pro:private twilkie$ jsonnet -J production/ksonnet-lib ./test.jsonnet 
{
   "apiVersion": "baz",
   "kind": "bar"
}
Toms-MacBook-Pro:private twilkie$ kubecfg -J production/ksonnet-lib show ./test.jsonnet 
Error: Error reading ./test.jsonnet: RUNTIME ERROR: Field does not exist: apiVersion
		object <anonymous>
	During manifestation	

from kubecfg.

tomwilkie avatar tomwilkie commented on June 1, 2024

If I just use jsonnet_cgo to parse the file, it works:

Toms-MacBook-Pro:jsonnet_cgo twilkie$ cat test.jsonnet 
{kind: "bar"} + {apiVersion+: "baz"}
Toms-MacBook-Pro:jsonnet_cgo twilkie$ ./jsonnet_main/jsonnet_main test.jsonnet 
{
   "apiVersion": "baz",
   "kind": "bar"
}
Toms-MacBook-Pro:jsonnet_cgo twilkie$ git show
commit 04f8990f6dd09242167d7320e3267a4326ffdcfb
Merge: 764010f c5a3601
Author: strick <[email protected]>
Date:   Thu Jun 22 15:16:47 2017 -0700

    Update to v0.9.4  (Merge from mmikulicic-0622)

If I update kubecfg to the latest jsonnet_cgo, it works:

Toms-MacBook-Pro:kubecfg twilkie$ git show
commit 99caa5bcc60855eb8aa8cb26aa1e89d2bfd39ca1
Merge: e064c44 e2a8c34
Author: Angus Lees <[email protected]>
Date:   Tue Jun 27 14:13:06 2017 +1000

    Merge pull request #32 from sebgoa/readme
    
    fix README example

Toms-MacBook-Pro:kubecfg twilkie$ git diff vendor/vendor.json
diff --git a/vendor/vendor.json b/vendor/vendor.json
index 30a4563..af4bd05 100644
--- a/vendor/vendor.json
+++ b/vendor/vendor.json
@@ -269,10 +269,10 @@
                        "revisionTime": "2017-05-08T18:43:26Z"
                },
                {
-                       "checksumSHA1": "Ig39xerEZknDRBUmktZnC6GdkFs=",
+                       "checksumSHA1": "zHXKW3VTfu4Dswo3GTsCGVCZuw4=",
                        "path": "github.com/strickyak/jsonnet_cgo",
-                       "revision": "764010f55a278d2abc7be38b439929824a66aee4",
-                       "revisionTime": "2017-06-16T09:44:14Z"
+                       "revision": "04f8990f6dd09242167d7320e3267a4326ffdcfb",
+                       "revisionTime": "2017-06-22T22:16:47Z"
                },
                {
                        "checksumSHA1": "MxLnUmfrP+r5HfCZM29+WPKebn8=",
@@ -1023,5 +1023,5 @@
                        "versionExact": "v2.0.0"
                }
        ],
-       "rootPath": "github.com/ksonnet/kubecfg"
+       "rootPath": "ksonnet/kubecfg"
 }
Toms-MacBook-Pro:kubecfg twilkie$ govendor fetch github.com/strickyak/jsonnet_cgo
Toms-MacBook-Pro:kubecfg twilkie$ git diff vendor/vendor.json
diff --git a/vendor/vendor.json b/vendor/vendor.json
index 30a4563..890116e 100644
--- a/vendor/vendor.json
+++ b/vendor/vendor.json
@@ -269,10 +269,10 @@
                        "revisionTime": "2017-05-08T18:43:26Z"
                },
                {
-                       "checksumSHA1": "Ig39xerEZknDRBUmktZnC6GdkFs=",
+                       "checksumSHA1": "zHXKW3VTfu4Dswo3GTsCGVCZuw4=",
                        "path": "github.com/strickyak/jsonnet_cgo",
-                       "revision": "764010f55a278d2abc7be38b439929824a66aee4",
-                       "revisionTime": "2017-06-16T09:44:14Z"
+                       "revision": "04f8990f6dd09242167d7320e3267a4326ffdcfb",
+                       "revisionTime": "2017-06-22T22:16:47Z"
                },
                {
                        "checksumSHA1": "MxLnUmfrP+r5HfCZM29+WPKebn8=",
Toms-MacBook-Pro:kubecfg twilkie$ go build ./
Toms-MacBook-Pro:kubecfg twilkie$ cat test.jsonnet 
{kind: "bar"} + {apiVersion+: "baz"}
Toms-MacBook-Pro:kubecfg twilkie$ ./kubecfg show test.jsonnet 
---
apiVersion: baz
kind: bar

from kubecfg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.