{"action":"created","issue":{"url":"https://api.github.com/repos/openfaas/faas/issues/682","repository_url":"https://api.github.com/repos/openfaas/faas","labels_url":"https://api.github.com/repos/openfaas/faas/issues/682/labels{/name}","comments_url":"https://api.github.com/repos/openfaas/faas/issues/682/comments","events_url":"https://api.github.com/repos/openfaas/faas/issues/682/events","html_url":"https://github.com/openfaas/faas/issues/682","id":322276661,"node_id":"MDU6SXNzdWUzMjIyNzY2NjE=","number":682,"title":"Support annotations in function schema","user":{"login":"alexellis","id":6358735,"node_id":"MDQ6VXNlcjYzNTg3MzU=","avatar_url":"https://avatars1.githubusercontent.com/u/6358735?v=4","gravatar_id":"","url":"https://api.github.com/users/alexellis","html_url":"https://github.com/alexellis","followers_url":"https://api.github.com/users/alexellis/followers","following_url":"https://api.github.com/users/alexellis/following{/other_user}","gists_url":"https://api.github.com/users/alexellis/gists{/gist_id}","starred_url":"https://api.github.com/users/alexellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexellis/subscriptions","organizations_url":"https://api.github.com/users/alexellis/orgs","repos_url":"https://api.github.com/users/alexellis/repos","events_url":"https://api.github.com/users/alexellis/events{/privacy}","received_events_url":"https://api.github.com/users/alexellis/received_events","type":"User","site_admin":false},"labels":[{"id":725579403,"node_id":"MDU6TGFiZWw3MjU1Nzk0MDM=","url":"https://api.github.com/repos/openfaas/faas/labels/design/review","name":"design/review","color":"ededed","default":false},{"id":505489877,"node_id":"MDU6TGFiZWw1MDU0ODk4Nzc=","url":"https://api.github.com/repos/openfaas/faas/labels/help%20wanted","name":"help wanted","color":"128A0C","default":true},{"id":653680993,"node_id":"MDU6TGFiZWw2NTM2ODA5OTM=","url":"https://api.github.com/repos/openfaas/faas/labels/skill/intermediate","name":"skill/intermediate","color":"1d76db","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2018-05-11T12:20:16Z","updated_at":"2018-07-21T20:59:52Z","closed_at":null,"author_association":"MEMBER","body":"## Description\r\n\r\nWe should consider adding annotations to the schema or using them to store labels with Kubernetes\r\n\r\n## Example\r\n\r\n`\"label\": {\"value-with-json-meta\": \"data\"}`\r\nSwarm: valid\r\nKubernetes: invalid\r\n\r\n\r\n`\"Git-Deploy\": \"03/03/2018 10:10:00\"`\r\nSwarm: valid\r\nKubernetes: invalid\r\n\r\n`\"valid-for-both\": \"anything-that-123-looks-like-a.domain\"`\r\nSwarm: valid\r\nKubernetes: valid\r\n\r\n## Problem/Issue\r\n\r\nKubernetes uses annotations to configure metadata for objects like Pods. With Docker Swarm we use labels which support almost any string - but the label schema for Kubernetes is very restrictive only allowing a value which is a valid DNS entry.\r\n\r\nOpenFaaS Cloud and the event connectors make use of metadata for filtering so for a rich experience with Kubernetes we need to think about how to start accommodating this metadata.\r\n\r\nFor Swarm labels work well - for Kubernetes we may need to make use of annotations in addition to labels.\r\n\r\n## Proposal\r\n\r\nAdd new field to function schema named \"annotations\"\r\n\r\nFormat: map[string]string (same as label)\r\n\r\nKubernetes: implemented as annotations in deployment and CRD\r\n\r\nSwarm: implemented as label with special name\r\n\r\nThis is a vertical slice going all the way from the CLI through to the gateway to the providers and into the container orchestration system. The work will require (copy/paste/rename) of where labels are mentioned, but the work will have to be tested (manual end-to-end testing) and well co-ordinated with project lead.\r\n\r\n## Acceptance\r\n\r\n```\r\nprovider:\r\n  name: faas\r\n  gateway: http://127.0.0.1:8080\r\n\r\nfunctions:\r\n  slack-responder:\r\n    lang: go\r\n    handler: ./slack-responder\r\n    image: alexellis2/slack-responder:0.1.0\r\n    labels:\r\n      source: git\r\n   annotations:\r\n      git: https://github.com/alexellis/super-pancake-fn.git\r\n      topics: \"arn:aws:sns:us-west-2:111122223333:MyTopic,arn:aws:sns:us-west-2:111122223333:My-Second-Topic\"\r\n```\r\n\r\nPreviously the above would *not* be supported in Kubernetes - storing complex metadata in the function, but this would have been supported in Swarm.\r\n\r\nLabels vs Annotations in K8s:\r\n\r\nLabels: allows for only a-z, (-) and (.) character\r\nAnnotations: any value.\r\n"},"comment":{"url":"https://api.github.com/repos/openfaas/faas/issues/comments/406823225","html_url":"https://github.com/openfaas/faas/issues/682#issuecomment-406823225","issue_url":"https://api.github.com/repos/openfaas/faas/issues/682","id":406823225,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjgyMzIyNQ==","user":{"login":"alexellis","id":6358735,"node_id":"MDQ6VXNlcjYzNTg3MzU=","avatar_url":"https://avatars1.githubusercontent.com/u/6358735?v=4","gravatar_id":"","url":"https://api.github.com/users/alexellis","html_url":"https://github.com/alexellis","followers_url":"https://api.github.com/users/alexellis/followers","following_url":"https://api.github.com/users/alexellis/following{/other_user}","gists_url":"https://api.github.com/users/alexellis/gists{/gist_id}","starred_url":"https://api.github.com/users/alexellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexellis/subscriptions","organizations_url":"https://api.github.com/users/alexellis/orgs","repos_url":"https://api.github.com/users/alexellis/repos","events_url":"https://api.github.com/users/alexellis/events{/privacy}","received_events_url":"https://api.github.com/users/alexellis/received_events","type":"User","site_admin":false},"created_at":"2018-07-21T20:59:52Z","updated_at":"2018-07-21T20:59:52Z","author_association":"MEMBER","body":"Derek set milestone: 0.8.7"}}
{"actor":{"display_login":"alexellis"}}