diff --git a/controllers/spec/common.go b/controllers/spec/common.go index f3b1a1fe..3ef849f8 100644 --- a/controllers/spec/common.go +++ b/controllers/spec/common.go @@ -40,7 +40,6 @@ import ( autov2 "k8s.io/api/autoscaling/v2" v1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/client-go/kubernetes/scheme" @@ -340,14 +339,14 @@ func makePodTemplate(container *corev1.Container, filebeatContainer *corev1.Cont } } -func MakeJavaFunctionCommand(downloadPath, packageFile, name, clusterName, generateLogConfigCommand, logLevel, details, extraDependenciesDir, uid string, memory *resource.Quantity, +func MakeJavaFunctionCommand(downloadPath, packageFile, name, clusterName, generateLogConfigCommand, logLevel, details, extraDependenciesDir, uid string, javaOpts []string, hasPulsarctl, hasWget, authProvided, tlsProvided bool, secretMaps map[string]v1alpha1.SecretRef, state *v1alpha1.Stateful, tlsConfig TLSConfig, authConfig *v1alpha1.AuthConfig, maxPendingAsyncRequests *int32, logConfigFileName string) []string { processCommand := setShardIDEnvironmentVariableCommand() + " && " + generateLogConfigCommand + strings.Join(getProcessJavaRuntimeArgs(name, packageFile, clusterName, logLevel, details, - extraDependenciesDir, uid, memory, javaOpts, authProvided, tlsProvided, secretMaps, state, tlsConfig, + extraDependenciesDir, uid, javaOpts, authProvided, tlsProvided, secretMaps, state, tlsConfig, authConfig, maxPendingAsyncRequests, logConfigFileName), " ") if downloadPath != "" && !utils.EnableInitContainers { // prepend download command if the downPath is provided @@ -1906,15 +1905,6 @@ func getPythonSecretProviderArgs(secretMaps map[string]v1alpha1.SecretRef) []str return ret } -func calcInstanceMemoryResources(resources corev1.ResourceRequirements) *resource.Quantity { - if resources.Requests.Memory() == resources.Limits.Memory() { - // if request and limit are the same, use the value * 0.9 as the instance (JVM) memory size, to prevent OOM - return resource.NewQuantity(int64(float64(resources.Requests.Memory().Value())*0.9), resource.DecimalSI) - } - // if request and limit are different, use the request value as the instance (JVM) memory size - return resources.Requests.Memory() -} - func getGenericSecretProviderArgs(secretMaps map[string]v1alpha1.SecretRef, language string) []string { var ret []string if len(secretMaps) > 0 { diff --git a/controllers/spec/function.go b/controllers/spec/function.go index 4e7c11b9..0392746b 100644 --- a/controllers/spec/function.go +++ b/controllers/spec/function.go @@ -221,7 +221,6 @@ func makeFunctionCommand(function *v1alpha1.Function) []string { generateFunctionDetailsInJSON(function), spec.Java.ExtraDependenciesDir, string(function.UID), - calcInstanceMemoryResources(spec.Resources), spec.Java.JavaOpts, hasPulsarctl, hasWget, spec.Pulsar.AuthSecret != "", spec.Pulsar.TLSSecret != "", spec.SecretsMap, spec.StateConfig, spec.Pulsar.TLSConfig, diff --git a/controllers/spec/sink.go b/controllers/spec/sink.go index 3b136c2f..d88c27f8 100644 --- a/controllers/spec/sink.go +++ b/controllers/spec/sink.go @@ -213,7 +213,6 @@ func MakeSinkCommand(sink *v1alpha1.Sink) []string { parseJavaLogLevel(spec.Java), generateSinkDetailsInJSON(sink), spec.Java.ExtraDependenciesDir, string(sink.UID), - calcInstanceMemoryResources(spec.Resources), spec.Java.JavaOpts, hasPulsarctl, hasWget, spec.Pulsar.AuthSecret != "", spec.Pulsar.TLSSecret != "", spec.SecretsMap, spec.StateConfig, spec.Pulsar.TLSConfig, spec.Pulsar.AuthConfig, nil, generateJavaLogConfigFileName(spec.Java)) diff --git a/controllers/spec/source.go b/controllers/spec/source.go index 9fc63dd3..3fb24942 100644 --- a/controllers/spec/source.go +++ b/controllers/spec/source.go @@ -160,7 +160,6 @@ func makeSourceCommand(source *v1alpha1.Source) []string { parseJavaLogLevel(spec.Java), generateSourceDetailsInJSON(source), spec.Java.ExtraDependenciesDir, string(source.UID), - calcInstanceMemoryResources(spec.Resources), spec.Java.JavaOpts, hasPulsarctl, hasWget, spec.Pulsar.AuthSecret != "", spec.Pulsar.TLSSecret != "", spec.SecretsMap, spec.StateConfig, spec.Pulsar.TLSConfig, spec.Pulsar.AuthConfig, nil, generateJavaLogConfigFileName(spec.Java))