openfaas / faas-netes

Serverless Functions For Kubernetes
https://www.openfaas.com
MIT License
2.13k stars 472 forks source link

Proposal: add parameter we can setting k8s api proxy #324

Closed feifeiiiiiiiiiii closed 4 years ago

feifeiiiiiiiiiii commented 5 years ago

We can add proxy parameter to set k8s api proxy for testing faas-netes, inspired nginxinc/kubernetes-ingress

Expected Behaviour

Setting k8s proxy api, we can test faas-netes in local machine not need deploy in k8s cluster

Current Behaviour

If we add some features we need to build faas-netes image and deploy to k8s cluster, not convenient

Possible Solution

var (
    proxyURL = flag.String("proxy", "",
        `Use a proxy server to connect to Kubernetes API started by "kubectl proxy" command. Only for testing purposes only.`)
)

func main() {
        flag.Parse()

        var config *rest.Config
    var err error
    if *proxyURL != "" {
        config, err = clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
            &clientcmd.ClientConfigLoadingRules{},
            &clientcmd.ConfigOverrides{
                ClusterInfo: clientcmdapi.Cluster{
                    Server: *proxyURL,
                },
            }).ClientConfig()
        if err != nil {
            panic(err.Error())
        }
    } else {
        // creates the in-cluster config
        if config, err = rest.InClusterConfig(); err != nil {
            panic(err.Error())
        }
    }
}

Steps to Reproduce (for bugs)

1. 2. 3. 4.

Context

Your Environment

ivanayov commented 5 years ago

Derek add label: proposal

ivanayov commented 5 years ago

Hi @feifeiiiiiiiiiii ,

This proposal affects how OpenFaaS is currently designed. Can you please elaborate on why do you think this approach is better than the available? What would we gain that's not available at the moment? (out of testing scope)

Thanks, Ivana

feifeiiiiiiiiiii commented 5 years ago

Hi @ivanayov I think if we develop some new feature in OpenFaas gateway or other modules , we can very easy deploy faas-netes in local machine, not deploy to k8s cluster and inconvenient, because we need to build new feature images, so I think we should support a easy way

Only my personal suggest, not affect we use OpenFaas

Thanks

alexellis commented 4 years ago

/lock: closing as inactive. Feel free to raise a new issue if this is still required