Skip to content

Commit

Permalink
Remove Nodejs16
Browse files Browse the repository at this point in the history
  • Loading branch information
halamix2 committed Mar 19, 2024
1 parent 667a989 commit 4010e8d
Show file tree
Hide file tree
Showing 30 changed files with 29 additions and 295 deletions.
22 changes: 0 additions & 22 deletions components/runtimes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,11 @@ ROOT := $(shell pwd)
release: build-images push-images

.PHONY: build-images
build-function-runtime-nodejs16-image \
build-function-runtime-python39-image

.PHONY: push-images
push-function-runtime-nodejs16-image \
push-function-runtime-python39-image


## nodejs16
FUNCTION_RUNTIME_IMAGE_NODEJS16 = function-runtime-nodejs16
FUNCTION_RUNTIME_NODEJS16_IMG_NAME:=$(DOCKER_PUSH_REPOSITORY)$(DOCKER_PUSH_DIRECTORY)/$(FUNCTION_RUNTIME_IMAGE_NODEJS16)

.PHONY: build-function-runtime-nodejs16-image push-function-runtime-nodejs16-image
build-function-runtime-nodejs16-image:
docker build -t $(FUNCTION_RUNTIME_IMAGE_NODEJS16) $(ROOT)/nodejs16/

push-function-runtime-nodejs16-image:
docker tag $(FUNCTION_RUNTIME_IMAGE_NODEJS16) $(FUNCTION_RUNTIME_NODEJS16_IMG_NAME):$(DOCKER_TAG)
docker push $(FUNCTION_RUNTIME_NODEJS16_IMG_NAME):$(DOCKER_TAG)
ifeq ($(JOB_TYPE), postsubmit)
@echo "Sign image with Cosign"
cosign version
cosign sign -key ${KMS_KEY_URL} $(FUNCTION_RUNTIME_NODEJS16_IMG_NAME):$(DOCKER_TAG)
else
@echo "Image signing skipped"
endif

## python39
FUNCTION_RUNTIME_IMAGE_PYTHON39 = function-runtime-python39
FUNCTION_RUNTIME_PYTHON39_IMG_NAME:=$(DOCKER_PUSH_REPOSITORY)$(DOCKER_PUSH_DIRECTORY)/$(FUNCTION_RUNTIME_IMAGE_PYTHON39)
Expand Down
1 change: 0 additions & 1 deletion components/serverless/.golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ linters:
issues:
exclude:
#exclude our internal deprecated fields
- "^SA1019: serverlessv1alpha2.NodeJs16 is deprecated:"
- "^SA1019: serverlessv1alpha2.Python39 is deprecated:"
- "^SA1019: status.RuntimeImageOverride is deprecated:"
- "^SA1019: s.instance.Spec.Template is deprecated:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,8 @@ spec:
type: object
runtime:
description: Specifies the runtime of the Function. The available
values are `nodejs16` - deprecated, `nodejs18`, `python39` - deprecated,
and `python312`.
values are `nodejs18`, `python39` - deprecated, and `python312`.
enum:
- nodejs16
- nodejs18
- python39
- python312
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
)

var (
rtmNodeJS16 = fnRuntime.GetRuntimeConfig(serverlessv1alpha2.NodeJs16)
rtmNodeJS18 = fnRuntime.GetRuntimeConfig(serverlessv1alpha2.NodeJs18)
rtmPython39 = fnRuntime.GetRuntimeConfig(serverlessv1alpha2.Python39)
rtmPython312 = fnRuntime.GetRuntimeConfig(serverlessv1alpha2.Python312)
Expand Down Expand Up @@ -432,25 +431,6 @@ func TestFunctionReconciler_buildJob(t *testing.T) {
ExpectedMountsLen int
ExpectedVolumeMounts []corev1.VolumeMount
}{
{
Name: "Success Node16",
Runtime: serverlessv1alpha2.NodeJs16,
ExpectedVolumesLen: 4,
ExpectedVolumes: []expectedVolume{
{name: "sources", localObjectReference: cmName},
{name: "runtime", localObjectReference: rtmNodeJS16.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 Node18",
Runtime: serverlessv1alpha2.NodeJs18,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func fillConfigEnvVars(runtime serverlessv1alpha2.Runtime, config *Config) {

func fillConfigFileNames(runtime serverlessv1alpha2.Runtime, config *Config) {
switch runtime {
case serverlessv1alpha2.NodeJs16, serverlessv1alpha2.NodeJs18:
case serverlessv1alpha2.NodeJs18:
config.DependencyFile = "package.json"
config.FunctionFile = "handler.js"
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@ func TestGetRuntimeConfig(t *testing.T) {
{Name: "PYTHONUNBUFFERED", Value: "TRUE"}},
},
},
"nodej16": {
name: "nodejs16 config",
runtime: serverlessv1alpha2.NodeJs16,
want: runtime.Config{
Runtime: serverlessv1alpha2.NodeJs16,
DependencyFile: "package.json",
FunctionFile: "handler.js",
DockerfileConfigMapName: "dockerfile-nodejs16",
RuntimeEnvs: []corev1.EnvVar{
{Name: "FUNC_RUNTIME", Value: "nodejs16"}},
},
},
"nodej18": {
name: "nodejs18 config",
runtime: serverlessv1alpha2.NodeJs18,
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.NodeJs16, serverlessv1alpha2.NodeJs18:
case serverlessv1alpha2.NodeJs18:
return []corev1.VolumeMount{
{
Name: "registry-config",
Expand Down
23 changes: 12 additions & 11 deletions components/serverless/internal/controllers/serverless/utils_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package serverless

import (
"testing"

serverlessv1alpha2 "github.com/kyma-project/serverless/components/serverless/pkg/apis/serverless/v1alpha2"
"github.com/stretchr/testify/assert"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"testing"
)

func Test_calculateGitImageTag(t *testing.T) {
Expand All @@ -26,10 +27,10 @@ func Test_calculateGitImageTag(t *testing.T) {
Dependencies: "",
},
},
Runtime: "nodejs16",
Runtime: "nodejs18",
},
},
want: "5e75a855ada0eb1fc5534e42387566508e03a1ef0d927ac281d5248a0ef1d0cc",
want: "4480d14ea252bf15f18c6632caff283b55beb6f38d5cf8cc43b1b116a151e78d",
},
{
name: "should use runtimeOverride",
Expand All @@ -44,7 +45,7 @@ func Test_calculateGitImageTag(t *testing.T) {
Dependencies: "",
},
},
Runtime: "nodejs16",
Runtime: "python312",
RuntimeImageOverride: "nodejs18",
},
},
Expand All @@ -63,11 +64,11 @@ func Test_calculateGitImageTag(t *testing.T) {
Dependencies: "",
},
},
Runtime: "nodejs16",
Runtime: "nodejs18",
RuntimeImageOverride: "",
},
},
want: "5e75a855ada0eb1fc5534e42387566508e03a1ef0d927ac281d5248a0ef1d0cc",
want: "4480d14ea252bf15f18c6632caff283b55beb6f38d5cf8cc43b1b116a151e78d",
},
}
for _, tt := range tests {
Expand Down Expand Up @@ -96,7 +97,7 @@ func Test_calculateInlineImageTag(t *testing.T) {
Dependencies: "",
},
},
Runtime: "nodejs16",
Runtime: "nodejs18",
},
Status: serverlessv1alpha2.FunctionStatus{
Commit: "commit",
Expand All @@ -105,7 +106,7 @@ func Test_calculateInlineImageTag(t *testing.T) {
},
},
},
want: "61373f52b742aec1e1be9b8b6a9984ea087524deffe6bb38f1788c0ae4d7d62b",
want: "e6ca45293444d4f6f1b43437f96cd2606842bf7cf9e14a126f52c0b7c216c677",
},
{
name: "should use runtimeOverride",
Expand All @@ -120,7 +121,7 @@ func Test_calculateInlineImageTag(t *testing.T) {
Dependencies: "",
},
},
Runtime: "nodejs16",
Runtime: "python312",
RuntimeImageOverride: "nodejs18",
},
Status: serverlessv1alpha2.FunctionStatus{
Expand All @@ -145,7 +146,7 @@ func Test_calculateInlineImageTag(t *testing.T) {
Dependencies: "",
},
},
Runtime: "nodejs16",
Runtime: "nodejs18",
RuntimeImageOverride: "",
},
Status: serverlessv1alpha2.FunctionStatus{
Expand All @@ -155,7 +156,7 @@ func Test_calculateInlineImageTag(t *testing.T) {
},
},
},
want: "61373f52b742aec1e1be9b8b6a9984ea087524deffe6bb38f1788c0ae4d7d62b",
want: "e6ca45293444d4f6f1b43437f96cd2606842bf7cf9e14a126f52c0b7c216c677",
},
}
for _, tt := range tests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ const (
// Deprecated: Python39 will be removed soon
Python39 Runtime = "python39"
Python312 Runtime = "python312"
// Deprecated: Nodejs16 will be removed soon
NodeJs16 Runtime = "nodejs16"
NodeJs18 Runtime = "nodejs18"
)

Expand Down Expand Up @@ -169,8 +167,8 @@ const (

// Defines the desired state of the Function
type FunctionSpec struct {
// Specifies the runtime of the Function. The available values are `nodejs16` - deprecated, `nodejs18`, `python39` - deprecated, and `python312`.
// +kubebuilder:validation:Enum=nodejs16;nodejs18;python39;python312;
// Specifies the runtime of the Function. The available values are `nodejs18`, `python39` - deprecated, and `python312`.
// +kubebuilder:validation:Enum=nodejs18;python39;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: nodejs16": {
fn: &serverlessv1alpha2.Function{
ObjectMeta: fixMetadata,
Spec: serverlessv1alpha2.FunctionSpec{
Runtime: serverlessv1alpha2.NodeJs16,
Source: serverlessv1alpha2.Source{
Inline: &serverlessv1alpha2.InlineSource{Source: "a"}},
},
},
},
"allowed runtime: nodejs18": {
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 NodeJs16, NodeJs18:
case NodeJs18:
return validateNodeJSDependencies(dependencies)
case Python39, Python312:
return nil
Expand Down
11 changes: 5 additions & 6 deletions config/serverless/templates/busola-serverless-extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ data:
source: 'spec.source.gitRepository ? "Git Repository" : "Inline Editor"'
- name: header.runtime
source: >-
spec.runtime = 'nodejs16' ? 'Node.js 16 - deprecated' : (spec.runtime = 'python39' ? 'Python 3.9 - deprecated' : (spec.runtime = 'nodejs18' ? 'Node.js 18' : (spec.runtime = 'python312' ? 'Python 3.12' : spec.runtime)))
spec.runtime = spec.runtime = 'python39' ? 'Python 3.9 - deprecated' : (spec.runtime = 'nodejs18' ? 'Node.js 18' : (spec.runtime = 'python312' ? 'Python 3.12' : spec.runtime))
body:
- widget: Tabs
children:
Expand Down Expand Up @@ -212,19 +212,19 @@ data:
enum: [JavaScript, Python]
trigger: [language]
dynamicValue: |
spec.runtime in ['nodejs16', 'nodejs18'] ? 'JavaScript' :
spec.runtime in ['nodejs18'] ? 'JavaScript' :
spec.runtime in ['python39', 'python312'] ? 'Python' :
''
- simple: true
path: spec.runtime
placeholder: placeholders.spec.runtime
enum: |
$language = 'JavaScript' ? ['nodejs16', 'nodejs18'] :
$language = 'JavaScript' ? ['nodejs18'] :
$language = 'Python' ? ['python39', 'python312'] :
[]
subscribe:
language: |
$language = 'JavaScript' ? ($exists($root.spec.runtime) and $root.spec.runtime != 'python39') ? $root.spec.runtime : 'nodejs16' :
$language = 'JavaScript' ? ($exists($root.spec.runtime) and $root.spec.runtime != 'python39') ? $root.spec.runtime : 'nodejs18' :
$language = 'Python' ? 'python39' :
''
- path: spec.resourceConfiguration.function.profile
Expand Down Expand Up @@ -422,7 +422,7 @@ data:
list: |-
- name: header.runtime
source: >-
spec.runtime = 'nodejs16' ? 'Node.js 16 - deprecated' : (spec.runtime = 'python39' ? 'Python 3.9 - deprecated' : (spec.runtime = 'nodejs18' ? 'Node.js 18' : (spec.runtime = 'python312' ? 'Python 3.12' : spec.runtime)))
spec.runtime = spec.runtime = 'python39' ? 'Python 3.9 - deprecated' : (spec.runtime = 'nodejs18' ? 'Node.js 18' : (spec.runtime = 'python312' ? 'Python 3.12' : spec.runtime))
- name: header.sourceType
source: 'spec.source.gitRepository ? "Git Repository" : "Inline Editor"'
- name: header.status
Expand Down Expand Up @@ -533,7 +533,6 @@ data:
Status: Status
Runtime: Runtime
'Source Type': Source Type
spec.runtime.nodejs16: Node.js 16 - deprecated
spec.runtime.nodejs18: Node.js 18
spec.runtime.python39: Python 3.9
spec.runtime.python312: Python 3.12
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 @@ -367,10 +367,8 @@ spec:
type: object
runtime:
description: Specifies the runtime of the Function. The available
values are `nodejs16` - deprecated, `nodejs18`, `python39` - deprecated,
and `python312`.
values are `nodejs18`, `python39` - deprecated, and `python312`.
enum:
- nodejs16
- nodejs18
- python39
- python312
Expand Down
28 changes: 0 additions & 28 deletions config/serverless/templates/runtimes.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,5 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: dockerfile-nodejs16
namespace: {{ .Release.Namespace }}
labels:
serverless.kyma-project.io/config: runtime
serverless.kyma-project.io/runtime: nodejs16
data:
Dockerfile: |-
ARG base_image={{ include "imageurl" (dict "reg" .Values.global.containerRegistry "img" .Values.global.images.function_runtime_nodejs16) }}
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-nodejs18
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 @@ -82,10 +82,6 @@ global:
name: "function-build-init"
version: "main"
directory: "prod"
function_runtime_nodejs16:
name: "function-runtime-nodejs16"
version: "main"
directory: "prod"
function_runtime_nodejs18:
name: "function-runtime-nodejs18"
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 `nodejs16` - deprecated, `nodejs18`, `python39` - deprecated, and `python312`. |
| **runtime** (required) | string | Specifies the runtime of the Function. The available values are `nodejs18`, `python39` - deprecated, 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: `nodejs16` - deprecated, `nodejs18`, `python39` - deprecated, and `python312`. |
| **FUNC_RUNTIME** | None | The name of the actual runtime. Possible values: `nodejs18`, `python39` - deprecated, 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 4010e8d

Please sign in to comment.