Skip to content

Commit

Permalink
Make Nodejs20 default (#831)
Browse files Browse the repository at this point in the history
  • Loading branch information
halamix2 authored Mar 20, 2024
1 parent b55f682 commit 03b1ba0
Show file tree
Hide file tree
Showing 31 changed files with 75 additions and 74 deletions.
8 changes: 4 additions & 4 deletions components/serverless/design/extend_function_spec_proposal.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ metadata:
labels:
app.kubernetes.io/name: my-function
spec:
runtime: nodejs18
runtime: nodejs20
source:
...
secretBindings:
Expand Down Expand Up @@ -215,7 +215,7 @@ metadata:
labels:
app.kubernetes.io/name: my-function
spec:
runtime: nodejs18
runtime: nodejs20
source:
...
runtimeSpec: # this name is not perfect
Expand Down Expand Up @@ -343,7 +343,7 @@ metadata:
labels:
app.kubernetes.io/name: my-function
spec:
runtime: nodejs18
runtime: nodejs20
source:
...
resourceProfiles:
Expand Down Expand Up @@ -421,7 +421,7 @@ metadata:
labels:
app.kubernetes.io/name: my-function
spec: #Contains spec of Function and run stage (deployments, hpa)
runtime: nodejs18
runtime: nodejs20
source:
...
replicas: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestFunctionReconciler_buildDeployment(t *testing.T) {
type args struct {
instance *serverlessv1alpha2.Function
}
rtmCfg := runtime.GetRuntimeConfig(serverlessv1alpha2.NodeJs18)
rtmCfg := runtime.GetRuntimeConfig(serverlessv1alpha2.NodeJs20)
resourceCfg := fixResources()

tests := []struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func newTestGitFunction(namespace, name string, auth *serverlessv1alpha2.Reposit
Auth: auth,
},
},
Runtime: serverlessv1alpha2.NodeJs18,
Runtime: serverlessv1alpha2.NodeJs20,
Env: []corev1.EnvVar{
{
Name: "TEST_1",
Expand Down Expand Up @@ -96,7 +96,7 @@ func newFixFunction(namespace, name string, minReplicas, maxReplicas int) *serve
Dependencies: " ",
},
},
Runtime: serverlessv1alpha2.NodeJs18,
Runtime: serverlessv1alpha2.NodeJs20,
Env: []corev1.EnvVar{
{
Name: "TEST_1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func TestGitOpsWithContinuousGitCheckout(t *testing.T) {
continuousGitCheckout := true

g := gomega.NewGomegaWithT(t)
rtm := serverlessv1alpha2.NodeJs18
rtm := serverlessv1alpha2.NodeJs20
resourceClient, testEnv := setUpTestEnv(g)
defer tearDownTestEnv(g, testEnv)
testCfg := setUpControllerConfig(g)
Expand Down Expand Up @@ -416,7 +416,7 @@ func TestGitOpsWithoutContinuousGitCheckout(t *testing.T) {
continuousGitCheckout := false

g := gomega.NewGomegaWithT(t)
rtm := serverlessv1alpha2.NodeJs18
rtm := serverlessv1alpha2.NodeJs20
resourceClient, testEnv := setUpTestEnv(g)
defer tearDownTestEnv(g, testEnv)
testCfg := setUpControllerConfig(g)
Expand Down Expand Up @@ -691,7 +691,7 @@ func TestGitOpsWithoutContinuousGitCheckout(t *testing.T) {
func TestGitOps_GitErrorHandling(t *testing.T) {
g := gomega.NewGomegaWithT(t)

rtm := serverlessv1alpha2.NodeJs18
rtm := serverlessv1alpha2.NodeJs20

resourceClient, testEnv := setUpTestEnv(g)
defer tearDownTestEnv(g, testEnv)
Expand Down Expand Up @@ -773,7 +773,7 @@ func TestGitOps_GitErrorHandling(t *testing.T) {
func Test_stateFnGitCheckSources(t *testing.T) {
g := gomega.NewGomegaWithT(t)

rtm := serverlessv1alpha2.NodeJs18
rtm := serverlessv1alpha2.NodeJs20

resourceClient, testEnv := setUpTestEnv(g)
defer tearDownTestEnv(g, testEnv)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const (

func TestFunctionReconciler_Reconcile_Scaling(t *testing.T) {
g := gomega.NewGomegaWithT(t)
rtm := serverlessv1alpha2.NodeJs18
rtm := serverlessv1alpha2.NodeJs20
resourceClient, testEnv := setUpTestEnv(g)
defer tearDownTestEnv(g, testEnv)
testCfg := setUpControllerConfig(g)
Expand Down Expand Up @@ -279,7 +279,7 @@ func TestFunctionReconciler_Reconcile_Scaling(t *testing.T) {

func TestFunctionReconciler_ResourceConfig(t *testing.T) {
g := gomega.NewGomegaWithT(t)
rtm := serverlessv1alpha2.NodeJs18
rtm := serverlessv1alpha2.NodeJs20
resourceClient, testEnv := setUpTestEnv(g)
defer tearDownTestEnv(g, testEnv)
testCfg := setUpControllerConfig(g)
Expand Down Expand Up @@ -399,7 +399,7 @@ func TestFunctionReconciler_Reconcile(t *testing.T) {

t.Parallel()
g := gomega.NewGomegaWithT(t)
rtm := serverlessv1alpha2.NodeJs18
rtm := serverlessv1alpha2.NodeJs20
resourceClient, testEnv := setUpTestEnv(g)
defer tearDownTestEnv(g, testEnv)
testCfg := setUpControllerConfig(g)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func Test_isOnSourceChange(t *testing.T) {
Source: v1alpha2.Source{
GitRepository: &v1alpha2.GitRepositorySource{},
},
Runtime: v1alpha2.NodeJs18,
Runtime: v1alpha2.NodeJs20,
},
},
expectedResult: true,
Expand All @@ -43,7 +43,7 @@ func Test_isOnSourceChange(t *testing.T) {
},
},
},
Runtime: v1alpha2.NodeJs18,
Runtime: v1alpha2.NodeJs20,
},
},
expectedResult: true,
Expand All @@ -59,7 +59,7 @@ func Test_isOnSourceChange(t *testing.T) {
},
},
},
Runtime: v1alpha2.NodeJs18,
Runtime: v1alpha2.NodeJs20,
},
},
expectedResult: true,
Expand All @@ -75,14 +75,14 @@ func Test_isOnSourceChange(t *testing.T) {
},
},
},
Runtime: v1alpha2.NodeJs18,
Runtime: v1alpha2.NodeJs20,
},
Status: v1alpha2.FunctionStatus{
Repository: v1alpha2.Repository{
Reference: "1",
},
Commit: "1",
Runtime: v1alpha2.NodeJs18,
Runtime: v1alpha2.NodeJs20,
},
},
revision: "1",
Expand All @@ -99,7 +99,7 @@ func Test_isOnSourceChange(t *testing.T) {
},
},
},
Runtime: v1alpha2.NodeJs18,
Runtime: v1alpha2.NodeJs20,
},
Status: v1alpha2.FunctionStatus{
Repository: v1alpha2.Repository{
Expand Down Expand Up @@ -173,7 +173,7 @@ func Test_isOnSourceChange(t *testing.T) {
},
},
},
Runtime: v1alpha2.NodeJs18,
Runtime: v1alpha2.NodeJs20,
},
Status: v1alpha2.FunctionStatus{
Repository: v1alpha2.Repository{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestNodejs_SanitizeDependencies(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
g := gomega.NewGomegaWithT(t)
r := runtime.GetRuntime(v1alpha2.NodeJs18)
r := runtime.GetRuntime(v1alpha2.NodeJs20)
got := r.SanitizeDependencies(tt.deps)
g.Expect(got).To(gomega.Equal(tt.want))
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func TestValidation_Invalid(t *testing.T) {
fn: serverlessv1alpha2.Function{
ObjectMeta: metav1.ObjectMeta{GenerateName: "test-fn"},
Spec: serverlessv1alpha2.FunctionSpec{
Runtime: serverlessv1alpha2.NodeJs18,
Runtime: serverlessv1alpha2.NodeJs20,
Source: serverlessv1alpha2.Source{
Inline: &serverlessv1alpha2.InlineSource{
Source: "source code",
Expand Down Expand Up @@ -394,7 +394,7 @@ func TestValidation_Invalid(t *testing.T) {
fn: serverlessv1alpha2.Function{
ObjectMeta: metav1.ObjectMeta{GenerateName: "test-fn"},
Spec: serverlessv1alpha2.FunctionSpec{
Runtime: serverlessv1alpha2.NodeJs18,
Runtime: serverlessv1alpha2.NodeJs20,
Source: serverlessv1alpha2.Source{
GitRepository: &serverlessv1alpha2.GitRepositorySource{
URL: "abc",
Expand All @@ -408,7 +408,7 @@ func TestValidation_Invalid(t *testing.T) {
fn: serverlessv1alpha2.Function{
ObjectMeta: metav1.ObjectMeta{GenerateName: "test-fn"},
Spec: serverlessv1alpha2.FunctionSpec{
Runtime: serverlessv1alpha2.NodeJs18,
Runtime: serverlessv1alpha2.NodeJs20,
Source: serverlessv1alpha2.Source{
GitRepository: &serverlessv1alpha2.GitRepositorySource{
URL: "github.com/kyma-project/kyma.git",
Expand All @@ -422,7 +422,7 @@ func TestValidation_Invalid(t *testing.T) {
fn: serverlessv1alpha2.Function{
ObjectMeta: metav1.ObjectMeta{GenerateName: "test-fn"},
Spec: serverlessv1alpha2.FunctionSpec{
Runtime: serverlessv1alpha2.NodeJs18,
Runtime: serverlessv1alpha2.NodeJs20,
Source: serverlessv1alpha2.Source{
GitRepository: &serverlessv1alpha2.GitRepositorySource{
URL: "[email protected]:kyma-project/kyma.git",
Expand Down Expand Up @@ -519,7 +519,7 @@ func TestValidation_Valid(t *testing.T) {
fn: serverlessv1alpha2.Function{
ObjectMeta: metav1.ObjectMeta{GenerateName: "test-fn"},
Spec: serverlessv1alpha2.FunctionSpec{
Runtime: serverlessv1alpha2.NodeJs18,
Runtime: serverlessv1alpha2.NodeJs20,
Source: serverlessv1alpha2.Source{
Inline: &serverlessv1alpha2.InlineSource{
Source: "source code",
Expand Down Expand Up @@ -547,7 +547,7 @@ func TestValidation_Valid(t *testing.T) {
fn: serverlessv1alpha2.Function{
ObjectMeta: metav1.ObjectMeta{GenerateName: "test-fn"},
Spec: serverlessv1alpha2.FunctionSpec{
Runtime: serverlessv1alpha2.NodeJs18,
Runtime: serverlessv1alpha2.NodeJs20,
Source: serverlessv1alpha2.Source{
Inline: &serverlessv1alpha2.InlineSource{
Source: "source code",
Expand All @@ -560,7 +560,7 @@ func TestValidation_Valid(t *testing.T) {
fn: serverlessv1alpha2.Function{
ObjectMeta: metav1.ObjectMeta{GenerateName: "test-fn"},
Spec: serverlessv1alpha2.FunctionSpec{
Runtime: serverlessv1alpha2.NodeJs18,
Runtime: serverlessv1alpha2.NodeJs20,
Source: serverlessv1alpha2.Source{
GitRepository: &serverlessv1alpha2.GitRepositorySource{
URL: "[email protected]:kyma-project/serverless.git",
Expand All @@ -573,7 +573,7 @@ func TestValidation_Valid(t *testing.T) {
fn: serverlessv1alpha2.Function{
ObjectMeta: metav1.ObjectMeta{GenerateName: "test-fn"},
Spec: serverlessv1alpha2.FunctionSpec{
Runtime: serverlessv1alpha2.NodeJs18,
Runtime: serverlessv1alpha2.NodeJs20,
Source: serverlessv1alpha2.Source{
GitRepository: &serverlessv1alpha2.GitRepositorySource{
URL: "https://github.com/kyma-project/serverless.git",
Expand Down
2 changes: 1 addition & 1 deletion components/serverless/internal/webhook/webhook_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type WebhookConfig struct {
}

func LoadWebhookCfg(path string) (WebhookConfig, error) {
cfg := WebhookConfig{DefaultRuntime: string(v1alpha2.NodeJs18)}
cfg := WebhookConfig{DefaultRuntime: string(v1alpha2.NodeJs20)}

cleanPath := filepath.Clean(path)
yamlFile, err := os.ReadFile(cleanPath)
Expand Down
4 changes: 2 additions & 2 deletions config/serverless/templates/busola-serverless-extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ data:
[]
subscribe:
language: |
$language = 'JavaScript' ? ($exists($root.spec.runtime) and $root.spec.runtime != 'python39') ? $root.spec.runtime : 'nodejs18' :
$language = 'JavaScript' ? ($exists($root.spec.runtime) and $root.spec.runtime != 'python39') ? $root.spec.runtime : 'nodejs20' :
$language = 'Python' ? 'python39' :
''
- path: spec.resourceConfiguration.function.profile
Expand Down Expand Up @@ -561,7 +561,7 @@ data:
- name: Node.js Function
value:
spec:
runtime: nodejs18
runtime: nodejs20
source:
inline:
source: |-
Expand Down
4 changes: 2 additions & 2 deletions docs/user/resources/06-10-function-cr.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ metadata:
labels:
app: my-test-function
spec:
runtime: nodejs18
runtime: nodejs20
source:
inline:
dependencies: |
Expand Down Expand Up @@ -100,7 +100,7 @@ spec:
auth:
type: basic
secretName: secret-name
runtime: "nodejs18"
runtime: "nodejs20"
```
## Custom Resource Parameters
Expand Down
6 changes: 3 additions & 3 deletions docs/user/technical-reference/05-20-env-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ spec:
configMapKeyRef:
key: my-var
name: my-vars-cm
runtime: nodejs18
runtime: nodejs20
source:
inline:
source: |
Expand Down Expand Up @@ -87,7 +87,7 @@ spec:
value: '2'
- name: REQ_MB_LIMIT
value: '10'
runtime: nodejs18
runtime: nodejs20
source:
inline:
source: |
Expand Down Expand Up @@ -120,7 +120,7 @@ spec:
env:
- name: FUNC_MEMFILE_MAX
value: '1048576' #1MiB
runtime: nodejs18
runtime: nodejs20
source:
inline:
source: |
Expand Down
2 changes: 1 addition & 1 deletion docs/user/technical-reference/07-10-sample-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ kind: Function
metadata:
name: test-function-nodejs
spec:
runtime: nodejs18
runtime: nodejs20
source:
inline:
dependencies: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For a Function to be considered ready, the status of all three conditions must b

```bash
NAME CONFIGURED BUILT RUNNING RUNTIME VERSION AGE
test-function True True True nodejs18 1 96s
test-function True True True nodejs20 1 96s
```

When you update an existing Function, conditions change asynchronously depending on the change type.
Expand Down Expand Up @@ -47,4 +47,4 @@ Thanks to the implemented reconciliation loop, the Function Controller constantl

The Function Controller observes the status of the underlying Deployment. If the minimum availability condition for the replicas is not satisfied, the Function Controller sets the **Running** status to `Unknown` with reason `MinimumReplicasUnavailable`. Such a Function should be considered unhealthy and the runtime profile or number of Replicas must be adjusted.

![Function running](../../assets/svls-running.svg)
![Function running](../../assets/svls-running.svg)
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ See the sample `config.yaml` for an inline Function for which code and dependenc
```yaml
name: function-practical-filip5
namespace: testme
runtime: nodejs18
runtimeImageOverride: eu.gcr.io/kyma-project/function-runtime-nodejs18:v20230228-b2981e80
runtime: nodejs20
runtimeImageOverride: europe-docker.pkg.dev/kyma-project/prod/function-runtime-nodejs20:v20240320-dacf4702
labels:
app: serverless-test
source:
Expand Down Expand Up @@ -95,7 +95,7 @@ See the sample `config.yaml` for a [Git Function](07-40-git-source-type.md) for
```yaml
name: function-practical-marcin
namespace: iteration-review
runtime: nodejs18
runtime: nodejs20
source:
sourceType: git
url: https://github.com/username/public-gitops.git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ See sample context details:
{
"function-name": "main",
"timeout": 180,
"runtime": "nodejs18",
"runtime": "nodejs20",
"memory-limit": 200Mi
}
```
Expand Down
Loading

0 comments on commit 03b1ba0

Please sign in to comment.