openfaas / faas-netes

Serverless Functions For Kubernetes

Home Page:https://www.openfaas.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add an empty Status field to the Function CRD

alexellis opened this issue · comments

Add an empty Status field to the Function CRD

Expected Behaviour

The Function CRD should have a Status in its CRD, so that we can expand on readiness concepts later on or store state about the function.

Current Behaviour

This doesn't exist at present.

Which Solution Do You Recommend?

Update the definition for the types, so that kubebuilder generates a status object.

Make sure that it is not mandatory, otherwise it will be a breaking change for anyone applying a new object from YAML.

Codegen will need to be updated so that the Status object is added to the Go SDK for Functions:

https://github.com/openfaas/faas-netes/blob/master/hack/update-codegen.sh

The CRDs will have to be regenerated too:

https://github.com/openfaas/faas-netes/blob/master/hack/update-crds.sh

The inlets-operator already has a status, this may be useful?

https://github.com/inlets/inlets-operator/blob/master/pkg/apis/inletsoperator/v1alpha1/types.go#L40
https://github.com/inlets/inlets-operator/blob/master/pkg/apis/inletsoperator/v1alpha1/types.go#L54

We will probably need to add // +kubebuilder:subresource:status to the Function type.

https://github.com/openfaas/faas-netes/blob/master/pkg/apis/openfaas/v1/types.go#L13

I have been through this exercise once or twice but threw away the code, there may be a couple of surprises or issues to resolve.

@alexellis I would like to work on this. Do we still need this, just to make sure, since it is an old issue?

If yes, do you need to inform me about something more about what you expect other than what you have mentioned above, since it has been some time since this issue was opened?

It's tricky as there are so many edge cases including being at 0/0 replicas.

I think the only thing we could potentially do is something like:

ready = owned_deployment.generation == owned_deployment.desired_generation

@alexellis For this issue I have created a PR: #1104, adding an empty status field to the function CRD.

We can discuss what are we planning on how to use status to expand on readiness concepts or store the state of a function, providing users useful info about the progress.