Skip to content

Commit

Permalink
Add pod SPIFFE id annotation for workload registrar
Browse files Browse the repository at this point in the history
Signed-off-by: Brandon Lum <lumjjb@gmail.com>
  • Loading branch information
lumjjb committed Feb 7, 2022
1 parent 2b69aa9 commit 91be287
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ const (
var (
ReleaseAnnotation = "pipeline.tekton.dev/release"

SpiffeIdAnnotation = "spiffe.io/spiffe-id"

groupVersionKind = schema.GroupVersionKind{
Group: v1beta1.SchemeGroupVersion.Group,
Version: v1beta1.SchemeGroupVersion.Version,
Expand Down Expand Up @@ -275,7 +277,9 @@ func (b *Builder) Build(ctx context.Context, taskRun *v1beta1.TaskRun, taskSpec
return nil, err
}

podAnnotations := kmeta.CopyMap(taskRun.Annotations)
if config.FromContextOrDefaults(ctx).FeatureFlags.EnableSpire {
podAnnotations[SpiffeIdAnnotation] = fmt.Sprintf("ns/%v/taskrun/%v", taskRun.Namespace, taskRun.Name)
volumes = append(volumes, corev1.Volume{
Name: "spiffe-workload-api",
VolumeSource: corev1.VolumeSource{
Expand Down Expand Up @@ -330,7 +334,6 @@ func (b *Builder) Build(ctx context.Context, taskRun *v1beta1.TaskRun, taskSpec
priorityClassName = *podTemplate.PriorityClassName
}

podAnnotations := kmeta.CopyMap(taskRun.Annotations)
version, err := changeset.Get()
if err != nil {
return nil, err
Expand Down

0 comments on commit 91be287

Please sign in to comment.