From a4728b4d6f8ea086f3f4fd0f4b2ba5ca4f4bcab4 Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Fri, 15 Feb 2019 10:20:33 +0100 Subject: [PATCH 1/2] Propagate the labels from the build to the pod This allows users to specify custom labels. --- pkg/reconciler/build/resources/pod.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pkg/reconciler/build/resources/pod.go b/pkg/reconciler/build/resources/pod.go index df1394b8..76aa7efe 100644 --- a/pkg/reconciler/build/resources/pod.go +++ b/pkg/reconciler/build/resources/pod.go @@ -259,6 +259,14 @@ func MakePod(build *v1alpha1.Build, kubeclient kubernetes.Interface) (*corev1.Po } annotations["sidecar.istio.io/inject"] = "false" + // Copy labels on the build through to the underlying pod to allow users + // to specify pod lablels. + labels := map[string]string{} + for key, val := range build.Labels { + labels[key] = val + } + labels[buildNameLabelKey] = build.Name + cred, secrets, err := makeCredentialInitializer(build, kubeclient) if err != nil { return nil, err @@ -365,9 +373,7 @@ func MakePod(build *v1alpha1.Build, kubeclient kubernetes.Interface) (*corev1.Po }), }, Annotations: annotations, - Labels: map[string]string{ - buildNameLabelKey: build.Name, - }, + Labels: labels, }, Spec: corev1.PodSpec{ // If the build fails, don't restart it. From 6cbb915e43378f7464e2adef2341cf9d6bbdf7bc Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Sun, 24 Feb 2019 21:16:01 +0100 Subject: [PATCH 2/2] Fix typo in comment --- pkg/reconciler/build/resources/pod.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/reconciler/build/resources/pod.go b/pkg/reconciler/build/resources/pod.go index 76aa7efe..c2f5eb8f 100644 --- a/pkg/reconciler/build/resources/pod.go +++ b/pkg/reconciler/build/resources/pod.go @@ -260,7 +260,7 @@ func MakePod(build *v1alpha1.Build, kubeclient kubernetes.Interface) (*corev1.Po annotations["sidecar.istio.io/inject"] = "false" // Copy labels on the build through to the underlying pod to allow users - // to specify pod lablels. + // to specify pod labels. labels := map[string]string{} for key, val := range build.Labels { labels[key] = val