diff --git a/pkg/client/testdata/custom-systemd-logs-image.golden b/pkg/client/testdata/custom-systemd-logs-image.golden index 3681600a7..b56efa9f9 100644 --- a/pkg/client/testdata/custom-systemd-logs-image.golden +++ b/pkg/client/testdata/custom-systemd-logs-image.golden @@ -69,6 +69,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: @@ -109,8 +110,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: spec: ports: @@ -118,5 +119,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/default-plugins-via-nil-selection.golden b/pkg/client/testdata/default-plugins-via-nil-selection.golden index ff17d4d26..295312c70 100644 --- a/pkg/client/testdata/default-plugins-via-nil-selection.golden +++ b/pkg/client/testdata/default-plugins-via-nil-selection.golden @@ -87,6 +87,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: sonobuoy @@ -127,8 +128,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: sonobuoy spec: ports: @@ -136,5 +137,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/default-pod-spec.golden b/pkg/client/testdata/default-pod-spec.golden index 122985d1c..0930c6288 100644 --- a/pkg/client/testdata/default-pod-spec.golden +++ b/pkg/client/testdata/default-pod-spec.golden @@ -112,6 +112,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: @@ -152,8 +153,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: spec: ports: @@ -161,5 +162,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/default.golden b/pkg/client/testdata/default.golden index ff17d4d26..295312c70 100644 --- a/pkg/client/testdata/default.golden +++ b/pkg/client/testdata/default.golden @@ -87,6 +87,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: sonobuoy @@ -127,8 +128,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: sonobuoy spec: ports: @@ -136,5 +137,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/e2e-default.golden b/pkg/client/testdata/e2e-default.golden index d4daf08af..1ff33ccc4 100644 --- a/pkg/client/testdata/e2e-default.golden +++ b/pkg/client/testdata/e2e-default.golden @@ -58,6 +58,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: sonobuoy @@ -98,8 +99,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: sonobuoy spec: ports: @@ -107,5 +108,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/e2e-progress-custom-port.golden b/pkg/client/testdata/e2e-progress-custom-port.golden index 56f71eb44..a876892cf 100644 --- a/pkg/client/testdata/e2e-progress-custom-port.golden +++ b/pkg/client/testdata/e2e-progress-custom-port.golden @@ -61,6 +61,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: @@ -101,8 +102,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: spec: ports: @@ -110,5 +111,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/e2e-progress-vs-user-defined.golden b/pkg/client/testdata/e2e-progress-vs-user-defined.golden index 672e62fa3..db324b94b 100644 --- a/pkg/client/testdata/e2e-progress-vs-user-defined.golden +++ b/pkg/client/testdata/e2e-progress-vs-user-defined.golden @@ -61,6 +61,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: @@ -101,8 +102,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: spec: ports: @@ -110,5 +111,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/e2e-progress.golden b/pkg/client/testdata/e2e-progress.golden index a2832b893..af3e91115 100644 --- a/pkg/client/testdata/e2e-progress.golden +++ b/pkg/client/testdata/e2e-progress.golden @@ -61,6 +61,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: @@ -101,8 +102,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: spec: ports: @@ -110,5 +111,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/envoverrides.golden b/pkg/client/testdata/envoverrides.golden index 5b77d4c21..90b3bd339 100644 --- a/pkg/client/testdata/envoverrides.golden +++ b/pkg/client/testdata/envoverrides.golden @@ -61,6 +61,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: @@ -101,8 +102,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: spec: ports: @@ -110,5 +111,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/goRunnerRemoved.golden b/pkg/client/testdata/goRunnerRemoved.golden index 0fea1bd3f..51e8891a0 100644 --- a/pkg/client/testdata/goRunnerRemoved.golden +++ b/pkg/client/testdata/goRunnerRemoved.golden @@ -56,6 +56,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: @@ -96,8 +97,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: spec: ports: @@ -105,5 +106,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/imagePullSecrets.golden b/pkg/client/testdata/imagePullSecrets.golden index 428bdba56..a9db7d895 100644 --- a/pkg/client/testdata/imagePullSecrets.golden +++ b/pkg/client/testdata/imagePullSecrets.golden @@ -58,6 +58,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: @@ -100,8 +101,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: spec: ports: @@ -109,5 +110,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/manual-custom-plugin-plus-e2e.golden b/pkg/client/testdata/manual-custom-plugin-plus-e2e.golden index 4cb22a8b9..5cb77c6bb 100644 --- a/pkg/client/testdata/manual-custom-plugin-plus-e2e.golden +++ b/pkg/client/testdata/manual-custom-plugin-plus-e2e.golden @@ -65,6 +65,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: @@ -105,8 +106,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: spec: ports: @@ -114,5 +115,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/manual-custom-plugin-plus-systemd.golden b/pkg/client/testdata/manual-custom-plugin-plus-systemd.golden index 00c3445ba..d5e2edc28 100644 --- a/pkg/client/testdata/manual-custom-plugin-plus-systemd.golden +++ b/pkg/client/testdata/manual-custom-plugin-plus-systemd.golden @@ -75,6 +75,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: @@ -115,8 +116,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: spec: ports: @@ -124,5 +125,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/manual-custom-plugin.golden b/pkg/client/testdata/manual-custom-plugin.golden index 18f7f5ed7..1e80adc05 100644 --- a/pkg/client/testdata/manual-custom-plugin.golden +++ b/pkg/client/testdata/manual-custom-plugin.golden @@ -46,6 +46,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: @@ -86,8 +87,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: spec: ports: @@ -95,5 +96,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/manual-e2e.golden b/pkg/client/testdata/manual-e2e.golden index 9f8da50be..cf180203e 100644 --- a/pkg/client/testdata/manual-e2e.golden +++ b/pkg/client/testdata/manual-e2e.golden @@ -58,6 +58,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: @@ -98,8 +99,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: spec: ports: @@ -107,5 +108,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/multiple-node-selector.golden b/pkg/client/testdata/multiple-node-selector.golden index 8622ae396..59b0d67cc 100644 --- a/pkg/client/testdata/multiple-node-selector.golden +++ b/pkg/client/testdata/multiple-node-selector.golden @@ -87,6 +87,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: sonobuoy @@ -130,8 +131,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: sonobuoy spec: ports: @@ -139,5 +140,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/no-plugins-via-selection.golden b/pkg/client/testdata/no-plugins-via-selection.golden index 40c481335..99a720f49 100644 --- a/pkg/client/testdata/no-plugins-via-selection.golden +++ b/pkg/client/testdata/no-plugins-via-selection.golden @@ -38,6 +38,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: sonobuoy @@ -78,8 +79,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: sonobuoy spec: ports: @@ -87,5 +88,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/plugins-and-pluginSelection.golden b/pkg/client/testdata/plugins-and-pluginSelection.golden index 34f995044..983e94ecb 100644 --- a/pkg/client/testdata/plugins-and-pluginSelection.golden +++ b/pkg/client/testdata/plugins-and-pluginSelection.golden @@ -53,6 +53,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: sonobuoy @@ -93,8 +94,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: sonobuoy spec: ports: @@ -102,5 +103,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/single-node-selector.golden b/pkg/client/testdata/single-node-selector.golden index 48ab58b43..11369f067 100644 --- a/pkg/client/testdata/single-node-selector.golden +++ b/pkg/client/testdata/single-node-selector.golden @@ -87,6 +87,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: sonobuoy @@ -129,8 +130,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: sonobuoy spec: ports: @@ -138,5 +139,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/ssh.golden b/pkg/client/testdata/ssh.golden index 646d3fc6d..e3b45cc41 100644 --- a/pkg/client/testdata/ssh.golden +++ b/pkg/client/testdata/ssh.golden @@ -82,6 +82,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: @@ -122,8 +123,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: spec: ports: @@ -131,5 +132,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/systemd-logs-default.golden b/pkg/client/testdata/systemd-logs-default.golden index 58eb06d23..348e13c05 100644 --- a/pkg/client/testdata/systemd-logs-default.golden +++ b/pkg/client/testdata/systemd-logs-default.golden @@ -68,6 +68,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: sonobuoy @@ -108,8 +109,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: sonobuoy spec: ports: @@ -117,5 +118,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/client/testdata/use-existing-pod-spec.golden b/pkg/client/testdata/use-existing-pod-spec.golden index 2fa7fe304..bbe1c4195 100644 --- a/pkg/client/testdata/use-existing-pod-spec.golden +++ b/pkg/client/testdata/use-existing-pod-spec.golden @@ -48,6 +48,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: @@ -88,8 +89,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: spec: ports: @@ -97,5 +98,5 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP diff --git a/pkg/plugin/aggregation/update.go b/pkg/plugin/aggregation/update.go index 0ee7f18a9..6037de90c 100644 --- a/pkg/plugin/aggregation/update.go +++ b/pkg/plugin/aggregation/update.go @@ -33,7 +33,6 @@ import ( const ( StatusAnnotationName = "sonobuoy.hept.io/status" - StatusPodLabel = "run=sonobuoy-master" DefaultStatusPodName = "sonobuoy" ) @@ -220,26 +219,45 @@ func GetPatch(annotation string) map[string]interface{} { // GetAggregatorPod gets the sonobuoy aggregator pod based on its label. // It returns NoPodWithLabelError in the case where a pod with sonobuoy aggregator label could not be found. func GetAggregatorPod(client kubernetes.Interface, namespace string) (*v1.Pod, error) { - listOptions := metav1.ListOptions{ - LabelSelector: StatusPodLabel, - } + getPodWithLabel := func(label string) (*v1.Pod, error) { + listOptions := metav1.ListOptions{ + LabelSelector: label, + } - podList, err := client.CoreV1().Pods(namespace).List(listOptions) - if err != nil { - return nil, errors.Wrapf(err, "unable to list pods with label %q", StatusPodLabel) + podList, err := client.CoreV1().Pods(namespace).List(listOptions) + if err != nil { + return nil, errors.Wrapf(err, "unable to list pods with label %q", label) + } + + switch { + case len(podList.Items) == 0: + logrus.Warningf("no pods found with label %q in namespace %s", label, namespace) + return nil, NoPodWithLabelError(fmt.Sprintf("no pods found with label %q in namespace %s", label, namespace)) + + case len(podList.Items) > 1: + logrus.Warningf("Found more than one pod with label %q. Using pod with name %q", label, podList.Items[0].GetName()) + return &podList.Items[0], nil + default: + return &podList.Items[0], nil + } } - switch { - case len(podList.Items) == 0: - logrus.Warningf("no pods found with label %q in namespace %s", StatusPodLabel, namespace) - return nil, NoPodWithLabelError(fmt.Sprintf("no pods found with label %q in namespace %s", StatusPodLabel, namespace)) + aggregatorPodLabel := "sonobuoy-component=aggregator" + deprecatedAggregatorPodLabel := "run=sonobuoy-master" + + pod, err := getPodWithLabel(aggregatorPodLabel) + if err != nil || pod == nil { + if _, ok := err.(NoPodWithLabelError); !ok { + // If we encountered an error which doesn't correspond to no pods existing, + // log the error as a warning. + logrus.Warning(err) + } - case len(podList.Items) > 1: - logrus.Warningf("Found more than one pod with label %q. Using pod with name %q", StatusPodLabel, podList.Items[0].GetName()) - return &podList.Items[0], nil - default: - return &podList.Items[0], nil + // In either case, retry using the deprecated aggregator pod label. + logrus.Warningf("retrying with deprecated label %q", deprecatedAggregatorPodLabel) + pod, err = getPodWithLabel(deprecatedAggregatorPodLabel) } + return pod, err } // GetAggregatorPodName gets the sonobuoy aggregator pod name. It returns the default pod name diff --git a/pkg/plugin/aggregation/update_test.go b/pkg/plugin/aggregation/update_test.go index e370e80ae..6468bd0ee 100644 --- a/pkg/plugin/aggregation/update_test.go +++ b/pkg/plugin/aggregation/update_test.go @@ -57,18 +57,20 @@ func TestCreateUpdater(t *testing.T) { } func TestGetAggregatorPod(t *testing.T) { - createPodWithRunLabel := func(name string) corev1.Pod { + createPodWithLabels := func(name string, labels map[string]string) corev1.Pod { return corev1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: name, - Labels: map[string]string{"run": "sonobuoy-master"}, + Labels: labels, }, } } testPods := []corev1.Pod{ - createPodWithRunLabel("sonobuoy-run-pod-1"), - createPodWithRunLabel("sonobuoy-run-pod-2"), + createPodWithLabels("sonobuoy-run-pod-1", map[string]string{"sonobuoy-component": "aggregator"}), + createPodWithLabels("sonobuoy-run-pod-2", map[string]string{"sonobuoy-component": "aggregator"}), + createPodWithLabels("sonobuoy-run-pod-3", map[string]string{"run": "sonobuoy-master"}), + createPodWithLabels("sonobuoy-run-pod-4", map[string]string{"sonobuoy-component": "aggregator", "run": "sonobuoy-master"}), } checkNoError := func(err error) error { @@ -107,7 +109,7 @@ func TestGetAggregatorPod(t *testing.T) { expectedPod: nil, }, { - desc: "No pods results in no pod and no error", + desc: "No pods results in no pod and no label error", podsOnServer: corev1.PodList{}, checkError: checkNoPodWithLabelError, expectedPod: nil, @@ -124,6 +126,18 @@ func TestGetAggregatorPod(t *testing.T) { checkError: checkNoError, expectedPod: &testPods[0], }, + { + desc: "Only one pod with deprecated label results in that pod being returned", + podsOnServer: corev1.PodList{Items: []corev1.Pod{testPods[2]}}, + checkError: checkNoError, + expectedPod: &testPods[2], + }, + { + desc: "Aggregator label is prioritised if pods with new and deprecated labels", + podsOnServer: corev1.PodList{Items: []corev1.Pod{testPods[2], testPods[3]}}, + checkError: checkNoError, + expectedPod: &testPods[3], + }, } for _, tc := range testCases { diff --git a/pkg/plugin/driver/daemonset/daemonset.go b/pkg/plugin/driver/daemonset/daemonset.go index 0bcc5391d..499553be0 100644 --- a/pkg/plugin/driver/daemonset/daemonset.go +++ b/pkg/plugin/driver/daemonset/daemonset.go @@ -118,10 +118,11 @@ func (p *Plugin) createDaemonSetDefinition(hostname string, cert *tls.Certificat annotations[k] = v } labels := map[string]string{ - "component": "sonobuoy", - "tier": "analysis", - "sonobuoy-run": p.SessionID, - "sonobuoy-plugin": p.GetName(), + "component": "sonobuoy", + "sonobuoy-component": "plugin", + "sonobuoy-plugin": p.GetName(), + "sonobuoy-run": p.SessionID, + "tier": "analysis", } ds.ObjectMeta = metav1.ObjectMeta{ diff --git a/pkg/plugin/driver/job/job.go b/pkg/plugin/driver/job/job.go index 4451cb86d..887684e78 100644 --- a/pkg/plugin/driver/job/job.go +++ b/pkg/plugin/driver/job/job.go @@ -85,10 +85,11 @@ func (p *Plugin) createPodDefinition(hostname string, cert *tls.Certificate, own annotations[k] = v } labels := map[string]string{ - "component": "sonobuoy", - "tier": "analysis", - "sonobuoy-run": p.SessionID, - "sonobuoy-plugin": p.GetName(), + "component": "sonobuoy", + "sonobuoy-component": "plugin", + "sonobuoy-plugin": p.GetName(), + "sonobuoy-run": p.SessionID, + "tier": "analysis", } pod.ObjectMeta = metav1.ObjectMeta{ diff --git a/pkg/templates/manifest.go b/pkg/templates/manifest.go index d63e62d66..851ea97af 100644 --- a/pkg/templates/manifest.go +++ b/pkg/templates/manifest.go @@ -113,6 +113,7 @@ metadata: labels: component: sonobuoy run: sonobuoy-master + sonobuoy-component: aggregator tier: analysis name: sonobuoy namespace: {{.Namespace}} @@ -177,8 +178,8 @@ kind: Service metadata: labels: component: sonobuoy - run: sonobuoy-master - name: sonobuoy-master + sonobuoy-component: aggregator + name: sonobuoy-aggregator namespace: {{.Namespace}} spec: ports: @@ -186,6 +187,6 @@ spec: protocol: TCP targetPort: 8080 selector: - run: sonobuoy-master + sonobuoy-component: aggregator type: ClusterIP `)