Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pass runtime arguments for java native image #610

Open
zhoufenqin opened this issue May 23, 2023 · 3 comments
Open

How to pass runtime arguments for java native image #610

zhoufenqin opened this issue May 23, 2023 · 3 comments
Labels
hacktoberfest Hacktoberfest eligible note:ideal-for-contribution An issue that a contributor can help us with type:enhancement A general enhancement

Comments

@zhoufenqin
Copy link

Env:
kpack 0.9.2
k8s

If I want to enable JFR with Native Image, then in the build phase, I will pass a build argument like BP_NATIVE_IMAGE_BUILD_ARGUMENTS="--no-fallback --enable-monitoring=jfr --enable-monitoring=jvmstat" .

In runtime, I should configure JFR -XX:+FlightRecorder -XX:StartFlightRecording="filename=recording.jfr" to enable JFR and start a recording

For an pod spec, it looks like

  spec:
      containers:
      - args:
        - -XX:+FlightRecorder
        - -XX:StartFlightRecording=filename=/tmp/troubleshooting/recording.jfr,dumponexit=true,duration=10s
        command:
        - /cnb/process/web

But I hope the argument can be passed in another way. Like in OpenJDK buildpack, we will set BPL_JFR_ENABLED = true, then -XX:StartFlightRecording=dumponexit=true,filename=/tmp/recording.jfr will be automatically injected into JAVA_TOOL_OPTION when starting the java process.

Not sure if there are similar operations in a native image, we can pass some runtime environment, then /cnb/process/web will pick up some env as runtime parameters?

Expected Behavior

we don't need to configure each args manually, just configure some BPL_ env to represent the runtime environments.

Current Behavior

we should define args for each native image feature

Possible Solution

Steps to Reproduce

Motivations

@dmikusa
Copy link
Contributor

dmikusa commented May 23, 2023

If the options to enable flight recorder are the same for native image, we could add the JFR helper for it too. If they are not the same, we'd need a new helper.

@dmikusa dmikusa added type:enhancement A general enhancement note:ideal-for-contribution An issue that a contributor can help us with labels May 23, 2023
@zhoufenqin
Copy link
Author

Great, thanks @dmikusa , I think it's different and the buildpack won't be put into runtime image /layers.

I think it's a general feature, some other features may also request for this. Like supporting heapdump also need a helper.

BTW, what are the plans for adding features to the buildpack? E.g. how long will the feature be realized?

@dmikusa
Copy link
Contributor

dmikusa commented May 23, 2023

BTW, what are the plans for adding features to the buildpack? E.g. how long will the feature be realized?

There is no roadmap like with a traditional product that you'd purchase. It's an OSS project, so it really depends on when someone that is interested in this feature contributes the code.

@anthonydahanne anthonydahanne added the hacktoberfest Hacktoberfest eligible label Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Hacktoberfest eligible note:ideal-for-contribution An issue that a contributor can help us with type:enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants