Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Propagate the labels form the build on the pod #559

Merged
merged 2 commits into from
Mar 18, 2019
Merged
Changes from 1 commit
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
12 changes: 9 additions & 3 deletions pkg/reconciler/build/resources/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
ccojocar marked this conversation as resolved.
Show resolved Hide resolved
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
Expand Down Expand Up @@ -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.
Expand Down