Skip to content
This repository has been archived by the owner on Jun 19, 2022. It is now read-only.

Commit

Permalink
add intevents
Browse files Browse the repository at this point in the history
  • Loading branch information
grac3gao committed May 26, 2020
1 parent 879b28d commit 4efdd80
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,17 @@ func makeReceiveAdapterPodSpec(ctx context.Context, args *ReceiveAdapterArgs) *c
}
}

// If k8s service account is specified, use that service account as credential.
if args.Source.Spec.ServiceAccountName != "" {
kServiceAccountName := args.Source.Spec.ServiceAccountName
return &corev1.PodSpec{
ServiceAccountName: kServiceAccountName,
Containers: []corev1.Container{
receiveAdapterContainer,
},
}
}

// Otherwise, use secret as credential.
secret := args.Source.Spec.Secret
credsFile := fmt.Sprintf("%s/%s", credsMountPath, secret.Key)
Expand Down
1 change: 1 addition & 0 deletions pkg/reconciler/intevents/resources/pullsubscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func MakePullSubscription(args *PullSubscriptionArgs) *inteventsv1alpha1.PullSub
PubSubSpec: duckv1alpha1.PubSubSpec{
IdentitySpec: duckv1alpha1.IdentitySpec{
GoogleServiceAccount: args.Spec.IdentitySpec.GoogleServiceAccount,
ServiceAccountName: args.Spec.IdentitySpec.ServiceAccountName,
},
Secret: args.Spec.Secret,
Project: args.Spec.Project,
Expand Down
1 change: 1 addition & 0 deletions pkg/reconciler/intevents/resources/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func MakeTopic(args *TopicArgs) *inteventsv1alpha1.Topic {
Spec: inteventsv1alpha1.TopicSpec{
IdentitySpec: duckv1alpha1.IdentitySpec{
GoogleServiceAccount: args.Spec.IdentitySpec.GoogleServiceAccount,
ServiceAccountName: args.Spec.IdentitySpec.ServiceAccountName,
},
Secret: args.Spec.Secret,
Project: args.Spec.Project,
Expand Down
11 changes: 11 additions & 0 deletions pkg/reconciler/intevents/topic/resources/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ func makePublisherPodSpec(args *PublisherArgs) *corev1.PodSpec {
}
}

// If k8s service account is specified, use that service account as credential.
if args.Topic.Spec.ServiceAccountName != "" {
kServiceAccountName := args.Topic.Spec.ServiceAccountName
return &corev1.PodSpec{
ServiceAccountName: kServiceAccountName,
Containers: []corev1.Container{
publisherContainer,
},
}
}

// Otherwise, use secret as credential.
secret := args.Topic.Spec.Secret
if secret == nil {
Expand Down

0 comments on commit 4efdd80

Please sign in to comment.