vmware-archive / http-trigger

Kubernetes CRD controller for http invocation of Kubeless functions
Apache License 2.0
9 stars 27 forks source link

Add support for CORS #10

Closed imishravmw closed 5 years ago

imishravmw commented 5 years ago

Issue Ref: [Issue number related to this PR or None] 934 Description: Support for cors flag for http trigger

[PR Description] cors-enable flag is a boolean flag, by default it is false to be backward compatible. if cors-enable flag is true, then one can specify cors-domain which will set that only from these cors-domain, cors will be supported. when cors-enable flag is true while creating HTTP trigger then it adds required annotations in ingress resource to enable cors

TODOs:

imishravmw commented 5 years ago
httpTriggerObj.ObjectMeta.Annotations

But using this approach we expect user to know what annotation to be applied on HTTPTrigger object , if one creates HttpTrigger object using yaml definition then one can do this ( rightly this will be more extensible).

but while creating trigger with kubeless CLI as well, then don't we want to give user a flag to enable cors. or we give a way to pass metadata as well. Then it will be fine.

in all ingress controllers, there is a way to enabled cors using annotation, is there a way to know which ingress controller is being used

imishravmw commented 5 years ago

Please see my latest changes, It copies annotation from metadata to http trigger object , and if using kubeless cli someone specifies cors-enable flag then also it applies cors enable annotation .

Still circleci build is failing because of below error Build Kubeless Components successful. Program saved at /home/circleci/.go_workspace/bin kubecfg show -U https://raw.githubusercontent.com/kubeless/runtimes/master -o yaml kubeless.jsonnet > kubeless.yaml.tmp ERROR unknown shorthand flag: 'U' in -U Makefile:36: recipe for target 'kubeless.yaml' failed

Can you let me know what could be problem, @andresmgot

imishravmw commented 5 years ago

@andresmgot please see now ,I have removed circular dependency in tests, build is passing now. Will make change in kubeless PR as well, Will add in kubeless doc regarding how to enable CORS Thanks for help.

imishravmw commented 5 years ago

@andresmgot changes are done and build has passed.

imishravmw commented 5 years ago

@andresmgot can you merge this PR , as my second PR is dependent on this merge

andresmgot commented 5 years ago

Thanks! I am merging this.