Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
Merge pull request #567 from bryanl/554-underscore-fields
Browse files Browse the repository at this point in the history
bugs: ksonnet lib printer
  • Loading branch information
bryanl committed May 29, 2018
2 parents ba67644 + fc1db17 commit 7cbf080
Show file tree
Hide file tree
Showing 31 changed files with 373 additions and 154 deletions.
6 changes: 3 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ required = ["k8s.io/kubernetes/pkg/kubectl/cmd/util"]

[[constraint]]
name = "github.com/ksonnet/ksonnet-lib"
version = "v0.1.5"
version = "v0.1.7"

[[constraint]]
name = "github.com/onsi/ginkgo"
Expand Down
6 changes: 3 additions & 3 deletions metadata/params/testdata/delete-env-param/expected1.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local params = {};
params + {
components+: {
foo+: {
replicas: 1
}
}
replicas: 1,
},
},
}
6 changes: 3 additions & 3 deletions metadata/params/testdata/delete-env-param/expected2.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local params = {};
params {
components+: {
foo+: {
replicas: 1
}
}
replicas: 1,
},
},
}
15 changes: 15 additions & 0 deletions pkg/app/encoder.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// Copyright 2018 The ksonnet authors
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package app

import (
Expand Down
15 changes: 15 additions & 0 deletions pkg/app/override_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// Copyright 2018 The ksonnet authors
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package app

import (
Expand Down
4 changes: 2 additions & 2 deletions pkg/component/testdata/delete-env-params.libsonnet
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local params = import "../../components/params.libsonnet";
local params = import '../../components/params.libsonnet';

params {
components+: {}
components+: {},
}
12 changes: 6 additions & 6 deletions pkg/component/testdata/guestbook/delete-params.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
// Each object below should correspond to a component in the components/ directory
"guestbook-ui": {
containerPort: 80,
image: "gcr.io/heptio-images/ks-guestbook-demo:0.1",
name: "guiroot",
image: 'gcr.io/heptio-images/ks-guestbook-demo:0.1',
name: 'guiroot',
obj: {
a: "b"
a: 'b',
},
servicePort: 80,
type: "ClusterIP"
}
}
type: 'ClusterIP',
},
},
}
12 changes: 6 additions & 6 deletions pkg/component/testdata/guestbook/set-params.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
// Each object below should correspond to a component in the components/ directory
"guestbook-ui": {
containerPort: 80,
image: "gcr.io/heptio-images/ks-guestbook-demo:0.1",
name: "guiroot",
image: 'gcr.io/heptio-images/ks-guestbook-demo:0.1',
name: 'guiroot',
obj: {
a: "b"
a: 'b',
},
replicas: 4,
servicePort: 80,
type: "ClusterIP"
}
}
type: 'ClusterIP',
},
},
}
6 changes: 3 additions & 3 deletions pkg/component/testdata/params-delete-entry.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Component-level parameters, defined initially from 'ks prototype use ...'
// Each object below should correspond to a component in the components/ directory
"certificate-crd": {
spec: {}
}
}
spec: {},
},
},
}
10 changes: 5 additions & 5 deletions pkg/component/testdata/params-delete-global.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
other: 1,
metadata: {
labels: {
locala: "local"
}
}
}
}
locala: 'local',
},
},
},
},
}
8 changes: 4 additions & 4 deletions pkg/component/testdata/updated-yaml-params.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
components: {
"certificate-crd": {
spec: {
version: "v2"
}
}
}
version: 'v2',
},
},
},
}
2 changes: 1 addition & 1 deletion pkg/env/testdata/add-global.libsonnet
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
foo: "bar"
foo: 'bar',
}
6 changes: 3 additions & 3 deletions pkg/env/testdata/delete-params.libsonnet
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local params = import "../../components/params.libsonnet";
local params = import '../../components/params.libsonnet';

params + {
components+: {
component1+: {}
}
component1+: {},
},
}
4 changes: 2 additions & 2 deletions pkg/env/testdata/params.libsonnet
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
local params = import "../../components/params.libsonnet";
local params = import '../../components/params.libsonnet';
params + {
components +: {
component1 +: {
foo: "bar",
foo: 'bar',
},
},
}
8 changes: 4 additions & 4 deletions pkg/env/testdata/updated-params.libsonnet
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
local params = import "../../components/params.libsonnet";
local params = import '../../components/params.libsonnet';

params + {
components+: {
component1+: {
foo: "bar"
}
}
foo: 'bar',
},
},
}
11 changes: 6 additions & 5 deletions pkg/params/testdata/env/globals/remove-component/out.libsonnet
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
local params = std.extVar("__ksonnet/params");
local globals = import "globals.libsonnet";
local params = std.extVar('__ksonnet/params');
local globals = import 'globals.libsonnet';
local envParams = params + {
components+: {}
components+: {},
};

{
components: {
[x]: envParams.components[x] + globals for x in std.objectFields(envParams.components)
}
[x]: envParams.components[x] + globals
for x in std.objectFields(envParams.components)
},
}
2 changes: 1 addition & 1 deletion pkg/params/testdata/env/globals/set-global/out.libsonnet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{group: "dev"}
{ group: 'dev' }
19 changes: 10 additions & 9 deletions pkg/params/testdata/env/globals/set/out-new-component.libsonnet
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
local params = std.extVar("__ksonnet/params");
local globals = import "globals.libsonnet";
local params = std.extVar('__ksonnet/params');
local globals = import 'globals.libsonnet';
local envParams = params + {
components+: {
guestbook+: {
name: "guestbook-dev",
replicas: params.global.replicas
name: 'guestbook-dev',
replicas: params.global.replicas,
},
component+: {
name: "new-component"
}
}
name: 'new-component',
},
},
};

{
components: {
[x]: envParams.components[x] + globals for x in std.objectFields(envParams.components)
}
[x]: envParams.components[x] + globals
for x in std.objectFields(envParams.components)
},
}
17 changes: 9 additions & 8 deletions pkg/params/testdata/env/globals/set/out.libsonnet
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
local params = std.extVar("__ksonnet/params");
local globals = import "globals.libsonnet";
local params = std.extVar('__ksonnet/params');
local globals = import 'globals.libsonnet';
local envParams = params + {
components+: {
guestbook+: {
name: "guestbook-dev",
name: 'guestbook-dev',
replicas: params.global.replicas,
containerPort: 8080
}
}
containerPort: 8080,
},
},
};

{
components: {
[x]: envParams.components[x] + globals for x in std.objectFields(envParams.components)
}
[x]: envParams.components[x] + globals
for x in std.objectFields(envParams.components)
},
}
15 changes: 8 additions & 7 deletions pkg/params/testdata/env/globals/unset/out.libsonnet
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
local params = std.extVar("__ksonnet/params");
local globals = import "globals.libsonnet";
local params = std.extVar('__ksonnet/params');
local globals = import 'globals.libsonnet';
local envParams = params + {
components+: {
guestbook+: {
name: "guestbook-dev"
}
}
name: 'guestbook-dev',
},
},
};

{
components: {
[x]: envParams.components[x] + globals for x in std.objectFields(envParams.components)
}
[x]: envParams.components[x] + globals
for x in std.objectFields(envParams.components)
},
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local params = import "../../components/params.libsonnet";
local params = import '../../components/params.libsonnet';

params + {
components+: {}
components+: {},
}
10 changes: 5 additions & 5 deletions pkg/params/testdata/env/no-globals/set/out.libsonnet
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
local params = import "../../components/params.libsonnet";
local params = import '../../components/params.libsonnet';

params + {
components+: {
guestbook+: {
name: "guestbook-dev",
name: 'guestbook-dev',
replicas: params.global.replicas,
containerPort: 8080
}
}
containerPort: 8080,
},
},
}
8 changes: 4 additions & 4 deletions pkg/params/testdata/env/no-globals/unset/out.libsonnet
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
local params = import "../../components/params.libsonnet";
local params = import '../../components/params.libsonnet';

params + {
components+: {
guestbook+: {
name: "guestbook-dev"
}
}
name: 'guestbook-dev',
},
},
}

0 comments on commit 7cbf080

Please sign in to comment.