openfaas / connector-sdk

SDK for connecting events to functions
MIT License
54 stars 25 forks source link

Connector crashes when no /system/namespaces endpoint available #41

Closed bmcustodio closed 4 years ago

bmcustodio commented 4 years ago

Expected Behaviour

/system/namespaces is implemented.

Current Behaviour

/system/namespaces is not implemented (returns 404 page not found).

Possible Solution

Steps to Reproduce (for bugs)

  1. Deploy the OpenFaaS operator.
  2. Call /system/namespaces.

Context

This prevents the latest release of https://github.com/openfaas-incubator/connector-sdk from working at all, as it cannot list namespaces:

https://github.com/openfaas-incubator/connector-sdk/blob/master/types/function_list_builder.go#L33-L36

This causes applications consuming the SDK to crash:

https://github.com/openfaas-incubator/connector-sdk/blob/master/types/controller.go#L156-L159

Your Environment

Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.6", GitCommit:"96fac5cd13a5dc064f7d9f4f23030a6aeface6cc", GitTreeState:"clean", BuildDate:"2019-08-19T11:13:49Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14+", GitVersion:"v1.14.6-eks-5047ed", GitCommit:"5047edce664593832e9b889e447ac75ab104f527", GitTreeState:"clean", BuildDate:"2019-08-21T22:32:40Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}

MacOS 10.14.6

N/A

https://github.com/aws/amazon-vpc-cni-k8s

alexellis commented 4 years ago

Hi @bmcstdio

The operator does not support namespaces at this time, because @stefanprodan hasn't worked on the feature yet.

Can you log an issue in the connector-sdk, if it crashes when the namespaces endpoint is not populated? This work was carried out by @viveksyngh who I'm sure can assist you there.

In the meantime, how do you feel about submitting a PR to add the /system/namespaces endpoint to the operator, but as a stub that only returns the default?

Alex

cc @LucasRoesler @jonatasbaldin FYI

bmcustodio commented 4 years ago

In the meantime, how do you feel about submitting a PR to add the /system/namespaces endpoint to the operator, but as a stub that only returns the default?

That would probably not play nicely with https://github.com/openfaas-incubator/openfaas-operator/blob/master/main.go#L91-L94, right? If that is indeed the case, some refactoring, albeit small, might be necessary.

alexellis commented 4 years ago

That would probably not play nicely with x

I'm missing the reason why.

I've added a unit test to the code in the connector-sdk, it should resolve the problem, can you try 0.5.3?

alexellis commented 4 years ago

In any case, it should resolve the fatal error, I'll leave it with @viveksyngh from here who owns that code.

alexellis commented 4 years ago

/close: Fixed in https://github.com/openfaas-incubator/connector-sdk/releases/tag/0.5.3

alexellis commented 4 years ago

This issue has been raised to track the feature for the operator https://github.com/openfaas-incubator/openfaas-operator/issues/92

alexellis commented 4 years ago

See also: https://github.com/openfaas/faas-netes/issues/511