$ docker run -it -v ${PWD}:/examples garethr/kubetest --tests /examples/tests /examples/app1.yaml --verbose
INFO /examples/app1.yaml should indicate which team owns the deployment
Created
December 6, 2017 16:30
-
-
Save garethr/f38b7f6990021f9186759ba845cf0f78 to your computer and use it in GitHub Desktop.
Demo from KubeCon metadata talk of kubetest
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
apiVersion: apps/v1beta2 # for versions before 1.8.0 use apps/v1beta1 | |
kind: Deployment | |
metadata: | |
name: nginx-deployment | |
spec: | |
selector: | |
matchLabels: | |
app: nginx | |
replicas: 2 # tells deployment to run 2 pods matching the template | |
template: # create pods using pod definition in this template | |
metadata: | |
# unlike pod-nginx.yaml, the name is not included in the meta data as a unique name is | |
# generated from the deployment name | |
labels: | |
app: nginx | |
team: team-shamu | |
spec: | |
containers: | |
- name: nginx | |
image: nginx:1.7.9 | |
ports: | |
- containerPort: 80 |
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
#// vim: set ft=python: | |
def test_for_team_label(): | |
if spec["kind"] == "Deployment": | |
labels = spec["spec"]["template"]["metadata"]["labels"] | |
assert_contains(labels, "team", "should indicate which team owns the deployment") | |
test_for_team_label() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment