Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(kapitan/examples): Add nginx jsonnet example
Signed-off-by: harsh jain <harshjniitr@gmail.com>
- Loading branch information
Showing
36 changed files
with
334 additions
and
36 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
examples/kubernetes/compiled/minikube-nginx-jsonnet/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
# Welcome to the README! | ||
|
||
Target *minikube-nginx-jsonnet* is running: | ||
|
||
* 1 replicas of *nginx* running nginx image nginx:1:15.8 | ||
* on cluster minikube |
36 changes: 36 additions & 0 deletions
36
examples/kubernetes/compiled/minikube-nginx-jsonnet/manifests/app-deployment.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: nginx | ||
name: nginx | ||
namespace: minikube-nginx-jsonnet | ||
spec: | ||
minReadySeconds: 30 | ||
replicas: 1 | ||
revisionHistoryLimit: 10 | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 25% | ||
maxUnavailable: 25% | ||
type: RollingUpdate | ||
template: | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: nginx | ||
spec: | ||
containers: | ||
- args: [] | ||
env: [] | ||
image: nginx:1:15.8 | ||
imagePullPolicy: Always | ||
name: nginx | ||
ports: | ||
- containerPort: 80 | ||
name: http | ||
volumeMounts: [] | ||
imagePullSecrets: [] | ||
initContainers: [] | ||
volumes: [] |
17 changes: 17 additions & 0 deletions
17
examples/kubernetes/compiled/minikube-nginx-jsonnet/manifests/app-service.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: nginx | ||
name: nginx | ||
namespace: minikube-nginx-jsonnet | ||
spec: | ||
loadBalancerSourceRanges: [] | ||
ports: | ||
- name: http | ||
port: 80 | ||
targetPort: http | ||
selector: | ||
name: nginx | ||
type: NodePort |
11 changes: 11 additions & 0 deletions
11
examples/kubernetes/compiled/minikube-nginx-jsonnet/nginx-deploy.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash -e | ||
DIR=$(dirname ${BASH_SOURCE[0]}) | ||
|
||
# Create namespace before anything else | ||
kubectl apply -f ${DIR}/pre-deploy/namespace.yml | ||
|
||
for SECTION in manifests | ||
do | ||
echo "## run kubectl apply for ${SECTION}" | ||
kubectl apply -f ${DIR}/${SECTION}/ | column -t | ||
done |
9 changes: 9 additions & 0 deletions
9
examples/kubernetes/compiled/minikube-nginx-jsonnet/pre-deploy/00_namespace.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: minikube-nginx-jsonnet | ||
name: minikube-nginx-jsonnet | ||
namespace: minikube-nginx-jsonnet | ||
spec: {} |
8 changes: 8 additions & 0 deletions
8
examples/kubernetes/compiled/minikube-nginx-jsonnet/pre-deploy/10_serviceaccount.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: default | ||
name: default | ||
namespace: minikube-nginx-jsonnet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
# Welcome to the README! | ||
|
||
Target *minikube-nginx-kadet* is running: | ||
|
||
* 2 replicas of *nginx* running nginx image nginx:1:15.8 | ||
* on cluster minikube |
2 changes: 1 addition & 1 deletion
2
...kube-nginx/manifests/nginx_deployment.yml → ...ginx-kadet/manifests/nginx_deployment.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
examples/kubernetes/compiled/minikube-nginx-kadet/nginx-deploy.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash -e | ||
DIR=$(dirname ${BASH_SOURCE[0]}) | ||
|
||
# Create namespace before anything else | ||
kubectl apply -f ${DIR}/pre-deploy/namespace.yml | ||
|
||
for SECTION in manifests | ||
do | ||
echo "## run kubectl apply for ${SECTION}" | ||
kubectl apply -f ${DIR}/${SECTION}/ | column -t | ||
done |
9 changes: 9 additions & 0 deletions
9
examples/kubernetes/compiled/minikube-nginx-kadet/pre-deploy/00_namespace.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: minikube-nginx-kadet | ||
name: minikube-nginx-kadet | ||
namespace: minikube-nginx-kadet | ||
spec: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ metadata: | |
labels: | ||
name: default | ||
name: default | ||
namespace: minikube-nginx | ||
namespace: minikube-nginx-kadet |
9 changes: 0 additions & 9 deletions
9
examples/kubernetes/compiled/minikube-nginx/pre-deploy/00_namespace.yml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash -e | ||
DIR=$(dirname ${BASH_SOURCE[0]}) | ||
|
||
# Create namespace before anything else | ||
kubectl apply -f ${DIR}/pre-deploy/namespace.yml | ||
|
||
for SECTION in manifests | ||
do | ||
echo "## run kubectl apply for ${SECTION}" | ||
kubectl apply -f ${DIR}/${SECTION}/ | column -t | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
local kube = import "lib/kube.libjsonnet"; | ||
local kap = import "lib/kapitan.libjsonnet"; | ||
local inv = kap.inventory(); | ||
local p = inv.parameters; | ||
|
||
local myContainers = kube.Container("nginx") { | ||
image: inv.parameters.nginx.image, | ||
ports_+: { | ||
http: {containerPort: 80} | ||
}, | ||
}; | ||
|
||
local deployment = kube.Deployment("nginx") { | ||
spec+: { | ||
replicas: inv.parameters.nginx.replicas, | ||
template+: { | ||
spec+: { | ||
containers_+: { | ||
nginx: myContainers | ||
}, | ||
} | ||
} | ||
} | ||
}; | ||
|
||
local svc = kube.Service("nginx") { | ||
target_pod:: deployment.spec.template, | ||
target_container_name:: "nginx", | ||
type: "NodePort", | ||
}; | ||
|
||
{ | ||
"app-service": svc, | ||
"app-deployment": deployment, | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{% set i = inventory.parameters %} | ||
|
||
# Welcome to the README! | ||
|
||
Target *{{ i.target_name }}* is running: | ||
|
||
* {{ i.nginx.replicas }} replicas of *nginx* running nginx image {{ i.nginx.image }} | ||
* on cluster {{ i.cluster.name }} |
13 changes: 13 additions & 0 deletions
13
examples/kubernetes/inventory/classes/component/nginx-common.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
parameters: | ||
nginx: | ||
image: nginx:1:15.8 | ||
kapitan: | ||
compile: | ||
- output_path: . | ||
input_type: jinja2 | ||
input_paths: | ||
- docs/nginx/README.md | ||
- output_path: . | ||
input_type: jinja2 | ||
input_paths: | ||
- components/nginx-deploy.sh |
10 changes: 10 additions & 0 deletions
10
examples/kubernetes/inventory/classes/component/nginx-jsonnet.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
parameters: | ||
nginx: | ||
replicas: 1 | ||
kapitan: | ||
compile: | ||
- output_path: manifests | ||
output_type: yaml | ||
input_type: jsonnet | ||
input_paths: | ||
- components/nginx-jsonnet/main.jsonnet |
4 changes: 2 additions & 2 deletions
4
...tes/inventory/classes/component/nginx.yml → ...ventory/classes/component/nginx-kadet.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
parameters: | ||
nginx: | ||
image: nginx:1:15.8 | ||
replicas: 2 | ||
kapitan: | ||
compile: | ||
- output_path: manifests | ||
input_type: kadet | ||
output_type: yaml | ||
input_paths: | ||
- components/nginx/ | ||
- components/nginx-kadet/ |
9 changes: 9 additions & 0 deletions
9
examples/kubernetes/inventory/targets/minikube-nginx-jsonnet.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
classes: | ||
- common | ||
- cluster.minikube | ||
- component.nginx-jsonnet | ||
- component.nginx-common | ||
|
||
parameters: | ||
target_name: minikube-nginx-jsonnet | ||
namespace: ${target_name} |
10 changes: 10 additions & 0 deletions
10
examples/kubernetes/inventory/targets/minikube-nginx-kadet.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
classes: | ||
- common | ||
- cluster.minikube | ||
- component.nginx-kadet | ||
- component.nginx-common | ||
|
||
parameters: | ||
target_name: minikube-nginx-kadet | ||
namespace: ${target_name} | ||
|
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
tests/test_kubernetes_compiled/minikube-nginx-jsonnet/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
# Welcome to the README! | ||
|
||
Target *minikube-nginx-jsonnet* is running: | ||
|
||
* 1 replicas of *nginx* running nginx image nginx:1:15.8 | ||
* on cluster minikube |
36 changes: 36 additions & 0 deletions
36
tests/test_kubernetes_compiled/minikube-nginx-jsonnet/manifests/app-deployment.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: nginx | ||
name: nginx | ||
namespace: minikube-nginx-jsonnet | ||
spec: | ||
minReadySeconds: 30 | ||
replicas: 1 | ||
revisionHistoryLimit: 10 | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 25% | ||
maxUnavailable: 25% | ||
type: RollingUpdate | ||
template: | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: nginx | ||
spec: | ||
containers: | ||
- args: [] | ||
env: [] | ||
image: nginx:1:15.8 | ||
imagePullPolicy: Always | ||
name: nginx | ||
ports: | ||
- containerPort: 80 | ||
name: http | ||
volumeMounts: [] | ||
imagePullSecrets: [] | ||
initContainers: [] | ||
volumes: [] |
17 changes: 17 additions & 0 deletions
17
tests/test_kubernetes_compiled/minikube-nginx-jsonnet/manifests/app-service.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: nginx | ||
name: nginx | ||
namespace: minikube-nginx-jsonnet | ||
spec: | ||
loadBalancerSourceRanges: [] | ||
ports: | ||
- name: http | ||
port: 80 | ||
targetPort: http | ||
selector: | ||
name: nginx | ||
type: NodePort |
11 changes: 11 additions & 0 deletions
11
tests/test_kubernetes_compiled/minikube-nginx-jsonnet/nginx-deploy.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash -e | ||
DIR=$(dirname ${BASH_SOURCE[0]}) | ||
|
||
# Create namespace before anything else | ||
kubectl apply -f ${DIR}/pre-deploy/namespace.yml | ||
|
||
for SECTION in manifests | ||
do | ||
echo "## run kubectl apply for ${SECTION}" | ||
kubectl apply -f ${DIR}/${SECTION}/ | column -t | ||
done |
9 changes: 9 additions & 0 deletions
9
tests/test_kubernetes_compiled/minikube-nginx-jsonnet/pre-deploy/00_namespace.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: minikube-nginx-jsonnet | ||
name: minikube-nginx-jsonnet | ||
namespace: minikube-nginx-jsonnet | ||
spec: {} |
8 changes: 8 additions & 0 deletions
8
tests/test_kubernetes_compiled/minikube-nginx-jsonnet/pre-deploy/10_serviceaccount.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: default | ||
name: default | ||
namespace: minikube-nginx-jsonnet |
7 changes: 7 additions & 0 deletions
7
tests/test_kubernetes_compiled/minikube-nginx-kadet/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
# Welcome to the README! | ||
|
||
Target *minikube-nginx-kadet* is running: | ||
|
||
* 2 replicas of *nginx* running nginx image nginx:1:15.8 | ||
* on cluster minikube |
Oops, something went wrong.