52
loading...
This website collects cookies to deliver better user experience
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
# replicas: 1 # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
volumeMounts:
- mountPath: /var/www
name: www-data
env:
- name: DEMO_GREETING
value: "Hello from the environment"
- name: DEMO_FAREWELL
value: "Such a sweet sorrow"
volumes:
- name: www-data
persistentVolumeClaim:
claimName: nginx-example
/var/www
and consuming it's data throughout a volume named www-data
:k8s apply -f nginx.yaml
deployment.apps/nginx-deployment created
tomty --edit verify
#!raku
task-run "chk-dpl", "k8s-deployment-check", %(
name => "nginx-deployment",
namespace => "melezhik-sandbox",
volume-mounts => %(
www-data => "/var/www"
),
);
tomty verify
[repository] :: index updated from file:///root/repo/api/v1/index
[chk-dpl] :: >>> verify deployment. name=nginx-deployment,namespace=melezhik-sandbox,container=nginx
[chk-dpl] :: [env_start]
[chk-dpl] :: [DEMO_GREETING=Hello from the environment]
[chk-dpl] :: [DEMO_FAREWELL=Such a sweet sorrow]
[chk-dpl] :: [env_end]
[chk-dpl] :: [volume_mounts_start]
[chk-dpl] :: [www-data /var/www]
[chk-dpl] :: [volume_mounts_end]
[chk-dpl] :: ==================================================================
[task check] >>> check volume mounts
[task check] stdout match (r) <[www-data /var/www]> True
www-data
mounted as /var/www
foldertomty --edit verify
task-run "chk-dpl", "k8s-deployment-check", %(
name => "nginx-deployment",
namespace => "melezhik-sandbox",
volume-mounts => %(
www-data => "/var/www"
),
env => {
DEMO_GREETING => "Hello from the environment",
DEMO_FAREWELL => "Such a sweet sorrow"
},
);
tomty verify
[repository] :: index updated from file:///root/repo/api/v1/index
[chk-dpl] :: >>> verify deployment. name=nginx-deployment,namespace=melezhik-sandbox,container=nginx
[chk-dpl] :: [env_start]
[chk-dpl] :: [DEMO_GREETING=Hello from the environment]
[chk-dpl] :: [DEMO_FAREWELL=Such a sweet sorrow]
[chk-dpl] :: [env_end]
[chk-dpl] :: [volume_mounts_start]
[chk-dpl] :: [www-data /var/www]
[chk-dpl] :: [volume_mounts_end]
[chk-dpl] :: ==================================================================
[task check] >>> check env
[task check] stdout match (r) <[DEMO_FAREWELL=Such a sweet sorrow]> True
[task check] stdout match (r) <[DEMO_GREETING=Hello from the environment]> True
[task check] >>> check volume mounts
[task check] stdout match (r) <[www-data /var/www]> True
k8s-deployment-check
plugin allows one to test k8s infrastructure by just writing a simple piece of Raku code. The full documentation is available at SparrowHub site. command => "regexp: '/usr/bin/python' 2|3"
52