mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-08 12:41:58 +00:00
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:
@@ -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,
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user