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

Enhance documentation: initContainer, lifecycle, additionalContainers #5954

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,72 @@ deployer.<application>.kubernetes.initContainers[1]={containerName:'test2', imag

Replace `<application>` with the name of your application and set the values of the `initContainer` attributes appropriate for your Init Container.

You can configure the Init Container at the global server level as well.

The following example shows how to do so for streams. Edit the appropriate `skipper-config-(binder).yaml`, replacing `(binder)` with the corresponding binder in use:

====
[source,yaml]
----
data:
application.yaml: |-
spring:
cloud:
skipper:
server:
platform:
kubernetes:
accounts:
default:
initContainers:
- containerName: test
imageName: busybox:latest
commands:
- sh
- -c
- echo hello
- containerName: test2
imageName: busybox:latest
commands:
- sh
- -c
- echo world
----
====

The following example shows how to do so for tasks by editing the `server-config.yaml` file:

====
[source,yaml]
----
data:
application.yaml: |-
spring:
cloud:
dataflow:
task:
platform:
kubernetes:
accounts:
default:
initContainers:
- containerName: test
imageName: busybox:latest
commands:
- sh
- -c
- echo hello
- containerName: test2
imageName: busybox:latest
commands:
- sh
- -c
- echo world
----
====

Replace the `initContainers` attribute with the appropriate value for your environment.

==== Lifecycle Support

When you deploy applications, you may attach `postStart` and `preStop` https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/[Lifecycle handlers] to execute commands.
Expand All @@ -1158,6 +1224,60 @@ deployer.<application>.kubernetes.lifecycle.preStop.exec.command=/bin/sh,-c,'ngi
----
====

You can configure the Lifecycle at the global server level as well.

The following example shows how to do so for streams. Edit the appropriate `skipper-config-(binder).yaml`, replacing `(binder)` with the corresponding binder in use:

====
[source,yaml]
----
data:
application.yaml: |-
spring:
cloud:
skipper:
server:
platform:
kubernetes:
accounts:
default:
lifecycle:
postStart:
exec:
command:
- /bin/sh
- -c
- 'echo Hello from the postStart handler > /usr/share/message'
----
====

The following example shows how to do so for tasks by editing the `server-config.yaml` file:

====
[source,yaml]
----
data:
application.yaml: |-
spring:
cloud:
dataflow:
task:
platform:
kubernetes:
accounts:
default:
lifecycle:
postStart:
exec:
command:
- /bin/sh
- -c
- 'echo Hello from the postStart handler > /usr/share/message'
----
====

Replace the `lifecycle` attribute with the appropriate value for your environment.

==== Additional Containers

When you deploy applications, you may need one or more containers to be deployed along with the main container.
Expand All @@ -1171,3 +1291,77 @@ The following example shows how you can configure additional containers for an a
deployer.<application>.kubernetes.additionalContainers=[{name: 'c1', image: 'busybox:1', command: ['sh', '-c', 'echo hello1'], volumeMounts: [{name: 'test-volume', mountPath: '/tmp', readOnly: true}]},{name: 'c2', image: 'busybox:1.26.1', command: ['sh', '-c', 'echo hello2']}]
----
====

You can configure the Additional Containers at the global server level as well.

The following example shows how to do so for streams. Edit the appropriate `skipper-config-(binder).yaml`, replacing `(binder)` with the corresponding binder in use:

====
[source,yaml]
----
data:
application.yaml: |-
spring:
cloud:
skipper:
server:
platform:
kubernetes:
accounts:
default:
additionalContainers:
- name: 'c1'
image: 'busybox:1'
command:
- sh
- -c
- 'echo hello1'
volumeMounts:
- name: 'test-volume'
mountPath: '/tmp'
readOnly: true
- name: 'c2'
image: 'busybox:1.26.1'
command:
- sh
- -c
- 'echo hello2'
----
====

The following example shows how to do so for tasks by editing the `server-config.yaml` file:

====
[source,yaml]
----
data:
application.yaml: |-
spring:
cloud:
dataflow:
task:
platform:
kubernetes:
accounts:
default:
additionalContainers:
- name: 'c1'
image: 'busybox:1'
command:
- sh
- -c
- 'echo hello1'
volumeMounts:
- name: 'test-volume'
mountPath: '/tmp'
readOnly: true
- name: 'c2'
image: 'busybox:1.26.1'
command:
- sh
- -c
- 'echo hello2'
----
====

Replace the `additionalContainers` attribute with the appropriate value for your environment.