Skip to content

Commit

Permalink
Merge pull request tektoncd#1 from lumjjb/spire-lumjjb
Browse files Browse the repository at this point in the history
Add pod SPIFFE id annotation for workload registrar
  • Loading branch information
pxp928 committed Feb 8, 2022
2 parents 2b69aa9 + 91be287 commit 3dd850a
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 3dd850a

Please sign in to comment.