Skip to content
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

Remove nodejs14 #414

Merged
merged 2 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion function/examples/cmd/workspace/sync/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ spec:
requests:
cpu: 50m
memory: 64Mi
runtime: nodejs14
runtime: nodejs18
source: |-
module.exports = {
main: function (event, context) {
Expand Down
18 changes: 2 additions & 16 deletions function/pkg/docker/runtimes/runtimes.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func ContainerEnvs(runtime types.Runtime, hotDeploy bool) []string {

func runtimeEnvs(runtime types.Runtime, hotDeploy bool) []string {
switch runtime {
case types.Nodejs14, types.Nodejs16, types.Nodejs18:
case types.Nodejs16, types.Nodejs18:
return []string{NodejsPath, "HOME=/home/node"}
case types.Python39:
envs := []string{Python39Path, Python39Unbuffered}
Expand All @@ -58,7 +58,7 @@ func runtimeEnvs(runtime types.Runtime, hotDeploy bool) []string {

func RuntimeDebugPort(runtime types.Runtime) string {
switch runtime {
case types.Nodejs14, types.Nodejs16, types.Nodejs18:
case types.Nodejs16, types.Nodejs18:
return NodejsDebugEndpoint
case types.Python39:
return Python39DebugEndpoint
Expand All @@ -69,18 +69,6 @@ func RuntimeDebugPort(runtime types.Runtime) string {

func ContainerCommands(runtime types.Runtime, debug bool, hotDeploy bool) []string {
switch runtime {
case types.Nodejs14:
runCommand := ""
if hotDeploy && debug {
runCommand = "npx nodemon --watch /kubeless/*.js --inspect=0.0.0.0 --exitcrash kubeless.js "
} else if hotDeploy {
runCommand = "npx nodemon --watch /kubeless/*.js /kubeless_rt/kubeless.js"
} else if debug {
runCommand = "node --inspect=0.0.0.0 kubeless.js "
} else {
runCommand = "node kubeless.js"
}
return []string{"npm install --production --prefix=$KUBELESS_INSTALL_VOLUME", runCommand}
case types.Nodejs16, types.Nodejs18:
runCommand := ""
if hotDeploy && debug {
Expand Down Expand Up @@ -155,8 +143,6 @@ func MoveInlineCommand(runtime types.Runtime, sourcePath, depsPath string) []str

func ContainerImage(runtime types.Runtime) string {
switch runtime {
case types.Nodejs14:
return "eu.gcr.io/kyma-project/function-runtime-nodejs14:v20230224-e59c5082"
case types.Nodejs16:
return "eu.gcr.io/kyma-project/function-runtime-nodejs16:v20230228-b2981e80"
case types.Nodejs18:
Expand Down
98 changes: 0 additions & 98 deletions function/pkg/docker/runtimes/runtimes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,40 +84,6 @@ func TestContainerEnvs(t *testing.T) {
"HOME=/home/node",
},
},
{
name: "should return envs for nodejs14",
args: args{
runtime: types.Nodejs14,
hotDeploy: false,
},
want: []string{
"KUBELESS_INSTALL_VOLUME=/kubeless",
"FUNC_RUNTIME=nodejs14",
"FUNC_HANDLER=main",
"MOD_NAME=handler",
"FUNC_PORT=8080",
"SERVICE_NAMESPACE=default",
NodejsPath,
"HOME=/home/node",
},
},
{
name: "should return envs for nodejs14 with hotDeploy",
args: args{
runtime: types.Nodejs14,
hotDeploy: true,
},
want: []string{
"KUBELESS_INSTALL_VOLUME=/kubeless",
"FUNC_RUNTIME=nodejs14",
"FUNC_HANDLER=main",
"MOD_NAME=handler",
"FUNC_PORT=8080",
"SERVICE_NAMESPACE=default",
NodejsPath,
"HOME=/home/node",
},
},
{
name: "should return envs for python39",
args: args{
Expand Down Expand Up @@ -191,11 +157,6 @@ func TestRuntimeDebugPort(t *testing.T) {
runtime: "",
want: "9229",
},
{
name: "should return nodejs14 debug port",
runtime: types.Nodejs14,
want: NodejsDebugEndpoint,
},
{
name: "should return nodejs16 debug port",
runtime: types.Nodejs16,
Expand Down Expand Up @@ -261,25 +222,6 @@ func TestContainerCommands(t *testing.T) {
"npm install --production --prefix=$KUBELESS_INSTALL_VOLUME", "npx nodemon --watch /kubeless/*.js /kubeless_rt/kubeless.js",
},
},
{
name: "should return commands for Nodejs14",
args: args{
runtime: types.Nodejs14,
},
want: []string{
"npm install --production --prefix=$KUBELESS_INSTALL_VOLUME", "node kubeless.js",
},
},
{
name: "should return commands for Nodejs14 with hotDeploy",
args: args{
runtime: types.Nodejs14,
hotDeploy: true,
},
want: []string{
"npm install --production --prefix=$KUBELESS_INSTALL_VOLUME", "npx nodemon --watch /kubeless/*.js /kubeless_rt/kubeless.js",
},
},
{
name: "should return commands for Nodejs16",
args: args{
Expand Down Expand Up @@ -396,13 +338,6 @@ func TestContainerImage(t *testing.T) {
},
want: "eu.gcr.io/kyma-project/function-runtime-nodejs18:v20230228-b2981e80",
},
{
name: "should return image for Nodejs14",
args: args{
runtime: types.Nodejs14,
},
want: "eu.gcr.io/kyma-project/function-runtime-nodejs14:v20230224-e59c5082",
},
{
name: "should return image for Nodejs16",
args: args{
Expand Down Expand Up @@ -445,39 +380,6 @@ func TestGetMounts(t *testing.T) {
args args
want []mount.Mount
}{
{
name: "should return mount for source type inline",
args: args{
runtime: types.Nodejs14,
sourceType: workspace.SourceTypeInline,
workDir: "/your/work/dir",
},
want: []mount.Mount{
{
Type: mount.TypeBind,
Source: "/your/work/dir",
Target: KubelessTmpPath,
},
{
Type: mount.TypeVolume,
Target: KubelessPath,
},
},
},
{
name: "should return mount for source type git",
args: args{
runtime: types.Nodejs14,
sourceType: workspace.SourceTypeGit,
},
want: []mount.Mount{
{
Type: mount.TypeBind,
Source: "",
Target: KubelessPath,
},
},
},
{
name: "should return mount for nodejs16",
args: args{
Expand Down
1 change: 0 additions & 1 deletion function/pkg/resources/types/runtimes.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ type Runtime = string

// List of supported runtimes
const (
Nodejs14 Runtime = "nodejs14"
Nodejs16 Runtime = "nodejs16"
Nodejs18 Runtime = "nodejs18"
Python39 Runtime = "python39"
Expand Down
2 changes: 1 addition & 1 deletion function/pkg/workspace/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ type Cfg struct {
Name string `yaml:"name"`
Namespace string `yaml:"namespace"`
Labels map[string]string `yaml:"labels,omitempty"`
Runtime types.Runtime `yaml:"runtime" jsonschema:"enum=nodejs14,enum=nodejs16,enum=nodejs18,enum=python39"`
Runtime types.Runtime `yaml:"runtime" jsonschema:"enum=nodejs16,enum=nodejs18,enum=python39"`
RuntimeImageOverride string `yaml:"runtimeImageOverride,omitempty"`
Source Source `yaml:"source"`
Resources Resources `yaml:"resource,omitempty"`
Expand Down
6 changes: 3 additions & 3 deletions function/pkg/workspace/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func initialize(cfg Cfg, dirPath string, writerProvider WriterProvider) (err err

func fromSources(runtime string, source, deps string) (workspace, error) {
switch runtime {
case types.Nodejs14, types.Nodejs16, types.Nodejs18:
case types.Nodejs16, types.Nodejs18:
return workspace{
NewTemplatedFile(source, FileNameHandlerJs),
NewTemplatedFile(deps, FileNamePackageJSON),
Expand All @@ -66,7 +66,7 @@ func fromSources(runtime string, source, deps string) (workspace, error) {

func fromRuntime(runtime types.Runtime) (workspace, error) {
switch runtime {
case types.Nodejs14, types.Nodejs16, types.Nodejs18:
case types.Nodejs16, types.Nodejs18:
return workspaceNodeJs, nil
case types.Python39:
return workspacePython, nil
Expand All @@ -81,7 +81,7 @@ type DepsFileName = string

func InlineFileNames(r types.Runtime) (SourceFileName, DepsFileName, bool) {
switch r {
case types.Nodejs14, types.Nodejs16, types.Nodejs18:
case types.Nodejs16, types.Nodejs18:
return string(FileNameHandlerJs), string(FileNamePackageJSON), true
case types.Python39:
return string(FileNameHandlerPy), string(FileNameRequirementsTxt), true
Expand Down
18 changes: 0 additions & 18 deletions function/pkg/workspace/workspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,6 @@ func Test_fromRuntime(t *testing.T) {
want: workspaceNodeJs,
wantErr: false,
},
{
name: "nodejs14",
args: args{
runtime: types.Nodejs14,
},
want: workspaceNodeJs,
wantErr: false,
},
{
name: "python39",
args: args{
Expand Down Expand Up @@ -219,16 +211,6 @@ func Test_fromSources(t *testing.T) {
want: workspace{},
wantErr: true,
},
{
name: "nodejs14",
args: args{
runtime: types.Nodejs14,
source: handlerJs,
deps: packageJSON,
},
want: workspaceNodeJs,
wantErr: false,
},
{
name: "python39",
args: args{
Expand Down
6 changes: 3 additions & 3 deletions function/pkg/workspace/writer_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestWriterProvider_write(t *testing.T) {
Labels: map[string]string{},
Namespace: "test-namespace",
Resources: Resources{},
Runtime: types.Nodejs14,
Runtime: types.Nodejs18,
Subscriptions: []Subscription{},
},
},
Expand All @@ -62,7 +62,7 @@ func TestWriterProvider_write(t *testing.T) {
Labels: map[string]string{},
Namespace: "test-namespace",
Resources: Resources{},
Runtime: types.Nodejs14,
Runtime: types.Nodejs18,
Subscriptions: []Subscription{},
},
},
Expand All @@ -81,7 +81,7 @@ func TestWriterProvider_write(t *testing.T) {
Labels: map[string]string{},
Namespace: "test-namespace",
Resources: Resources{},
Runtime: types.Nodejs14,
Runtime: types.Nodejs18,
Subscriptions: []Subscription{},
},
},
Expand Down