Backport annotations to PodTemplateSpec

Backport annotation support to v1beta1 and v1beta2 PodTemplateSpec. This
allows ReplicationController users to specify annotations for Pods in
addition to labels.
This commit is contained in:
Dan Mace
2015-02-02 13:49:41 -05:00
parent c2b79e52d4
commit 3d7f5cc642
5 changed files with 19 additions and 0 deletions

View File

@@ -61,6 +61,10 @@ func (r RealPodControl) createReplica(namespace string, controller api.Replicati
for k, v := range controller.Spec.Template.Labels {
desiredLabels[k] = v
}
desiredAnnotations := make(labels.Set)
for k, v := range controller.Spec.Template.Annotations {
desiredAnnotations[k] = v
}
// use the dash (if the name isn't too long) to make the pod name a bit prettier
prefix := fmt.Sprintf("%s-", controller.Name)
@@ -71,6 +75,7 @@ func (r RealPodControl) createReplica(namespace string, controller api.Replicati
pod := &api.Pod{
ObjectMeta: api.ObjectMeta{
Labels: desiredLabels,
Annotations: desiredAnnotations,
GenerateName: prefix,
},
}