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

Add JAVA_ARGS to support command line arguments #50

Open
rhuss opened this issue Dec 9, 2016 · 2 comments
Open

Add JAVA_ARGS to support command line arguments #50

rhuss opened this issue Dec 9, 2016 · 2 comments

Comments

@rhuss
Copy link
Contributor

rhuss commented Dec 9, 2016

This is related to https://issues.jboss.org/projects/OSFUSE/issues/OSFUSE-475 to transport command line arguments to the run s2i script.

@LarsMilland
Copy link

LarsMilland commented Dec 12, 2016

Hi

I have just recently looked for a way to inject commandline arguments to s2i script /usr/local/s2i/run, exactly for the use case as how to choose which profile of a Spring Boot application to launch.

I think that if just the run script was extended with parsing on its own arguments then one could just change the Docker image launch configuration in the containers segment of a related resource fragment or a fully OpenShift/Kubernetes DepoymentController/ReplicationController manifest.

So if the script would just do:

exec /opt/run-java/run-java.sh $*
instead of just:
exec /opt/run-java/run-java.sh

Or with the actually already specified/documented way as environment variable JAVA_MAIN_ARGS (though not actually working):

spec:
  replicas: ${replicas}
  template:
    spec:
      volumes:
        - name: secrets-volume
          secret:
            secretName: datasource-secrets
      containers:
      - volumeMounts:
        - name: secrets-volume
          mountPath: /etc/secrets
        args:
          - /usr/local/s2i/run
          - "${appargs}"
        env:
          - name: JAVA_OPTIONS
            value: ${javaoptions}
          - name: JAVA_MAIN_ARGS
            value: ${appargs}

Best regards
Lars Milland

@rhuss
Copy link
Contributor Author

rhuss commented Jan 12, 2017

I agree that we should support both:

  • If arguments are given to the script, then use these first.
  • In addition, if the env var "JAVA_ARGS" is provided, then append these arguments, too.

The problem with the env approach of course is how to deal with arguments containing spaces. The best would be to expand the variable and then eval everything in the startup script, so that we leave this to the shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants