Skip to content

Commit

Permalink
Add jsonnet formatting test (kubeflow#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankush Agarwal authored and k8s-ci-robot committed May 1, 2018
1 parent bfab11b commit 906dc27
Show file tree
Hide file tree
Showing 28 changed files with 24,376 additions and 24,306 deletions.
2 changes: 1 addition & 1 deletion dev-kubeflow-org/ks-app/components/cert-manager.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ local acmeUrl = params.acmeUrl;
// updatedParams uses the environment namespace if
// the namespace parameter is not explicitly set
local updatedParams = params {
namespace: if params.namespace == "null" then env.namespace else params.namespace
namespace: if params.namespace == "null" then env.namespace else params.namespace,
};

certManager.parts(updatedParams.namespace).certManagerParts(acmeEmail, acmeUrl)
2 changes: 1 addition & 1 deletion dev-kubeflow-org/ks-app/components/iap-ingress.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local util = import "kubeflow/core/util.libsonnet";
// updatedParams uses the environment namespace if
// the namespace parameter is not explicitly set
local updatedParams = params {
namespace: if params.namespace == "null" then env.namespace else params.namespace
namespace: if params.namespace == "null" then env.namespace else params.namespace,
};

local name = params.name;
Expand Down
30 changes: 16 additions & 14 deletions dev-kubeflow-org/ks-app/components/issue-summarization-ui.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@ local service = k.core.v1.service;
local servicePort = k.core.v1.service.mixin.spec.portsType;

local targetPort = params.containerPort;
local labels = {app: params.name};
local labels = { app: params.name };

local appService = service
.new(
params.name,
labels,
servicePort.new(params.servicePort, targetPort))
.withType(params.type);
.new(
params.name,
labels,
servicePort.new(params.servicePort, targetPort)
)
.withType(params.type);

local appDeployment = deployment
.new(
params.name,
params.replicas,
container
.new(params.name, params.image)
.withPorts(containerPort.new(targetPort)),
labels);
.new(
params.name,
params.replicas,
container
.new(params.name, params.image)
.withPorts(containerPort.new(targetPort)),
labels
);

k.core.v1.list.new([appService, appDeployment])
k.core.v1.list.new([appService, appDeployment])
2 changes: 1 addition & 1 deletion dev-kubeflow-org/ks-app/components/kubeflow-core.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local all = import "kubeflow/core/all.libsonnet";
// updatedParams uses the environment namespace if
// the namespace parameter is not explicitly set
local updatedParams = params {
namespace: if params.namespace == "null" then env.namespace else params.namespace
namespace: if params.namespace == "null" then env.namespace else params.namespace,
};

std.prune(k.core.v1.list.new(all.parts(updatedParams).all))
2 changes: 1 addition & 1 deletion dev-kubeflow-org/ks-app/environments/base.libsonnet
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local components = std.extVar("__ksonnet/components");
components + {
components {
// Insert user-specified overrides here.
}
2 changes: 1 addition & 1 deletion dev-kubeflow-org/ks-app/environments/default/main.jsonnet
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local base = import "base.libsonnet";
local k = import "k.libsonnet";

base + {
base {
// Insert user-specified overrides here. For example if a component is named "nginx-deployment", you might have something like:
// "nginx-deployment"+: k.deployment.mixin.metadata.labels({foo: "bar"})
}
6 changes: 3 additions & 3 deletions dev-kubeflow-org/ks-app/environments/default/params.libsonnet
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
local params = import "../../components/params.libsonnet";
params + {
components +: {
params {
components+: {
// Insert component parameter overrides here. Ex:
// guestbook +: {
// name: "guestbook-dev",
// replicas: params.global.replicas,
// },
"kubeflow-core" +: {
"kubeflow-core"+: {
disks: "github-issues-data",
},
},
Expand Down
30 changes: 15 additions & 15 deletions dev-kubeflow-org/ks-app/lib/v1.7.0/k.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local hidden = {
},
},

mapContainersWithName(names, f) ::
mapContainersWithName(names, f)::
local nameSet =
if std.type(names) == "array"
then std.set(names)
Expand All @@ -32,46 +32,46 @@ local hidden = {
),
};

k8s + {
apps:: apps + {
v1beta1:: apps.v1beta1 + {
k8s {
apps:: apps {
v1beta1:: apps.v1beta1 {
local v1beta1 = apps.v1beta1,

daemonSet:: v1beta1.daemonSet + {
daemonSet:: v1beta1.daemonSet {
mapContainers(f):: hidden.mapContainers(f),
mapContainersWithName(names, f):: hidden.mapContainersWithName(names, f),
},

deployment:: v1beta1.deployment + {
deployment:: v1beta1.deployment {
mapContainers(f):: hidden.mapContainers(f),
mapContainersWithName(names, f):: hidden.mapContainersWithName(names, f),
},
},
},

core:: core + {
v1:: core.v1 + {
core:: core {
v1:: core.v1 {
list:: {
new(items)::
{apiVersion: "v1"} +
{kind: "List"} +
{ apiVersion: "v1" } +
{ kind: "List" } +
self.items(items),

items(items):: if std.type(items) == "array" then {items+: items} else {items+: [items]},
items(items):: if std.type(items) == "array" then { items+: items } else { items+: [items] },
},
},
},

extensions:: extensions + {
v1beta1:: extensions.v1beta1 + {
extensions:: extensions {
v1beta1:: extensions.v1beta1 {
local v1beta1 = extensions.v1beta1,

daemonSet:: v1beta1.daemonSet + {
daemonSet:: v1beta1.daemonSet {
mapContainers(f):: hidden.mapContainers(f),
mapContainersWithName(names, f):: hidden.mapContainersWithName(names, f),
},

deployment:: v1beta1.deployment + {
deployment:: v1beta1.deployment {
mapContainers(f):: hidden.mapContainers(f),
mapContainersWithName(names, f):: hidden.mapContainersWithName(names, f),
},
Expand Down
Loading

0 comments on commit 906dc27

Please sign in to comment.