Contributing to Fission

Build deploy and contribute to Fission!

Thanks for helping make Fission better😍!

There are many areas we can use contributions - ranging from code, documentation, feature proposals, issue triage, samples, and content creation.

First, please read the code of conduct. By participating, you’re expected to uphold this code.

Choose something to work on

  • The easiest way to start is to look at existing issues and see if there’s something there that you’d like to work on. You can filter issues with label “Good first issue” which are relatively self sufficient issues and great for first time contributors.

  • If you are going to pick up an issue, it would be good to add a comment stating the intention.

  • If the contribution is a big change/new feature, please raise an issue and discuss the needs, design in the issue in detail.

Please check following repositories for your areas of interest,

Get Help

Do reach out on Slack or Twitter and we are happy to help.

Contributing - building & deploying

Pre-requisite

  • You’ll need the go compiler and tools installed. Currently version 1.16.x of Go is needed.

  • You’ll also need docker for building images locally. For Mac and Windows, Docker Desktop is recommended. You may prefer any compatible options for you OS.

  • You will need a Kubernetes cluster and you can use one of options from below.

    • Kind(Preferred)
    • Minikube
    • Cluster in cloud such as GKE (Google Kubernetes Engine cluster)/ EKS (Elastic Kubernetes Service)/ AKS (Azure Kubernetes Service)
  • Kubectl and Helm installed.

  • Goreleaser for building the Go binaries.

  • Skaffold for local development workflow to make it easier to build and deploy Fission.

  • And of course some basic concepts of Fission such as environment, function are good to be aware of!

Use Skaffold with Kind/K8S Cluster to build and deploy

You should create a Kubernetes cluster using Kind/Minikube cluster or if using a cloud provider cluster then Kubecontext should be pointing to appropriate cluster.

  • For building & deploying to Cloud Provider K8S cluster such as GKE/EKS/AKS:
skaffold config set default-repo vishalbiyani  // (vishalbiyani - should be your registry/Dockerhub handle)
skaffold run
  • For building & deploying to Kind cluster use Kind profile
kind create cluster
kubectl create ns fission
make skaffold-prebuild # This builds all Go binaries required for Fission
make create-crds
skaffold run -p kind
  • If you want your new changes to reflect after skaffold deploy,
make skaffold-prebuild # This builds all Go binaries required for Fission
skaffold run -p kind
Skaffold no longer uses the --force option which was causing issues with re-deploying after changes. For any changes requiring pod restart, please restart the pods manually.

Validating Installation

If you are using Helm, you should see release installed:

$ helm list -n fission -oyaml
- app_version: 1.14.1
  chart: fission-all-1.14.1
  name: fission
  namespace: fission
  revision: "1"
  status: deployed
  updated: 2021-09-13 13:16:28.51769

Also, you should see the Fission services deployed and running:

$ kubectl get pods -nfission
NAME                                                    READY   STATUS             RESTARTS   AGE
buildermgr-6f778d4ff9-dqnq5                             1/1     Running            0          6h9m
controller-d44bd4f4d-5q4z5                              1/1     Running            0          6h9m
executor-557c68c6fd-dg8ld                               1/1     Running            0          6h9m
influxdb-845548c959-2954p                               1/1     Running            0          6h9m
kubewatcher-5784c454b8-5mqsk                            1/1     Running            0          6h9m
logger-bncqn                                            2/2     Running            0          6h9m
mqtrigger-kafka-765b674ff-jk5x9                         1/1     Running            0          6h9m
mqtrigger-nats-streaming-797498966c-xgxmk               1/1     Running            3          6h9m
nats-streaming-6bf48bccb6-fmmr9                         1/1     Running            0          6h9m
router-db76576bd-xxh7r                                  1/1     Running            0          6h9m
storagesvc-799dcb5bdf-f69k9                             1/1     Running            0          6h9m
timer-7d85d9c9fb-knctw                                  1/1     Running            0          6h9m

Examples

In examples repo, we have a few Fission function samples for different languages. You can add your own samples also, so that they can provide help to a wider community.

Understanding code structure

cmd

Cmd package is entrypoint for all runtime components and also has Dockerfile for each component. The actual logic here will be pretty light and most of logic of each component is in pkg (Discussed later).

ComponentRuntime ComponentUsed in
fetcherDocker ImageEnvironments
fission-bundleDocker ImageBinary for all components
fission-cliCLI BinaryCLI by user
preupgradechecksDocker ImagePre-install upgrade
reporterDocker ImageUsed for analytics
cmd
β”œβ”€β”€ builder
β”‚Β Β  β”œβ”€β”€ Dockerfile.fission-builder
β”‚Β Β  β”œβ”€β”€ app
β”‚Β Β  β”‚Β Β  └── server.go
β”‚Β Β  └── main.go
β”œβ”€β”€ fetcher
β”‚Β Β  β”œβ”€β”€ Dockerfile.fission-fetcher
β”‚Β Β  β”œβ”€β”€ app
β”‚Β Β  β”‚Β Β  └── server.go
β”‚Β Β  └── main.go
β”œβ”€β”€ fission-bundle
β”‚Β Β  β”œβ”€β”€ Dockerfile.fission-bundle
β”‚Β Β  β”œβ”€β”€ main.go
β”‚Β Β  └── mqtrigger
β”‚Β Β      └── mqtrigger.go
β”œβ”€β”€ fission-cli
β”‚Β Β  β”œβ”€β”€ app
β”‚Β Β  β”‚Β Β  └── app.go
β”‚Β Β  └── main.go
β”œβ”€β”€ preupgradechecks
β”‚Β Β  β”œβ”€β”€ Dockerfile.fission-preupgradechecks
β”‚Β Β  β”œβ”€β”€ main.go
β”‚Β Β  └── preupgradechecks.go
└── reporter
    β”œβ”€β”€ Dockerfile.reporter
    β”œβ”€β”€ app
    β”‚Β Β  β”œβ”€β”€ app.go
    β”‚Β Β  └── cmd_event.go
    └── main.go

fetcher : is a very lightweight component and all of related logic is in fetcher package itself. Fetcher helps in fetching and uploading code and in specializing environments.

fission-bundle : is a component which is a single binary for all components. Based on arguments you pass to fission-bundle - it becomes that component. For ex.

/fission-bundle --controllerPort "8888" # Runs Controller

/fission-bundle --kubewatcher --routerUrl http://router.fission  # Runs Kubewatcher

So, most server side components running on server side are fission-bundle binary wrapped in container and used with different arguments. Various arguments and environment variables are passed from manifests/helm chart.

fission-cli : is the cli used by end user to interact Fission

preupgradechecks : is again a small independent component to do pre-install upgrade tasks.

pkg

Pkg is where most of core components and logic reside. The structure is fairly self-explanatory for example all of executor related functionality will be in executor package and so on.

pkg
β”œβ”€β”€ apis
β”œβ”€β”€ builder
β”œβ”€β”€ buildermgr
β”œβ”€β”€ cache
β”œβ”€β”€ canaryconfigmgr
β”œβ”€β”€ controller
β”œβ”€β”€ crd
β”œβ”€β”€ error
β”œβ”€β”€ executor
β”œβ”€β”€ featureconfig
β”œβ”€β”€ fetcher
β”œβ”€β”€ fission-cli
β”œβ”€β”€ generated
β”œβ”€β”€ generator
β”œβ”€β”€ info
β”œβ”€β”€ kubewatcher
β”œβ”€β”€ logger
β”œβ”€β”€ mqtrigger
β”œβ”€β”€ plugin
β”œβ”€β”€ poolcache
β”œβ”€β”€ publisher
β”œβ”€β”€ router
β”œβ”€β”€ storagesvc
β”œβ”€β”€ throttler
β”œβ”€β”€ timer
β”œβ”€β”€ tracker
└── utils

Custom Resource Definitions

Fission defines few Custom Resources Definitions, which helps in Fission defining Kubernetes like APIs for Fission entities, and in extending APIs as per Fission needs.

You can visualize CRDs here. YAML definition can be found in crds folder.

All definitions are defined in pkg/apis/core/v1/types.go.

Charts

Fission currently has fission-all for development.

charts
└── fission-all

Environments

Each of runtime environments is in fission/environments repository and fairly independent. If you are enhancing or creating a new environment - most likely you will end up making changes in that repository.

.
β”œβ”€β”€ environments
β”‚Β Β  β”œβ”€β”€ binary
β”‚Β Β  β”œβ”€β”€ dotnet
β”‚Β Β  β”œβ”€β”€ dotnet20
β”‚Β Β  β”œβ”€β”€ go
β”‚Β Β  β”œβ”€β”€ jvm
β”‚Β Β  β”œβ”€β”€ nodejs
β”‚Β Β  β”œβ”€β”€ perl
β”‚Β Β  β”œβ”€β”€ php7
β”‚Β Β  β”œβ”€β”€ python
β”‚Β Β  β”œβ”€β”€ ruby
β”‚Β Β  └── tensorflow-serving

You can visualize latest environment version at environments