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

Adds Heptio Check Plugin #139

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 17 additions & 11 deletions pkg/config/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func TestLoadAllPlugins(t *testing.T) {
PluginSelections: []plugin.Selection{
plugin.Selection{Name: "systemd_logs"},
plugin.Selection{Name: "e2e"},
plugin.Selection{Name: "heptio-check"},
},
}

Expand All @@ -121,18 +122,23 @@ func TestLoadAllPlugins(t *testing.T) {
t.Fatal(err.Error())
}
plugins := cfg.getPlugins()
if len(plugins) != 2 {
t.Fatalf("Should have constructed 2 plugins, got %v", len(plugins))
if len(plugins) != len(cfg.PluginSelections) {
t.Fatalf("Should have constructed %v plugins, got %v", len(cfg.PluginSelections), len(plugins))
}

dsplugin := plugins[0]
if name := dsplugin.GetName(); name != "systemd_logs" {
t.Fatalf("First result of LoadAllPlugins has the wrong name: %v != systemd_logs", name)
}

jobplugin := plugins[1]
if name := jobplugin.GetName(); name != "e2e" {
t.Fatalf("Second result of LoadAllPlugins has the wrong name: %v != e2e", name)
for _, selection := range cfg.PluginSelections {
found := false
for _, loadedPlugin := range plugins {
if loadedPlugin.GetName() == selection.Name {
found = true
}
}
if !found {
pluginNames := make([]string, len(plugins))
for i, plugin := range plugins {
pluginNames[i] = plugin.GetName()
}
t.Fatalf("Expected to find %v in %v", selection.Name, pluginNames)
}
}

}
55 changes: 55 additions & 0 deletions plugins.d/heptio-e2e.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apiVersion: v1
kind: Pod
metadata:
annotations:
sonobuoy-driver: Job
sonobuoy-plugin: heptio-check
sonobuoy-result-type: heptio-check
labels:
component: sonobuoy
sonobuoy-run: '{{.SessionID}}'
tier: analysis
name: heptio-check
namespace: '{{.Namespace}}'
spec:
containers:
- image: 'gcr.io/heptio-images/heptio-e2e:latest'
imagePullPolicy: Always
name: 'sonobuoy-heptio-check-job-{{.SessionID}}'
volumeMounts:
- mountPath: /tmp/results
name: results
readOnly: false
- command:
- sh
- '-c'
- /sonobuoy worker global -v 5 --logtostderr
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: RESULTS_DIR
value: /tmp/results
- name: MASTER_URL
value: '{{.MasterAddress}}'
- name: RESULT_TYPE
value: heptio-check
image: 'gcr.io/heptio-images/sonobuoy:latest'
imagePullPolicy: Always
name: sonobuoy-worker
volumeMounts:
- mountPath: /tmp/results
name: results
readOnly: false
restartPolicy: Never
serviceAccountName: sonobuoy-serviceaccount
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
operator: Exists
- key: CriticalAddonsOnly
operator: Exists
volumes:
- emptyDir: {}
name: results