6.6. Customizing Presto Docker Images#
Custom Bootstrap Script#
Adding a bootstrap script to the Presto pods allows you to perform custom actions prior to the Presto startup. The script is executed after Presto configuration setup, but before starting the Presto server.
The volume is required to have a
bootstrap.sh file, and additional files are
allowed and provide further resources. The volume is mounted in all the Presto
The script is passed the string literal
executed. This allows you to use the same script to program different behavior:
if [ "$1" = "coordinator" ]; then echo "Bootstrapping coordinator" elif [ "$1" = "worker" ]; then echo "Bootstrapping worker" fi
For example, the
additionalBootstrapScriptVolume can be specified as a
additionalBootstrapScriptVolume: configMap: name: my-bootstrap-script-volume
You can add the ConfigMap to the Kubernetes resource. The following example contains the bootstrap.sh script inlined in the YAML syntax as multi-line string.
kind: ConfigMap apiVersion: v1 metadata: name: my-bootstrap-script-volume namespace: <my-namespace> data: bootstrap.sh: |- echo "Hello World." > /tmp/hello.txt
Note that it is also possible to mount multiple bootstrap script volumes via the
additionalBootstrapScriptVolumes: - configMap: name: my-bootstrap-script-volume-1 - configMap: name: my-bootstrap-script-volume-2
Bootstrap scripts are applied in the order they are defined in
bootstrap script is applied before any of the scripts defined in
Building Custom Presto Docker Images#
The Custom Bootstrap Script script mechanism, is a lighter, built-in way to customize the default Presto pod, without the need to build a separate custom Presto Docker image, it should suffice for most extension needs.
If you need to do more extensive changes to the underlying node, it is possible to build custom Presto Docker images used by Presto cluster. This allows you to to extend Presto with additional features, which are not supported by default, or otherwise modify the Presto nodes.
In order to build a custom Presto Docker image you must create a Docker image that is based on the SEP Docker image, e.g.
FROM starburstdata/presto:338-e.5-k8s-0.50 LABEL maintainer="..." # Your custom Docker image steps
/usr/local/bin/entrypoint.sh script, which is responsible for
autoconfiguring and launching Presto, if you need changes to the startup. Your
custom steps should be executed after Presto is autoconfigured by
presto-autoconfigure program, in addition to, or instead of, the
additional bootstrap script handling.
Once you have built your custom Presto Docker image and published it to your
container registry, you can use it within the cluster by updating the
section of resource:
apiVersion: starburstdata.com/v1 kind: Presto metadata: name: presto-cluster-name spec: image: name: custom-org/custom-presto-image:tag pullPolicy: IfNotPresent ...