Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
nlu90 committed Dec 5, 2023
1 parent e974851 commit 5062e28
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 15 deletions.
14 changes: 2 additions & 12 deletions controllers/spec/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion controllers/spec/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion controllers/spec/sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 0 additions & 1 deletion controllers/spec/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 5062e28

Please sign in to comment.