diff --git a/manager/drivers/secrets.go b/manager/drivers/secrets.go index a9bdaa46a6..642d244690 100644 --- a/manager/drivers/secrets.go +++ b/manager/drivers/secrets.go @@ -5,6 +5,7 @@ import ( "github.com/docker/docker/pkg/plugingetter" "github.com/docker/swarmkit/api" + "github.com/docker/swarmkit/api/naming" ) const ( @@ -40,8 +41,14 @@ func (d *SecretDriver) Get(spec *api.SecretSpec, task *api.Task) ([]byte, bool, var secretResp SecretsProviderResponse secretReq := &SecretsProviderRequest{ SecretName: spec.Annotations.Name, + SecretLabels: spec.Annotations.Labels, + ServiceID: task.ServiceID, ServiceName: task.ServiceAnnotations.Name, ServiceLabels: task.ServiceAnnotations.Labels, + TaskID: task.ID, + TaskName: naming.Task(task), + TaskImage: task.Spec.GetContainer().Image, + NodeID: task.NodeID, } container := task.Spec.GetContainer() if container != nil { @@ -82,9 +89,15 @@ func (d *SecretDriver) Get(spec *api.SecretSpec, task *api.Task) ([]byte, bool, // SecretsProviderRequest is the secrets provider request. type SecretsProviderRequest struct { SecretName string `json:",omitempty"` // SecretName is the name of the secret to request from the plugin + SecretLabels map[string]string `json:",omitempty"` // SecretLabels capture environment names and other metadata pertaining to the secret ServiceHostname string `json:",omitempty"` // ServiceHostname is the hostname of the service, can be used for x509 certificate + ServiceID string `json:",omitempty"` // ServiceID is the name of the service that requested the secret ServiceName string `json:",omitempty"` // ServiceName is the name of the service that requested the secret - ServiceLabels map[string]string `json:",omitempty"` // ServiceLabels capture environment names and other metadata + ServiceLabels map[string]string `json:",omitempty"` // ServiceLabels capture environment names and other metadata pertaining to the service + TaskID string `json:",omitempty"` // TaskID is the ID of the task that the secret will be assigned to + TaskName string `json:",omitempty"` // TaskName is the name of the task that the secret will be assigned to + TaskImage string `json:",omitempty"` // TaskName is the image of the task that the secret will be assigned to + NodeID string `json:",omitempty"` // NodeID is the ID of the node that the task will be executed on ServiceEndpointSpec *EndpointSpec `json:",omitempty"` // ServiceEndpointSpec holds the specification for endpoints }