New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V2 types and TPR #266
V2 types and TPR #266
Conversation
@soamvasani Thanks. I made some experiments with TPR in fission-benchmark. I will work on the new types. |
c6c5831
to
801de25
Compare
types.go
Outdated
// "sha256" is the only currently supported one. Sum is hex | ||
// encoded. | ||
Checksum struct { | ||
Type string `json:"type"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to alias this to ChecksumType, similar to PackageType
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
Literal []byte `json:"literal"` | ||
|
||
// URL references a package. | ||
URL string `json:"url"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not read through all the changes yet, but why do you need the distinction here between literal and URL? That might be something to extract from the actual Package
struct to something like this:
PackageLocation (Url/Filesystem) ---fetch--> Package
That would make the package agnostic of what way it was retrieved.
types.go
Outdated
@@ -92,6 +175,52 @@ type ( | |||
} | |||
|
|||
errorCode int | |||
|
|||
// | |||
// Fission-Environment interface. The following types are not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just about FunctionLoadRequest
? For clarity it might be an idea to split these internal type definitions to a separate file/package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is; I'll split it out.
Metadata `json:"metadata"` | ||
RunContainerImageUrl string `json:"runContainerImageUrl"` | ||
// FunctionSpec describes the contents of the function. | ||
FunctionSpec struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the definition of a function in general or the definition of a (deployed) function instance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the definition of a fission function. Not sure I get the question, what do you mean by "instance"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I thought there was also a plan to introduce a declarative function definition (something like the serverless.yml file in the serverless framework or npm's package.json). I thought this was it. :P So how do users have to specify package metadata (like the package entrypoint and version) now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is part of the plan for declarative definitions. You can have a yaml file that's the serialized version of these objects, just like any other kubernetes yaml files. (Client tooling to work with those files will be improved in future changes.)
All types now have a spec, following the pattern of K8s objects. Functions now have source and deployment packages. A Package can be specified by literal, or by URL. Environments now have a builder and runtime component. All triggers use a new FunctionReference to specify the function. This for now only uses a function name, but in the future can be extended to be more flexible. A new FunctionLoadRequest type is added for specialization requests to the environment runtime.
Implements TPR types using the spec types in fission/types.go. Adds code for adding creating TPR types, and convenient types for crud operations on each of our resource types. Adds code for connecting to K8s API and configuring a REST client with fission types set up.
This apiserver is now simply a stateless api layer on top of the TPR types. At the moment it doesn't do anything that couldn't be done by simply talking to the TPR types. In the future we can have better validation and potentially some higher level APIs (like versioning for example) in here.
As far as possible we keep the CLI flags the same. We'll have to add flags for source/deploy packages and builder/runtime environments. That will come in the next change.
Also adds a poolmgr_test.
Also adds a function reference resolver, which separates out the job of resolving a FunctionReference to a function.
Remove controllerUrl flag, since we don't need it any more.
Also update the poolmgr commandline, and use an env var for the fetcher image URL.
7f896d2
to
e55e1b4
Compare
This changes the core fission function, environment and trigger types. It also changes Fission's storage to use ThirdPartyResources.
See Documentation/wip/env-v2.md for design discussion about points 1 and 2.
Operationally, moving our state to TPRs means that users no longer have to maintain an etcd instance just for fission, and they also don't have to use persistent volumes for the fission api server. It also means they can specify functions and triggers declaratively and version control these declarations.
This change breaks compatibility with the v1 Fission API. It removes versioning from the core API. Some points of rationale for this:
Note that all v1 environments are still compatible Fission even after the API change. This is largely because environments don't have fission-api-specific stuff in them.
The fission CLI retains all of its old commands, but loses the versioning semantics. To migrate from a v1 to v2 deployment, you have to use the v1 CLI to get functions, envs and triggers; and then use the v2 CLI to create them again. This is a rather manual process. We'll be happy to help anyone having trouble with this process on the fission slack channel.
This is not a complete Environment v2 implementation; the remaining changes for that are: