Skip to content

Commit

Permalink
Make the example more Nickely
Browse files Browse the repository at this point in the history
The original example was automatically converted from YAML. Make it a
bit more Nickely by making it a more idiomatic partial configuration.
  • Loading branch information
yannham committed May 2, 2024
1 parent 55d2dbb commit 5ac8361
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 29 deletions.
36 changes: 36 additions & 0 deletions examples/redis-replication-controller.ncl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Example of a non conform Kubernetes resource
let ReplicationController = import "../kubernetes-contracts/v1.29.3/replicationcontroller-v1.ncl" in

{
config = {
name = "redis-master",
labels = { app = "redis", role = "master" },
},
kubernetes | ReplicationController
= {
apiVersion = "v1",
kind = "ReplicationController",
metadata = { labels = config.labels, name = config.name },
spec = {
replicas = 1,
selector = config.labels,
template = {
metadata = { labels = config.labels },
spec.containers = [
{
image = "registry.k8s.io/redis:e2e",
name = config.name,
ports = [
{
# the error is here: containerPort is a string, but it should be
# an integer
containerPort = "200",
name = config.name,
}
],
}
],
},
},
}
}
29 changes: 0 additions & 29 deletions examples/test.ncl

This file was deleted.

0 comments on commit 5ac8361

Please sign in to comment.