Skip to content

Commit

Permalink
Merge pull request vmware-tanzu#133 from chuckha/plugin
Browse files Browse the repository at this point in the history
Change how plugins work
Signed-off-by: Jesse Hamilton jesse.hamilton@heptio.com

Signed-off-by: Jesse Hamilton jesse.hamilton@heptio.com
  • Loading branch information
timothysc authored Nov 9, 2017
2 parents 7d67000 + 4be4ff2 commit 46da6bd
Show file tree
Hide file tree
Showing 11 changed files with 356 additions and 557 deletions.
227 changes: 128 additions & 99 deletions examples/quickstart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,91 +112,48 @@ metadata:
---
apiVersion: v1
data:
e2e.yaml: |
driver: Job
name: e2e
resultType: e2e
e2e.tmpl: |
apiVersion: v1
kind: Pod
metadata:
name: "sonobuoy-e2e-job-{{.SessionID}}"
annotations:
"sonobuoy-plugin": "e2e"
"sonobuoy-driver": "Job"
"sonobuoy-result-type": "e2e"
labels:
component: sonobuoy
tier: analysis
"sonobuoy-run": "{{.SessionID}}"
namespace: "{{.Namespace}}"
spec:
containers:
- env:
- name: E2E_FOCUS
value: Pods should be submitted and removed
image: gcr.io/heptio-images/kube-conformance:v1.8
imagePullPolicy: Always
name: e2e
volumeMounts:
- mountPath: /tmp/results
name: results
- command:
- sh
- -c
- /sonobuoy worker global -v 5 --logtostderr
env:
- name: NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: RESULTS_DIR
value: /tmp/results
image: gcr.io/heptio-images/sonobuoy:master
imagePullPolicy: Always
name: sonobuoy-worker
volumeMounts:
- mountPath: /etc/sonobuoy
name: config
- mountPath: /tmp/results
name: results
restartPolicy: Never
serviceAccountName: sonobuoy-serviceaccount
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
- key: CriticalAddonsOnly
operator: Exists
volumes:
- emptyDir: {}
name: results
- configMap:
name: __SONOBUOY_CONFIGMAP__
name: config
systemdlogs.yaml: |
driver: DaemonSet
name: systemd_logs
resultType: systemd_logs
spec:
restartPolicy: Never
containers:
- command:
- sh
- -c
- /get_systemd_logs.sh && sleep 3600
env:
- name: NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: RESULTS_DIR
value: /tmp/results
- name: CHROOT_DIR
value: /node
image: gcr.io/heptio-images/sonobuoy-plugin-systemd-logs:latest
- name: e2e
image: gcr.io/heptio-images/kube-conformance:latest
imagePullPolicy: Always
name: systemd-logs
securityContext:
privileged: true
# NOTE: Full conformance can take a while depending on your cluster size.
# As a result, only a single test is set atm to verify correctness.
# Operators that want the complete test results can comment out the
# env section.
env:
- name: E2E_FOCUS
value: "Pods should be submitted and removed"
volumeMounts:
- mountPath: /node
name: root
- mountPath: /tmp/results
name: results
- mountPath: /etc/sonobuoy
name: config
- command:
- name: results
mountPath: /tmp/results
- name: sonobuoy-worker
command:
- sh
- -c
- /sonobuoy worker single-node -v 5 --logtostderr && sleep 3600
- /sonobuoy worker global -v 5 --logtostderr
env:
- name: NODE_NAME
valueFrom:
Expand All @@ -205,35 +162,107 @@ data:
fieldPath: spec.nodeName
- name: RESULTS_DIR
value: /tmp/results
- name: MASTER_URL
value: "{{.MasterAddress}}"
- name: RESULT_TYPE
value: "e2e"
image: gcr.io/heptio-images/sonobuoy:master
imagePullPolicy: Always
name: sonobuoy-worker
securityContext:
privileged: true
volumeMounts:
- mountPath: /tmp/results
name: results
- mountPath: /etc/sonobuoy
name: config
dnsPolicy: ClusterFirstWithHostNet
hostIPC: true
hostNetwork: true
hostPID: true
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
operator: Exists
- key: CriticalAddonsOnly
operator: Exists
- name: results
mountPath: /tmp/results
volumes:
- hostPath:
path: /
name: root
- emptyDir: {}
name: results
- configMap:
name: __SONOBUOY_CONFIGMAP__
name: config
- name: results
emptyDir: {}
systemd_logs.tmpl: |
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: "sonobuoy-systemd-logs-config-{{.SessionID}}"
annotations:
"sonobuoy-plugin": "systemd_logs"
"sonobuoy-driver": "DaemonSet"
"sonobuoy-result-type": "systemd_logs"
labels:
component: sonobuoy
tier: analysis
"sonobuoy-run": "{{.SessionID}}"
namespace: {{.Namespace}}
spec:
selector:
matchLabels:
"sonobuoy-run": "{{.SessionID}}"
template:
metadata:
labels:
component: sonobuoy
tier: analysis
"sonobuoy-run": "{{.SessionID}}"
spec:
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
- key: CriticalAddonsOnly
operator: Exists
hostNetwork: true
hostIPC: true
hostPID: true
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: systemd-logs
command:
- sh
- -c
- /get_systemd_logs.sh && sleep 3600
env:
- name: NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: RESULTS_DIR
value: /tmp/results
- name: CHROOT_DIR
value: /node
image: gcr.io/heptio-images/sonobuoy-plugin-systemd-logs:latest
imagePullPolicy: Always
securityContext:
privileged: true
volumeMounts:
- mountPath: /node
name: root
- mountPath: /tmp/results
name: results
- name: sonobuoy-worker
command:
- sh
- -c
- /sonobuoy worker single-node -v 5 --logtostderr && sleep 3600
env:
- name: NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: RESULTS_DIR
value: /tmp/results
- name: MASTER_URL
value: "{{.MasterAddress}}"
image: gcr.io/heptio-images/sonobuoy:master
imagePullPolicy: Always
securityContext:
privileged: true
volumeMounts:
- mountPath: /tmp/results
name: results
volumes:
- name: root
hostPath:
path: /
- name: results
emptyDir: {}
kind: ConfigMap
metadata:
labels:
Expand Down
17 changes: 0 additions & 17 deletions pkg/config/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,26 +130,9 @@ func TestLoadAllPlugins(t *testing.T) {
t.Fatalf("First result of LoadAllPlugins has the wrong name: %v != systemd_logs", name)
}

if len(dsplugin.GetPodSpec().Containers) != 2 {
t.Fatalf("DaemonSetPlugin should have 2 containers, got %v", len(dsplugin.GetPodSpec().Containers))
}

firstContainerName := dsplugin.GetPodSpec().Containers[0].Name
if firstContainerName != "systemd-logs" {
t.Fatalf("systemd_logs plugin had unexpected container name (%v != %v)", firstContainerName, "systemd-logs")
}

jobplugin := plugins[1]
if name := jobplugin.GetName(); name != "e2e" {
t.Fatalf("Second result of LoadAllPlugins has the wrong name: %v != e2e", name)
}

if len(dsplugin.GetPodSpec().Containers) != 2 {
t.Fatalf("JobPlugin should have 2 containers, got %d", len(jobplugin.GetPodSpec().Containers))
}

firstContainerName = jobplugin.GetPodSpec().Containers[0].Name
if firstContainerName != "e2e" {
t.Fatalf("e2e plugin had unexpected container name (%v != %v)", firstContainerName, "e2e")
}
}
Loading

0 comments on commit 46da6bd

Please sign in to comment.