Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

[Kube Runtime] Refine init and runtime scripts in k8s pods. #3245

Merged
merged 4 commits into from
Jul 24, 2019

Conversation

abuccts
Copy link
Member

@abuccts abuccts commented Jul 23, 2019

Refine init and runtime scripts in k8s pods:

  • init script and init.d:

    • init script is executed as entrypoint in init container
    • all scripts under init.d will be executed in priority order
    • task container will be started after init script
  • runtime script and runtime.d:

    • runtime script will be executed as entrypoint in task container
    • all scripts under runtime.d will be executed in priority order
    • user commands will be executed in the end of runtime script

Here're the steps to onboard a new init/runtime script:

  1. put it under init.d/runtime.d
  2. give it a priority in [0, 100] and insert into init/runtime in order
  3. add the following format block
# comment for the script purpose
# priority=value
# ${PAI_{INIT,RUNTIME}_DIR}/{init,runtime}.sh >> ${PAI_LOG_FILE} 2>&1

Refine init and runtime scripts in k8s pods:

* `init` script and `init.d`:

  * init script is executed as entrypoint in init container
  * all scripts under `init.d` will be executed in priority order
  * task container will be started after `init` script

* `runtime` script and `runtime.d`:

  * `runtime` script will be executed as entrypoint in task container
  * all scripts under `runtime.d` will be executed in priority order
  * user commands will be executed in the end of `runtime` script
@abuccts abuccts requested review from wangdian and yqwang-ms July 23, 2019 09:40
@coveralls
Copy link

Coverage Status

Coverage remained the same at 50.592% when pulling 1f1378d on xiongyf/refine-init into 84354bf on feature/pure-k8s.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage remained the same at 50.592% when pulling 1f1378d on xiongyf/refine-init into 84354bf on feature/pure-k8s.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 50.592% when pulling 1f1378d on xiongyf/refine-init into 84354bf on feature/pure-k8s.

@coveralls
Copy link

coveralls commented Jul 23, 2019

Coverage Status

Coverage decreased (-0.0001%) to 50.592% when pulling 4daecc4 on xiongyf/refine-init into 84354bf on feature/pure-k8s.

Add steps to onboard a new init/runtime script:
1. put it under init.d/runtime.d
2. give it a priority in [0, 100] and insert into init/runtime in order
3. add the following format block

  # comment for the script purpose
  # priority=value
  # ${PAI_{INIT,RUNTIME}_DIR}/{init,runtime}.sh >> ${PAI_LOG_FILE} 2>&1
@abuccts
Copy link
Member Author

abuccts commented Jul 24, 2019

Add +x to executable scripts

RUN mkdir -p ./logs && \
chmod -R +x ./

@abuccts abuccts self-assigned this Jul 24, 2019
source ${PAI_RUNTIME_DIR}/runtime_env.sh

# prepare ssh

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call all scripts in runtime.d here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

script owner should add entrypoint here by themselves.

@abuccts abuccts merged commit 8725c06 into feature/pure-k8s Jul 24, 2019
@abuccts abuccts deleted the xiongyf/refine-init branch July 24, 2019 03:39
@hzy46 hzy46 mentioned this pull request Apr 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants