Skip to content
Snippets Groups Projects
Commit 1a055deb authored by Lucas Roesler's avatar Lucas Roesler Committed by Alex Ellis
Browse files

Add secret management to the update handler


**What**
- Pass secrets to the updateSpec method

Signed-off-by: default avatarLucas Roesler <roesler.lucas@gmail.com>
parent 7c28f7d9
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,14 @@ func MakeUpdateFunctionHandler(metricsOptions metrics.MetricOptions, c *client.C
return
}
updateSpec(&request, &service.Spec, maxRestarts, restartDelay)
secrets, err := makeSecretsArray(c, request.Secrets)
if err != nil {
log.Println(err)
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte("Deployment error: " + err.Error()))
return
}
updateSpec(&request, &service.Spec, maxRestarts, restartDelay, secrets)
updateOpts := types.ServiceUpdateOptions{}
updateOpts.RegistryAuthFrom = types.RegistryAuthFromSpec
......@@ -72,7 +79,7 @@ func MakeUpdateFunctionHandler(metricsOptions metrics.MetricOptions, c *client.C
}
}
func updateSpec(request *requests.CreateFunctionRequest, spec *swarm.ServiceSpec, maxRestarts uint64, restartDelay time.Duration) {
func updateSpec(request *requests.CreateFunctionRequest, spec *swarm.ServiceSpec, maxRestarts uint64, restartDelay time.Duration, secrets []*swarm.SecretReference) {
constraints := []string{}
if request.Constraints != nil && len(request.Constraints) > 0 {
......@@ -103,6 +110,7 @@ func updateSpec(request *requests.CreateFunctionRequest, spec *swarm.ServiceSpec
Target: request.Network,
},
}
spec.TaskTemplate.ContainerSpec.Secrets = secrets
spec.TaskTemplate.Resources = buildResources(request)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment