kubeless icon indicating copy to clipboard operation
kubeless copied to clipboard

Cannot update a function label

Open lorenzo-ange opened this issue 5 years ago • 0 comments

Is this a BUG REPORT or FEATURE REQUEST?: BUG REPORT What happened: I deploy a function with a label: kubeless function deploy hello --runtime python2.7 --from-file func.py --handler func.hello --label my-label=a I try to update the function label: kubeless function update hello --label my-label=b The deployment label does NOT get updated and I get this error in the kubeless-controller logs:

time="2021-01-07T09:50:49Z" level=error msg="Function can not be created/updated: Deployment.apps \"hello\" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{\"created-by\":\"kubeless\", \"function\":\"hello\", \"my-label\":\"b\"}: `selector` does not match template `labels`" pkg=function-controller
time="2021-01-07T09:50:49Z" level=error msg="Error processing default/hello (will retry): Deployment.apps \"hello\" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{\"created-by\":\"kubeless\", \"function\":\"hello\", \"my-label\":\"b\"}: `selector` does not match template `labels`" pkg=function-controller

What you expected to happen: The deployment label gets updated and no error log in the kubeless-controller logs.

How to reproduce it (as minimally and precisely as possible): kubeless function deploy hello --runtime python2.7 --from-file func.py --handler func.hello --label my-label=a kubeless function update hello --label my-label=b kubectl -n kubeless logs kubeless-controller-manager-7c9b96cc7-758fk -c kubeless-function-controller Anything else we need to know?: If I first deploy the function without any labels and then I add the label my-label with "kubeless update" then I can change the value of my-label how many times I want.

I think the problem is related to the fact that my-label is inserted in the deployment spec.selector.matchLabels section. Environment:

  • Kubernetes version (use kubectl version): 1.14
  • Kubeless version (use kubeless version): v1.0.5-dirty
  • Cloud provider or physical cluster: minikube

lorenzo-ange avatar Jan 07 '21 10:01 lorenzo-ange