Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wl/webhook test #182

Merged
merged 86 commits into from
Aug 9, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
3ec3f78
Added testing for webhook using KIND
willfairwinds Jul 30, 2019
53c7662
fixed branching error
willfairwinds Jul 31, 2019
f6e5b08
Merge branch 'master' into wl/webhook-test
willfairwinds Jul 31, 2019
11ac419
Merge branch 'master' into wl/webhook-test
willfairwinds Jul 31, 2019
13f1dad
added tests to CircleCI
willfairwinds Jul 31, 2019
d2ec9d8
added tests to CircleCI
willfairwinds Jul 31, 2019
e7c5fe1
Merge branch 'wl/webhook-test' of https://github.com/FairwindsOps/pol…
willfairwinds Jul 31, 2019
2f9cd73
attempt to stop failing circleci test
willfairwinds Jul 31, 2019
6ec2acf
Merge branch 'master' into wl/webhook-test
willfairwinds Jul 31, 2019
693db94
moved location of testing for webhook in CircleCI
willfairwinds Jul 31, 2019
3ef5a36
Merge branch 'wl/webhook-test' of https://github.com/FairwindsOps/pol…
willfairwinds Jul 31, 2019
e9ade0c
debugging
willfairwinds Jul 31, 2019
51220fe
more debugging
willfairwinds Jul 31, 2019
94e4562
.
willfairwinds Jul 31, 2019
2a38840
.
willfairwinds Jul 31, 2019
c46e9b6
added download of webhook to test
willfairwinds Jul 31, 2019
ccac426
..
willfairwinds Jul 31, 2019
5e6c8cf
...
willfairwinds Jul 31, 2019
fb72633
corrected sleep comand
willfairwinds Aug 1, 2019
f276ab5
Merge branch 'master' into wl/webhook-test
willfairwinds Aug 1, 2019
1be38a1
.
willfairwinds Aug 1, 2019
5998e40
.
willfairwinds Aug 1, 2019
9c17287
code working now, clean up
willfairwinds Aug 1, 2019
d87c372
testing smaller sleep times
willfairwinds Aug 1, 2019
be05a76
increased sleep time
willfairwinds Aug 1, 2019
8e692c9
responded to comments on github
willfairwinds Aug 2, 2019
a79ba0d
Merge branch 'master' into wl/webhook-test
willfairwinds Aug 2, 2019
1adb494
.
willfairwinds Aug 2, 2019
497d3c0
Merge branch 'wl/webhook-test' of https://github.com/FairwindsOps/pol…
willfairwinds Aug 2, 2019
7050451
debug
willfairwinds Aug 2, 2019
118d211
more edits
willfairwinds Aug 5, 2019
2b558b9
Merge branch 'master' into wl/webhook-test
willfairwinds Aug 5, 2019
1138857
debugging second test failing.
willfairwinds Aug 5, 2019
aac2b28
Merge branch 'wl/webhook-test' of https://github.com/FairwindsOps/pol…
willfairwinds Aug 5, 2019
ce43ca3
debugging
willfairwinds Aug 5, 2019
acf9d8b
tests doing opposite of what they should be debugging.
willfairwinds Aug 5, 2019
3b29be4
debugging
willfairwinds Aug 5, 2019
39cc0f8
.
willfairwinds Aug 5, 2019
0d302e4
.
willfairwinds Aug 5, 2019
62a27e1
fixing error in installation of webhook.
willfairwinds Aug 5, 2019
9176ab6
.
willfairwinds Aug 5, 2019
977253e
timeout increase
willfairwinds Aug 5, 2019
eccd31c
trying to install webhook
willfairwinds Aug 5, 2019
91b9b45
.
willfairwinds Aug 5, 2019
0fb7626
.
willfairwinds Aug 5, 2019
4163d38
..
willfairwinds Aug 5, 2019
0bc5441
webhook still not i installing properly
willfairwinds Aug 5, 2019
ab31fa6
..
willfairwinds Aug 5, 2019
c510814
..
willfairwinds Aug 5, 2019
d3741f6
add log message
rbren Aug 5, 2019
54e21ff
..
willfairwinds Aug 5, 2019
3cff8d1
changed order of test_k8s, removed set -e
willfairwinds Aug 5, 2019
bef555a
..
willfairwinds Aug 5, 2019
e2f3de5
namespace polaris
willfairwinds Aug 5, 2019
4d75388
.
willfairwinds Aug 5, 2019
c119248
.......
willfairwinds Aug 5, 2019
2374c87
intial testing for new strategy.
willfairwinds Aug 6, 2019
e709a6e
intial testing for new strategy.
willfairwinds Aug 6, 2019
4403614
..
willfairwinds Aug 6, 2019
23d9855
.
willfairwinds Aug 6, 2019
d824e6a
...
willfairwinds Aug 6, 2019
c3c58c8
final edits, working now
willfairwinds Aug 6, 2019
9ed0f3d
fixed files, cleaned up logs, added more detail to webhook starting d…
willfairwinds Aug 6, 2019
86b3ff7
?
willfairwinds Aug 6, 2019
ca9ce22
added test files for other controller types, adding testing for them …
willfairwinds Aug 6, 2019
0ab9425
increased sleep time
willfairwinds Aug 6, 2019
846210c
testing
willfairwinds Aug 6, 2019
85b7278
finally added tests for jobs
willfairwinds Aug 7, 2019
2f97534
changed while loop condition to include webhook.
willfairwinds Aug 7, 2019
ddbad55
.
willfairwinds Aug 7, 2019
ef32265
lskdfsjkl
willfairwinds Aug 7, 2019
583150b
sd
willfairwinds Aug 7, 2019
b950df7
lskfjlskj
willfairwinds Aug 7, 2019
1a8c67d
.
willfairwinds Aug 7, 2019
86670de
final
willfairwinds Aug 7, 2019
8910a3c
added timeout test for dashboard to try to aleviate error
willfairwinds Aug 8, 2019
cd96188
.
willfairwinds Aug 8, 2019
78fa43c
.
willfairwinds Aug 8, 2019
bffb7b5
install the dashboard
willfairwinds Aug 8, 2019
b7e6eb1
...
willfairwinds Aug 8, 2019
aeee3d1
initial test for new kube_dashboard_test
willfairwinds Aug 8, 2019
bcf6c7f
initial test for new kube_dashboard_test
willfairwinds Aug 8, 2019
d6acc0c
?
willfairwinds Aug 8, 2019
cac7311
deleting unused code
willfairwinds Aug 9, 2019
00ab8d4
final change for dashboard test
willfairwinds Aug 9, 2019
caa0b30
final
willfairwinds Aug 9, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added test files for other controller types, adding testing for them …
…in webhook_test.sh
  • Loading branch information
willfairwinds committed Aug 6, 2019
commit ca9ce229007431173221585efcbee7e13811b1cd
48 changes: 48 additions & 0 deletions test/failing_test.daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: fluentd-elasticsearch
namespace: kube-system
labels:
k8s-app: fluentd-logging
spec:
selector:
matchLabels:
name: fluentd-elasticsearch
template:
metadata:
labels:
name: fluentd-elasticsearch
spec:
tolerations:
- key: node-role.kubernetes.io/master
effect:
containers:
- name: fluentd-elasticsearch
image: gcr.io/fluentd-elasticsearch/fluentd:v2.5.1
resources:
requests:
cpu: 100m
volumeMounts:
- name: varlog
mountPath: /var/log
- name: varlibdockercontainers
mountPath: /var/lib/docker/containers
readOnly: true
securityContext:
allowPrivilegeEscalation: true
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
terminationGracePeriodSeconds: 30
volumes:
- name: varlog
hostPath:
path: /var/log
- name: varlibdockercontainers
hostPath:
path: /var/lib/docker/containers

27 changes: 27 additions & 0 deletions test/failing_test.replicationcontroller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx
spec:
replicas: 3
selector:
app: nginx
template:
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
securityContext:
allowPrivilegeEscalation: true
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
56 changes: 56 additions & 0 deletions test/failing_test.statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
spec:
ports:
- port: 80
name: web
clusterIP: None
selector:
app: nginx
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: web
spec:
selector:
matchLabels:
app: nginx # has to match .spec.template.metadata.labels
serviceName: "nginx"
replicas: 3 # by default is 1
template:
metadata:
labels:
app: nginx # has to match .spec.selector.matchLabels
spec:
terminationGracePeriodSeconds: 10
containers:
- name: nginx
image: k8s.gcr.io/nginx-slim:0.8
ports:
- containerPort: 80
name: web
volumeMounts:
- name: www
mountPath: /usr/share/nginx/html
securityContext:
allowPrivilegeEscalation: true
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
volumeClaimTemplates:
- metadata:
name: www
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "my-storage-class"
resources:
requests:
storage: 1Gi
16 changes: 16 additions & 0 deletions test/passing_test.cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: test
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: test
image: busybox:uclibc
args:
- whoami
restartPolicy: OnFailure
48 changes: 48 additions & 0 deletions test/passing_test.daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: fluentd-elasticsearch
namespace: kube-system
labels:
k8s-app: fluentd-logging
spec:
selector:
matchLabels:
name: fluentd-elasticsearch
template:
metadata:
labels:
name: fluentd-elasticsearch
spec:
tolerations:
- key: node-role.kubernetes.io/master
effect:
containers:
- name: fluentd-elasticsearch
image: gcr.io/fluentd-elasticsearch/fluentd:v2.5.1
resources:
requests:
cpu: 100m
volumeMounts:
- name: varlog
mountPath: /var/log
- name: varlibdockercontainers
mountPath: /var/lib/docker/containers
readOnly: true
securityContext:
allowPrivilegeEscalation: false
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
terminationGracePeriodSeconds: 30
volumes:
- name: varlog
hostPath:
path: /var/log
- name: varlibdockercontainers
hostPath:
path: /var/lib/docker/containers

14 changes: 14 additions & 0 deletions test/passing_test.job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: batch/v1
kind: Job
metadata:
name: pi
spec:
template:
spec:
containers:
- name: pi
image: nginx:1.7.9
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
restartPolicy: Never
backoffLimit: 4

27 changes: 27 additions & 0 deletions test/passing_test.replicationcontroller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx
spec:
replicas: 3
selector:
app: nginx
template:
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
securityContext:
allowPrivilegeEscalation: false
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
56 changes: 56 additions & 0 deletions test/passing_test.statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
spec:
ports:
- port: 80
name: web
clusterIP: None
selector:
app: nginx
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: web
spec:
selector:
matchLabels:
app: nginx # has to match .spec.template.metadata.labels
serviceName: "nginx"
replicas: 3 # by default is 1
template:
metadata:
labels:
app: nginx # has to match .spec.selector.matchLabels
spec:
terminationGracePeriodSeconds: 10
containers:
- name: nginx
image: k8s.gcr.io/nginx-slim:0.8
ports:
- containerPort: 80
name: web
volumeMounts:
- name: www
mountPath: /usr/share/nginx/html
securityContext:
allowPrivilegeEscalation: false
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
volumeClaimTemplates:
- metadata:
name: www
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "my-storage-class"
resources:
requests:
storage: 1Gi
23 changes: 14 additions & 9 deletions test/webhook_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,20 @@ echo "Webhook started!"
#Webhook started, setting all tests as passed initially.
ALL_TESTS_PASSED=1

if ! kubectl apply -f test/passing_test.deployment.yaml &> /dev/null; then
ALL_TESTS_PASSED=0
echo "Test Failed: Polaris prevented a deployment with no configuration issues."
fi

if kubectl apply -f test/failing_test.deployment.yaml &> /dev/null; then
ALL_TESTS_PASSED=0
echo "Test Failed: Polaris should have prevented this deployment due to configuration issues."
fi
for filename in test/passing_test.*.yaml; do
echo $filename
if ! kubectl apply -f $filename &> /dev/null; then
ALL_TESTS_PASSED=0
echo "Test Failed: Polaris prevented a deployment with no configuration issues."
fi
done
for filename in test/failing_test.*.yaml; do
echo $filename
if kubectl apply -f $filename &> /dev/null; then
ALL_TESTS_PASSED=0
echo "Test Failed: Polaris should have prevented this deployment due to configuration issues."
fi
done

#Verify that all the tests passed.
if [ $ALL_TESTS_PASSED -eq 1 ]; then
Expand Down