Skip to content

Commit

Permalink
Remove Nodejs18 (#1213)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cortey authored Oct 16, 2024
1 parent 0a6a6e1 commit ac71fcf
Show file tree
Hide file tree
Showing 33 changed files with 25 additions and 370 deletions.
24 changes: 0 additions & 24 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,6 @@ updates:
# ignore minor python updates, e.g. 3.9 -> 3.12
- dependency-name: kyma-project/prod/external/library/python
update-types: ["version-update:semver-minor"]
- package-ecosystem: "docker"
directory: "/components/runtimes/nodejs/nodejs18"
labels:
- "area/dependency"
- "kind/chore"
schedule:
interval: "weekly"
commit-message:
prefix: "nodejs18"
include: "scope"
- package-ecosystem: "docker"
directory: "/components/runtimes/nodejs/nodejs20"
labels:
Expand All @@ -128,20 +118,6 @@ updates:
patterns:
- "opentelemetry-*"

- package-ecosystem: "npm"
directory: "/components/runtimes/nodejs/nodejs18"
labels:
- "area/dependency"
- "kind/chore"
schedule:
interval: "weekly"
commit-message:
prefix: "npm-nodejs18"
include: "scope"
groups:
opentelemetry:
patterns:
- "@opentelemetry/*"
- package-ecosystem: "npm"
directory: "/components/runtimes/nodejs/nodejs20"
labels:
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,6 @@ jobs:
dockerfile: components/serverless/deploy/jobinit/Dockerfile
tags: ${{ needs.compute-tags.outputs.tags }}

build-nodejs18:
needs: compute-tags
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main # Usage: kyma-project/test-infra/.github/workflows/image-builder.yml@main
with:
name: function-runtime-nodejs18
dockerfile: nodejs18/Dockerfile
context: components/runtimes/nodejs
tags: ${{ needs.compute-tags.outputs.tags }}

build-nodejs20:
needs: compute-tags
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main # Usage: kyma-project/test-infra/.github/workflows/image-builder.yml@main
Expand Down
29 changes: 0 additions & 29 deletions components/runtimes/nodejs/nodejs18/Dockerfile

This file was deleted.

29 changes: 0 additions & 29 deletions components/runtimes/nodejs/nodejs18/package.json

This file was deleted.

2 changes: 0 additions & 2 deletions components/serverless/.golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ issues:
max-same-issues: 0
exclude:
#exclude our internal deprecated fields
- "^SA1019: v1alpha2.Nodejs18 is deprecated:"
- "^SA1019: serverlessv1alpha2.Nodejs18 is deprecated:"
- "^SA1019: status.RuntimeImageOverride is deprecated:"
- "^SA1019: s.instance.Spec.Template is deprecated:"
- "^SA1019: s.instance.Spec.Template.Labels is deprecated:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,8 @@ spec:
type: object
runtime:
description: Specifies the runtime of the Function. The available
values are `nodejs18` - deprecated, `nodejs20`,
and `python312`.
values are `nodejs20` and `python312`.
enum:
- nodejs18
- nodejs20
- python312
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
)

var (
rtmNodeJS18 = fnRuntime.GetRuntimeConfig(serverlessv1alpha2.NodeJs18)
rtmNodeJS20 = fnRuntime.GetRuntimeConfig(serverlessv1alpha2.NodeJs20)
rtmPython312 = fnRuntime.GetRuntimeConfig(serverlessv1alpha2.Python312)
)
Expand Down Expand Up @@ -449,25 +448,6 @@ func TestFunctionReconciler_buildJob(t *testing.T) {
ExpectedMountsLen int
ExpectedVolumeMounts []corev1.VolumeMount
}{
{
Name: "Success Node18",
Runtime: serverlessv1alpha2.NodeJs18,
ExpectedVolumesLen: 4,
ExpectedVolumes: []expectedVolume{
{name: "sources", localObjectReference: cmName},
{name: "runtime", localObjectReference: rtmNodeJS18.DockerfileConfigMapName},
{name: "credentials", localObjectReference: dockerCfg.ActiveRegistryConfigSecretName},
{name: "registry-config", localObjectReference: packageRegistryConfigSecretName},
},
ExpectedMountsLen: 5,
ExpectedVolumeMounts: []corev1.VolumeMount{
{Name: "sources", MountPath: "/workspace/src/package.json", SubPath: FunctionDepsKey, ReadOnly: true},
{Name: "sources", MountPath: "/workspace/src/handler.js", SubPath: FunctionSourceKey, ReadOnly: true},
{Name: "runtime", MountPath: "/workspace/Dockerfile", SubPath: "Dockerfile", ReadOnly: true},
{Name: "credentials", MountPath: "/docker", ReadOnly: true},
{Name: "registry-config", MountPath: "/workspace/registry-config/.npmrc", SubPath: ".npmrc", ReadOnly: true},
},
},
{
Name: "Success Node20",
Runtime: serverlessv1alpha2.NodeJs20,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func fillConfigEnvVars(runtime serverlessv1alpha2.Runtime, config *Config) {

func fillConfigFileNames(runtime serverlessv1alpha2.Runtime, config *Config) {
switch runtime {
case serverlessv1alpha2.NodeJs18, serverlessv1alpha2.NodeJs20:
case serverlessv1alpha2.NodeJs20:
config.DependencyFile = "package.json"
config.FunctionFile = "handler.js"
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ func TestGetRuntimeConfig(t *testing.T) {
{Name: "PYTHONUNBUFFERED", Value: "TRUE"}},
},
},
"nodejs18": {
name: "nodejs18 config",
runtime: serverlessv1alpha2.NodeJs18,
want: runtime.Config{
Runtime: serverlessv1alpha2.NodeJs18,
DependencyFile: "package.json",
FunctionFile: "handler.js",
DockerfileConfigMapName: "dockerfile-nodejs18",
RuntimeEnvs: []corev1.EnvVar{
{Name: "FUNC_RUNTIME", Value: "nodejs18"}},
},
},
"nodejs20": {
name: "nodejs20 config",
runtime: serverlessv1alpha2.NodeJs20,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func getArg(args []string, arg string) string {

func getPackageConfigVolumeMountsForRuntime(rtm serverlessv1alpha2.Runtime) []corev1.VolumeMount {
switch rtm {
case serverlessv1alpha2.NodeJs18, serverlessv1alpha2.NodeJs20:
case serverlessv1alpha2.NodeJs20:
return []corev1.VolumeMount{
{
Name: "registry-config",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ type Runtime string

const (
Python312 Runtime = "python312"
// Deprecated: Nodejs18 will be removed soon
NodeJs18 Runtime = "nodejs18"
NodeJs20 Runtime = "nodejs20"
NodeJs20 Runtime = "nodejs20"
)

type FunctionType string
Expand Down Expand Up @@ -167,8 +165,8 @@ const (

// Defines the desired state of the Function
type FunctionSpec struct {
// Specifies the runtime of the Function. The available values are `nodejs18` - deprecated, `nodejs20`, and `python312`.
// +kubebuilder:validation:Enum=nodejs18;nodejs20;python312;
// Specifies the runtime of the Function. The available values are `nodejs20`, and `python312`.
// +kubebuilder:validation:Enum=nodejs20;python312;
Runtime Runtime `json:"runtime"`

// Specifies the runtime image used instead of the default one.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,6 @@ func Test_XKubernetesValidations_Valid(t *testing.T) {
},
},
},
"allowed runtime: nodejs18": {
fn: &serverlessv1alpha2.Function{
ObjectMeta: fixMetadata,
Spec: serverlessv1alpha2.FunctionSpec{
Runtime: serverlessv1alpha2.NodeJs18,
Source: serverlessv1alpha2.Source{
Inline: &serverlessv1alpha2.InlineSource{Source: "a"}},
},
},
},
"allowed runtime: nodejs20": {
fn: &serverlessv1alpha2.Function{
ObjectMeta: fixMetadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

func ValidateDependencies(runtime Runtime, dependencies string) error {
switch runtime {
case NodeJs18, NodeJs20:
case NodeJs20:
return validateNodeJSDependencies(dependencies)
case Python312:
return nil
Expand Down
9 changes: 4 additions & 5 deletions config/serverless/templates/busola-serverless-extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ data:
source: 'spec.source.gitRepository ? "Git Repository" : "Inline Editor"'
- name: header.runtime
source: >-
spec.runtime = 'nodejs18' ? 'Node.js 18 - deprecated' : (spec.runtime = 'python312' ? 'Python 3.12' : (spec.runtime = 'nodejs20' ? 'Node.js 20' : spec.runtime)))
spec.runtime = 'python312' ? 'Python 3.12' : (spec.runtime = 'nodejs20' ? 'Node.js 20' : spec.runtime)))
body:
- widget: Tabs
children:
Expand Down Expand Up @@ -214,14 +214,14 @@ data:
enum: [JavaScript, Python]
trigger: [language]
dynamicValue: |
spec.runtime in ['nodejs18', 'nodejs20'] ? 'JavaScript' :
spec.runtime in ['nodejs20'] ? 'JavaScript' :
spec.runtime in ['python312'] ? 'Python' :
''
- simple: true
path: spec.runtime
placeholder: placeholders.spec.runtime
enum: |
$language = 'JavaScript' ? ['nodejs18', 'nodejs20'] :
$language = 'JavaScript' ? ['nodejs20'] :
$language = 'Python' ? ['python312'] :
[]
subscribe:
Expand Down Expand Up @@ -471,7 +471,7 @@ data:
list: |-
- name: header.runtime
source: >-
spec.runtime = 'nodejs18' ? 'Node.js 18 - deprecated' : (spec.runtime = 'python312' ? 'Python 3.12' : (spec.runtime = 'nodejs20' ? 'Node.js 20' : spec.runtime)))
spec.runtime = 'python312' ? 'Python 3.12' : (spec.runtime = 'nodejs20' ? 'Node.js 20' : spec.runtime)))
- name: header.sourceType
source: 'spec.source.gitRepository ? "Git Repository" : "Inline Editor"'
- name: header.status
Expand Down Expand Up @@ -582,7 +582,6 @@ data:
Status: Status
Runtime: Runtime
'Source Type': Source Type
spec.runtime.nodejs18: Node.js 18 - deprecated
spec.runtime.nodejs20: Node.js 20
spec.runtime.python312: Python 3.12
spec.resourceConfiguration.build: Build
Expand Down
4 changes: 1 addition & 3 deletions config/serverless/templates/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,8 @@ spec:
type: object
runtime:
description: Specifies the runtime of the Function. The available
values are `nodejs18` - deprecated, `nodejs20`,
and `python312`.
values are `nodejs20` and `python312`.
enum:
- nodejs18
- nodejs20
- python312
type: string
Expand Down
31 changes: 0 additions & 31 deletions config/serverless/templates/runtimes.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,5 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: dockerfile-nodejs18
namespace: {{ .Release.Namespace }}
labels:
serverless.kyma-project.io/config: runtime
serverless.kyma-project.io/runtime: nodejs18
{{- include "tplValue" ( dict "value" .Values.global.commonLabels "context" . ) | nindent 4 }}
app.kubernetes.io/instance: {{ template "fullname" . }}-runtime-nodejs18
app.kubernetes.io/component: {{ template "fullname" . }}
data:
Dockerfile: |-
ARG base_image={{ include "imageurl" (dict "reg" .Values.global.containerRegistry "img" .Values.global.images.function_runtime_nodejs18) }}
FROM ${base_image}
USER root
ARG SRC_DIR=/src
RUN mkdir -p /usr/src/app/function
WORKDIR /usr/src/app/function
COPY /registry-config/* /usr/src/app/function/
COPY $SRC_DIR/package.json /usr/src/app/function/package.json
RUN npm install --omit=dev
COPY $SRC_DIR /usr/src/app/function
RUN ls -l /usr/src/app/function
WORKDIR /usr/src/app
USER 1000
---
apiVersion: v1
kind: ConfigMap
metadata:
name: dockerfile-nodejs20
namespace: {{ .Release.Namespace }}
Expand Down
4 changes: 0 additions & 4 deletions config/serverless/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ global:
name: "registry-init"
version: "v20240506-57d31b1d"
directory: "prod"
function_runtime_nodejs18:
name: "function-runtime-nodejs18"
version: "main"
directory: "prod"
function_runtime_nodejs20:
name: "function-runtime-nodejs20"
version: "main"
Expand Down
2 changes: 1 addition & 1 deletion docs/user/resources/06-10-function-cr.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ spec:
| **resourceConfiguration.​function** | object | Specifies resources requested by the Function's Pod. |
| **resourceConfiguration.​function.​profile** | string | Defines the name of the predefined set of values of the resource. Can't be used together with **Resources**. |
| **resourceConfiguration.​function.​resources** | object | Defines the amount of resources available for the Pod. Can't be used together with **Profile**. For configuration details, see the [official Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/). |
| **runtime** (required) | string | Specifies the runtime of the Function. The available values are `nodejs18` - deprecated, `nodejs20` and `python312`. |
| **runtime** (required) | string | Specifies the runtime of the Function. The available values are `nodejs20` and `python312`. |
| **runtimeImageOverride** | string | Specifies the runtime image used instead of the default one. |
| **scaleConfig** | object | Defines the minimum and maximum number of Function's Pods to run at a time. When it is configured, a HorizontalPodAutoscaler will be deployed and will control the **Replicas** field to scale the Function based on the CPU utilisation. |
| **scaleConfig.​maxReplicas** (required) | integer | Defines the maximum number of Function's Pods to run at a time. |
Expand Down
2 changes: 1 addition & 1 deletion docs/user/technical-reference/05-20-env-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Every runtime provides its own unique environment configuration which can be rea
| **FUNC_PORT** | `8080` | The right port a server listens to. |
| **SERVICE_NAMESPACE** | None | The namespace where the right Function exists in a cluster. |
| **KUBELESS_INSTALL_VOLUME** | `/kubeless` | Full path to volume mount with users source code. |
| **FUNC_RUNTIME** | None | The name of the actual runtime. Possible values: `nodejs18` - deprecated, `nodejs20` and `python312`. |
| **FUNC_RUNTIME** | None | The name of the actual runtime. Possible values: `nodejs20` and `python312`. |
| **TRACE_COLLECTOR_ENDPOINT** | None | Full address of OpenTelemetry Trace Collector is exported if the trace collector's endpoint is present. |
| **PUBLISHER_PROXY_ADDRESS** | `http://eventing-publisher-proxy.kyma-system.svc .cluster.local/publish` | Full address of the Publisher Proxy service. |

Expand Down
Loading

0 comments on commit ac71fcf

Please sign in to comment.