nephio-project / nephio

Nephio is a Kubernetes-based automation platform for deploying and managing highly distributed, interconnected workloads such as 5G Network Functions, and the underlying infrastructure on which those workloads depend.
Apache License 2.0
93 stars 52 forks source link

support multiple function versions built into porch #670

Open liamfallon opened 2 months ago

liamfallon commented 2 months ago

Original issue URL: https://github.com/kptdev/kpt/issues/3427 Original issue user: https://github.com/natasha41575 Original issue created at: 2022-08-01T22:00:51Z Original issue last updated at: 2022-08-01T22:14:19Z Original issue body: We recently ran into an issue where we wanted to support both set-namespace v0.4.1 and v0.3.4 as builtins in porch, but realized that with the current setup this is not possible because Go only allows you to import one major version of a library. (Ref: https://github.com/GoogleContainerTools/kpt/pull/3421#issuecomment-1199844216 and https://github.com/GoogleContainerTools/kpt/issues/3419)

Some options:

  1. Rename one of the functions so that they have different import paths
  2. Use the golang embed library to store the compiled executable binaries of the functions as bytes. During runtime, dump the contents into the local filesystem and execute the function as an exec.
  3. Add the compiled executable binaries of the functions into the image where porch is running.
  4. When we are out of alpha, we can separate by major versions (i.e. have one version of the function be v1 and the other v2) - Go will allow us to import different major versions.

We will probably eventually do (4), but in the meantime we are using (3) as a workaround for the set-namespace function.

Original issue comments: