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

[Feature] Support command and args field #515

Conversation

yandongxiao
Copy link
Collaborator

@yandongxiao yandongxiao commented Apr 22, 2024

Description

Although the Operator currently supports two extension methods, Init Container and sidecar, they may not meet users' needs in some situations.

  1. Users need to extend the Entrypoint script. For example, users may want to dynamically export some environment variables based on runtime information. In this case, users need to create their own Dockerfile and build their own container image.
  2. Users wish to add some files to the container. For instance, they may want to add a jar file to the lib directory. If the size of the jar file exceeds 1MB, users must first create a shared volume, then copy the existing contents of the lib directory to the shared volume, and finally mount this volume to the lib directory.

Suggestion

Although users can find workarounds, that increases the complexity of their operations.

We can solve the above problems by supporting the command and args field.

  1. Maintained compatibility. If the user does not use this, it will not cause the container to restart.
  2. We have added examples in values.yaml to make it easy to use command and args.
  3. In these examples, after adding the entrypoint in values.yaml, the program structure remains unchanged.
# the original processes
root@kube-starrocks-fe-0:/opt/starrocks# ps -ef
UID          PID    PPID  C STIME TTY          TIME CMD
root           1       0  0 11:01 ?        00:00:00 /bin/bash /opt/starrocks/fe_entrypoint.sh kube-starrocks-fe-service.starrocks
root          16       1 60 11:01 ?        00:00:12 /lib/jvm/default-java/bin/java -Dlog4j2.formatMsgNoLookups=true -Xmx8192m -XX:+UseG1GC -Xlog:gc*:/opt/starrocks/fe/log/fe.gc.log.20240423-110154:time com.starrocks.StarRocksFE -host_type FQDN
root         234       0  0 11:02 pts/0    00:00:00 bash
root         248     234  0 11:02 pts/0    00:00:00 ps -ef

root@kube-starrocks-be-0:/opt/starrocks# ps -ef
UID          PID    PPID  C STIME TTY          TIME CMD
root           1       0  0 11:02 ?        00:00:00 /bin/bash /opt/starrocks/be_entrypoint.sh kube-starrocks-fe-service
root          48       1  2 11:02 ?        00:00:01 /opt/starrocks/be/lib/starrocks_be
root         543       0  1 11:02 pts/0    00:00:00 bash
root         555     543  0 11:03 pts/0    00:00:00 ps -ef

root@kube-starrocks-cn-0:/opt/starrocks# ps -ef
UID          PID    PPID  C STIME TTY          TIME CMD
root           1       0  0 11:02 ?        00:00:00 /bin/bash /opt/starrocks/cn_entrypoint.sh kube-starrocks-fe-service
root          30       1  2 11:02 ?        00:00:01 /opt/starrocks/cn/lib/starrocks_be --cn
root         578       0  0 11:03 pts/0    00:00:00 bash
root         591     578  0 11:03 pts/0    00:00:00 ps -ef


# after entrypoint is specified in values.yaml

root@kube-starrocks-fe-0:/opt/starrocks# ps -ef
UID          PID    PPID  C STIME TTY          TIME CMD
root           1       0  0 10:56 ?        00:00:00 /bin/bash /opt/starrocks/fe_entrypoint.sh kube-starrocks-fe-service.starrocks
root          16       1 30 10:56 ?        00:00:14 /lib/jvm/default-java/bin/java -Dlog4j2.formatMsgNoLookups=true -Xmx8192m -XX:+UseG1GC -Xlog:gc*:/opt/starrocks/fe/log/fe.gc.log.20240423-105617:time com.starrocks.StarRocksFE -host_type FQDN
root         251       0  1 10:57 pts/0    00:00:00 bash
root         263     251  0 10:57 pts/0    00:00:00 ps -ef

root@kube-starrocks-be-0:/opt/starrocks# ps -ef
UID          PID    PPID  C STIME TTY          TIME CMD
root           1       0  0 10:56 ?        00:00:00 /bin/bash /opt/starrocks/be_entrypoint.sh kube-starrocks-fe-service
root          48       1  2 10:56 ?        00:00:01 /opt/starrocks/be/lib/starrocks_be
root         543       0  0 10:57 pts/0    00:00:00 bash
root         556     543  0 10:57 pts/0    00:00:00 ps -ef

root@kube-starrocks-cn-0:/opt/starrocks# ps -ef
UID          PID    PPID  C STIME TTY          TIME CMD
root           1       0  0 10:56 ?        00:00:00 /bin/bash /opt/starrocks/cn_entrypoint.sh kube-starrocks-fe-service
root          30       1  2 10:56 ?        00:00:01 /opt/starrocks/cn/lib/starrocks_be --cn
root         578       0  0 10:57 pts/0    00:00:00 bash
root         590     578  0 10:57 pts/0    00:00:00 ps -ef

Checklist

For operator, please complete the following checklist:

  • run make generate to generate the code.
  • run golangci-lint run to check the code style.
  • run make test to run UT.
  • run make manifests to update the yaml files of CRD.

For helm chart, please complete the following checklist:

  • make sure you have updated the values.yaml
    file of starrocks chart.
  • In scripts directory, run bash create-parent-chart-values.sh to update the values.yaml file of the parent
    chart( kube-starrocks chart).

@yandongxiao yandongxiao force-pushed the feature/support-hook-on-entrypoint branch from 629b266 to 5df9d2c Compare April 22, 2024 08:28
@yandongxiao yandongxiao marked this pull request as ready for review April 22, 2024 08:29
@yandongxiao yandongxiao force-pushed the feature/support-hook-on-entrypoint branch 2 times, most recently from 2b77408 to dcfd84d Compare April 22, 2024 15:42
@yandongxiao yandongxiao force-pushed the feature/support-hook-on-entrypoint branch from dcfd84d to 6e243cb Compare April 23, 2024 03:04
@yandongxiao yandongxiao changed the title [Feature] Add preStartScriptLocation field and support in helm chart [Feature] Support command and args field Apr 23, 2024
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

Successfully merging this pull request may close these issues.

1 participant