Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Add labels to the containers from the function spec #19

Open
alexellis opened this issue Jan 7, 2020 · 6 comments
Open

Add labels to the containers from the function spec #19

alexellis opened this issue Jan 7, 2020 · 6 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@alexellis
Copy link
Owner

alexellis commented Jan 7, 2020

Add labels to the containers from the function spec

Expected Behaviour

If you create a function with a label, that label should be added to the container definition, then read back later in the list endpoint.

Current Behaviour

They are ignored

Possible Solution

I'm OK if we only store the label and don't read it back for the first PR.

Update https://github.com/alexellis/faas-containerd/blob/master/handlers/update.go and https://github.com/alexellis/faas-containerd/blob/master/handlers/deploy.go

The types.FunctionDeployment struct already contains labels.

Steps to Reproduce (for bugs)

  1. faas-cli store deploy figlet --label has=label
  2. faas-cli describe figlet

The above on faas-netes / K8s will show the labels, on faas-containerd it won't

@alexellis alexellis added good first issue Good for newcomers help wanted Extra attention is needed labels Jan 7, 2020
@utsavanand2
Copy link
Contributor

I'll take this up

@utsavanand2
Copy link
Contributor

@alexellis Sir do we also want to put the labels from the types.FunctionDeployment by default in addition to the custom ones we apply from the cli flag?

@alexellis
Copy link
Owner Author

It'd be anything that is in the struct received over HTTP

utsavanand2 added a commit to utsavanand2/faas-containerd that referenced this issue Jan 8, 2020
This PR adds support for adding labels to OpenFaas functions
ruuning on containerd with faas-cli
closes alexellis#19

Signed-off-by: Utsav Anand <utsavanand2@gmail.com>
utsavanand2 added a commit to utsavanand2/faas-containerd that referenced this issue Jan 10, 2020
This option enables to add a label to containers
from the function spec.
e.g., `faas-cli store deploy figlet --label has=label`
Closes alexellis#19

Signed-off-by: Utsav Anand <utsavanand2@gmail.com>
@alexellis
Copy link
Owner Author

@utsavanand2 I think your PR should be a little easier now that we have merged changes for #20, here's an example of the test command, right now the labels are ignored, after your PR, they should show up here. cc @carlosedp

> faas-cli store deploy figlet --label test=true
WARNING! Communication is not secure, please consider using HTTPS. Letsencrypt.org offers free SSL/TLS certificates.
Function figlet already exists, attempting rolling-update.

Deployed. 200 OK.
URL: http://127.0.0.1:8080/function/figlet

> faas-cli describe figlet
Name:                figlet
Status:              Ready
Replicas:            1
Available replicas:  1
Invocations:         0
Image:               
Function process:    
URL:                 http://127.0.0.1:8080/function/figlet
Async URL:           http://127.0.0.1:8080/async-function/figlet

@carlosedp
Copy link
Contributor

@utsavanand2 I'd look here: https://godoc.org/github.com/containerd/containerd#WithContainerLabels

and here:

container, err := client.NewContainer(

:)

@utsavanand2
Copy link
Contributor

Thanks for the help @alexellis and @carlosedp !! 😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants